# Learn Michelson
Welcome to the interactive Michelson learning course!
It consists of a series of Jupyter notebooks covering all aspects of the language as well as some patterns of smart contract development. Code snippets from the notebooks can be executed both online and locally. Also, you can write code yourself — there are exercises at the end of several tutorials for self-evaluation.
# Why 🤔
Here are several reasons why learning Michelson might be a good idea:
- You are new to smart contract development and willing to do it right, starting from the very basics (laudably!);
- You are already a Tezos DApp developer and desire to go deeper in order to learn how to write a more optimized code in high-level languages (that are compiled down to Michelson);
- You are a Tezos ecosystem developer and need to upgrade your skills for better understanding what's happening under the hood and/or implementing some Michelson-related tools.
# Michelson is not just another compilation target
It is strikingly different from the low-level bytecode, providing a rich system of safe types, as well as the ability to attach metadata to describe data structures and name stack variables.
In fact, most of the containers used in high-level languages are directly bound to the Michelson primitives (currently). Basically, there are three main issues that HL languages do solve:
- It's hard to write complex contracts in a stack-based language, variables are much more convenient;
- There's no native records/tuples (but there will be!) and working with nested structures is tough;
- It's not possible to split code over logical blocks and/or files.
On the other hand, manual control allows you to write perfectly optimized code that consumes less gas.
# Pure Michelson contracts are used in production
Michelson perfectly suits for writing small pieces of business logic. Here are some examples:
- Generic multisig — fomally verified, integrated into Tezos-client;
- Spending limit contract — fomally verified, integrated into Cortez wallet;
- Vesting contract — fomally verified, handles millions of tez;
- Atomex — an operating cross-chain DEX;
- Bakers registry — a decentralized approach to handling public validators' data;
As already mentioned, our course is based on interactive notebooks, a tool that is designed to solve some of the problems when writing contracts in Michelson.
In particular it helps to visualize and understand stack transformations, and to split code across several cells/steps.
Our course consists of chapters each of which is dedicated to a specific topic. Each chapter contains step-by-step code samples accompanied by explanatory comments, as well as some elements from the CS program needed for better understanding. The course materials can be used in many ways:
- The renderred version is essentially a verbose Michelson documentation, complementary to other resources;
- Notebooks are available for self-paced study: read and execute chapters one by one, do exercises for self-evaluation;
- We also plan to host online training sessions in collaboration with Tezos community entities. Follow the updates in our Twitter channel.
Here are some useful links that will complement your knowledge:
- Michelson reference https://michelson.nomadic-labs.com/
- Michelson specification https://tezos.gitlab.io/whitedoc/michelson.html
- TQ wiki https://learn.tqtezos.com/files/language.html
- Michelson Slack channel https://tezos-dev.slack.com/archives/C69RKF3PG
- Michelson playground https://try-michelson.tzalpha.net/
- Jupyter kernel https://github.com/baking-bad/michelson-kernel
Introduction to Michelson by Claude Barde:
# Contact us
If you have any questions regarding the tutorials, Michelson kernel, or you spotted a bug — please reach us:
- Telegram https://t.me/baking_bad_chat
- Slack https://tezos-dev.slack.com/archives/CV5NX7F2L
- Email firstname.lastname@example.org
This is the first part of an educational project called Tezos Labs, supported by Tezos Foundation.