Create, deploy & mint a fungible token

A step-by-step tutorial on how to create, deploy and mint a ERC-20 fungible token with VORJ.

Prerequisites

To follow this tutorial you must have completed the following:

Objective of this tutorial

The objective of this tutorial is to provide a simple jargon free step-by-step guide on how a user can create, deploy and mint fungible tokens.

What is a ERC-20 fungible token?

To answer the question of what is an ERC-20 fungible token let's first break this question into two.

What do we mean by fungible token?

A fungible token is a form of digital asset that can be easily interchanged with other tokens of the same type because each token has the same value and properties. In other words, every token is identical to every other token, and they can be exchanged or traded without any difference in value or functionality.

For example, if you have two $1 dollar bills, they have the same value and can be used interchangeably. Similarly, if you have two fungible tokens, such as ERC-20 tokens they have the same value and can be used interchangeably.

Fungible tokens are often used as a form of currency or as a way to represent other digital property such as stocks, bonds or commodities on a blockchain. They are also commonly used a a means of exchange in decentralized applications and smart contracts, where they can represent anything from voting rights to loyalty points.

What does ERC-20 mean? (Technical - skip if you want)

An Ethereum Request for Comment (ERC) is a document that outlines the rules that determine how data is formatted, transmitted and also what actions will take place when an event occurs.

The ERC-20 standard, which is one of the most popular token standards, determines the standards / rules that determine how data is formatted, transmitted and what actions will take place when an events occurs.

As VeChain is compatible with the Ethereum Virtual Machine (EVM) and the ERC-20 standard is used across all EVM compatible chains for interoperability across chains it makes sense for VeChain to use the ERC-20 fungible token standard.

1. Access your project

If you are continuing on from the previous tutorial of Create an organization and project space you should see a screen similar to the image below. If you have logged out of VORJ then login at https://vorj.app/ and you should see a screen similar to the image below.

Select the project that you created by pressing on it. This should redirect you to the project space. Your screen should now look similar to the one below.

2. Allocate some resources to your project

Refer to Plans, Resources and Usage for more information in terms of the plan metrics.

To create a fungible token we must first assign some resources to the project. Select the Allocate Resources button. This will bring up a modal similar to what is show below. This modal allows you to assign resources to your project. Let's just max out the resources for this project. We can always reassign unused resources across projects.

After having assigned all of the available resources to a project we should see a screen similar to the one below.

3. Create and deploy a fungible token

Press the Create Smart Contract button in the top right hand corner to start. This will open a modal requesting you to select the smart contract standard that you want to create. Select the first option Fungible Token.

After selecting the Fungible Token option you should now see a screen similar to the one presented below. This is the fungible token form. There are four fields that must be populated and two optional features. While there are information icons available on the page which should help you understand what is required in each field let's quickly talk through each of the six fields.

FieldDescription

Token Name

The name of your token, which must be at least two characters long.

Token Symbol

The symbol for your token, which must be at least three characters long.

Decimals

Determines how divisible the token is, usually set to 18 decimals, but can be set to any value between 0 and 50.

Max Supply

The total maximum supply which can never be exceeded.

Burnable

Whether users should be able to burn their tokens.

Pausable

Whether the contract can be paused which will prevent all interaction with the contract until it is unpaused. (Useful for emergency response)

Populate the fields with any values that you want and select the features that you would like for your specific smart contract implementation. Once you have populated the form press the Deploy button or if you prefer press Save and come back later and Deploy another time.

Once you have pressed Deploy you will see a screen similar to the below which is informing you that there will be a minimum of a two minute wait until your contract has been deployed and indexed by VORJ.

Once the contract has been deployed and indexed by VORJ you can perform some Actions with your smart contract.

4. Perform some actions with your fungible token

Once your fungible smart contract has been deployed you should see a screen similar to the below.

There are some elements on this screen that we should discuss. The long hexadecimal string starting with 0x is the contract address of your deployed smart contract. Next to the contract address are two icons. The first icon copies the address to your clipboard. The second icon links out to the explorer to view your smart contracts transactions.

The form elements on this page will depend on the features that you implemented as part of your contract. From the image above we can see that the contract was deployed with the pausable feature. This means that the contract can be paused and unpaused with the press of a button.

The primary function on the Action tab is the ability to mint tokens. You can mint tokens from your fungible smart contract to any address with any given amount by populating the Address and Amount cells. We have provided a useful balance counter for the smart contract to inform the user how many tokens remain un-minted.

Double check that the address is correct. Once a transaction has been submitted it is irreversible and the funds cannot be recovered.

To do a test transaction you could send some of the tokens to the burn address `0x000000000000000000000000000000000000dEaD`. This is an address which is used to burn tokens, the funds in this address are lost forever as there is an almost zero percent likelihood that the key for this address can be generated.

Done, Congratulations

You have successfully created and deployed a fungible token on the vechain blockchain.

In terms of next steps you can choose to either continue the tutorial series and explore Create, deploy & mint a non-fungible token (NFT)or investigate what you can do with your newly generated fungible token in the Fungible token utility.

Last updated