Overview
A “transaction” in this context is simply a transfer of bitcoin on the blockchain when one entity sends bitcoin to another.
Bitcoin makes use of public-key cryptography to ensure the integrity of transactions created on the network. In order to transfer bitcoin, each entity has pairs of public keys and private keys that provide access to the 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 authorises the spending of any funds received by the associated public key. Another way to conceive of the difference is that while your home address may be public knowledge (public key), only you have the key to the front door (private key).
The terms address and public key are often used interchangeably. An address is a representation of a public key, used for security and brevity.
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. Anyone who possesses your private keys has access to your bitcoin.
To clarify, a bitcoin transaction is a transfer of bitcoin from one address to another, and in order to be valid, must be signed by the sender. There are no “accounts” with Bitcoin. Instead, fractions of a bitcoin (known as “Satoshis”, of which there are 100 million in a bitcoin), are associated with an address, and can be sent to another entity in the network. Importantly, bitcoin transactions are published to the mempool (a database of unconfirmed transactions), where they are considered ‘pending’. When a bitcoin miner adds a transaction to a block, it is then considered confirmed.
An Example
To illustrate how value is transferred, we’ll consider an example, where Jack sends 0.5 bitcoin to Jill.
At a high level, a transaction has three components, namely:
- Inputs – this is the bitcoin address from which Jack had previously received bitcoin to and is now wanting to spend.
- Outputs – Jill’s public key or bitcoin address.
- Amounts -The amount of bitcoin Jack 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 Jack to send the 0.5 bitcoin to Jill, he signs a message with the transaction details using his 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 Jack’s private key is able to access the inputs (by checking that Jack’s private key matches the public key he 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.
Fees
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 incentivised 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.
