A smart contract is a digital contract written using the If-Then conditional computer code to define an agreement between two or more parties, with certain rules and penalties, recorded onto the blockchain. Contracting parties are anonymous, yet the contract itself is broadcast onto the public ledger. A triggering event, such as hitting a strike price or reaching an expiration date, ignites execution of the contract as per the agreement terms coded within the smart contract.
Smart contracts are means for exchanging money, shares, properties, or any form of asset in a transparent, secure, conflict-free way while omitting the need for intermediation by a middleman.
Throughout this article, we will review the most widely used smart contract platforms that have proven to be efficient and reliable across various business applications.
The most popular smart contract platforms
Ethereum is a decentralized blockchain based platform that runs smart contracts, which has also opened the door to decentralized applications (DApps). The Ethereum Virtual Machine (EVM) is a virtual machine that executes all the smart contracts. EVM is a Turing Complete 256 bit virtual machine. Ethereum based smart contracts are coded using Solidity, which is a Turing Complete programming language that permits the coding of looping and branching code statements. Solidity's "Turing Completeness" renders Ethereum ideal for coding smart contracts with sophisticated logic.
"Gas" is the fuel of Ethereum's smart contracts. It quantifies the amount of computational power needed to execute smart contracts via the EVM. When you submit a smart contract, you have to determine its gas value. Every step along the code of the smart contract requires a predetermined amount of gas to be executed.
Ethereum's smart contracts can:
- Act as "multi-signature" ethereum accounts, so that coins are spent only if a predetermined number of users agree
- Offer utility to other smart contracts on Ethereum's blockchain
- Record information about asset ownership, domain registration, membership privileges, application rights, and more
- Manage agreements between multiple parties, such as rentals, business collaboration, and insurance
- Be coded to issue tokens such as ICO tokens used for crowd funding. There are multiple token standards used to issue tokens on Ethereum's platform including the ERC-20, ERC223, and ERC77 standards. ERC-20 is the most commonly used standard to issue to tokens for ICO purposes, despite its serious bugs that have already led to millions of dollars worth of losses in the crypto industry.
ERC-20 performs a token transaction via one of two ways:
this function ignites the sending of tokens to a specific user's address.
: this function ignites depositing tokens to a predefined smart contract.
However, if the transfer()
function is accidentally used to send tokens to a smart contract, the transaction will be successfully executed, yet this transaction will never be recognized by the smart contract address of the recipient. This bug inspired developers to create the ERC223 and ERC77 standards.
- ERC223: This standard mitigates the ERC-20 critical bug via modifying the transfer()
function so that it would throw an error in response to invalid transfers and cancel the transaction so that no funds are lost.
- ERC777: This standard resolves ERC20's problem of lack of transaction handling operations.
Ethereum is a popular choice for creating smart contracts, yet the platform's scalability issues render it unsuitable for many real-world applications. Solidity lacks coding flexibility that is provided by more recent programming languages. Solidity lacks support of multi-dimensional arrays in input parameters as well as output parameters. Moreover, Solidity only supports 16 parameters within a smart contract function.
Despite this, smart contracts based on Ethereum are used in various applications. For example, PCHAIN
was the first blockchain project to create a native, multi-chain system that fully supports the Ethereum Virtual Machine (EVM) – the runtime environment for Ethereum smart contracts.
EOS is increasingly becoming one of the most popular smart contract platforms. The platform has captured the attention of the crypto community due to a myriad of reasons, namely that transactions on the platform require near zero fees, and the platform's capability to handle millions of transactions per second.
Smart contracts are programmed using C++, which boosts programming flexibility. EOS smart contracts are implemented onto the blockchain in the form of pre-compiled Web Assembly (WASM), which promotes faster execution of contracts when compared to Ethereum based smart contracts. WASM is compiled with C/C++ via means of clang and LLVM. Developers have to have knowledge of C/C++ in order to be able to code smart contracts on EOS's blockchain. Even though C can be used to create contracts, it is highly recommended to use the EOS.IO C++ API, which strengthens contract's safety and renders its code easily readable. EOS utilizes the delegated proof of stake (dPoS) consensus mechanism, which acts with partial evaluation and parallel execution to offer a smart contract platform with high levels of scalability and near zero transaction fees.
Even though EOS is much less popular than Ethereum, it has established the "airdropping" model as a competitor to Ethereum's ICO crowd funding model.
Aion is a smart contract platform that enables routing of transactions and messages between different blockchains via its innovative "bridging" protocols. Aion is a multi-tier network comprised of the following components:
- Connecting Networks
- Interchain transactions
- Participating Networks
Aion's bridges will make it possible to transact across multiple blockchains (interchain transactions) via the AION blockchain ecosystem. Interchain transactions are executed via bridges and connecting networks. Connecting Networks represent the protocols via which all public and private blockchains can intercommunicate with AION's blockchain ecosystem. Participating Networks are networks that have fulfilled a special set of requirements to become part of AION's blockchain ecosystem. Participating Networks have to support broadcasting of atomic transactions, and implement lock-time that will enable them to freeze up transactions that enter a state of "Oh Hold".
The Aion Virtual Machine (AVM) enables the execution of smart contracts. AVM is a JVM implementation that is designed to execute chain logic. The Aion language is the scripting language used to program smart contracts in the AVM. Currently, Aion's kernel runs on Java, so developers have to use languages like Python or Groovy to code smart contracts on Aion's blockchain. However, the platform will eventually rely on the Aion language for scripting smart contracts.
Aion-1 is Aion's standalone platform that permits the execution of smart contracts created on other blockchains. Right now, Aion relies on Ethereum's EVM, yet eventually Aion-1 will be activated and enable developers to run their Ethereum based smart contracts and DApps much cheaper and faster than on the EVM.
NEM is a smart contract platform that is more scalable than Ethereum. Where Ethereum can handle 15 transactions per second, NEM can handle hundreds of transactions per second. NEM is faster, more secure, and provides a simple smart contract technology. NEM utilizes off-blockchain code for programming smart contracts, which renders NEM's blockchain less decentralized than Ethereum's, yet promotes higher security levels, faster confirmation of transactions, and lighter programming code. NEM's on-chain security features such as multi-signatures and smart assets resolve this problem.
Smart assets are unique data management apps that can be utilized to create data records, tokens, voting systems, and new coins using simple programming code. The extreme functionality of NEM's blockchain is provided via its powerful API, which permits the usage of any programming language (such as JS, Python, and others) to code smart contracts. NEM's API is used to develop "off-chain contracts", which can be updated at any time, without communicating with NEM's blockchain.
Stellar is a smart contract platform where transactions are more secure, faster, and cheaper than transactions on Ethereum's blockchain. Stellar smart contracts (SSC) are not Turing complete, and are deployed in the form of programmed agreements between multiple parties that are enforced by transactions. While it takes around 3.5 minutes for a transaction to get confirmed on Ethereum's blockchain, a transaction on Stellar's blockchain only requires around 5 seconds to be confirmed. Transaction fees are negligible, averaging around (0.0001 XLM ~=$0.0000002). SSC can be coded using any programming language such as Python, JS, PHP, Golang, and others via Stellar's API. An SSC is composed of transactions that are interconnected and executed via means of multiple constraints including multi-signatures, batching/atomicity, sequence, and time bounds. Batching permits the inclusion of multiple operations within a single transaction. Atomicity ensures that upon the submission of a series of operations to Stellar's network, all operations in a transaction would fail, if a single operation fails to get executed. Sequence is a unique concept featured on Stellar's blockchain via the "sequence number". With sequence numbers, specific transactions would fail if an alternative transaction is successfully executed. Time bounds represent limitations on the time period of validity of a transaction. Utilization of time bounds permits the representation of time periods in an SSC.
Hyperledger Fabric (HLF)
Hyperledger Fabric (HLF) is a permissioned blockchain designed with advanced flexibility. HLF's smart contracts are known as "chaincode". HLF is written in Go language, Google's open source programming language, so chaincode supports this language also quite well.
Corda is a smart contract platform that is ideal for creating financial agreements. Corda's smart contracts are valid transactions that have to be accepted by the smart contract of each of its input and output states. Smart contracts are coded using a JVM programming language such as Java or Kotlin. Execution of a smart contract is deterministic and its acceptance of a transaction solely relies on the contents of the transaction. Occasionally, validity of a transaction relies on an external piece of information, such as a token price. In such case, an oracle is needed. A fact can be coded to be part of a transaction's command. An oracle represents a service that will only confirm a transaction, if the command's fact is true.
Corda's DApps, or CorDapps, are installed at the level of network nodes, rather than on the blockchain network itself. CorDapps are coded using Java or Kotlin. CorDapps are coded to run on Corda's platform. This is achieved via defining flows Corda node operators can invoke via RPC calls.
NEO is a smart contract platform that features efficient and low fee smart contracts. Smart contracts can be coded using a myriad of programming languages including C#, F#, Java, Python, VB.Net, and Kotlin. NEO offers plug-ins and compilers for all of these languages. In the future, support for JS, Go language, C, and C++ will be implemented.
NEO's smart contracts are executed via the lightweight NEO Virtual Machine (NeoVM). Smart contract execution via NeoVM consumes minimal resources. Static compilation of smart contracts and caching of hotspot smart contracts can be considerably enhanced via the real-time compiler JIT. Currently, NEO's blockchain features Smart Contract 2.0 which boasts support for complex data structures and arrays. Also, Smart Contract 2.0 provides a scalable approach via dynamic partitioning and high concurrency, in combination with a low coupling design. The low coupling procedure of smart contracts is executed in NeoVM and interacts with off-chain systems via an interactive service layer. As such, most of the smart contract function upgrades can be achieved via the special API of the interactive service layer.
Waves' smart contracts are coded via the RIDEON programming language. The launch of Waves' smart contracts is divided into two stages. The first stage has been already rolled out last April, enabling the development of non-Turing complete smart contracts on testnet. First stage non-Turing complete smart contracts enable a myriad of account control functionalities that will cover multiple use cases that range from exchanging tokens on different blockchains, to enabling control of shared budget control. One of the most common use cases of Waves' non-Turing complete smart contracts is multi-signature accounts. Also, they can be used to implement token freezing, which involves sending a token to an address and ensuring that it remains unspendable, i.e. untransferrable, for a predefined period of time. This will be quite useful in implementing token vesting for the creators of an ICO, after the crowdsale ends.
After the first stage non-Turing complete smart contracts have been extensively tested and activated on Waves' mainnet, second stage Turing complete smart contracts will be launched.
Stratis utilizes the popularl .NET framework. Smart contracts are coded via the C# programming language. Smart contracts have to be executed deterministically, so they cannot utilize all the capabilities of C#, or all of .NET's core libraries. Stratis also relies on the "gas" concept, which is identical to Ethereum's gas concept.
Cardano is a smart contract platform that is focused on providing guarantees that a smart contract operates exactly as it is coded, without any hidden vulnerabilities. Smart contracts can be coded using Solidity or Plutus. Cardano features the Cardano Computation Layer (CCL) which is comprised of two layers - a language framework and a formally specified virtual machine. The language framework features a set of formally specified programming languages that facilitate automated authentication of human readable smart contract code.
Tezos is a smart contract platform that supports formal verification of on-chain smart contract code. Smart contracts are coded using a new programming language, known as Michelson, which boosts security. Unlike Solidity, Michelson's code is not compiled to anything; instead, it represents a low level, stock based, Turing complete programming language that is interpreted directly by the Tezos virtual machine. Michelson programmed smart contracts enable the coding of high level constructs including sets, maps, cryptographic primitives, lambdas, and contract specific operations that renders code more human readable.
Next is a cryptocurrency and a smart contract platform. Even though Next's smart contracts are non-Turing complete, the platform utilizes a unique Turing complete scripting layer that enables users to create template smart contracts easily. Users can pick the most suitable template for their needs and modify its parameters to create their very own smart contracts. The developers of Next's platform believe that these smart contract templates cover almost every business application, in addition to being simple to code and implement.
There are other cryptocurrencies that permit the development of smart contract platforms including Quorum, Wanchain, Aeternity, Zen, Counterparty, Rootstock, RChain, Qtum, Ark, Neblio, DFINITY, BOSCoin, Agoras Tauchain, Burst, iOlite, ByteBall, XTRABYTES, PolkaDot, Radix, Exonum, Universa, Urbit, Soil, Expanse, Monax, and probably others. However, the platforms featured in this article are the most widely-used, and the ones that have proven to be reliable across various applications.