Bitcoin's Data Structures

When a user submits a bitcoin transaction, it is verified and settled through a consistent journey requiring three data structures, each of which has a different role, allowing any node to enforce the protocol and ensure bitcoin cannot be spent more than once:

  • The UTXO set is the current state of all bitcoin balances (who owns what) within the system

  • The blockchain is the historical transaction record which logs every exchange of bitcoin from one address to another, and

  • The mempool is a temporary home for correct transactions awaiting processing into the blockchain

A transaction begins with a participant authorising the spending of bitcoin with a digital signature from a private key. That transaction is broadcast to the network, and received by another participant running the bitcoin software. The receiving participant verifies the correctness of the transaction per the protocol rules implemented by Bitcoin software. This verification process, detailed by the protocol rules, requires nodes to search their databases (UTXO set, blockchain and mempool) to determine whether bitcoin can be correctly transferred.

If the transaction is deemed correct by a full node, it is added to their mempool and propagated to each of its connected peers. The verification process is repeated for the connected peers and the transaction is continuously ‘gossiped’ throughout the network, effectively being added to each participant’s mempool along the way. Eventually, a mining node will add the transaction to their mempool and subsequently include the transaction into a valid block.

Once the valid block is broadcast, it undergoes a similar verification and propagation process across the network, whereby each participant appends their blockchain and updates their UTXO set and mempool. Similarly to transactions, this process is repeated for each bitcoin block and ensures the correct transfer of bitcoin from wallet to wallet.