Bitcoin Stack Exchange is a question and answer site for Bitcoin crypto-currency enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
up vote 6 down vote accepted

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.

share|improve this answer
    
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 Mar 1 at 15:37
1  
Bitcoin Core's bitcoind has a sendmany RPC, and its GUI allows entering multiple addresses/amounts/payment requests. – Pieter Wuille Mar 1 at 15:54
    
@KalenGi see here and here for details/examples. – karask Mar 1 at 16:18

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

share|improve this answer

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)
share|improve this answer
    
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 Mar 1 at 21:13
    
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 Mar 1 at 23:47
    
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 Mar 1 at 23:50

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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