What has been sent to your individual bitcoin addresses is supposedly recorded in the blockchain, but can you then send all of the combined bitcoins (that you received via various different addresses) at once with your public key? For example, if I received 1 bitcoin via address 1, 2 via address 2 and 5 via address 3, all of these addresses being derived from the same public key, and I wanted to send 6 btc to a friend, could I send all of them at once with my public key? Or would I have to send a combination of bitcoins from different addresses, i.e. by separate transactions? And if I could send them all together using the public key, how is it determined that I am in possession of all of these bitcoins if they were sent not directly to my public key, but to various irreversibly hashed addresses derived from my public key?
Can you send bitcoins together from the same wallet if they have been received via various different addresses?
A bitcoin transaction can have one or more inputs, and one or more outputs. For example, here is a transaction with 1 input 3 outputs, and here is one with 3 inputs 1 output.
I think you are confusing the terms public key, and private key. A wallet is a collection of keypairs (private keys and public keys), and each one can be used to create a unique bitcoin address. So if you have three different input transactions to three different bitcoin addresses, each of these will be spendable using it's own private key.
Your wallet will sign the transaction with each of these three keys, and the rest of the network can validate the signature by comparing it to the public key associated with each input (despite never knowing the private key!). To learn more about how this works, look up some info on how public key cryptography works, it is a useful cryptographic tool employed in many systems, not just bitcoin.
So in the transaction with 3 inputs and 1 output, did the sender have to send the bitcoins from 3 different addresses (albeit all signed by the same private key), and specify these addresses when making the transaction, as opposed to sending all of the bitcoins from one place, given that they, I am assuming, all came from the same wallet?– MattJan 11, 2018 at 5:01
Each bitcoin addresses relates to a unique private key, there is not one private key that will sign for all of the inputs in a three input transaction. I think you are confusing this with a BIP 32 HD wallet, in which a master private key is used to derive the wallet's subsequent private keys (each of which will have its own uniqe bitcoin address). As a user, you do not have to worry about this, the wallet software will take care of input selection and transaction signing in the background for you. Jan 11, 2018 at 5:37
I am able to generate multiple bitcoin addresses in Exodus, so I've been under the impression that any number of addresses can be made by hashing the public key. So all of these addresses go back to the one common key. Are you sure that each bitcoin address relates to a unique private key? Or were you referring to public keys?– MattJan 11, 2018 at 5:49
Multiple addresses aren't created by hashing a public key, this is a misunderstanding. A hash function is deterministic, so if you provide the same input more than once, you will receive the same output each time. That said, it occurs to me that you may be talking about an extended public key (xpub), which can be used to derive infinite child pub keys. Even in this case, you still need the extended private key (xpriv) that created the xpub key so that you can derive the child priv key of each child pub key. So each address still has a priv key of its own, that is required in order to spend Jan 11, 2018 at 10:03
A BIP32 hierarchical deterministic (HD) wallet works in this way, all addresses are derived from a master extended private key (xpriv key), but it is public/private key-pairs that you derive, not just addresses that are all controlled by a single private key. The mnemonic phrase that many wallets implore you to write down is the seed phrase to generate your xpriv key for the wallet. Jan 11, 2018 at 10:03