<p>A bitcoin transaction can have one or more inputs, and one or more outputs. For example, <a href="https://blockchain.info/tx/dfe67f92ab1b849aa826bc1c766650dfc97b53ea5ae30e66743bde0d9b1193d6" rel="nofollow noreferrer">here is a transaction with 1 input 3 outputs</a>, and <a href="https://blockchain.info/tx/c04d4be85a16617321c4c2a44680f40de6eaaaeebb6160162fdf6f71e0c5c345" rel="nofollow noreferrer">here is one with 3 inputs 1 output</a>. </p>

<p>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. </p>

<p>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 <a href="https://en.wikipedia.org/wiki/Public-key_cryptography" rel="nofollow noreferrer">how public key cryptography works</a>, it is a useful cryptographic tool employed in many systems, not just bitcoin. </p>

CC BY-SA 3.0
2018-01-11T05:01:41.133Z
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?
Matt
CC BY-SA 3.0
2018-01-11T05:37:23.003Z
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.
chytrik
CC BY-SA 3.0
2018-01-11T05:49:37.040Z
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?
Matt
CC BY-SA 3.0
2018-01-11T10:03:09.027Z
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
chytrik
CC BY-SA 3.0
2018-01-11T10:03:15.983Z
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.
chytrik
CC BY-SA 3.0
2018-01-11T04:47:44.197Z
2018-01-11T04:47:44.197Z
chytrik
<p>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? </p>

<blockchain><address><balance>
Can you send bitcoins together from the same wallet if they have been received via various different addresses?
Matt
# Can you send bitcoins together from the same wallet if they have been received via various different addresses?

(Asked by: username_0 on 2018-01-11)

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?

**Tags:** blockchain, address, balance


---

## 1 answers

### Answer by username_1 on 2018-01-11. Score: 1

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](https://blockchain.info/tx/dfe67f92ab1b849aa826bc1c766650dfc97b53ea5ae30e66743bde0d9b1193d6), and [here is one with 3 inputs 1 output](https://blockchain.info/tx/c04d4be85a16617321c4c2a44680f40de6eaaaeebb6160162fdf6f71e0c5c345).

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](https://en.wikipedia.org/wiki/Public-key_cryptography), it is a useful cryptographic tool employed in many systems, not just bitcoin.

> **Comments:**
> **username_0**: 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?  
> **username_1**: 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.  
> **username_0**: 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?  
> **username_1**: 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  
> **username_1**: 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.  

---

