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

As is normal when doing Elliptic Curve encryption, a private key is simply a random number. In the case of secp256k1, the elliptic curve used by Bitcoin, it has to be a number between 1 and 115792089237316195423570985008687907852837564279074904382605163141518161494336 (or in hexadecimal, between 0x1 and 0xFFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFE BAAEDCE6 AF48A03B ...


26

Because of the Birthday paradox, you only need 280 addresses (despite there existing 2160 different address combinations) before a collision becomes probable. Thankfully, that is still an enormous number. At 90 million addresses per 4 hours, it will take about 445 times the age of the universe to reach that number. It's also irrelevant. Even if anyone - or ...


23

TL;DR: There are so many addresses that it is improbable that anyone will ever generate a duplicate of another address in use – as long as random number generators work as they should. 2^160 possible addresses Bitcoin addresses consist of an alphanumerical string with a length of up to 34 characters, excluding the capital "O", the capital "I" and the ...


18

Yes, you can have two keys generate the same address. There are 2^160 possible addresses, and 2^256 possible private keys, so each address corresponds to roughly 2^(256-160)=2^96 private keys. Any of these will generate the same address and thus be able to spend the money owned by that address. Since 2^160 is so large, however, it would take a near-eternity ...


11

There's no Expert Mode anymore. The Gap Limit has been hidden from the UI as it was unnecessarily complicated for normal users, and it is not a good method for merchants. If you need to change the gap limit, enter this in the Console tab and restart the client (Tested with Electrum 3.0): wallet.change_gap_limit(10) wallet.storage.write() To view/verify ...


10

It is enforced simply having such an enormous number of addresses, that generating one equal to another one is so unlikely it can be considered as good as impossible.


10

The public and private keys in a Bitcoin address are a normal ECDSA key pair. I haven't poked through this particular bit of Bitcoin's own code but the offshoot products I've had a chance to work with typically use the Bouncy Castle crypto library. Bouncy Castle also has an excellent introduction/tutorial on how to use their library. Their examples are in ...


10

A while ago I created an extension for BitcoinLib in order to put bitcoind to the test. The setup was trivial: call getnewaddress() in the main network for ever My performance index was the number of addresses generated per second. It took off on an average of 35 addresses/sec. I left it running on a VM for a whole month. The rounded results were: Total ...


10

Private and public key correspond to a point on the secp256k1 curve. They have a one-to-one relationship. The address is derived from the public key by performing a ripemd160 hash after a sha256 hash on the public key. Multiple public keys hash to the same address, as the address space is only 160 bit, while the public key space is 256 bit. Since both ...


10

Why base-58 instead of standard base-64 encoding? Don't want 0OIl characters that look the same in some fonts and could be used to create visually identical looking account numbers. A string with non-alphanumeric characters is not as easily accepted as an account number. E-mail usually won't line-break if there's no punctuation to break at. Double-clicking ...


9

Bitcoin private keys are most commonly displayed in wallet import format (WIF), also known as base58check (a number expressed in base 58 with a checksum at the end and a version byte at the beginning). To create a WIF private key, you need to: Generate an ECDSA secret exponent (the private key) using the SECP256k1 curve. Convert the secret exponent/private ...


9

With Electrum 2.x, a wallet can contain either keys you've imported from elsewhere, or keys which are generated (deterministically) by Electrum. You cannot store both types of keys in a single Electrum 2.x wallet. Since your wallet is of the former type, Electrum will refuse to generate any new keys for your wallet. I suspect the reason for this is to make ...


9

Bech32 is an address format that was only recently proposed. While its design had input from multiple wallet authors, it is way too early to say anything about adoption. It is important to realize that there is no hurry about this. Every usable address type is available through embedding in P2SH, which is compatible with every wallet created the past few ...


9

Schnorr will replace ECDSA, the signing algorithm, but both still use the same elliptic curve and thus the same public and private keys, etc. Regardless, compatibility with ECDSA must be kept too even if Schnorr is used, because otherwise all old nodes would see the schnorr signatures as invalid signatures, and all old transactions would be seen as invalid ...


8

The problem is that you're treating the pubkey as string data. What you need to do is treat it as raw binary hexadecimal. If you use fileformat.info and calculate it using Binary Hash hex bytes you do indeed get 600FFE422B4E00731A59557A5CCA46CC183944191006324A447BDB2D98D4B408.


8

Use BitWasp Bitcoin-php library https://github.com/Bit-Wasp/bitcoin-php <?php use BitWasp\Bitcoin\Bitcoin; use BitWasp\Bitcoin\Key\PrivateKeyFactory; $network = Bitcoin::getNetwork(); $privateKey = PrivateKeyFactory::create(true); $publicKey = $privateKey->getPublicKey(); $address = $publicKey->getAddress(); // returns AddressInterface echo $...


8

A very relevant answer can be found here: Is Each Bitcoin Address Unique? This is a question of the birthday attack on the hashes. Bitcoin addresses (assuming the "normal" style starting with a 1) encode 160 bit hashes, so the output space has a possible 2^160 hashes. Because its a hash function, we assume all outputs have equal probability of being output. ...


7

One private key maps onto two addresses - one that uses an uncompressed public key, and one that uses a compressed public key. What you might also be interested in is a deterministic wallet - a Bitcoin wallet holding multiple addresses generated from one private key / secret. This will let you secure multiple addresses and store only one key.


7

For one new wallet type in electrum console: wallet.create_new_address(False) For 100 new wallets type in electrum-console: for i in range(0, 100): print wallet.create_new_address(False) or just (effect after restart application): wallet.storage.put('gap_limit',100)


7

Litecoin uses exactly the same procedure to generate addresses, the only difference is the network prefix. On step 4 (Add version byte in front of RIPEMD-160 hash) instead of 0x00 for bitcoin use 0x30 for Litecoin main-net or 0x6F for Litecoin test-net. Your address should start with L then and will be a valid Litecoin address. Full sequence: 0 - ...


6

The 160-bit hash that is encoded in addresses is uniformly distributed ("truely random" as you call it), but the base58 encoded form is not. Some characters are more likely to occur at the start, for example. To illustrate, consided the set of all integers between 0 and 1999. Even though each of those numbers is equally likely to be chosen, this is not true ...


6

It only knows anything about the address because you asked about it. Since the address has never appeared in the blockchain, all it knows is what can be seen from the address: its hash160 value. This is the hexadecimal version of what is encoded in your address, which is a hash of your public key via the algorithm explained here.


6

You may have already read this, but make sure you read this if you want to know about how the accounts feature of the core client works: https://en.bitcoin.it/wiki/Accounts_explained. (It's somewhat of a legacy feature.) Are you looking to be able to do this manually with the RPC methods, or automated? For manually, do: bitcoin-cli getaddressesbyaccount "...


6

IANAL. What you describe is the act of taking something that isn't yours in full knowledge that somebody else invested effort and money to accumulate it. Just as with your Swiss bank example: The rightful owner would be losing the funds that you misappropriated. Taking someone's property without their consent is theft. I feel that this is independent of ...


6

With Bitcoin, a single private key will have associated compressed and uncompressed private/public key pairs. Uncompressed public key addresses are larger in size than newer compressed public addresses. (Contrast 1b and 2b below.) Uncompressed and compressed public keys shall have different associated Bitcoin addresses. Private keys encoded in wallet input ...


6

No. All addresses generated by HD derivation are indistinguishable to someone who does not know the parent's master key (the private one for hardened derivation, the public one for normal derivation).


6

There are about 2^256 private keys, 2^256 public keys, and 2^160 (simple) addresses. There are other addresses (multisig) that have more than one corresponding public key and thus more than one corresponding private key. 2^160 is 1,461,501,637,330,902,918,203,684,832,716,283,019,655,932,542,976. Just to put that in perspective: Number of stars in the ...


5

By the pigeonhole principle yes, there could be two bitcoin addresses that are the same. The Pigeonhole Principle states, that if there are N items for M spots with N > M then there must be at least 2 of the N items in one of the M spots. For Bitcoin this means we want/need but might never reach an infinite amount of addresses for an infinite amount ...


5

Not directly. You'd first have to convert your RSA private key into an secp256k1 ECDSA private key (a 256 bit value between 0x1 and 0xFFFF FFFF FFFF FFFF FFFF FFFF FFFF FFFE BAAE DCE6 AF48 A03B BFD2 5E8C D036 4140). You could do this by using a SHA256 hash of your RSA private key as your ECDSA private key. Then you could import that hash (as a number) ...


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