Skip to main content

Introduction

To write smart contracts for Mavryk, one can either choose the official low-level language called Michelson, or a high-level language, such as LIGO which compiles into Michelson.

This module focuses on the Michelson language.

At the end of this module, you will be able to:

  • manipulate a stack-based language,
  • write basic smart contracts in Michelson,
  • understand the constitutive parts of a smart contract (entrypoints, storage, code),
  • test a smart contract.

This module is inspired from the official Michelson documentation available here and here.

Environment

Before you proceed, we recommend setting up a development environment on your computer to test your Michelson scripts. Install an IDE such as Visual Studio Code with the Michelson extensions vscode-michelson.

You can launch a sandbox node following the Deploy a node module or the official documentation here.

Once mavkit-client is installed and configured, you can run your smart contract with the following command:

mavkit-client run script example.mv on storage '0' and input '5'

It is also possible to verify whether the smart contract is well formatted and respects the language's grammar using the following command:

mavkit-client typecheck script example.mv -v