Top Four Smart Contract Platforms: An In-Depth Analysis
In this deep dive guide of Smart Contract Platforms Comparison, we are going to be comparing four of the most promising smart contract platforms out there – Ethereum, EOS, Cardano, and RSK. So before we go into comparing these platforms, let’s get a quick understanding of smart contracts.
Smart Contracts may end up becoming one of the most important inventions of all time. Today, there are thousands of deployed contracts on several smart-contract platforms.
What are Smart Contracts?
A smart contract is like a normal legal contract but it is written in a formal language and is enforced by computers. While a normal contract requires the legal system and law enforcement as a last resource to execute the actions triggered by the contract, the smart contract can directly trigger actions on the digital domain, such as making a payment or transferring ownership of a digital asset.
Also, some legal contracts require a trustee (sometimes a lawyer or a law firm) as a third-party that executes certain actions at specific times, generally when the contract involves simultaneous exchanges of goods. Smart contracts can emulate the role of the trustee and replace it with a computer program. Therefore, as long as all the program inputs and outputs are in the digital realm, a smart contract can be completely automated and self-executing.
Smart Contract Platforms Comparison
In 2013, a young Russian-Canadian programmer Vitalik Buterin released the Ethereum white paper and introduced the world to smart contract platforms. Since then, Ethereum has grown strength-to-strength and has gathered to build one of the healthiest developer communities in the crypto space.
Reason for Creation
While Buterin was intrigued by Bitcoin and its potential utility, he felt that the blockchain had a lot more to offer than just being a payment system. He envisioned a future where developers could create their applications on the blockchain. Ethereum was going to be a decentralized global supercomputer that would rent out computing power or “gas” to the developers to create their decentralized applications or dApps.
The proper development of Ethereum began in early 2014 through a Swiss company, Ethereum Switzerland GmbH (EthSuisse). Ethereum held its initial coin offering between 20th July- 2nd September 2014 and raised ~$18.4 million.
Ethereum uses a variant of Nakamoto Consensus, which is based on proof-of-work and therefore it is generally referred to as a POW consensus. In that regard, Ethereum is relatively similar to Bitcoin. However, during its final stage, it will be upgraded to a new consensus protocol called Casper FFG which is usually referred to as Proof-of-Stake or POS.
In POW, we have certain nodes called miners who own specialized equipment. These types of equipment (ASICs and GPUs) spend real-life computational power and compete to solve cryptographically hard puzzles. If you solve the puzzle before the rest, you win the competition. Then you get to add your block to the blockchain and get rewarded accordingly.
Ethereum plans to move on to the POS protocol because it is more scalable and less wasteful.
A POS system makes the entire mining process virtual. In a POS system, the miners (aka validators) lock a portion of their coins as a stake within the system. The miner’s hashing power is directly proportional to the size of their stake. Following that, the validators bet on a particular block. If the bet is successful, then they get a block reward proportional to their overall stake.
Ethereum will be implementing POS via the Casper protocol. In this protocol, a malicious validator gets punished by having their stake slashed.
For a more detailed explanation on Casper, check out our guide.
Developing on Ethereum
To understand how smart contracts work on top of Ethereum, we need to understand the concept of gas.
To better understand how gas works in Ethereum, let’s use an analogy. Suppose you are going on a road trip. Before you do so you go through these steps:
- You go to the gas station and specify how much gas you want to fill up in your car.
- You get that gas-filled up in your car.
- You pay the gas station the amount of money you owe them for the gas.
Now, let’s draw parallels with Ethereum.
The car is the operation that you want to execute, like a gas or a smart contract.
The gas is well….gas.
The gas station is your miner.
The money that you paid them is the miner fees.
All the operations that users want to execute in ethereum must provide gas for the following:
- To cover its data aka intrinsic gas.
- To cover its entire computation.
The following flowchart taken from Unblock should give you an idea of how the entire governance process flow works.
While Ethereum does have some on-chain governance due to its consensus protocol, it does a majority of its governance off-chain via Ethereum Improvement Proposals (EIP). EIPs are usually detailed design documents that provide suggestions on improving the Ethereum blockchain. These processes are not presented, recorded, passed or voted for on the blockchain itself.
According to Ethereum guidelines, the following needs to be kept in mind when it comes to EIPs:
- EIPs have to be backed by technical knowledge and specifications.
- The EIP author needs to have influence or gather enough support to get EIP passed without causing a rift in the community.
- The most important part of the process is that all the views are required to be heard and considered.
- You can see the EIP documentation and all the discussions surrounding it to see the progress comprehensively.
EIPs can also originate from Ethereum Request for Comments (ERCs). In that case, the same procedure is followed, as well.
What are ERCs?
ERCs are suggestions for improvement proposals that are submitted for peer review through Ethereum. The ERC-20 token standard came about as a result of an ERC. Once an ERC shows enough promise to improve the Ethereum ecosystem, they are discussed further within the community and later changed into EIPs.
The EIP Discussion Phase
In this stage, the developers working on Ethereum will hold exhaustive discussions and meetings on whether the EIP in question is sound enough for real-world implementation. These developers are deeply involved in Ethereum’s development. GitHub has an entire room dedicated to Ethereum governance and development on GitHub, where they indulge in a real-time discussion. If the developers feel that the code upgrade will have a positive impact on the ecosystem, then and only then is the code implemented.
More of then than not, the discussion phase is often a death knell for most EIPs. The developers are reluctant to implement any change that may be a little too extreme to avoid a debacle like the Ethereum Classic hard fork.
There are both disadvantages and advantages to this process. The biggest obstacle, of course, is that this process takes a long time. The main advantage is that each EIP is researched so thoroughly, that more often than not, the EIP that gets passed brings in a positive change to the ecosystem.
#2 Smart Contract Platforms – EOS
EOS is based on the EOSIO software that was built by block.one. Block.one is headed by Brendan Blumer and Dan Larimer. If you have been involved in the crypto space, then you’ll know who Larimer is. He is the creator of delegated proof-of-stake and decentralized autonomous organizations, aka DAOs. He is also the man behind BitShares and Steem.
Reason for Creation
While Ethereum paved the way for smart contract platforms, the fact remains that it’s a very slow platform. Because of its design, it can only manage 15-20 transactions per second. A platform with such high latency cannot support modern dapps. It’s like playing a modern game like GTA 5 in your Windows 98 computer.
Eos aims to support industrial-scale decentralized applications. The way they are going to do that is by approaching smart contracts from a different angle than Ethereum’s. Instead of being a decentralized supercomputer, Eos plans to be a decentralized operating system. Users in Eos will own resources in exchange for their stake. So, if you own 1/1000th of the stake in EOS, then you will have ownership of 1/1000th of the total computational power and resources in EOS.
EOS delegates the validation of the blockchain to 21 members of a consensus committee, under a delegated proof-of-stake (DPOS) consensus mechanism.
In DPOS, anyone who holds tokens on a blockchain integrated into the EOS software can select the block producers through a continuous approval voting system. Anyone can participate in the block producer election and they will be given an opportunity to produce blocks proportional to the total votes they receive relative to all other producers.
How does it work?
- Blocks are produced in the rounds of 21.
- At the start of every round, 21 block producers are chosen. Top 20 are automatically chosen while the 21st one is chosen proportional to the number of their votes relative to the other producers. The producers are then shuffled around using a pseudorandom number derived from the block time. This is done to ensure that balanced connectivity to all other producers is maintained. To ensure that regular block production is maintained and that block time is kept to 3 seconds, producers are punished for not participating by being removed from consideration. A producer has to produce at least one block every 24 hours to be in consideration.
Development on EOS
Like already mentioned, EOS uses a governance model. Whenever your stake your EOS tokens, you are entitled to own resources like RAM, Network Bandwidth, and CPU Bandwidth in return. Having said that, these resources are very scarce and that is why you can only hold on to the EOS tokens, without using them, for a period of 3 years. Holders who don’t use their tokens will get their account terminated.
EOS uses WebAssembly (WASM) to develop smart contracts. While WASM is not a programming language, but it will give developers to code in the language of their choice and compile into a bytecode that can run on a supported browser.
The reasons why EOS chose WASM are as follows:
- Flexibility: Developers can code in the language of their choice.
- Speed and Efficiency: WebAssembly executes at native speed by taking advantage of common hardware capabilities available on a wide range of platforms.
- Open and Debuggable: It is designed to be pretty-printed in a textual format for debugging, testing, experimenting, optimizing, learning, teaching, and writing programs by hand.
In EOS, the Governance is maintained by establishing jurisdiction and choice of law along with other mutually accepted rules. This is usually done via the legally binding constitution. Every single transaction in EOS must include the hash of the constitution in its signature. This binds the users to the constitution.
The constitution and protocol can be amended by the following process:
- The change is proposed by the block producer who obtains a 17/21 approval rate
- The 17/21 approval must be maintained for 30 straight days.
- All users are required to sign off their transactions with the hash of the new constitution.
- Block producers adopt changes to the source code to reflect the change in the constitution and propose it to the blockchain using the hash of a git commit.
- Block producers again need to maintain 17/21 approval for 30 consecutive days.
- After that, full nodes are given one whole week to adapt to the new changes.
- Any node that doesn’t follow the new protocol is automatically shut down.
This process can hasten up during an emergency.
#3 Smart Contract Platforms – Cardano
Cardano is one of the most talked-about projects in the crypto space and offers scalability and security through a layered architecture. It was conceptualized by one of the co-founders of Ethereum, Charles Hoskinson. There used to be three organizations working full-time to take care of Cardano’s upkeep.
- The Cardano Foundation.
Reason for Creation
Cardano’s approach is unique in the space itself since it is built on scientific philosophy and peer-reviewed academic research.
The Cardano team wants to adhere to a set of principles and philosophies. They did not set out with a proper roadmap or a white paper. Instead, they focused on embracing a “collection of design principles, engineering best practices, and avenues for exploration.
The following are these principles and they are taken directly from the Cardano website.
- Separation of accounting and computation into different layers.
- Implementation of core components in highly modular functional code.
- Small groups of academics and developers competing with peer-reviewed research.
- Heavy use of interdisciplinary teams including the early use of InfoSec experts
- Fast iteration between white papers, implementation and new research required to correct issues discovered during the review.
- Building in the ability to upgrade post-deployed systems without destroying the network
- Development of a decentralized funding mechanism for future work
- A long-term view on improving the design of cryptocurrencies so they can work on mobile devices with a reasonable and secure user experience
- Bringing stakeholders closer to the operations and maintenance of their cryptocurrency
- Acknowledging the need to account for multiple assets in the same ledger
- Abstracting transactions to include optional metadata in order to better conform to the needs of legacy systems
- Learning from the nearly 1,000 altcoins by embracing features that make sense
- Adopt a standards-driven process inspired by the Internet Engineering Task Force using a dedicated foundation to lock down the final protocol design
- Explore the social elements of commerce
- Find a healthy middle-ground for regulators to interact with commerce without compromising some core principles inherited from Bitcoin.
Ouroborous is the first peer-reviewed consensus algorithm in the crypto space. Ouroboros looks at the distribution of the tokens in the ecosystem and from a source of random numbers, it divides the world into epochs. Each epoch is subdivided into slots and lasts for ~20 seconds.Each slot then gets its own slot leader, who is randomly chosen.
The Slot leader act like miners does in a POW protocol in the sense that they are the ones who choose the blocks that get added to the blockchain. They can, however, add only one block.
If a slot leader somehow misses their chance and doesn’t choose the block, they miss their opportunity and will have to wait till they become slot leaders again. It is ok for one or more slots to remain empty (without generated blocks), but the majority of the blocks (at least 50% + 1) must be generated during an epoch.
As you can see, the slot leaders have a vital role to play in the ecosystem. To be considered for qualification, one must own a 2% stake in Cardano. These stakeholders are called electors, and they are the ones who elect the slot leaders for the next epoch during the current epoch. The more stake the stakeholder has in the system, the more chance they get to be elected as slot leaders.
Development on Cardano
Cardano has chosen Haskell and Plutus as their languages of choice. Haskell will be used to code Cardano, while Plutus will be used for the smart contract creation. Both of them are functional languages.
When it comes to programming languages, there are two families:
Imperative Programming Languages
In an imperative approach, the coder needs to sequentially put down all the steps that the computer needs to take to reach a goal. All of our traditional programming languages like C++, Java, and even Solidity are imperative programming languages. This kind of programming approach is also called algorithmic programming.
Let’s take an example of what we mean by that. Let’s look at C++. Suppose we want to add 5 and 3.
int a = 5;
int b = 3;
Int c= a + b;
So, as you can see, the addition process takes over multiple steps and each step is constantly changing the state of the program as they are all being executed in turn individually.
An addition process took four steps and the steps are:
- Declaring an integer a and assigning the value 5 to it.
- Declaring an integer b and assigning the value 3 to it.
- Declaring an integer c and adding the values of and b and storing them in c.
Functional Programming Languages
This style of programming was created to build a functional approach to problem-solving and is also called declarative programming.
So, how does functional programming work?
Suppose there is a function f(x) that we want to use to calculate a function g(x) and then we want to use that to work with a function h(x). Instead of solving all of those in a sequence, we can simply club all of them together in a single function like this:
This makes the functional approach easier to reason mathematically. This is why functional programs are supposed to be a more secure approach to smart contract creation. This also aids in simpler Formal Verification, which pretty much means that it is easier to mathematically prove what a program does and how it acts out. This gives Cardano its “High Assurance Code” property.
This is precisely why the functional approach is so desirable and that is exactly what Cardano is using Haskell to code their ecosystem and Plutus for their smart contracts.
Like we have said before, there are institutions like IOHK and Emurgo taking care of Cardano’s governance. Along with that, to make sure that the protocol is being developed continually over time, Cardano will have a voting center for updates. Proposals to update the software and protocol will be put up for voting. The weight of a user’s vote is directly proportional to the stake they have locked up in the system. Users may also delegate their voting rights to a trusted stake pool.
#4 Smart Contract Platforms – RSK
Rootstock (RSK) is a smart contract platform that is connected to the Bitcoin blockchain through sidechain technology. Rootstock was born to be compatible with Ethereum’s applications (the web3/EVM/Solidity model) but using bitcoin as the underlying cryptocurrency. The idea behind the creation of RSK was to give the Bitcoin blockchain smart contract functionalities. At its very core, Rootstock is a combination of:
- A Turing-complete resource-accounted deterministic virtual machine (for smart contracts) is compatible with the Ethereum’s EVM.
- A two-way pegged Bitcoin sidechain (for BTC denominated trade) based on a strong federation.
- A SHA256D merge-mining consensus protocol (for consensus security relying on Bitcoin’s miners) with 30-seconds block interva. (for fast payments).
Reasons for Creation
The Bitcoin blockchain has several advantages. It is long-running with proven security, wide distribution, and awareness. Plus, it also has a healthy community with strong hashing power. RSK wants its users to enjoy the benefits of Bitcoin as a store-of-value and while providing smart contract functionality and higher scalability.
So how does Rootstock interact with Bitcoin? Via sidechain mechanisms. The Rootstock chain is connected to the Bitcoin blockchain via a 2-way peg. The users lock up their BTC and get an equivalent amount of RBTC in the side chain. These coins can be used to deploy or to interact with smart contracts and dApps on the Rootstock blockchain. The RSK Federation secures the RSK Two-way Peg and block consensus is secured by merge-mining.
The RSK sidechain has 15 active functionaries and needs signatures from eight of them to release BTC. The sidechain uses custom Hardware Security Modules (HSMs) to store the private keys and the RSK federation functionaries are allowed to audit both the HSMs’ firmware and hardware.
The native token in the RSK sidechain is RBTC. RBTC can’t be pre-mined, minted, nor coin there is inflation on RSK. This 2-Way Peg between Bitcoin blockchain and RSK blockchain ensures a fixed conversion between BTC and RBTC. (1 RBTC = 1 BTC). The process to transfer BTC to RSK is as follows:
- The sender must make sure that the bitcoins to transfer are locked up in a P2PKH address. If not, then they must be transferred to a P2PKH address in a transaction Tx1.
- The Bitcoins are transferred from P2PKH address to the Federation multisig address in a transaction Tx2.
- After the federation confirms this transaction, the blockchain immediately unlocks the equivalent number of RBTC to an address that is controlled by the sender.
Bitcoin uses the POW consensus mechanism protocol, which has already been discussed above. While the protocol has certain issues, it is the only one, at present, which reliably protects the blockchain from reorganizations and double-spends by achieving probabilistic finality with a thermodynamic guarantee.
Finality, in very loose terms, means that once a particular operation has been done, it will forever be etched in history and nothing can revert that operation. This is particularly important in fields that deal with finance. Imagine that Alice owns a particular amount of an asset in a company. Just give of some glitch in the company’s processes, she shouldn’t have to revert ownership of that asset.
So, how does POW give finality? Check out the following diagram.
So, let’s take a look at what’s happening here. The blue chain is the main blockchain. The red chain is a group of malicious miners that want to overtake the main chain and take over the system. In POW this will be extremely impractical because of one reason – cost. POW is a costly process. Hence the miners are not really economically incentivized to go against the system because it can be expensive.
Rootstock is using a technique called “merge mining” to use the same mining hashrate as the main Bitcoin blockchain and in fact it currently sustains about 30% of Bitcoin’s hashing power, making RSK the most secure smart contract platform. Let’s get an overview of how merge mining works:
- During the mining process, the cryptographic hash of a newly mined block from the secondary blockchain (RSK) is embedded in the primary blockchain (Bitcoin).
- The hash of the secondary block is prefixed by a merge-mining “tag.” This tag is a short descriptive text aka “magic bytes.”
- A block from the main Bitcoin blockchain can only be associated with, at most, one block from the RSK blockchain. This makes sure that there is no confusion when it comes to tag location.
- The main security requirement for merge-mining is that it must be more difficult to create a primary-blockchain block that can be associated with two blocks from the same secondary blockchain than to mine two different primary-blockchain blocks.
There is one specific section about merge-mining on RSK´s website explaining the incentives for miners.
Development on RSK
The smart contracts in RSK get executed inside the RSK virtual machine (RVM). The main features of RVM are as follows:
- At the op-code level, the RVM is compatible with EVM meaning that it can RSK can execute Ethereum contracts.
- Users will be able to run Ethereum DApps with the security of the Bitcoin blockchain. Essentially enjoying the best of both worlds.
- The RSK community will continually suggest a performance improvement pipeline documented in numerous RSKIPs (RSK improvement proposals).
This is an ingenious approach that has been adopted by RSK. Instead of creating their own language and forcing developers to work in a certain way, they will allow them to use the most popular smart contract language (Solidity) to create dApps.
While currently Rootstock uses a community-driven improvement proposal system (RSKIPs) RKS’s original white paper proposes a long-term governance model that aims to represent all the actors of the community, providing a board of governance composed of 5 seats:
- Miners will be able to vote with hashing power (1 vote)
- Bitcoin and Rootstock users will vote with Proof-of-Stake (1 vote)
- Exchanges and web-wallets will vote through their participation in the Federation (1 vote)
- Rootstock and Bitcoin Core developers will have a special threshold voting system (1 vote)
- The last vote may be offered to a non-profit established Bitcoin institution, which may represent the largest ecosystem. An institutional vote may also be offered to the organization with the objective to standardize the EVM/Solidity/Web3 toolchain.
Smart Contract Platforms Comparison – Conclusion
Right now, it will be a fool’s errand to choose the “best smart contract platform” among these four. All of them have their own advantages and disadvantages. What is important to keep in mind is to choose a platform that works best for you.
- If you want a platform that has a strong developer community, then you go for Ethereum.
- If you want a platform that emphasizes speed and don’t care much about decentralization, then EOS is the one for you.
- If you want a scientifically and academically researched platform, then Cardano is what you will choose.
- Finally, if you believe Bitcoin as a store-of-value will dominate DeFi in the long run and you want a platform that allows you to leverage Ethereum’s smart contracts while enjoying Bitcoin’s security, then RSK will be your ideal platform.
Let’s do a final comparison of the four platforms: