Crypto Bookkeeping

in LeoFinance11 days ago (edited)

accounting6

Dear reader,

Crypto fascinates me just as much as it confuses me. This keeps me in the game as there’s always something new to learn in this entertaining ecosystem. Writing about it helps me process what it is that I'm thinking about and lets me see if I understand the concept correctly. You see, if I cannot put my understanding down on paper so that someone else can pick it up and understand it too, then do I really understand it all?

One thing that's been on my crypto to-do list for a while now is to foster a solid understanding of the key difference between Bitcoin and Ethereum - and no, I'm not talking about the classic Proof of Work debate. I want to understand their bookkeeping architectures: Bitcoin's UTXO vs Ethereum's account model.

Let's see if you follow me on this one, shall we? We're going down the rabbit hole...

rabbit


Where it all started
Bitcoin arose from a need to bring transparency to a broken accounting model; a model that required the intervention of far too many middlemen. The shenanigans leading up to the 2008 housing market crash clearly highlighted this necessity. We won’t dive into the history of Satoshi Nakamoto’s creation today but we will take a closer look at the UTXO model that the Bitcoin network uses to correctly assign the value to its participants.

Any guesses for what UTXO stands for? That’s right, it’s Unspent (U) Transaction (TX) Output (O). Well done you in the back!

Bitcoin was first launched with the promise of being A Peer-to-Peer Electronic Cash System. Let’s think about cash transactions for a minute.

  • Gavin walks into a pizzeria and orders a couple of pizzas. The cost is $41. He takes out a $50 note and receives $9 change (a $5 note and 4x $1 coins).
  • Hal rolls into a pizzeria and orders a couple of pizzas. The cost is $41. He takes out 3x $20 notes from his wallet and receives $19 change (a $10 note and 9x $1 coins).
  • Laszlo walks into a pizzeria and orders a couple of pizzas. He pays 10,000 BTC and the pizza chef retires.

Well, let’s scrap the 3rd example and focus on Gavin and Hal. In theory, they carried out similar transactions, starting with similar amounts and receiving the same goods and some small change. Notice however that Gavin used 1 note for his transaction, yet Hal used 3. Their cash balances reverted correctly, although the physical units were different.

In Bitcoin, our addresses collect these loose change “notes” and “coins” from all our previous transactions, just as the contents of our own physical wallets are representations of the change we received at our most recent visits to the shop, barber, restaurant, etc. These individual loose change values are known as UTXOs. They are the OUTPUTS originating from previous TRANSACTIONS and they are still UNSPENT.

At this point it’s important to understand a critical function of the Bitcoin network, specifically its ledger. Think of the ledger as the large database that records every single transaction that ever took place on the network. The ledger itself does produce an exact record of who owns what at a certain moment in time. This is calculated on the spot when you open up your digital wallet. The wallet calculates the combined value of all your unspent coins, your UTXOs, and displays this as a single value.



The state of affairs
We’ve seen how the Bitcoin network keeps a record of all the transactions. User’s wallets calculate the assigned UTXOs and display the real-time cumulative amount on the wallet’s user interface.

Let’s take a moment to think about the ledger once again. As you’ve no doubt heard, Bitcoin runs on a blockchain – a long line of grouped transactions. The ledger therefore is an ever-expanding list of transactions. Special network nodes called miners encode the transactions into a single block and in Bitcoin’s case, a new block is added to the chain every 10 minutes or so. The reason for this is that it would be computationally impractical to make individual adjustments to the ledger for each new transaction, hence there being a bundle of transactions called a block.

So behind the scenes, nodes are busy collecting all the info to be placed into the next block but once this block has been encoded on the chain, a change has occurred in the global state of the system. This updated global state is stored on-chain.



The World of Warcraft moment
Having co-founded Bitocin Magazine in 2012, Vitalik Buterin was well versed on the mechanics of Bitcoin and its UTXO bookkeeping architecture. But do you know where the need for Ethereum came from. Let’s allow Vitalik to explain it for himself:

“One day [‘World of Warcraft’ game maker] Blizzard removed the damage component from my beloved warlock's Siphon Life spell. I cried myself to sleep, and on that day I realized what horrors centralized services can bring. I soon decided to quit.”

This moment of despair was presumably the catalyst that spurred on the creation of Ethereum – a smart contract cryptocurrency. There are many points of contention between Bitcoin and Ethereum but I believe the method in which they resolve their global state is a key distinguisher between the 2 protocols.

At a fundamental level, Ethereum offers 2 account types, user and contract code:

  • The user account is controlled by its owner and transactions need to be signed by the private key.
  • The smart contract accounts are deployed on-chain and are controlled by their particular code for that contract’s purpose.

Unlike Bitcoin’s global state which is stored on-chain and constantly added to, Ethereum’s global state is actually kept locally on the network’s nodes. These decentralised nodes must all achieve consensus on their data, with the majority consensus proposal attaining a majority approval.

This local collection of global state, liberates space on the blockchain for keeping the account balances, for storage and for holding the smart contract codes. Liberating space is at first glance a good thing, but with all those smart contract codes comes an immense amount of computational power, something that increases aggressively with network activity. A key distinction to be made at this point is that whereas UTXO model nodes verify, account model nodes compute.

Now, I think we’re getting ahead of ourselves, back to basics: transactions. When a transaction occurs, the protocol deducts the sent amount from account 1 and increases the amount on account 2 (minus transaction fees, or gas as it more colloquially known). Coincidentally, this is more or less how modern digital banking works.

Whereas the UTXO model simply adds an extra level of transactions to an existing forward moving graph, account model nodes must replicate the entire global state of all account balances, and contract codes (remember that the UTXO balance calculation is done on the wallet side, not on the protocol itself).



Weighing up the options
The obvious advantage and underlying necessity for Ethereum’s creation, is the ability to run smart contracts and the introduction of project tokens (as opposed to main chain “coins”). This unlocks the ability for users to do much more with their crypto assets. It also offers far better fungibility as payments are simply deducted from the account balance, whereas UTXO balances involve a complex combination of previously unspent outputs. We’ve seen how computationally intensive a network like Ethereum can be, but the basic review of an account’s balance is far less work than verifying unspent UTXOs.

Let’s not forget UTXO altogether. With the creation of change addresses, privacy becomes all that much cloaked (although modern day onchain metrics do make it difficult to conceal transactions altogether). UTXOs also offer a more beneficial approach to simple payments that don’t require smart contract code.



The best of both worlds?
The crypto space is an increasingly competitive space and project founders and their research teams are scrambling to define methodologies that iterate on lessons learnt in the space. Certain projects combine both UTXO and account models in their construction, such as Avalanche for example with its 3-chain architecture.

Personally I like the idea of UTXO network security. When you approach the technology from a cash out, change in perspective, it makes it much easier to understand what’s going on with the bits and bytes that make up your crypto wallet. However, having spent some time looking on various blockchain explorers, I do find it far more intuitive to navigate an account based system. The option of incorporating smart contracts into the ecosystem is admittedly also a huge advantage.

Going forward, I believe we have interesting times ahead of us as we come witness what future ecosystems can conjure and I’m excited to see what iterations are still in store. If user adoption is important to crypto’s growth, then a good explorer tool to see and understand what’s going on is critical, but of course this may not come at the detriment to security and utility.

Exciting times ahead in the world of digital bookkeeping.



Signing off for now,

Jase - Digital Media Freelancer


Resources:

Original content, copyright JaseDMF 2022. First published on read.cash.


Let's connect:


  • Twitter
  • Publish0x: Earn crypto for reading about crypto
  • Read.cash: Earn Bitcoin Cash for writing
  • Noise.cash: Earn Bitcoin Cash for microblogging
  • Hive: Earn HIVE for your Web3 social activity (signup via Ecency)


Disclaimer: some URLs may include affiliate links. These don't cost you any money, nor do they alter your web browsing experience. They do however help yours truly keep the heating on in the winter!

Sort:  

Congratulations @jasedmf! You have completed the following achievement on the Hive blockchain and have been rewarded with new badge(s):

You distributed more than 10 upvotes.
Your next target is to reach 50 upvotes.

You can view your badges on your board and compare yourself to others in the Ranking
If you no longer want to receive notifications, reply to this comment with the word STOP

Support the HiveBuzz project. Vote for our proposal!

It may seem simple, but referring to cryptographic accounting in these times of extreme uncertainty and volatility is not an easy thing to apply, and mechanisms are still being sought to create an accounting system that allows business records to be kept.