EVM Tokens (ERC-20)
How to create Tokens on Ethereum, Polygon, Celo, BSC, Avalanche C Chain, Stratus, Hyperledger Besu
Creating an ERC-20 token
Step 1
As with most actions performed using Cryptum, the first thing you need to do is create an instance of the SDK like this:
const CryptumSdk = require('cryptum-sdk')
const sdk = new CryptumSdk({
environment: 'testnet', // 'testnet', 'mainnet'
apiKey: "YOUR-API-KEY-HERE",
})Step 2
Now you must have or create a Wallet object using the SDK. This wallet will be used to send transactions to the blockchain in order to create your token, so make sure it has enough funds to perform all the desired interactions.
const wallet = await sdk.wallet.generateWallet({
protocol: 'ETHEREUM',
mnemonic: 'lorem ipsum dolor sit amet consectetur adipiscing elit ...',
derivation: { account: 0, address: 0 }
})Step 3
Now we must call the sdk.token.create function on the SDK. The smart contract used in this deployment is in the contracts directory, so you must pass as arguments the token name, token symbol, decimals (integer number) and the amount of total supply.
The function returns the transaction hash of the smart contract deployment to the blockchain. To use this new token you need its address which you can retrive it from like this:
Minting tokens
If you’re the owner of the token’s contract, you can mint extra tokens like this:
Burning tokens
Unlike minting, anybody can burn the tokens they own.
Transferring tokens
To transfer tokens between accounts, follow this guideline:
Besides ERC20-based tokens, you also can transfer native tokens by passing the native token symbol instead of the token address. Depending on the protocol you're using there are the supported native tokens that you can transfer:
"ETH" for protocol ETHEREUM;"CELO", "cUSD", "cEUR"for protocol CELO;"BNB"for protocol BSC;"MATIC"for protocol POLYGON;"AVAX"for protocol AVAXCCHAIN;"CWN"for protocol STRATUS;
Last updated
