Coin Set vs Account Model
In the account model used in many blockchains such as Ethereum, Solana and Algorand, balances are kept in accounts. These are permanent data structures which do not get destroyed when they send funds.
In this section, we'll focus on Ethereum and how its account model compares with Chia's coin set model.
Ethereum's account model
In terms of keeping track of state, Ethereum's account model functions similarly to legacy banks. Accounts, balances and smart contracts are persisted on the blockchain.
Accounts and contracts have money associated with them. The source code governing how money may be spent is a first class object.
A typical Ethereum transaction would look like the following:
Alice wants to send 1 eth to Bob. To complete this transaction, 1 eth is subtracted from Alice's balance, and 1 eth is added to Bob's balance. There is no need to calculate the history of how Alice acquired 1 eth prior to this transaction. In order for the transaction to be processed, the system only needs to know that Alice's balance was at least 1 eth.
Chia's coin set model
There are no accounts or balances, but rather only coins (see the Coin Set Intro page for more info). Coins are first class objects; they are the only data that is persisted on the blockchain. Each coin has a parent, allowing for its history to be tracked to its coinbase.
A typical Chia transaction would look like the following:
Alice wants to send 1 XCH to Bob. Alice has five coins in her wallet: four worth 0.2 XCH apiece, and one worth 0.7 XCH. Her wallet automatically selects two of the coins worth 0.2 XCH and the 0.7 XCH coin to be spent. All three coin spends happen simultaneously, along with two new coin creations: one worth 1 XCH which goes to Bob's wallet, and one worth 0.1 XCH which goes to Alice's wallet as "change." Alice now has two coins worth 0.2 XCH and one worth 0.1 XCH. Bob has one coin worth 1 XCH. The total value owned by Alice and Bob has not changed -- it was 1.5 XCH both before and after the transaction was processed.
Owner | Before | After |
---|---|---|
Alice | 1.5 XCH (5 coins) | 0.5 XCH (3 coin) |
Bob | 0 XCH | 1.0 XCH (1 coin) |
Total | 1.5 XCH | 1.5 XCH |