Skip to content

Latest commit

 

History

History
9 lines (5 loc) · 2.9 KB

utxo.md

File metadata and controls

9 lines (5 loc) · 2.9 KB

The Unspent Transaction Output (UTXO) Model

Blockchains are often described as ledgers: devices that are used in order to maintain a record of transactions; each blockchain implements its own model for describing and tracking transactions. Those who are familiar with Ethereum may already have some knowledge of the account-based transaction model. In this model, blockchain entities (users and smart contracts) are described as "accounts" that have an associated "balance"; it is the responsibility of the blockchain to ensure that accounts do not overspend their balance.

The account model is a straightforward example of a decentralized ledger of virtual assets: an account owner is free to spend any of their account's balance but may not spend any more. When describing a transaction model, it is constructive to think in terms of the logical abstraction that the model creates as well as the specific rules that it imposes. In the case of the account model, the logical model is similar to a credit card company tracking debits and credits to a credit card account; although these transactions represent the transfer of real value, the value that is being transferred is more of a logical representation as opposed to a physical one (e.g. cash). The rule of such a system is trivial: account balances may never be less than zero.

The unspent transaction output (UTXO) model for ledger-keeping, which is most notably used by the Bitcoin blockchain, is logically more similar to a cash-based system than Ethereum's account model. In a cash-based system, a finite set of discrete units (cash) represents value. Unlike in an account-based model, where account owners are free to spend any portion of their balance in any denomination that they'd like, in a UTXO system, entities may only spend the discrete units of value of which they have ownership. This means that each transaction consists of some set of "inputs" (the collection of cash that is used to pay for the transaction) and some set of "outputs" (the change that is leftover). The rules for a UTXO system are slightly more complicated than those of an account-based system because they require the ledger-keeper to track the ownership of discrete assets.

I recently made some changes to the Substrate UTXO Workshop to upgrade it from Substrate v1.0 to Substrate pre-v2.0; this was an awesome experience that really helped me to cement my understanding of the UTXO model for ledger-keeping. If you'd like to learn more about the rules of UTXO ledger-keeping, I certainly recommend going through the workshop on your own. Please feel free to get in touch with me if you have any questions, notice anything wrong or would just like to talk about blockchain development!