Understanding Bitcoin Transaction Inputs and Outputs - Blockchain Technology Explained

In this article I explore the terms input and output of Bitcoin transactions and explain it in simple terms.

Exploring transactions
image source

A lively Chain of transactions

The Bitcoin protocol is a very complex construct and arguably the 8th world wonder. Digging into the code and understanding the magic is a never ending adventure to me.

The way our "balance" is actually determined by the blockchain is quite different from what you might expect. Let's explore the chain of transactions a little and see what is going on behind the scenes. To do this we must learn what the two components, Inputs and Outputs actually mean.

Input

An input is a reference to an output of a previous transaction. One transaction can contain multiple inputs. These input values are combined to give a total that represents your balance. You see, in bitcoin, the added amount of unspent (previous) transaction outputs are the coins you may claim, and what we call balance. The output of this transaction will be constructed as the Sum_of_Inputs - Transaction_fee = Sum_of_Outputs.

Furthermore, a script component is included, that contains your signature and public key. The public key is used to verify your signature to prove that you are the address owner and are entitled to claim the coins referenced in the transaction input.

The input is your way to redeem coins.

Output

The output is comprised of instructions for spending the coins. The output value shows how much the total value of claimed coins amounts to. There can be multiple outputs but in sum they must equal to the sum of input less the transaction fee. A single output from one transaction may only be referenced once, as an input of the next transaction. Therefore, the entire value of the input needs to be spent in the output of the next transaction. Otherwise it will be lost.

Example

Imagine you had 0 BTC and somebody sent you 10 BTC. You may say you "own" 10 BTC now. That is - your keys allow you to redeem the unspent 10 BTC (as a Transaction Input). Now you want to send 5 BTC to your friend. Executing the "send 5 BTC" operation creates 1 input equal to 10 BTC and 2 outputs: One will send 5 BTC to your friend and the other one will send 5 BTC back to you (change). If you fail to do so, the other 5 BTC will be lost. (Actually, the miner will claim them).
Picture it as a bank notes: any single output is automatically a "note". You have to spend all of it, not just half and you get the change back. But in Bitcoin this note can have any value 0.1, 0.2, 1, 5 ...whatever. (Your friend now has to spend 5 BTC in his future transaction).


image source

Can you spot it? Address 336x.. is sending some change back.

At this point we note down some rules:

  1. A transaction output sum is always equal to the transaction input sum, minus the fee
  2. The sum of unspent transaction outputs you can reference are your balance
  3. Single transaction outputs are indivisible
  4. You must always spend the full amount of a single output or the remaining coins will be lost

Don't be alarmed: This is theory, showing how bitcoin code actually works. Most wallets provide this functionality under the hood when you click "send", you don't have to worry about any of it.

But it's good to know.

The best way to learn is actually browsing through the blockchain explorer yourself and following some transactions, have a go: https://blockchain.info


More Articles like this:
Do you want to learn about a secure and safe Google alternative? (Read article)
Do you want to know how to protect Internet Freedom? (Read article)

Thank you for visiting my blog! If you enjoy my content, you are welcome to follow me for more updates. ᕦ(ò_óˇ)ᕤ
- Nick ( @cryptonik ) -

Cryptonik-Logo

H2
H3
H4
Upload from PC
Video gallery
3 columns
2 columns
1 column
6 Comments