This is an old revision of the document!
Fungible vs Non-Fungible Tokens:
Think about the following example if fungible or non-fungible:
ESDT stands for Elrond Standard Digital Token.
Custom tokens at native speed and scalability, like EGLD.
The Elrond network natively supports the issuance of custom tokens, without the need for contracts such as ERC20 (Ethereum), but addressing the same use-cases. And due to the native in-protocol support, transactions with custom tokens do not require the VM at all. In effect, this means that custom tokens are as fast and as scalable as the native EGLD token itself.
The balances of ESDT tokens held by an Account are stored directly under the data trie of that Account. It also implies that an Account can hold balances of any number of custom tokens, in addition to the native EGLD balance. The protocol guarantees that no Account can modify the storage of ESDT tokens, neither its own nor of other Accounts.
ESDT tokens can be issued, owned and held by any Account on the Elrond network, which means that both users and smart contracts have the same functionality available to them. Due to the design of ESDT tokens, smart contracts can manage tokens with ease, and they can even react to an ESDT transfer.
ESDT tokens are issued via a request to the Metachain, which is a transaction submitted by the Account which will manage the tokens. When issuing a token, one must provide a token name, a ticker, the initial supply, the number of decimals for display purpose and optionally additional properties. The issuance cost is set to 0.05 EGLD.
The receiver address erd1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzllls8a5w6u
is a built-in system smart contract (not a VM-executable contract), which only handles token issuance and other token management operations, and does not handle any transfers. The contract will add a random string to the ticker thus creating the token identifier. The random string starts with “-” and has 6 more random characters (3 bytes - 6 characters hex encoded). For example, a token identifier could look like ALC-6258d2.
If you want to make an erdpy
transaction use the info from Elrond documentation to correctly format your parameters.
IssuanceTransaction { Sender: erd1sg4u62lzvgkeu4grnlwn7h2s92rqf8a64z48pl9c7us37ajv9u8qj9w8xg Receiver: erd1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzllls8a5w6u Value: 50000000000000000 # (0.05 EGLD) GasLimit: 60000000 Data: "issue" + "@416c696365546f6b656e73" + // "AliceTokens" hex encoded "@414c43" + // "ALC" hex encoded "@f3d7b4c0" + // 4091000000 hex encoded "@06" // 6 hex encoded }
Issue an ESDT token of your own.
LocalMintTransaction { Sender: <address with ESDTRoleLocalMint role> Receiver: <same as sender> Value: 0 GasLimit: 300000 Data: "ESDTLocalMint" + "@" + <token identifier in hexadecimal encoding> + "@" + <supply to mint in hexadecimal encoding> }
Verify if the transaction worked.
Assign ESDTRoleLocalMint to your address:
RolesAssigningTransaction { Sender: <address of the ESDT manager> Receiver: erd1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzllls8a5w6u Value: 0 GasLimit: 60000000 Data: "setSpecialRole" + "@" + <token identifier in hexadecimal encoding> + "@" + <address to assign the role(s) in a hexadecimal encoding> + "@" + <role in hexadecimal encoding> + "@" + <role in hexadecimal encoding> + ... }
You can find more details here
Set roles for your address.
An account with the ESDTRoleLocalMint role set can perform a local mint.
LocalMintTransaction { Sender: <address with ESDTRoleLocalMint role> Receiver: <same as sender> Value: 0 GasLimit: 300000 Data: "ESDTLocalMint" + "@" + <token identifier in hexadecimal encoding> + "@" + <supply to mint in hexadecimal encoding> }
Mint 1.000.000 ESDT Tokens you created.
Anyone that holds an amount of ESDT tokens may burn it at their discretion, effectively losing them permanently. This operation reduces the total supply of tokens, and cannot be undone, unless the token manager mints more tokens.
Do you have roles for burning?
LocalBurnTransaction { Sender: <address with ESDTRoleLocalBurn role> Receiver: <same as sender> Value: 0 GasLimit: 300000 Data: "ESDTLocalBurn" + "@" + <token identifier in hexadecimal encoding> + "@" + <supply to burn in hexadecimal encoding> }
Burn 30% of your ESDTTokens
The manager of an ESDT token may choose to suspend all transactions of the token, except minting, freezing/unfreezing and wiping. Check more details here.
The manager of an ESDT token may freeze the tokens held by a specific Account. As a consequence, no tokens may be transferred to or from the frozen Account. Freezing and unfreezing the tokens of an Account are operations designed to help token managers to comply with regulations. The manager of an ESDT token may choose to suspend all transactions of the token, except minting, freezing/unfreezing and wiping. Check more details here.
The manager of an ESDT token may wipe out all the tokens held by a frozen Account. This operation is similar to burning the tokens, but the Account must have been frozen beforehand, and it must be done by the token manager. Wiping the tokens of an Account is an operation designed to help token managers to comply with regulations. The manager of an ESDT token may choose to suspend all transactions of the token, except minting, freezing/unfreezing and wiping. Check more details here.
The Elrond protocol introduces native NFT support by adding metadata and attributes on top of the already existing ESDT. This way, one can issue a semi-fungible token or a non-fungible token which is quite similar to an ESDT, but has a few more attributes, as well as an assignable URI. Once owning a quantity of a NFT/SFT, users will have their data store directly under their account, inside the trie.
One has to perform an issuance transaction in order to register a non-fungible token. Non-Fungible Tokens are issued via a request to the Metachain, which is a transaction submitted by the Account which will manage the tokens. When issuing a token, one must provide a token name, a ticker and optionally additional properties.
IssuanceTransaction { Sender: <account address of the token manager> Receiver: erd1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzllls8a5w6u Value: 50000000000000000 # (0.05 EGLD) GasLimit: 60000000 Data: "issueNonFungible" + "@" + <token name in hexadecimal encoding> + "@" + <token ticker in hexadecimal encoding> }
Optionally, the properties can be set when issuing a token. Example:
IssuanceTransaction { Sender: <account address of the token manager> Receiver: erd1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzllls8a5w6u Value: 50000000000000000 # (0.05 EGLD) GasLimit: 60000000 Data: "issueNonFungible" + "@" + <token name in hexadecimal encoding> + "@" + <token ticker in hexadecimal encoding> + "@" + <"canFreeze" hexadecimal encoded> + "@" + <"true" or "false" hexadecimal encoded> + "@" + <"canWipe" hexadecimal encoded> + "@" + <"true" or "false" hexadecimal encoded> + "@" + <"canPause" hexadecimal encoded> + "@" + <"true" or "false" hexadecimal encoded> + "@" + <"canTransferNFTCreateRole" hexadecimal encoded> + "@" + <"true" or "false" hexadecimal encoded> + "@" + <"canChangeOwner" hexadecimal encoded> + "@" + <"true" or "false" hexadecimal encoded> + "@" + <"canUpgrade" hexadecimal encoded> + "@" + <"true" or "false" hexadecimal encoded> + "@" + <"canAddSpecialRoles" hexadecimal encoded> + "@" + <"true" or "false" hexadecimal encoded> + ... }
The receiver address erd1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzllls8a5w6u
is a built-in system smart contract (not a VM-executable contract), which only handles token issuance and other token management operations, and does not handle any transfers. The contract will add a random string to the ticker thus creating the token identifier. The random string starts with “-” and has 6 more random characters. For example, a token identifier could look like ALC-6258d2.
One has to perform an issuance transaction in order to register a semi-fungible token. Semi-Fungible Tokens are issued via a request to the Metachain, which is a transaction submitted by the Account which will manage the tokens. When issuing a semi-fungible token, one must provide a token name, a ticker and optionally additional properties.
IssuanceTransaction { Sender: <account address of the token manager> Receiver: erd1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzllls8a5w6u Value: 50000000000000000 # (0.05 EGLD) GasLimit: 60000000 Data: "issueSemiFungible" + "@" + <token name in hexadecimal encoding> + "@" + <token ticker in hexadecimal encoding> }
Issue your own SFT or NFT.
In order to be able to perform actions over a token, one needs to have roles assigned. The existing roles are:
For NFT:
For SFT:
Roles can be assigned by sending a transaction to the Metachain from the ESDT manager. Within a transaction of this kind, any number of roles can be assigned (minimum 1).
RolesAssigningTransaction { Sender: <address of the ESDT manager> Receiver: erd1qqqqqqqqqqqqqqqpqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqzllls8a5w6u Value: 0 GasLimit: 60000000 Data: "setSpecialRole" + "@" + <token identifier in hexadecimal encoding> + "@" + <address to assign the role(s) in a hexadecimal encoding> + "@" + <role in hexadecimal encoding> + "@" + <role in hexadecimal encoding> + ... }
Fields of an NFT/SFT:
NFTCreationTransaction { Sender: <address with ESDTRoleNFTCreate role> Receiver: <same as sender> Value: 0 GasLimit: 3000000 + Additional gas (see below) Data: "ESDTNFTCreate" + "@" + <token identifier in hexadecimal encoding> + "@" + <initial quantity in hexadecimal encoding> + "@" + <NFT name in hexadecimal encoding> + "@" + <Royalties in hexadecimal encoding> + "@" + <Hash in hexadecimal encoding> + "@" + <Attributes in hexadecimal encoding> + "@" + <URI in hexadecimal encoding> + "@" + <URI in hexadecimal encoding> + ... }
Create your own NFT.
Example of NFT Creation:
{ Sender: <address with ESDTRoleNFTCreate role> Receiver: <same as sender> Value: 0 GasLimit: 3000000 Data: "ESDTNFTCreate" + "@414c432d317132773365" + # previously fetched token identifier "@01" + # quantity: 1 "@42656175746966756c20736f6e67" + # NFT name: 'Beautiful song' in hexadecimal encoding "@1d4c" + # Royalties: 7500 =75%c in hexadecimal encoding "@00" + # Hash: 00 in hexadecimal encoding "@6d657461646174613a697066734349442f736f6e672e6a736f6e3b746167733a736f6e672c62656175746966756c2c6d75736963" + # Attributes: metadata:ipfsCID/song.json;tags:song,beautiful,music in hexadecimal encoding> + "@55524c5f746f5f646563656e7472616c697a65645f73746f726167652f736f6e672e6d7033" + # URI: URL_to_decentralized_storage/song.mp3 in hexadecimal encoding> + "@" + <additional optional URI in hexadecimal encoding> + }
Transfer NFT Creation Role, Stop NFT creation, Change NFT Attributes, Add URIs to NFT, Wiping a single NFT, etc..
TransferTransaction { Sender: <account address of the sender> Receiver: <same as sender> Value: 0 GasLimit: 1000000 + length of Data field in bytes * 1500 Data: "ESDTNFTTransfer" + "@" + <collection identifier in hexadecimal encoding> + "@" + <the NFT nonce in hexadecimal encoding> + "@" + <quantity to transfer in hexadecimal encoding> + "@" + <destination address in hexadecimal encoding> }
Transfer your NFT to erd1xex9ptczwwce4w9zejpjranj6mt8q5sqseenfj7ym55gfcpgq7cq5e9amz
.
TransferTransaction { Sender: <account address of the sender> Receiver: <same as sender> Value: 0 GasLimit: 1000000 + extra for smart contract call Data: "ESDTNFTTransfer" + "@" + <collection identifier in hexadecimal encoding> + "@" + <the nonce after the NFT creation in hexadecimal encoding> + "@" + <quantity to transfer in hexadecimal encoding> + "@" + <destination address in hexadecimal encoding> + "@" + <name of method to call in hexadecimal encoding> + "@" + <first argument of the method in hexadecimal encoding> + "@" + <second argument of the method in hexadecimal encoding> + <...> }