Writing a Simple Token using Leo language: a step-by-step guide

4 min readAug 29


In this tutorial, we will explore how to create a basic token using the Leo programming language. Tokens are the building blocks of blockchain ecosystems, and understanding how to create them is essential for anyone interested in blockchain development. You can find an example of the token we’ll be creating here: https://play.leo-lang.org/.

Advantages of Using the Leo Language Playground:

  1. Interactive Learning Environment: The Leo Language Playground provides an interactive and educational environment where you can experiment with code examples. It allows you to learn blockchain programming concepts hands-on.
  2. Real-Time Feedback: As you modify the code, the playground offers real-time feedback, helping you understand the impact of your changes immediately. This iterative process accelerates the learning curve.
  3. Code Explanations: Each code snippet comes with detailed explanations. This helps beginners understand the logic behind each step, making complex blockchain concepts more approachable.
  4. Safe Testing: The playground offers a controlled space for testing code without the risk of making irreversible mistakes. This is especially valuable when dealing with blockchain transactions.
  5. Example Showcase: The provided example of creating a simple token showcases the capabilities of the Leo Language. You can use it as a foundation to build more complex applications.

Getting Started

1. To begin, open the Leo Language Playground. In this interactive environment, you’ll see the code for our simple token along with explanations for each step.

2. Defining Inputs. The playground will prompt you to define the mint function with specific inputs.

For instance, you'll be asked to mint 100 tokens to the address aleo1mgfq6g40l6zkhsm063n3uhr43qk5e0zsua5aszeq5080dsvlcvxsn0rrau. This is where our token creation journey starts.

3. Transfer Function. Next, we’ll look at the transfer function. This function will send 50 tokens from the address ...n0rrau… to the same address, showcasing the basic transfer functionality of our token.

4. Program Name and Description. In the same window, you’ll find the program name along with a brief description. Additionally, there is an .env file that configures our environment.

5. Minting Tokens. Now, let’s mint 155 tokens. Press the button mint in Leo Function list.

As you’ll notice, a record is generated, documenting the minting of these tokens. This transparent record-keeping is a crucial feature of blockchain systems.

6. Initiating Token Transfer. Continuing our journey, let’s initiate the transfer function to send 50 tokens.

As a result, we now have two records: one for 105 tokens and another for 50 tokens, representing the balance change.

7. Deployment Preparation. If you’re interested in deploying this contract to a live environment, switch to the Aleo Instructions mode.

You can then copy the program code and navigate to https://aleo.tools/ for deployment.

Creating tokens using the Leo Language showcases the power of programmability in blockchain systems. It provides a hands-on understanding of how basic transactions, such as minting and transferring tokens, work within a decentralized ecosystem. This knowledge forms the foundation for more complex projects and applications in the blockchain world. Happy coding!

More info about Leo: https://developer.aleo.org/leo
Token Example: https://github.com/AleoHQ/workshop/tree/master/token

To know more, join now!
Aleo X (former Twitter)
Aleo Discord
Aleo Website

Prepared by Colliseum