Skip to main content

ESDT token creation

Abstract

In contrast with EVM token standards such as ERC-20, ERC-721, and ERC-1155, where tokens are minted and managed inside a smart contract, Elrond tokens are minted in an ESDT, which stands for Elrond Standard Digital Tokens, which provides for speed and scalability compared to EGLD, the native token of Elrond.

Solving Vitalik Buterin's Trilema, Elrond sharded its blockchain into Metachain and three shards. ESDT handles the asset propagation into shards, so the user does not have to worry about deploying contracts on each one of them.

Like in EVM compatible chains, the major difference between fungible and non-fungible tokens is that the last has additional metadata describing the unique features of the token and bears a link to the digital asset - an image, a video, or a sound. However, in Elrond, there's no need for contracts implementing multiple standards. Everything happens inside ESDT.

Issuing steps

Before an NFT can be minted on Elrond, several steps must be taken, each one of them being a submitted and signed transaction:

  1. The ESDT token must be created.
  2. The roles (Minting, Burning, etc.) must be set to designated accounts.
  3. Minting NFTs or SFTs.
  4. Transferring the tokens to the new owner if required.

Existing Roles:

For NFT:

  • ESDTRoleNFTCreate : this role allows one to create a new NFT
  • ESDTRoleNFTBurn : this role allows one to burn quantity of a specific NFT
  • ESDTRoleNFTUpdateAttributes : this role allows one to change the attributes of a specific NFT
  • ESDTRoleNFTAddURI : this role allows one add URIs for a specific NFT
  • ESDTTransferRole : this role enables transfer only to specified addresses. The owner of the NFT and the address with the ESDTTransferRole should be located on the same shard. The addresses with the transfer role can transfer anywhere.

For SFT:

  • ESDTRoleNFTCreate : this role allows one to create a new SFT
  • ESDTRoleNFTBurn : this role allows one to burn quantity of a specific SFT
  • ESDTRoleNFTAddQuantity : this role allows one to add quantity of a specific SFT
  • ESDTTransferRole : this role enables transfer only to specified addresses. The owner of the SFT and the address with the ESDTTransferRole should be located on the same shard. The addresses with the transfer role can transfer anywhere.

ESDT Names

The identifier of ESDT consists of two parts. The first part should be provided by the deployer. It must not contain spaces, dashes, or any other punctuation. The second part is randomly generated by the network, which prevents name collisions even if someone names an ESDT just like you did. For example, if you named your collection MyCollection, you will get something like MYCOLLECTION-3e4r5t.

0. Initial project setup

To conveniently deploy ESDT tokens run the following commands in your terminal one after another:

git clone https://github.com/XP-NETWORK/esdt-deployer.git
cd esdt-deployer/
yarn
mv .env.example .env

1. ESDT token creation

1.1 Populate the keys of the .env file with values

# 1. Set Issue params & run yarn issue-esdt
# A-z-a-z 3-20 chars:
ISSUE_NAME=
# Upper case 3-10 A-Z chars only
ISSUE_TICKER=
# Select from: FT | NFT | SFT
ISSUE_TYPE="NFT"

1.2 Run the following command in the terminal:

yarn issue-esdt

2. Setting roles

In order to mint and burn assets, roles must be granted to the accounts:

2.1 Populate the keys of the .env file with values

# 2. Set Roles & run yarn set-roles
ROLES_TICKER=
# ESDT Type - Select from: FT | NFT | SFT
ROLES_TYPE="NFT"
# Roles recipient
# Devnet: erd1qqqqqqqqqqqqqpgqy2nx5z4cpr90de4sga2v2yx62fph3lg8g6vskt0k2f
# Mainnet: erd1qqqqqqqqqqqqqpgq3y98dyjdp72lwzvd35yt4f9ua2a3n70v0drsfycvu8
# Your address can be retrieved from the wallet or your pem file
ROLES_ADDRESS=

2.2 Run the following command in the terminal:

yarn set-roles

3. Minting FTs, NFT, SFTs

3.1 Populate the keys of the .env file with values

# 3. Set Minting Params & run yarn mint
MINT_TICKER="Collection-12345"
# 1 for NFT, 1..MAX_INT for FTs/SFTs
MINT_SUPPLY=1
MINT_NAME="NFT Name"
MINT_ROYALTIES=0
MINT_ATTRIBUTES="https://your.url.here"
# Comma-separated string of values, no spaces
MINT_URI="https://your.url.here"

3.2 Run the following command in the terminal:

yarn mint