The Stack Overflow podcast is back! Listen to an interview with our new CEO.

Hot answers tagged

6

(The language used in this post is Python) Breadwallet uses BIP39 to generate the 128-bit master seed from the 12-word mnemonic. The master seed is then used to generate a set of wallets/accounts containing chains of addresses, using BIP32. First off, import hashlib and binascii, we're going to need them later. import hashlib from binascii import hexlify, ...


5

Why does BIP44 use non-hardened paths at all? Imagine you have a website where you want to sell things. You need the website to be able to generate addresses, but you don't want it to be able to spend from them. Well, you can give the website an account-level extended public key, and it can generate the non-hardened addresses you need from that. You wouldn'...


5

Mycelium HD is BIP 44 compliant. As specified by BIP 44, the address gap limit is 20. This means that after 20 indexes of unused addresses, the wallet expects that no more addresses are used beyond that point. Therefore if you send funds to an address with a gap of more than 20 indexes between the last used address, the wallet software will not check if that ...


4

I ended up writing my own command-line tool to perform wallet discovery and print out a report. It supports single xpub derivation as well as multisig m-of-n wallets, specifically CoPay wallets. It determines if each address has been used or not by querying blockchain.info or also toshi or insight servers (the latter two can be run locally.) Anyone ...


4

Change can be sent to any address separately specified in the transaction for the change or, paid as fees to the miner if not. Looking at the examples, it is clear that where the specification mentions change in the path it might well be intended to read chain with possible options of either change or external. This leads me to believe that depending on ...


3

I believe 0x8000002C is 128 as an integer ... No, it isn't. First of all, it already is an integer, just represented in hexadecimal. In decimal it is 2147483692. How did you get 128? how does this equate to 44' however? 44' means that hardened keys should be used. The distinguisher for whether a key a given index is hardened is that the index is greater ...


3

BIP44 is more like a standard which you are supposed to follow. The coin id's assigned are way to standardise the approach in case you are making a wallet and want better segregation of your coins. For example, with the same seed, you can derive keys for different cryptocurrencies, just by changing the coin id. Do note all those ids can be used to generate ...


3

Does it just try all possible addresses related to that seed's master key ? (This seems impractical imo). No, this is actually impossible to do since there is effectively an infinite number of addresses that can be generated from a single master private key. Instead wallets generate keys at standardized derivation paths and assume that other wallets follow ...


3

The apostrophes show whether or not that particular derivation is hardened. The difference been hardened and non-hardened keys is described in BIP32. See the wiki for some further detail. https://bitcoin.org/en/glossary/hardened-extended-key


2

The difficulty is with the poorly named BIP32Key.fromEntropy. Typically to create a new wallet, you: Get some entropy from a cryptographically secure random source, at least 128 bits and must be a multiple of 32 bits. Convert the entropy to a mnemonic (this conversion is not a one-way function, it's bijective). Convert the mnemonic to a 512-bit seed (this ...


2

Not sure how NBitcoin works, but it looks like so far you have derived your private and public key, you now need to hash it in the Ethereum method rather than the bitcoin way. Look at step 3 in this answer: https://ethereum.stackexchange.com/questions/3542/how-are-ethereum-addresses-generated Edit: Nethereum has implemented it in C#: https://github.com/...


1

Please try the following demo, and the result is same with https://iancoleman.io/bip39/. $ python3.6 test.py {'addr': '1A9vZ4oPLb29szfRWVFe1VoEe7a2qEMjvJ', 'coin': 'BTC', 'mnemonic_words': 'aware report movie exile buyer drum poverty supreme gym oppose float elegant', 'privatekey': 'L3g3hhYabnBFbGqd7qReebwCrRkGhAzaX4cBpYSv5S667sWJAn5A', 'publickey': '...


1

If the above two keys are leaked, then your master private key at the account level (m/44'/60'/4') can be back-calculated. That means, any private key (both receiving and change) that you derive from that account is compromised. To elaborate, BIP 44 uses non-hardened derivation to derive private keys after the account level. The child private key derivation ...


1

There is a list of BIPs at https://github.com/bitcoin/bips I don't see anything that specifies a wallet format. To be honest I'd be surprised to see one. This is something that each implementation ought to determine for itself, Some wallets might use an embedded SQL DBMS, some a Berkely DB format, some a JSON store of some sort and so on. Similarly, the ...


1

BIP44 is a convention about derivation paths. BIP32 gives you an extended master key which you can then combine with a derivation path to get a private key. So after you get your master key you are probably looking for the key with derivation path m/44'/0'/0'/0/0. I am not familiar with bitcoinj or Java but from a quick search it seems that you can find ...


1

I got it - the paragraph in the BIP 44 proposal I referenced is about "Account discovery" - i.e. discovering whether an account was used at all. It's not about used addresses discovery within the account which is another thing of course, and it apparently requires scanning the change addresses as well, given the example in the question. So I just ...


1

You can find a list of compatible wallets on BIP44's Github page. Mycelium Bitcoin Wallet (Android) Copay CoinVault Samourai Wallet Coinomi TREZOR KeepKey Ledger Wallet 21 Machine Wallet Trust Wallet According to MetaMask they also support BIP44, although they are not on the list above.


1

That depends on what kind of wallet you have. The derivation path is designed to tell you which types of addresses you need to. m/44 means just regular addresses m/49 means segwit nested in P2SH. m/84 means native segwit. Wallets such as electrum allow you to select which address type to check, and then perform the account recovery process you linked in ...


1

The short answer is yes. The examples below are referenced to a higher level libbitcoin framework command line interface. For a working example see the Bitcoin HD wallet key synthesis example that uses the secp256k1 curve and the Monero HD wallet key synthesis example. Monero uses ed25519 digital signature technology for public key and address synthesis, ...


1

You can only do that if you are deriving hardened keys. For non-hardenend keys, you still need to know the curve as a public key is calculated for non-hardened derivation in order to derive the next private key. Note that hardened derivation means that you will not be able to derive public keys from a master public key.


1

Here's my solution. When gap limit is reached, append a random and unique satoshi amount to the total bitcoin amount and associate it with the user. For example, if your product price is BTC 0.001, then generate an amount like 0.00100001 for user A, 0.00100002 for user B, both using the same address when gap is reached. Now for user A, you use Blockchain....


1

Issues related to gap limit as summarized in this blog post. Basically you have few options Use wallets like electrum to increase gap limit setting Automatically send small amount of funds to 20th unsued address to keep things going. This is done by services like blockonomics Keep generating new address without worrying about gap limit. Later you can ...


1

According to Bip32 - Bip44 - Bip49(Segwit) You can generate many public keys using one master private/public key. I don't know which deriving path Bitpay using but Electrum using path 44 for legacy bitcoin addresses and 49 for Segwit addresses. As @pebwindkraft answer Bitpay maybe providing you an extended private key so generating address progress become ...


1

One private key can generate two different bitcoin addresses. That depends on the ECDSA logic and encoding schemes used. Probably you have heard about compressed and uncompressed keys. The details are deep under the hood, and requires some reading, e.g. Andreas book "Mastering Bitcoin" (2nd edition), which is online available. Chapter 4 and 5 are the ...


1

I guess I've found the answer as explained in bip43 m / purpose' / * Apostrophe indicates that BIP32 hardened derivation is used. We encourage different schemes to apply for assigning a separate BIP number and use the same number for purpose field, so addresses won't be generated from overlapping BIP32 spaces. Example: Scheme described in BIP44 should use ...


1

Any derivation path with an apostrophe (') signifies that that index should use hardened derivation. Hardened derivation means that you can only use the master private key. So with just an xpub, you cannot derive the full path. Usually what happens with BIP 44 is that you generate a master private key, derive the keys for the hardened parts of the path, and ...


1

The recommended practice is to use any address for only one input and one output. Once you've done that, don't use it again. To illustrate with examples: You receive 1 bitcoin to address A. You later send 1 bitcoin out. The next time you receive any bitcoin it should be with new address B. You receive 1 bitcoin to address B. You later send .5 bitcoin out....


1

In terms of "Accounts discovery" algorithm, it is not needed to get internal addresses. We just sequentially take receiver addresses of an account and check whether one of them was used in any transaction. Literally: we get a transaction and check whether receiver address is in the set of target addresses of looking transaction. This is so because if there ...


1

BIP 44 just specifies a structure for organising keys using BIP 32 style generation. The tree structure is this: m / purpose' / coin_type' / account' / change / address_index Generally, m refers to your BIP 32 master private key generated from the mnemonic in BIP 39. But all children extended keys are also extended parents if you want them to be - all can ...


1

I have 3 ways I go about this: BX tool by libbitcoin Python libraries, namely pybitcointools ... and PyCoin Both have a CLI interface, though PyCoin is more comprehensive. The address scanning is something that can be achieved with this pybitcointools fork. You'll need to clarify your preferences in terms of shell/OS/programming language for me to detail ...


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