How to create an Ethereum ERC-20 token

Create your own token in one simple step.

An ERC-20 token is a standardized Smart Contract with a predefined set of features. It represents fungible tokens, which can be interchanged. The ERC-20 token is used as a blockchain representation of the currency.

Creating your own Smart Contract on Ethereum is not easy at all. As a developer, you must do a few things:

  • Solidity - you have to be able to write Smart Contracts in Ethereum Solidity.

  • Run the Solidity compiler

  • Run the Solidity development IDE

  • Deploy the compiled Smart Contract

It is a lot to know. For developers who only need the basic features of ERC-20 tokens, Tatum offers a single-API-call solution.

Tatum has a prebuilt ERC-20 contract ready for deployment. The source code is available on GitHub.

Creating an ERC-20 Smart Contract

To create and deploy the ERC-20 token using Tatum, all you need is one simple API call. This API call deploys a standard, validated ERC-20 Smart Contract to the Ethereum blockchain. The required parameters are the name and symbol of the deployed token, the initial supply of the tokens, and the recipient address where the initial supply will be transferred.

Blockchain transactions are signed using a private key via API, which is not a secure way of signing transactions. Your private keys and mnemonics should never leave your security perimeter. To correctly and securely sign a transaction, you can use Tatum CLI from the command line, a specific language library like Tatum JS, the local middleware API, or our complex key management system, Tatum KMS.

Request
Response
Request
curl --location --request POST 'https://api-eu1.tatum.io/v3/ethereum/erc20/deploy' \
--header 'x-api-key: YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data-raw '{
"symbol": "SMBL",
"name": "DemoToken",
"supply": "10000000",
"digits": 18,
"address": "0x28cbeb0681bca9a07165c98cdb05051Fdf7Dc3F3",
"fromPrivateKey": "0xd3d46d51fa3780cd952821498951e07307dfcfbbf2937d1c54123d6582032fa6"
}'
Response
{
"txId": "0x75808516abfb2fa4e44fd2fc85863d15e11bdc3f90769962e3f34d7a17df4f0f"
}

Getting the details of the blockchain transaction

The response is the transaction ID, from which the created token address can be obtained. You can see the property contractAddress, which is the address of the ERC-20 token.

Request
Response
Request
curl --location --request GET 'https://api-eu1.tatum.io/v3/ethereum/transaction/0x75808516abfb2fa4e44fd2fc85863d15e11bdc3f90769962e3f34d7a17df4f0f' \
--header 'x-api-key: YOUR_API_KEY'
Response
{
"blockHash": "0x2f8c280e6e568f4a65b9314b5f3dcf9f1d774f1d4aafc80d9b77825d5cc0c148",
"blockNumber": 9095572,
"contractAddress": "0x316e52b83c66E8FB3936bdc2C8Ed8437441774cE",
"gas": 1527507,
"gasPrice": "64000000000",
"gasUsed": 1527507,
...
...
}

Transferring the ERC-20 token to another blockchain address

To transfer the tokens from the address where they were issued to another blockchain address, you can use the Transfer ERC20 token endpoint from the Blockchain/Ethereum section. You need the private key of the address where tokens are located (address from the first call where the initial supply is distributed).

Request
Response
Request
curl --location --request POST 'https://api-eu1.tatum.io/v3/ethereum/erc20/transaction' \
--header 'x-api-key: YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data-raw '{
"to": "0x687422eEA2cB73B5d3e242bA5456b782919AFc85",
"amount": "50000",
"contractAddress": "0x316e52b83c66E8FB3936bdc2C8Ed8437441774cE",
"digits": 18,
"fromPrivateKey": "0xd3d46d51fa3780cd952821498951e07307dfcfbbf2937d1c54123d6582032fa6"
}'
Response
{
"txId": "0xc330005e40aa36b1256f6629ebbf8c0a1b73bf1b517ed4fecf862d422b190ec3"
}

And the response is again the ID of the transaction of the tokens.

That wasn't too bad at all, right? With just three calls to Tatum, you were able to deploy your own token and transfer it. You don't have to install anything, learn Solidity, etc.

To find out more about the API calls we have just used, visit our API Reference.