Docs

Docs

  • Develop
  • Validate
  • Integrate
  • Learn

›Integrators

Welcome to Elrond

  • Welcome to Elrond

Technology

  • Architecture Overview
  • Glossary
  • Entities
  • Chronology
  • Secure Proof of Stake
  • Adaptive State Sharding
  • The Elrond WASM VM
  • Cross Shard Transactions

Wallet

  • Wallets - Overview
  • Web Wallet
  • Maiar Web Wallet Extension
  • Webhooks
  • Ledger

Tokens

  • Native Tokens
  • ESDT tokens
  • NFT tokens

Validators

  • Validators - Overview
  • System Requirements
  • Install a Mainnet Node

    • Scripts & User config
    • Installing a Validator Node
    • Optional Configurations
    • How to use the Docker Image

    Install a Testnet/Devnet Node

    • Scripts & User config
    • Installing a Validator Node
    • Manage a validator node
    • How to use the Docker Image

    Manage your keys

    • Validator Keys
    • Wallet Keys
    • Protecting your keys

    Staking, Unstaking, Unjailing

    • Staking, unstaking and unjailing
    • Staking
    • Unjailing
    • The Staking Smart Contract
  • The Delegation Manager
  • Convert An Existing Validator Into A Staking Pool
  • Merging A Validator Into An Existing Delegation Smart Contract
  • Rating
  • Elrond Node upgrades
  • Node redundancy
  • Import DB
  • Node CLI
  • Node Databases
  • Useful Links & Tools
  • FAQs

Developers

  • Developers - Overview
  • Tutorials

    • Build a dApp in 15 minutes
    • Build a Microservice for your dApp
    • The Crowdfunding Smart Contract (part 1)
    • The Crowdfunding Smart Contract (part 2)
    • The Counter Smart Contract
    • Custom Wallet Connect

    Signing Transactions

    • Signing Transactions
    • Tools for signing
    • Signing programmatically

    Gas and Fees

    • Overview
    • EGLD transfers (move balance transactions)
    • System Smart Contracts
    • User-defined Smart Contracts

    Developer reference

    • The Elrond Serialization Format
    • Smart contract annotations
    • Smart contract modules
    • Smart contract to smart contract calls
    • Smart Contract Developer Best Practices
    • Code Metadata
    • Smart Contract API Functions
    • Storage Mappers
    • Rust Testing Framework
    • Rust Testing Framework Functions Reference
    • Rust Smart Contract Debugging
    • Random Numbers in Smart Contracts

    Developers Best Practices

    • Basics
    • BigUint Operations
    • The dynamic allocation problem
    • Multi-values

    Mandos tests reference

    • Mandos Overview
    • Mandos Structure
    • Mandos Simple Values
    • Mandos Complex Values
    • Embedding Mandos code in Go
  • Constants
  • Built-In Functions
  • Account storage
  • Setup a Local Testnet
  • Set up a Local Testnet (advanced)
  • Creating Wallets

SDK and Tools

  • SDKs and Tools - Overview
  • REST API

    • REST API overview
    • api.elrond.com
    • Gateway overview
    • Addresses
    • Transactions
    • Network
    • Nodes
    • Blocks
    • Virtual Machine
    • Versions and Changelog
  • Proxy
  • Elasticsearch
  • erdpy

    • erdpy
    • Installing erdpy
    • Configuring erdpy
    • erdpy CLI
    • Deriving the Wallet PEM file
    • Sending bulk transactions
    • Writing and running erdpy scripts
    • Smart contract interactions

    erdjs

    • erdjs
    • Cookbook
    • Extending erdjs
    • Writing and testing interactions
    • Migration guides
    • Signing Providers for dApps
  • erdgo
  • erdcpp
  • erdjava
  • erdkotlin
  • erdwalletjs-cli

Integrators

  • Integrators - Overview
  • EGLD integration guide
  • ESDT tokens integration guide
  • Observing Squad
  • Accounts Management
  • Creating Transactions
  • Querying the Blockchain

ESDT tokens integration guide

Introduction

Integrating ESDT tokens support can be done alongside native EGLD integration, so one should refer to the egld-integration-guide.

The only differences are internal ways to store ESDT tokens alongside with their token identifier and number of decimals and different approaches for identifying and parsing ESDT transactions.

ESDT transactions parsing

Considering that the platform which wants to support ESDT tokens already supports EGLD transfers, this section will provide the additional steps that are to be integrated over the existing system.

If so, all the transactions on the network are being parsed so the integrator will check if the sender or receiver of the transaction is an address that is interested in. In addition to this, one can check if the transaction is a successful ESDT transfer. If so, then the transferred token, the amount and the receiver can be further parsed.

One has to follow these steps:

  • check if the transaction is an ESDT transfer (data field format is ESDTTransfer@<tokenID hexadecimal>@<amount hexadecimal>. More details here)
  • parse the tokens transfer details from Logs&Events. More details here

Example

Let's suppose we are watching these addresses:

  • erd1zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3z92425g3zygs3mthts
  • erd1venxvenxvenxvenxvenxvenxvenxvenxvenxvenxvenxvenxvenq5ezmpv

And we support the following tokens:

  • TKN-99hh44 (hex encoded: 544b4e2d393968683434)
  • TKN2-77hh33 (hex encoded: 544b4e322d373768683333)

Therefore, we will look for transactions that have the following structure:

TokenTransferTransaction {
    Sender: erd1....
    Receiver: erd1zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zygspavcaj OR erd1venxvenxvenxvenxvenxvenxvenxvenxvenxvenxvenxvenxvenq5ezmpv
    Value: 0 
    GasLimit: 60000000
    Data: "ESDTTransfer" +
          "@<token identifier hex>" + // 544b4e2d393968683434 OR 544b4e322d373768683333
          "@<amount hex>"
}

Any other transaction that does not follow this structure has to be omitted.

When we find such a transaction, we will fetch the logs of the transaction, as described here. The logs will provide us information about the receiver, the token and the amount to be transferred. If the log is there, we are sure that the transfer is successful, and we can start processing with the extracted data.

Sending ESDT tokens

Sending ESDT tokens to a given recipient can be done via preparing and broadcasting to the network a transaction that follows the format described here.

Also, there is support for building tokens transfer transaction on many SDKs. A few examples are:

  • erdjs - ESDTTransferPayloadBuilder
  • erdjava - ESDTTransferBuilder

Balances check

From time to time, or for safety reasons before performing a transaction, an integrator would want to check the tokens balance of some addresses. This can be performed via Get address token balance endpoint.

Getting tokens properties

Each tokens has some properties such as the name, the ticker, the token identifier or the number of decimals. These properties can be fetch via an API call described here.

Useful tools

  • ESDT documentation can be found here.
  • ESDT API docs can be found here.
  • erdjs helper functions can be found here.
  • erdjs token transfer transactions builder can be found here.
  • erdjava helper functions can be found here.
  • erdjava token transfer transactions builder can be found here.
  • @elrondnetwork/transaction-decoder.
← EGLD integration guideObserving Squad →
  • Introduction
  • ESDT transactions parsing
    • Example
  • Sending ESDT tokens
  • Balances check
  • Getting tokens properties
  • Useful tools
Made withby the Elrond team.
GithubChat
Main siteWalletExplorerBridgeDocsGrowthMaiarMaiar Exchange