To better illustrate how value is transferred in the Bitcoin network, we will walk through an example transaction, where Alice sends .05 bitcoin to Bob.
At a high level, a transaction has three main parts:
- Inputs. The bitcoin address that contains the bitcoin Alice wants to send. To be more accurate, it is the address from which Alice had previously received bitcoin to and is now wanting to spend.
- Outputs. Bob’s public key or bitcoin address.
- Amounts. The amount of bitcoin Alice wants to send.
A transaction can contain multiple inputs and outputs. As long as each output has an associated amount and the input amounts total more than the output amounts, the transaction is valid.
In order for Alice to send the .05 bitcoin to Bob, she signs a message with the transaction details using her private key. The message contains the input, output, and amount as described above. The transaction is then broadcast to the rest of the Bitcoin network where nodes verify that Alice’s private key is able to access the inputs (by checking that Alice’s private key matches the public key she is claiming to own).
Once a transaction is broadcasted to a node, this node then passes it along the network until it reaches a mining node. Miners will then order this transaction into what is called a block template. This is a blueprint for the block which the miner is attempting to add to the blockchain. If a miner finds the next block in the chain, then this block template is mined and becomes an immutable block on the blockchain. Finally, this block is broadcasted to the network’s nodes who will include it in their copy of the chain.