I have read that entire bitcoins received in one transaction have to be spend in other transaction. The actual amount to be transferred is deducted from the total bitcoins and the change is returned back to sender's bitcoin address.

Suppose, David Sends Alice the amount in form of two outputs, output0: 10 bitcoins and output1: 20 bitcoins in the same transaction. Now Alice wants to transfer 5 bitcoin to Eve. Does Alice has to spend entire 30 bitcoins, by transfering 5 to Eve and remaining 25 to herself?

Or can she choose any of the output e.g. output0: 10, transfer 5 bitcoins to Eve and change 5 bitcoins to herself? If this is the case, how is this tracked, as the hash of the David's transaction can be used to spend the output1: 20 bitcoins.

1 Answer 1


A transaction can have multiple inputs, so any of the scenarios you describe are possible.

Let's call David's transaction to Alice T, and its outputs T0 and T1. Here are three ways Alice could make a transaction to achieve the desired results.

  • One input: T0. Two outputs: 5 BTC to Eve, 5 BTC to Alice. (In this case T1 remains available for Alice to spend in some future transaction.)

  • One input: T1. Two outputs: 5 BTC to Eve, 15 BTC to Alice. (T0 remains unspent.)

  • Two inputs: T0 and T1. Two outputs: 5 BTC to Eve, 25 BTC to Alice.

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.