Choosing a Language for Smart Contracts on Tezos

Protofire.io
Protofire Blog
Published in
5 min readOct 9, 2019

This blog post explores pros and cons of five languages — LIGO, SmartPy, Morley, Fi, and Archetype — to write smart contracts on the Tezos blockchain.

Multi-language compatibility

In this blog post, we continue to introduce you to under-the-hood mechanisms of the Tezos platform. In our previous blog post, we introduced the Tezos blockchain and provided a guide for getting started with it.

There is a variety of languages to write smart contracts on Tezos. For instance, Michelson is a domain-specific language for smart contracts on Tezos. However, there are also some other alternatives available.

In this article, we analyze and compare five languages that can be used for creating smart contracts on Tezos.

LIGO

LIGO is a statically typed, high-level language for smart contracts that compiles down to Michelson. The LIGO language is extensible and easy to use while promoting security. It also supports several syntaxes. While most examples are written in Pascal, it also supports OCaml, and Reason will be supported soon.

Using the official documentation of LIGO, we were able to start writing a basic smart contract. We encountered some challenges, but we were able to use the Discord and StackExchange support channels to get answers to our problems. Both channels are very active and helpful.

LIGO is still in the beta phase, and new updates are being released on a regular basis. The LIGO team uses GitLab, where you can add or check a pull request. There are also a vsCode extension and a CLI available to test contracts and their functions independently.

SmartPy

SmartPy is a high-level smart contract language that enables developers to use Python to write contracts, which can be compiled to Michelson. The SmartPy team has created an online editor, where you can write, run, and test contracts. Informal documentation resources are provided via the project’s website and are quite thorough. Through these materials, you can learn everything necessary to start working with SmartPy. There is a Telegram channel to discuss any SmartPy-related topics and ask questions.

Morley

Morley provides a library to write Tezos smart contracts in Haskell. The documentation is limited (just a few commands to install an executable command to compile and run the contracts) as the project is still under development.

Fi

Fi is a high-level language based on JavaScript and Solidity. The Fi language is intended to be a much closer experience to programming smart contracts in Solidity. If you want to give it a try, you can test the project’s online editor.

Archetype

Archetype is a domain-specific language (DSL) to develop smart contracts on the Tezos blockchain with a specific focus on security and formal verification of contracts.

It is an open-source project developed in OCaml. Archetype offers a completely different way to writing smart contracts on Tezos with its own set of instructions and treating contracts as a state machine.

Edukera, the team behind Archetype, is developing a vsCode extension and a CLI to compile and run the contracts, which will be released soon.

The documentation is extensive and contains a lot of examples. For more detail, check the project’s GitHub repo.

Conclusion

After researching all the described languages and gaining first-hand experience with them, we decided to go with LIGO. The reasons for such a choice are as follows.

Firstly, LIGO has a simple contract, which provides a hello world example. The extension for vsCode and the simplicity to install the CLI with Docker is a major plus. You can get started with it in just a few minutes. LIGO supports several syntaxes, and a couple of examples written in Pascal are available.

Finally, the LIGO project has a responsive team, which is working hard on fixing bugs and adding new features, as well as an active community

SmartPy is also a good option, especially if you are familiar with Python. It has extensive documentation and is easy to get started with.

We are excited for Archetype’s release, so we can give it a try. We think it will generate a huge impact because of its originality and potential.

About the authors

Nicolás Dominguez is a Senior Software Engineer at Protofire. With 9+ years in IT, he is now focusing on blockchain-based development with a special interest in applying GraphQL to build production-grade DApps. Nicolás has experience of working as a full-stack JavaScript developer with a profound knowledge of React and Node.js. He is also enthusiastic about machine learning.

Darío Miñones is a Software Engineer at Protofire. He is a highly enthusiastic and passionate self-starter with 10+ years building awesome web and mobile apps, now focusing on DApps and blockchain-based development. Darío loves to create great software, using agile methodologies and being part of an awesome team that helps him to grow both professionally and personally.

Cristian Malfesi is a Project Manager of Blockchain at Protofire. He has extensive experience in building DApps, working with databases, enabling cloud services, etc. Cristian has worked in different positions as a full stack developer, software architect, server administrator, DevOps expert, and product owner. He likes new challenges and is always searching for continuous self-improvement.

--

--

Protofire.io
Protofire Blog

We help token-based startups with protocol & smart contract engineering, high-performance trusted data feeds (oracles), and awesome developer tools (SDKs/APIs).