About Token Decimals (ERC-20 or compatible)

Decimals refer to how divisible a token can be, from 0 (not divisible) to 18 (divisible). Depending on a Token contract, this may be higher.

You may use the Blockchain Explorer to find the Token Contract you want to interact with and verify its amount of decimals supported.

If you still can't find the related token details, try looking at the token's documentation via a web search.

EVM: Ethereum ERC-20 or compatible

We can confirm the supported digits of an ERC-20 (or compatible) token by looking up the TokenAddress over a chain explorer Explorer.

Example Token: Tether USDT: 0xdac17f958d2ee523a2206206994597c13d831ec7 supports six (6) decimals.

Example request:

curl --location 'https://api.tatum.io/v3/blockchain/token/transaction' \
--header 'Content-Type: application/json' \
--header 'x-api-key: {YOUR_API_KEY}' \
--data '{
    "chain": "ETH",
    "contractAddress": "0x03cee0939F57855EB95437f4a0EFA7B1AfBFA4c6", //The Token Address
    "digits": 18, // Amount of supported decimals by the Token contract
    "amount": "1.123456789123456789", // Decimals amount must be lower or equal to "digits" parameter
    "to": "0x5593549ead3b3bd6e4b049ed607ec0f422208298",
    "nonce": 13,
    "fee": {
        "gasLimit": "52036",
        "gasPrice": "23"
    },
    "fromPrivateKey": "SENDER_ADDRESS_PRIVATE_KEY"
}'
import {sendEthOrErc20Transaction} from '@tatumio/tatum';
/**
 * Send Ethereum or supported ERC20 transaction to the blockchain.
 * @param chain - chain to work with
 * @param fromPrivateKey - private key of sender address. Private key, or signature Id must be present.
 * @param contractAddress - address of ERC20 token
 * @param digits - number of decimal points that ERC20 token has
 * @param amount - amount to be sent
 * @param to - blockchain address to send ERC20 token to
 * @returns transaction id of the transaction in the blockchain
 */
  const transaction = await sendEthOrErc20Transaction({
  chain: Currency.ETH,
  fromPrivateKey: '##_related_pric_address_here_##',
  contractAddress: '0xdac17f958d2ee523a2206206994597c13d831ec7', //ERC-20 Smart Contract Address
  digits: 6, // The token supports 6 decimals (see Token Contract)
  amount: "100000",
  to: "##_destination_address_here_##"
});

Tron: TRC-20

We can confirm the supported digits of a TRC-20 token by looking up the TokenAddress over the Tronscan Explorer.

Example Token: Tether USDT: TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t supports six (6) decimals.

Example request:

curl --location 'https://api.tatum.io/v3/tron/trc20/transaction' \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--header 'x-api-key: {YOUR_API_KEY}' \
--data '
{
  "fromPrivateKey": "SENDER_ADDRESS_PRIVATE_KEY",
  "to": "TF48MUvZhSDpLFfC414b94Nj4LwqBFbXom",
  "tokenAddress": "TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t", //TRC-20 Smart Contract Address
  "feeLimit": 100,
  "amount": "100.123456" // The token supports 6 decimals (see Token Contract)
}'