11

I saw a Bitcoin transaction that has 6 inputs and 4 outputs. I understand that several inputs are sometimes used in order to meet the amount requirements of the output. As a result you have two outputs: The spent amount and the change.

How is it then that a transaction can have four outputs? Is it possible to pay more than one person (address) in a single transaction?

3 Answers 3

7

How is it then that a transaction can have four outputs? Is it possible to pay more than one person (address) in a single transaction?

Yes, a transaction can have several inputs and several outputs. Those inputs and outputs can belong to the same user or a different user. So user A and B could make a transaction that combines several of their addresses and send money to C and D in as many of their addresses as they see fit.

Actually the change address that you mentioned is not a special output; just an output that sends some money to any of your addresses.

3
  • 1
    What Bitcoin client do you use to perform such transactions? The only capabilities I've come across so far are to send/receive to a single address.
    – KalenGi
    Commented Mar 1, 2016 at 15:37
  • 2
    Bitcoin Core's bitcoind has a sendmany RPC, and its GUI allows entering multiple addresses/amounts/payment requests. Commented Mar 1, 2016 at 15:54
  • 1
    @KalenGi see here and here for details/examples.
    – karask
    Commented Mar 1, 2016 at 16:18
5

When you said "as a result you have two outputs: The spent amount and the change", that is only one special case for Bitcoin transactions.

In a general Bitcoin transaction, here is what actually happens:

  • One or more inputs, each with a valid signature, "dumps" coin value into the transaction.
  • One or more outputs each "extracts" value from the transaction.
  • Any remaining value (which must be zero or positive - but not negative) is considered to be a transaction fee for the miner to grab.
  • (A special case of inputs is that the first transaction of each block is a coinbase transaction, and the single input is allowed to synthesize a certain amount of value from nothing.)

In light of this view, it should be clear that multiple outputs are allowed.


Let's illustrate with an example. Suppose some friends want do a transaction together because they want to share and save on the transaction fee:

  • Alice dumps one input valued at 3 BTC into the transaction.
  • Alice dumps another input valued at 2 BTC into the transaction.
  • Bob dumps one input valued at 4 BTC into the transaction.
  • Alice wants to pay Carol 2.5 BTC, so this is added as an output.
  • Bob wants to pay Dave 3.99 BTC, so this is added as an output.
  • Alice and Bob each agree to pay 0.01 BTC as a transaction fee.
  • Bob needs no change.
  • Alice needs 2.49 BTC in change, so this is added as an output.

Transaction summary:

  • Input: +3.00 BTC (from Alice)
  • Input: +2.00 BTC (from Alice)
  • Input: +4.00 BTC (from Bob)
  • Output: -2.50 BTC to Carol (payment)
  • Output: -3.99 BTC to Dave (payment)
  • Output: -2.49 BTC to Alice (change)
  • Fee: -0.02 BTC to miner
  • Final balance: 0.00 BTC (must always be zero)
3
  • 1
    I've seen how multiple recipients are specified. How do you combine inputs from different wallets though? Do you each enter your respective wallet addresses into a third party transaction client?
    – KalenGi
    Commented Mar 1, 2016 at 21:13
  • 1
    That really depends on the implementation. Personally I craft raw Bitcoin transactions using custom tools, so nothing prevents me from doing something like this. But for actual Bitcoin front-end GUIs, I have doubts that any of them can do this.
    – Nayuki
    Commented Mar 1, 2016 at 23:47
  • 1
    One real-life example of multiple outputs is that the operator of a mining pool needs to pay out the block reward to many many users. Because the Bitcoin protocol allows it, this can be done in just one transaction, instead of one transaction per output.
    – Nayuki
    Commented Mar 1, 2016 at 23:50
4

Short answer: yes, you can do multiple payments in one transaction, and that's more efficient than doing them separately.

Your Answer

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

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