22

Such a great question. Background Derivation paths are related to HD Wallets or HD Keys, a type of wallet where you have a single, human readable, seed phrase that unlocks a number of accounts / addresses / private keys across any supported network. These phrases typically look like brain surround have swap horror body response double fire dumb bring ...


12

Jaxx,MEtamask,...etc uses the BIP44 derivation. from the BIP44 specification, the HD derivation path is defined as : m / purpose' / coin_type' / account' / change / address_index But some wallets (e.g Ledger) chose an HD path of m/44'/60/0' which is almost BIP44, except the change path is not used. just for information : Change Constant 0 is used ...


11

HD Wallets refer to Hierarchical Deterministic wallets. They are wallets that from a root it can generate multiple "child" private keys in a deterministic way. You only need to remember the "path" of the child key. For example hardware wallets use them from a single root you can generate separate keys for Bitcoin (with path m/44'/0'/0'/0) and Ethereum (path ...


6

There are several bitcoin standards related to creating keys from mnemonic seeds. BIP 39 for making mnemonics to create a seed: https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki BIP 32 for deriving keys from that seed: https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki However, not all clients use all these standards (eg Electrum'...


6

Do it with ethers: const ethers = require('ethers'); const mnemonic = await ethers.HDNode.entropyToMnemonic(ethers.utils.randomBytes(16)); const wallet = ethers.Wallet.fromMnemonic(mnemonic); P.S. Here is a community you can find ask more questions about it:


6

No, a mnemonic is generated using an hd wallet - a hierarchical deterministic wallet. Private keys are "children" of this mnemonic and there can be millions of them, but there's no way to go back to the parent having only a child private key. You can generate a new mnemonic if you install MetaMask or most of the other Ethereum wallets out there (Status, ...


5

This is a community wiki of HD wallet implementations for Ethereum. Javascript LightWallet


4

You can pass an instance of the provider instead of a string as a second argument. So you can pass a websocket provider in: const webSocketProvider = new Web3.providers.WebsocketProvider(...); const walletProvider = new HDWalletProvider(mnemonic, webSocketProvider);


4

You can use the package github.com/miguelmota/go-ethereum-hdwallet to implement an HD wallet (which implements the accounts.Wallet interface from go-ethereum). Here's a basic example to get started: import ( "fmt" "log" "github.com/miguelmota/go-ethereum-hdwallet" "github.com/tyler-smith/go-bip39" ) func main() { entropy, err := bip39....


3

There's no such thing as "pushing" a wallet to an Ethereum node. You can go ahead and send ether to the new address. When you want to send ether from that address, you'll need to know the corresponding private key (which you already generated).


3

I managed to get this working. There's definitely something wrong with that digix-eth fork of the eth gem. I suspect it's the padding he adds to the mnemonic. Anyway, here's how you can generate HD addresses using a seed: require 'bitcoin' require 'eth' NODE_INDEX = 0 # An index corresponds to a unique Ethereum address. MNEMONIC = '...' # Generate this ...


3

Bitcoin operates under a UTXO (unspent transaction output) system, which necessitates new addresses for each transaction. Ethereum, in contrast, operates on an account based system. While it would be possible to deterministically generate a tree of accounts from a single seed in Ethereum, there's really no need to, because a single account can handle all of ...


3

I only know the mobile Jaxx app wallet for now that can handle Ethereum HD accounts all linked under a mnemonic. It can also handle bitcoin. It's my favorite wallet app for the moment if you only want to receive and send ether and not interact with contracts. Note that Jaxx is still in beta, so use it with small amounts.


3

BIP32 and BIP39 are describing ways to generate hierarchical deterministic keypairs. In general you generate a deterministic private key first and generate a public key derived from that private key. Ethereum HD wallets pretty much do the same, here are five hex addresses extracted from the javascript LightWallet (HD): ["...


3

If I'm understanding your question correctly, you are asking whether you can go from any key pair in the hierarchy back to the original seed. This is not possible since each step down the hierarchy is a HMAC-SHA512, which is a just a SHA512 hash with a little extra. SHA512 is a one-way function, so you can't reverse it aka go up in the hierarchy. Even the ...


3

No, you cannot use ethers.js to generate a Bitcoin key pair. Most Bitcoin and Ethereum wallets use the same standard though (BIP-32 and BIP-39), so you can simply use one of the other libraries that implement this functionality, like bitcoinjs-lib. There is an example using bitcoinjs-lib here: https://github.com/bitcoinjs/bitcoinjs-lib/blob/master/test/...


3

This is silly but I found what the problem was. After I ran the libsecp256k1 point multiplication to obtain the second coordinate of the public key I was discarding the first 8 bytes of the resulting public key instead of just the first ("0x04" prefix).


3

You can get the balance of a single account via: web3.eth.getBalance(address); By default you will get all accounts of metamask. (this code uses await and therefore has to be placed within an async function) const accounts = await web3.eth.getAccounts(); What you get is an array with all the accounts. Now it is up to you to loop through them and sum up ...


2

BIP 44 path is represented as m / purpose' / coin_type' / account' / change / address_index, Purpose is a constant set to 44' (or 0x8000002C) following the BIP43 recommendation. Apostrophe in the path indicates that BIP32 hardened derivation is used. coin_type is 60 for Eth, 0 for BTC, 2 for LTC etc. Based on the coin type, you can generate public and ...


2

You can also use the highly convenient HDWalletProvider library from the Truffle team const HDWalletProvider = require("truffle-hdwallet-provider"); const Web3 = require('web3'); var mnemonic = "opinion destroy betray ..."; // 12 word mnemonic var provider = new HDWalletProvider(mnemonic, "http://localhost:8545"); const web3 = new Web3(provider); HD ...


2

Yep, it really was "duplicated" mnemonic phrase equal to... undefined.


2

A solution is provided here. Essentially, you build the HDProvider, just as you would in truffle, and then pass it to Web3.


2

I have experimented with Consensys eth-lightwallet. It makes use a 12-word seed to calculate private keys. You can probably look into its dependencies.


2

DO NOT use the default mnemonic for production. Everyone has access to that mnemonic and that means they can generate the private keys for all the addresses derived from said mnemonic. There are several mnemonics generators out there. You can even have a combination of a mnemonic and a password for extra security. https://iancoleman.io/bip39/


2

Now my question is how can i dynamically get the new 12 mnemonics without metamask You can use BIP39 npm package to generate mnemonic. var mnemonic = bip39.generateMnemonic(); and use this mnemonic to generate HD wallet.


2

The Mnemonic creates and extended private key (root key), that can create many private keys. https://iancoleman.io/bip39/ An extended private key can deterministicly generate millions of private keys, so that you can regenerate all those same addresses in the future as long as you have the extended private key or your mnemonic seed.


2

I think you’re asking if the subwallet addresses can “do something” other than just accept ether even if they are not smart contracts. If that’s what you’re asking, then no. They can’t. Non-smart-contract addresses (regular accounts) can’t “do” anything other than send transactions to other addresses or receive them. If that’s not what you’re asking, ...


2

Just in case someone comes here later, in the recent version of ethers, HDNODE has been moved to the utils method. So, in modification to @George's answer above; const ethers = require('ethers'); const mnemonic = await ethers.utils.HDNode.entropyToMnemonic(ethers.utils.randomBytes(16)); const wallet = ethers.Wallet.fromMnemonic(mnemonic);


2

This code will generate the same address from the mnemonic that MetaMask, MyEtherWallet, etc const bip39 = require('bip39'); const hdkey = require('ethereumjs-wallet/hdkey'); const mnemonic = 'party box feel talent peace tiger endorse defy cheese girl tumble mail'; const seed = bip39.mnemonicToSeed(mnemonic); const hdwallet = hdkey.fromMasterSeed(seed); ...


2

Your problem resides on lines 7 and 8 where you are feeding the seed hex into the fromMasterSeed function. What you should be doing is feeding the raw seed in. When you do so, you end up with identical output as freewallet.org: Web3 = require('web3'); bip39 = require('bip39') etherHDkey = require('ethereumjs-wallet/hdkey') ethUtil = require('ethereumjs-util'...


Only top voted, non community-wiki answers of a minimum length are eligible