fbpx
development,tezos-intro - 30.05.2020

Programming Languages on Tezos

The Tezos ecosystem offers many opportunities for developers, application builders and smart contract creators. Tezos Ukraine talks about programming languages ​​in Tezos.

In 2019, more than 1000 programmers were trained to develop on the Tezos blockchain. Educational, training and research activities continue, Tezos teams all around the world contribute their efforts and Tezos Ukraine is not an exception. In 2019 we conducted the First Eastern European Hackathon, and as a result, several strong teams emerged and they are developing on the Tezos blockchain.

Many languages exist in Tezos ecosystem and in future there will be even more. As explained by Arthur Breitman in a recent interview, Tezos’ core itself is built on a functional programming language. A lot of people involved in the Tezos ecosystem tend to like functional programming. These people are programming language gurus and they like to create new languages, because that’s what they know and what they like to do.

However, Tezos Ukraine saw a glaring need in that non-technical newcomers to the Tezos world might be lost in the variety of programming languages involved, so we decided to write a basic article about them so that getting started would be much easier.

OCaml — the language of Tezos protocol

The Tezos protocol is written in OCaml, a general-purpose industrial-strength programming language with an emphasis on expressiveness and safety. OCaml was created in 1996 and it has a large standard library, which makes it useful for many of the same applications such as Python or Perl. It has robust modular and object-oriented programming constructs that make it applicable for large-scale software engineering.

OCaml is a free and open-source software project managed and maintained by the French Institut e for Research in Computer Science and Automation (INRIA).
In the early 2000s, elements from OCaml were adopted by many languages, notably F# and Scala (one more language popular in blockchain development).
Many top projects use OCaml, including Facebook, Bloomberg, Docker, Wikipedia and others.

Michelson — the language of smartcontracts in Tezos

Michelson is a brand-new programming language introduced to the world by L.M Goodman (Arthur Breitman) in the Tezos Whitepaper in 2014. It is an open-source functional programming language designed for Tezos smart-contract development.

Michelson is the low-level, domain-specific, stack-based programming language which is used to write smart contracts on the Tezos blockchain. Michelson was designed to facilitate formal verification, allowing users to prove the properties of their contracts.

Even experienced Tezos developers say that at first sight, Michelson is a strange language. It doesn’t include features like polymorphism, closures, or named functions. It seems to be underpowered compared to a language like Haskell or OCaml. Its stack is not always easy to deal with, and there is no standard library. But the main advantages are that Michelson is introspectable and provides readable bytecode.

Tezos developers wanted to start with a small core language in which everyone is confident and add features as good use cases are created for them. In fact, few people write code on Michelson, as there are other various high-level languages available for programming smart contracts on Tezos. With such new languages like LIGO, SmartPy, Morley/Lorentz the development experience is much easier, so programmers can focus on the content of their smart contracts, rather than on the implementation.

LIGO

LIGO is a friendly Smart Contract Language for Tezos, which provides a strong, static type system and easy integration. LIGO is Polyglot — it provides you an opportunity to code in your language. As for now 3 syntax (languages) are supported and it’s possible to add your own syntax.

  • PascaLIGO — a syntax inspired by Pascal which provides an imperative developer experience.
  • CameLIGO, — OCaml inspired syntax that allows you to write in a functional style.
  • ReasonLIGO — ReasonML inspired syntax that builds on the strong points of OCaml. It aims to be familiar for those coming from JavaScript.

LIGO takes the approach of replicating the structure used by languages from a particular paradigm. It is packaged in a Docker container, so that no particular installation instructions are required.

More languages will be added to LIGO, and the community is actively working on it. For example Madfish Solutions created Solidity to Ligo transpiler, and they were awarded a Tezos foundation grant for this development.

SmartPy

SmartPy is a high-level smart contract language that enables developers to use Python to write smart contracts, which then are compiled to Michelson.

Users benefit from the full power of Python to iterate over data structures, call other libraries, pre-compute parameters while ultimately targeting a powerful yet limited language Michelson.

SmartPy has an amazing online editor with templates to write, run, and test contracts. SmartPy.io is an in-browser development platform with advanced capabilities to develop, test, and prove properties of smart contracts. All development takes place in a browser — from Python programming to Michelson contracts generation, testing, and analysis. Python is considered a relatively easy language to learn and it has existed for a long time, which allows SmartPy to bring more Python developers into the Tezos ecosystem.

Baking Bad, a Tezos-focused team of developers, crypto-enthusiasts created PyTezos — Python SDK for Tezos and several Tezos dev tools: ConseilPy — Python toolkit for Conseil blockchain indexer, PyTzKT — Python toolkit for TzKT blockchain indexer. You can check all these tools at the Baking Bad website.

Useful links:

Other Programming Languages

Morley/Lorentz provides a library to write Tezos smart contracts in Haskell. The project is under development and the documentation is limited.

Archetype is a domain-specific language (DSL) for developing 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 of writing smart contracts on Tezos with its own set of instructions and treating contracts as a state machine.

Albert is an intermediate smart contract programming language compiled to Michelson. Like the main Tezos language, Albert as a name was chosen in honor of the physicist Albert Michelson.

It is an imperative language with variables and records, abstracting the Michelson stack. The intent of Albert is to serve as a compilation target for high-level smart contract programming languages.

Fi (pronounced as “fee”) is a high-level language for Michelson, which aims to allow programmers to easily develop on Tezos. Fi is based on JavaScript and Solidity and is intended to be a much closer experience to programming smart contracts in Solidity.

As you see, there are many languages in the Tezos ecosystem. Hence there are multiple ways and opportunities to develop on Tezos. If you cannot decide where to start or what to learn first — the best way is to interact with the Tezos Developer Community who are already using particular languages and are involved in Tezos-related projects.

Join the Tezos community in our social media channels and never miss any updates!

  1. Telegram channel.
  2. Facebook.
  3. Twitter in Russian and Ukrainian.
  4. Twitter in English.
  5. YouTube channel.
  6. Instagram.
  7. LinkedIn.
  8. hub at ForkLog.

Ready to work with Tezos Ukraine?

Contact Us