Bitcoin's ledger system is different from our traditional "account/balance" model. In order to better understand the operation of Bitcoin, we need to understand its UTXO (unspent transaction output) model. This model is a unique accounting method for Bitcoin.

What is the UTXO model?

The full name of the UTXO model is "unspent transaction output". It is essentially a way to manage funds through transaction records rather than account balances. In simple terms, the UTXO model records the "input" and "output" in each transaction, rather than the balance in the account.

In the Bitcoin system, each transaction has two parts:

Transaction Input: This section identifies the source of funds.

Transaction Output: This part identifies where the funds go.

Each transaction can have multiple inputs and multiple outputs. We can think of each transaction as "consuming" the output of the previous transaction and generating new outputs, which can be used as inputs for other transactions in the future.

Trading Examples

Transaction A: Assume there is a miner node X, which receives a reward of 15 bitcoins through mining. These 15 bitcoins were originally an unspent transaction output (UTXO).

Next, Node X makes some transactions:

Transaction B: Node X transfers 5 bitcoins to node Y. This transaction can be expressed as:

  • Input: 15 Bitcoins from Node X (from mining rewards).

  • Output: Node Y received 5 bitcoins, and Node X was left with 10 bitcoins as change.

In this transaction, Node X consumes the 15 bitcoins it previously obtained (as input) and generates two new unspent transaction outputs (UTXOs): one for Node Y’s 5 bitcoins and the other for Node X’s remaining 10 bitcoins.

Transaction C:

Later, node X and node Y jointly invest and each pay 3 bitcoins to node Z. This transaction can be expressed as:

  • Input: 3 of 10 bitcoins from node X, 3 of 5 bitcoins from node Y (from previous transaction B).

  • Output: Node Z received 6 bitcoins, Node X received 7 bitcoins as change, and Node Y received 2 bitcoins as change. These are all newly generated UTXOs.

in conclusion

Each "account" in the Bitcoin system can be considered to correspond to a certain address. The Bitcoin blockchain does not directly track the Bitcoin balance of each address, but stores the entire history of transaction data in the blockchain. The Bitcoin system tracks the collection of all UTXOs in the blockchain network through the "transaction pool", and the "balance" of an address at a certain point in time is calculated by checking and summing all UTXOs related to the address. When a UTXO is used, it will be deleted from the transaction pool, which will be reflected in real time when calculating the balance.