In previous articles, we learned that DApps are just “Apps” that allow people to use blockchain Smart Contracts through a friendly user interface. We looked at the range of examples of DApps, from Gaming to DeFi, and more. Broadly, these definitions and examples apply to DApps as they exist on any blockchain network that supports Smart Contracts, including Ethereum, Algorand, Cardano, and numerous others. However, when you look under the hood, there are interesting differences in how different protocols handle Smart Contracts. As you might expect, Cardano has a novel and unique approach.
Other networks that support Smart Contract run the entire contract right on the blockchain. On Cardano, they are instead run in two parts. One part is run off the blockchain, by the party interested in the result of the contract. The other part, to validate the off-chain result, is stored and run on the blockchain. This means software engineers have to write two separate pieces of code: one to validate the work, another to do the actual work.
This plays out something like this:
- First, a developer says, “Hey Cardano, I’m creating a contract that knows how to create ducks. Here is what my duck looks like, here is how it quacks.”
- Then you, a user, come along. Through an interface, you run the Smart Contract. The Contract creates an output (a duck!), and submits it, along with the contract, to Cardano.
- Cardano verifies that the contract hasn’t been altered. Then it performs a duck check, by comparing the prescription that lives on the blockchain with the output you just handed it.
- At the end, you have your duck that lives on the blockchain!
Pros & Cons
There are some downsides of doing it this way. It is challenging for companies who are already building on other blockchain networks to deploy on Cardano, because it is so different! It also makes it a little more expensive on the deployment side, because users cannot call the contracts themselves in their browsers and phones. Companies therefore have to host servers to facilitate thousands or millions of users submit their contract results to the blockchain.
So why do it that way? There are some significant advantages for companies, customers, and network node operators alike:
For both companies and end-users, the huge advantage is that one can know ahead of time exactly how much it will cost to interact with a Smart Contract. This is in contrast to other networks like Ethereum where the entire program is run on the network, making it difficult to predict ahead of time how long it will take for the program to run, and therefore how much it will cost.
In addition to taking the extra step of “saying what you’re going to do” before doing it, Cardano’s Smart Contracts benefit from their programming language, Haskell. Haskell is known for superior verifiability. In tandem, these reduce the risk of costly bugs.
Cardano’s eUTXO accounting model (a cash drawer style accounting system) makes it easy to serve thousands of users in a single transaction to the blockchain. This means that as a business’s customer base grows, they can optimize their Smart Contracts to cost less to run.
Companies build trust based on reliability and predictability, and customers enjoy transactions free of costly surprises.
This method also lowers the cost for node operators - the engines of the decentralized network. On Ethereum, getting started as a node operator requires a minimum investment of $3,000 for equipment, plus $45 to $80/month for electricity to be profitable. By contrast, on Cardano you can profitably help run the network with 3 raspberry pi machines, or basic server hardware running in the cloud. If running your own hardware, an investment of $600 plus $4 to $7 a month for electricity will get the job done. (These modest energy needs can realistically and fairly easily be served by renewable sources, such as solar!)
More people, from more walks of life, can participate in building a more decentralized network that is good for everyone - and the planet.
If you’ve made your way through all three installments of this series, you should now have a good idea of whether getting into DApps on Cardano is the right fit for your business. If you’re a blockchain user, you now have a deeper understanding of how DApps work on Cardano, which can help you avoid beginner mistakes and understand what you are looking at. If you’re considering building a DApp and want to read deeper, we have a series on Cardano’s Plutus Architecture. Start here: Technical Overview: Plutus Architecture.
Because of the trust and integrity Smart Contracts can bring, engineers and businesses will be relying on them more and more, in lieu of human supervision of event-driven software workflows. Like the internet, the better you understand Smart Contracts, the better positioned you will be to thrive in the coming blockchain era.