Do you want to code Smart Contracts? Which language is the best choice?
There are a large number of programming languages that are used to write smart contracts. These languages serve different ecosystems which determine their key characteristics. This article presents the most popular and useful smart contract languages.
Languages for Bitcoin ecosystem
Bitcoin Script is a simple scripting language that possesses certain characteristics: Forth-like, stack-based, reverse-polish, Turing Incomplete language.
- Turing Incomplete. Bitcoin Script as Turing Incomplete language has limited functionality and can not make jumps and/or loops. Turing Complete languages are capable of solving any problem. Bitcoin Script doesn’t need to be Turing Complete, as complicated transactions have the potential to slow down the ecosystem.
- Reverse Polish. In reverse polish systems the operators follow the operands.
- Stack Based. The basic idea of the stack is LIFO, or Last In First Out.
There are two stack operations:
– Push – adding to the stack,
– Pop – removing from the stack.
The last item pushed into the stack is popped out first.
- Forth-Like. Bitcoin Script is similar to the programming language “Forth”. When a transaction is validated, the input scripts are concatenated with the output scripts and evaluated. To be valid, all transaction scripts must be evaluated to be true.
Simplicity – a new programming language designed as an alternative to existing languages that are used to create smart contracts. The language is based on a sequential computation algorithm and offers several important improvements. The pinnacle factor is the extension of language capabilities. Simplicity is a Turing-Incomplete Language that provides the limitation of a recursive call, protection from endless loops and allows for static code analysis.
All this in combination creates more secure, efficient and functional code for smart contracts.
Other languages for Bitcoin blockchain
- Ivy – a non-Turing complete, higher-level language that compiles to Bitcoin Script.
- BitML – a calculus for Bitcoin smart contracts.
Languages for the Ethereum ecosystem
Solidity is a contact-oriented, high-level language for implementing smart contracts.
eWASM – a restricted subset of WebAssembly for Ethereum contracts. The WebAssembly (wasm) language was launched in 2015 by a team of developers from Google, Microsoft and Mozilla, and aims to provide developers with a single way of compiling code that will eventually become a web standard implemented across all browsers.
These are the WebAssembly properties the Ethereum developers intend to use in their work. eWasm language allows the execution of scripts much faster, taking full advantage of potential hardware capabilities.
Other languages for Ethereum
- Ethereum bytecode – a Turing complete stack-based language executed by the Ethereum virtual machine (EVM).
- SolidityX – a typed-superset of Solidity.
- LLL – a “low-level Lisp-like language” (blog post, series of blog posts).
- Vyper – an experimental programming language (announcement of formal tools from RV).
- Bamboo – a language for morphing smart contracts.
- Serpent – a Python-like, high-level language (deprecated due to security issues with the compiler).
- Idris – a pure functional language with dependent types.
- JULIA – an intermediate low-level language (blog post).
- Babbage – “a mechanical smart contract language”.
- Pyramid – An EVM backend for SICP Scheme.
- L4 – a language “based on deontic modal logic”.
- Michelson – a stack-based and strongly typed domain-specific language (Tezos).
- Liquidity – a high-level, typed smart-contract language that strictly complies with Michelson security restrictions (Tezos).
- Plutus – a pure functional language with user-defined data types and polymorphism (Cardano); compiles to (Plutus Core).
- Rholang – a reflective higher-order process calculus language (RChain).
- Obsidian – a state-oriented language with linear types.
- Qtum smart contract language (QSCL) – language for the Qtum system.
- Skilla – an intermediate level language for verified smart contracts.