Table of Contents
- A Bitcoin transaction is a transfer of bitcoin from one address to another. The valid transaction must be signed by the sender.
- Bitcoin does not have accounts. Instead, pieces of Bitcoin of arbitrary size are all associated with an address, which is controlled by the owner of that bitcoin. These pieces of Bitcoin are called Unspent Transaction Outputs (UTXOs).
- All Bitcoin transactions are published to the mempool, where they are considered 'pending'. When a miner adds a transaction to a block, it is then considered confirmed.
How Do Bitcoin Transactions Work?
What Is a Transaction?
A transaction is a transfer of Bitcoin value on the blockchain. In very simple terms, a transaction is when participant A gives a designated amount of Bitcoin they own to participant B.
How Does It Work?
Bitcoin makes use of public-key cryptography to ensure the integrity of transactions created on the network. In order to transfer Bitcoin, each participant has pairs of public keys and private keys that control pieces of bitcoin they own. A public key is a series of letters and numbers that a user must share in order to receive funds. In contrast, a private key must be kept secret as it authorizes the spending of any funds received by the associated public key.
Using the private key associated with their bitcoin, a user can sign transactions and thereby transfer the value to a new owner. The transaction is then broadcast to the network to be included in the blockchain.
Overview of a Bitcoin Transaction
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.
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.
Bitcoin users can control how quickly their transactions are processed by setting the fee rate. The higher the fee rate, the faster the transaction will be processed.
Each block in the blockchain can only contain up to 1MB of information. Since space is limited, a limited number of transactions can be included in each block. Miners receive both a block subsidy (newly minted bitcoin) and transaction fees for ordering transactions into blocks. This means they are incentivized to prioritize the transaction with the highest fees. During times of high network congestion, where a large number of users want to transact, the transactions with the highest fees are more likely to be included in the next block.