3

In the beginning it was my understanding that:

  • Every address has a private key
  • Every address has a balance
  • Every address may send and receive coins.

This is simple.

But now I am using more proper wallets (because you shouldn't reuse addresses) and got a little confused about not having one central bitcoin address. In specific - how does an airdrop work if my holdings are split between all these addresses. But more generally, what I read was:

Bitcoin transactions can have many inputs. You shouldn't think in terms of address balances. The protocol doesn't work in balances internally. If you receive 0.3 BTC, then you have a "0.3 BTC coin" in your wallet, not so much an address with a balance of 0.3.

There are many implications. What if I add a private key of an address to two different wallets?

Is a wallet not just a keychain of all these addresses and private keys? I guess not, if so, how would airdrops work, how would you send more coins than one address holds with just one transaction?

1 Answer 1

3

Bitcoin does not work on an account model but operates on an UTXO (unspent transaction output) model. When you send bitcoins to an address, what you are essentially doing is locking those bitcoins in a mathematical equation. Spending those coins requires that you provide the correct unlocking condition (most often signature and public key associated with that address). "Address balance" is a higher level abstraction that can be derived from this basic construct although that information does not explicitly exist in the blockchain.

How would you send more coins than one address holds with just one transaction?

When you spend your bitcoins, you have to reference the transaction outpoint (txid and output number) from which you earned those coins and then provide the satisfactory unlocking condition. If you intend to spend more bitcoins than you earned from a single transaction, you will have to reference multiple transactions from where you control those bitcoins in the input field of your transaction until input value > output value.

Is a wallet not just a keychain of all these addresses and private keys?

Yes, a wallet is just a bunch of keys. There are two types of wallets: (1) non-deterministic or random wallets and (2) deterministic or seeded wallets. The first wallet is just a collection of bunch of randomly generated private keys, while the second type of wallet follows a deterministic path of private key generation. The latter approach helps in better management in terms of backup and import. You can read more about HD wallets in BIP 32 and how mnemonics can be used to generate HD wallets here.

What if I add a private key of an address to two different wallets?

Just consider that you have a normal key that open a lock. You create a duplicate of that key. Now, both of those keys will be able to open the lock. Similarly, both the wallets will be able to control the bitcoins locked in that address. You can spend your bitcoins from either one of the wallets.

2
  • Thank you! That was quite the comprehensive answer and left me with no questions so far!
    – Opcode
    Oct 2, 2019 at 11:22
  • This is such a beautifully clear answer that I refrained from marking the question as a duplicate of Where are bitcoins stored Oct 2, 2019 at 12:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.