If you’ve ever sent or received a bitcoin transaction, you can recognize the magical feeling that you’ve just done something profound. there was no intermediary for the transaction, no one had to ask for permission, and it was faster than any bank transfer. how is all this possible? In this article we look at how bitcoin transactions work under the hood.
what is a bitcoin transaction?
A transaction is a transfer of value from bitcoin on the blockchain. In very simple terms, a transaction is when Participant A gives a designated amount of Bitcoin that they own to Participant B.
Reading: How do bitcoin transactions work
transactions are created through mobile, desktop or hardware wallets.
➤ learn more about how bitcoin wallets work.
how does a bitcoin transaction work?
For bitcoin users, sending a transaction is as simple as entering an amount and address in your wallet and pressing send. they don’t have to worry about the technicalities of how it works. however, many users are curious how it works in practice.
Bitcoin uses public key cryptography to ensure the integrity of transactions created on the network. To transfer bitcoins, each participant has pairs of public keys and private keys that control parts of bitcoin owned by them. a public key is a series of letters and numbers that a user must share in order to receive funds. conversely, a private key must be kept secret as it authorizes the spending of funds received by the associated public key.
Using the private key associated with their bitcoin, a user can sign transactions and thus transfer the value to a new owner. then the transaction is broadcast to the network to be included in the blockchain.
summary of a bitcoin transaction
To better illustrate how value is transferred on the bitcoin network, we’ll look at an example transaction, where alice sends .05 bitcoin to bob.
At a high level, a transaction has three main parts:
- entries. the bitcoin address that contains the bitcoin alice wants to send. to be more precise, it is the address from which alice had previously received bitcoins and now wants 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 details of the transaction using her private key. the message contains the input, output, and quantity as described above. The transaction is then broadcast to the rest of the bitcoin network where nodes verify that alice’s private key can access the inputs (by verifying that alice’s private key matches the public key it claims to possess).
once a transaction is transmitted to a node, this node 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 that the miner is trying to add to the blockchain. if a miner finds the next block in the chain, this block template is mined and becomes an immutable block in the blockchain. finally, this block is transmitted to the nodes of the network, who will include it in their copy of the chain.
bitcoin transaction fees
Bitcoin users can control how quickly their transactions are processed by setting the fee rate. the higher the fee, 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 a block subsidy (newly minted bitcoin) and transaction fees for ordering block transactions. this means that they are incentivized to prioritize the transaction with the highest fees. during times of high network congestion, when a large number of users want to transact, transactions with the highest fees are more likely to be included in the next block.