On January 3, 2009, Bitcoin revolutionized the world by demonstrating a technological innovation that enabled a fully trustless system with an elegant and simple ledger model. But it failed to create a thriving ecosystem of decentralized financial instruments. Ethereum attempted to build a world computer by combining an accounts-based ledger model and object-oriented programming. But it also failed to enable safe and secure decentralized financial applications with widespread adoption. Cardano is now creating a financial operating system by combining the best of Bitcoin and functional programming. A combination that has the potential to transform global finance.
Bitcoin and the UTxO Ledger model
With its invention, Bitcoin introduced a technology that was the first of its kind. It introduced the first known trustless payment system that allows individuals or institutions who do not know or trust each other to exchange value directly. All of this happened without needing a trusted authority or centralized clearing house. This novel technology revolutionized how we could transfer value between each other.
Satoshi was a visionary not because he invented every technology that made Bitcoin possible. But he had the vision to create the world’s first decentralized blockchain technology by combining existing technologies in a way that had never been done before.
One of the most impressive part of Bitcoin is its simple and elegant UTXO (Unspent Transaction Output) ledger model. In the UTXO ledger model, individual transactions consist of a list of ”inputs” and ”outputs,” and the sum of the values consumed by a transaction’s inputs must equal the sum of the values provided by its outputs. The output of every transaction can be utilized as an input in a future transaction.
The main advantage of the UTxO model is its simple and elegant design. UTXO model keeps the semantic model or method of structuring data on the ledger simple and uncomplicated in a complex distributed and dynamic computing environment.
But this model comes with some limitations.
Why bitcoin failed to enable a thriving dApp ecosystem
One of the main drawbacks of the UTXO model is its limited expressiveness of programmability. Meaning, it is not possible to implement complex logic in the protocol based on this model. This limitation restricts the types of transactions and decentralized applications that can be built on a UTXO-based blockchain, limiting the full potential of the technology.
Before Vitalik Buterin developed Ethereum with his team, he was involved in a project known as “Colored Coins.” Colored Coin was an attempt to create a way to issue and transfer assets on Bitcoin. From a conceptual point of view, a colored coin can be issued to represent assets like stocks, bonds, commodities, real estate, etc.
Colored Coins were unsuccessful due to the limitations of the UTXO model in enabling the implementation of complex logic. This limitation of Bitcoin motivated Vitalik to build a platform that can support decentralized applications, i.e., Ethereum.
Ethereum: Accounts-based ledger model and object-oriented programming, a combination that failed at mass adoption
Ethereum was created to build a platform that enables an ecosystem of decentralized applications. Two critical choices were made in building such a platform.
1. The accounts-based ledger model
2. Object-oriented programming language based on Solidity for implementing smart contracts
So let’s dig a bit deeper into both of these concepts.
The accounts-based ledger model
Accounts based ledger model is like traditional bank accounts. They store assets as balances within user accounts, which can be controlled by a private key or a smart contract. It’s just like a regular bank account – when you deposit coins into your wallet, the balance increases, and when you transfer coins elsewhere, the balance decreases. These balances are kept as a global state of accounts by each node on the network and are updated with every transaction.
Compared to the UTXO model of Bitcoin, the accounts-based model of Ethereum offered some clear advantages. Especially when it comes to enabling smart contracts, this ledger model allows way more expressiveness of programmability than the UTXO model of Bitcoin.
Object-oriented programming (OOP) language based on Solidity for implementing smart contracts
Both of these design choices made it easier to build on Ethereum. But these design choices came at a cost.
Shared mutable state: The root of all evil
The account-based ledger model and object-oriented programming environment of Ethereum share one common characteristic: a “Shared Mutable State.” This feature, while offering flexibility and the ability to implement complex logic, also introduces the risk of conflicts and problems if the shared state is not managed properly.
Imagine this: two or more parties can change the same data, and their lifetimes overlap. The risk here is that one party’s modifications could prevent other parties from working correctly. This scenario highlights the potential dangers of shared mutable states, where multiple users or processes can modify the same resource and create conflicts or inconsistencies in the data.
A public blockchain creates a dynamic and fast-paced environment where multiple parties are vying to execute actions simultaneously. However, the account-based system of Ethereum introduces a “Shared Mutable State” that significantly complicates the semantics of contract code, leading to a higher risk of transactions failing mid-script execution and taking fees from users. This limitation also restricts the scalability of the blockchain, as it cannot effectively execute parallel processing of transactions.
Programming in a dynamic environment with object-oriented languages like Solidity can create a “Dependency Hell,” where multiple abstractions are stacked on top of each other to modularize complex systems, creating a shared mutable state. When submodules try to access this shared state simultaneously, it can lead to complexity and chaos in the programming environment. This not only creates a more significant surface area for attacks on smart contracts but it also makes it more difficult to reason about and verify the behavior of these complex systems.
As the DeFi market has grown in size, we’ve unfortunately seen a corresponding (or even larger) growth in DeFi exploits.
Just imagine trying to build a complex global financial infrastructure on top of this. Talk about a recipe for chaos! I’m sure it would be quite a complicated endeavor, to say the least.
That is one reason why we have not seen any sophisticated financial instrument or serious institutional interest in building a dApp on top of Ethereum.
This makes us realize the fundamental requirement of the system we want to be a part of. A blockchain architecture that offers safety & security.
How Cardano is combining Bitcoin and Functional programming
When it comes to building a reliable and secure foundation for mission-critical decentralized applications (DApps), there are few approaches as effective as the UTXO model of Bitcoin and functional programming with Haskell. Both of these approaches prioritize simplicity and elegance, resulting in robust and secure systems that can be trusted to handle the most important tasks. That’s why the engineers and researchers who developed Cardano integrated these two components into the core of Cardano.
Functional programming with Haskell
Functional programming is a programming paradigm that involves building software using “pure functions,” which are functions that do not rely on shared states, mutable data, or side effects. A pure function is a fundamental concept in computation that is characterized by its ability to always produce the same output for a given input.
It follows four key rules:
1. A pure function must take at least one argument in order to perform its computation.
2. A pure function must return a value as a result of its computation.
3. A pure function must not rely on any variables or state that can change during the execution of a program.
4. A pure function must not change any variables or state itself, as this would violate the rule that it must not depend on changing variables or state.
These properties make pure functions stateless and timeless, meaning that they are not affected by the current state of a program or by the passage of time. This makes them reliable and predictable, as they will always produce the same output for a given input.
One of the other main benefits of pure functions is that they are easily parallelizable. This is because they encourage the use of immutable data structures, which reduces the risk of side effects and makes it easier to run code on multiple processors simultaneously.
Additionally, functional programming languages, like Haskell, have a unique feature that allows functions to be treated as first-class citizens. This means that they can be used as arguments, returned as values, and assigned to variables, just like any other data type. This ability to treat functions as values enables the creation of higher-order functions, which are functions that operate on other functions.
Higher-order functions raise the level of abstraction in a program, allowing for the creation of functions that produce other functions. This can be useful for simplifying code and reasoning about higher-level details. Like Bitcoin’s UTXOs, pure functions in functional programming are simply mappings from inputs to outputs that do not depend on any state changes.
Cardano’s Plutus Platform uses Haskell for off-chain code and PlutusTX for on-chain code. This is compiled down to Plutus Core, enabling the use of the same syntax, compiler, and data types in both parts of the code. This creates an integrated, compact, and robust programming model.
Because of this, functional programming can help to create more reliable and predictable software that is easier to reason about, test, and debug.
The EUTxO ledger model
The engineers and researchers building Cardano have developed the Extended UTXO (EUTXO) model to improve over the UTXO model used by Bitcoin. The EUTXO model addresses some of the limitations of the UTXO model, such as its limited expressiveness and difficulty in implementing complex logic, while still maintaining its benefits, such as its simplicity and security.
Here are the components of the E-UTxO model:
The E-UTXO model is significantly superior to the account-based model used by Ethereum for a number of reasons. Firstly, it allows for transaction parallelization, which helps to reduce congestion and improve scalability. Secondly, it offers determinism, allowing users to predict the cost and validity of a transaction before it is processed on the chain. Thirdly, arbitrary data carries information about the state of outputs, enabling the contract state to be localized without the concept of a “shared mutable state”.
This elegant design is combined with a functional programming environment that prioritizes safety, reliability, and predictability.
Why this combination is going to revolutionize global finance
To build the future of open global finance, it is essential to have a platform that has put in the necessary work to ensure the security and safety of dApps. It can’t be built on a platform where multimillion-dollar hacks occur regularly. This is the minimum requirement for building mission-critical decentralized applications (DApps).
Ethereum has not yet managed to enable safe and secure decentralized financial applications with widespread adoption. Bitcoin is so far from enabling any decentralized application on top of it. Cardano is now creating a financial operating system with the security and reliability of Bitcoin and the ability to handle complex high-level abstractions and perform efficient, reliable computations through functional programming. A combination that has the potential to transform global finance.