May 10, 2022

EMURGO Academy: How Does Accounting Work in a Decentralized Blockchain?

EMURGO

EMURGO-Academy-Blockchain-Accounting-Cardano-Course1.png

Train for a career in blockchain with EMURGO Academy

Click to pick the right EMURGO Academy blockchain course for you!

As a founding entity of the Cardano blockchain, EMURGO’s education unit EMURGO Academy offers several online blockchain courses for students with both technical and non-technical backgrounds.

Taught by instructors with real-world experience in blockchain, EMURGO Academy’s courses are an ideal fit for those wanting to prepare for a career in blockchain.

Read about how an EMURGO Academy student now works full-time in blockchain!

These days, there are many companies and blockchain projects looking for prospective talents with Web3 work experience.

Blockchain serves as the foundation technology for applications in NFTs, DeFi, wallets, and many more, highlighting the need for blockchain education.

How does a blockchain keep track of accounting?

There are many pieces that compose a decentralized blockchain ledger:

  • the data structure that determines how information is stored
  • the consensus algorithm which governs how the network reaches agreement on the history of the ledger
  • the rewards incentives that show the tokenomics (token economics) of a particular network

One part that is important but often overlooked is a blockchain’s Balance Model or Account Model.

This piece of technology is in charge of its accounting – deciding how transactions are processed by the network and what the ledger is tracking. This part impacts the scalability potential of all blockchains.

For the digital transfer of cryptocurrencies to be useful, the blockchain network needs to record these movements. The transfer of cryptocurrencies or tokens on a blockchain is started by the owner of the private key associated with a wallet, thus creating the transaction. This transaction informs the network about how much value is moving and its destination.

The system or set of rules governing this process is the Balance/Account Model.

In the accounting profession, many have decided to call blockchain technology “triple entry bookkeeping.”

“Double entry bookkeeping” is the regular practice where debits and credits are recorded in a single ledger. In contrast, “triple entry bookkeeping” adds the security of having that book, or ledger, copied across many nodes in a decentralized network.

That ledger is the state of the network.

Systems are said to have a “state” if they were designed to remember preceding events or user interactions. This recorded information is what we would normally call the “state” of the system. A distributed ledger like a blockchain, by its very nature, has a state, which needs to be recorded according to a set of objective rules.

The Balance or Account Model is precisely the way a network records these interactions.

After a network has been launched, changing this model is an enormously difficult task that has never been successfully done in a fully live network.

It’s crucial to understand it for anyone looking to seriously develop dApps on a blockchain.

What are the different Balance or Account Models?

There are two standard ways to determine how transactions are recorded by a distributed ledger, Global Balance and Unspent Transaction Output (UTXO).

The UTXO model is a more abstract concept comparatively.

Yet, UTXO is the initial Accounting Model for decentralized ledger technology introduced by Bitcoin in 2008.

The Global Balance model was introduced by first generation smart contract blockchains.

Cardano’s blockchain utilizes the UTXO model to increase scalability for its ability to process transactions in parallel. But, the original UTXO model had to be extended to account for smart contract computations.

Below, we will discuss both of these models in more detail.

The Global Balance Model

The Global Balance system was taken from digital banking in near identical fashion.

The Ethereum blockchain was the first to introduce it to the blockchain world in the Ethereum Yellow Paper. It is named in that text as “world state” which manages account balances and smart contract computations.

The state on Ethereum is a part of its base protocol and forms the single transaction layer of its blockchain. This means that the “state” being recorded by its ledger is entirely based on transactions.

Ethereum doesn’t actually have independent assets that can be called tokens. Instead, it has smart contracts that record interactions in the form of transactions.

These in turn make the state of the Ethereum ledger and are recorded by its network. We can say that any movement of modification to the state on Ethereum is a transaction. The Ethereum blockchain begins existence at the genesis block. It has an index of 0, and activities after this blockchain such as transactions, smart contracts computations, and mining, will modify the state of the Ethereum blockchain.

Now, in order to preserve the order of the state, all transactions have to be processed sequentially. This means that the network is taking all of the transactions broadcasted to the ledger and queuing them in a single file. Each is processed when their turn arrives.

Under this Global Balance Model, the Ethereum network has to be aware of the state of the entire system including balances across all different crypto wallets, all the tokens on the ledger, all NFTs minted, and so on.

It’s important to note that data such as account balances are not stored directly in the blocks of the Ethereum blockchain. Only the root node hashes of the transaction tree, state tree and receipts tree are stored directly in the blocks.

This linear system prevents the ledger from changing the history of the transactions and prevents any sort of parallelizing processing since that would break the model.

The blockchains using a Global Balance must process transactions one by one. Even those that are unrelated, like the purchase of an NFT and a Uniswap token exchange, have to be put in a serial line.

This sacrifice is what allows these networks to have a simpler transaction structure. In them, direct debits of a balance are possible.

For example, if a user has 100 X tokens in my crypto wallet, the user can subtract 50 X tokens and send them to another wallet address.

The UTXO way to record a state is more abstract, but it opens the possibility to having parallel transactions.

Cardano’s Extended Unspent Transaction Output (eUTXO) Model

The eUTXO model was first pioneered by Bitcoin and later adopted by most first generation blockchains.

The first generation blockchains only have one asset in their ledgers, their native cryptocurrency, and the system is less cumbersome.

The “state” in these distributed ledgers is represented by a global aggregation of Unspent Transaction Outputs (UTXOs).

These represent the movement of value in the network whenever a transaction happens. This means, a user on one of these blockchains is able to spend one, or more, of their UTXOs by creating a transaction and adding one or more of their UTXOs as the transaction’s input.

This accounting model of UTXO makes Cardano and Bitcoin different from Ethereum and other Global Balance blockchains.

Let’s illustrate an example to understand the difference.

Example

In Bitcoin’s blockchain, a UTXO cannot be partially spent. If a user has 1 Bitcoin (BTC) in a crypto wallet and spends 0.5 BTC, the system will create a second transaction that sends back 0.5 BTC in return as change.

Instead of thinking of the balance as a fully fractionalized account, we can think of UTXOs as physical money.

If I have a $5 bill in my pocket and I want a candy bar that costs $2.50, I can give the vendor the $5 bill, and the vendor can return two $1 bills and a fifty-cent coin in change.

For this reason, at the level of the core protocol, UTXO blockchains don’t maintain account balances. The user simply holds the private keys to one or more UTXOs at any given point in time. Crypto wallets make it seem like the blockchain is automatically storing and organizing the users account balances, but that is not the case.

In UTXO blockchains, the crypto wallet is doing a lot of heavy lifting. These are in charge of:

  1. Tracking UTXOs
  2. Storing the private keys
  3. Calculating transaction fees
  4. Ensuring the return of the remainder balance
  5. Aggregating all the remaining UTXOs

What is concurrency?

Concurrency is a concept in computer science that refers to the ability of a system to execute two or more tasks at the same time (in parallel).

The UTXO model introduced was designed to be able to do this on the Bitcoin network.

That is the main reason why Cardano chose to extend the UTXO model and adapt it to smart contracts.

UTXOs can be processed by the ledger in parallel if they are not related.

For example, a transaction between two friends and a third user buying an NFT have no relation between each other. The UTXO used are controlled by different private keys, and can be broadcasted to the network at nearly the same time.

This gives enormous power to the ledger to scale, as unrelated transactions don’t have to be artificially ordered according to some history.

Regular transactions and other dApps benefit greatly by the use of UTXOs, and that is one of the main advantages Cardano has over the other protocols that rely on a Global Balance.

Start a career in blockchain

Click to pick the right EMURGO Academy blockchain course for you!

As the official commercial arm and a founding entity of the Cardano blockchain, EMURGO is uniquely positioned to leverage its extensive knowledge of Cardano’s technical development to offer curated educational courses on Cardano to interested students.

All courses are taught by professional instructors with actual blockchain experience.

EMURGO Academy, EMURGO’s education unit, has now expanded to offer six different courses on Cardano to a range of student types interested in becoming a Cardano developer, becoming a Cardano entrepreneur, becoming a Cardano business analyst/consultant, and more.

For more information on each of the courses and to contact a representative, please visit the link here now!

About EMURGO

Related articles