Skip to main content

Create Tokens via EOA Address

How to create tokens

Regular users can only create tokens/NFT collections through the sales contract.

Users enter the desired symbol, and the sales contract first mints a 721-type NFT containing this symbol's information. Subsequently, the MultiToken contract is called through this NFT to create the symbol.

1. Obtain SEED

Refer to Obtain SEED

2. Create Token

Create Using aelf SDK

Refer to contract documentation: https://docs.aelf.io/en/latest/reference/smart-contract-api/multi-token.html

For instance: The token corresponding to TEST-SEED is TEST TOKEN.

  1. Initialize chain information
const aelf = new AElf(new AElf.providers.HttpProvider('https://aelf-public-node.aelf.io'));
  1. Initialize wallet
const wallet = AElf.wallet.getWalletByPrivateKey('your privateKey');
  1. Initialize contract
const tokenContract = await aelf.chain.contractAt(
"tokenContract address", // MultiToken contract address
wallet
);
  1. Call the contract method for creation, with parameter details outlined in the MultiToken contract documentation
const { TransactionId } = await tokenContract.Create({
symbol: 'TEST TOKEN',
tokenName: "TEST TOKEN NAME",
totalSupply: 1000000000_00000000,
decimals: 8,
issuer: 'target issuer',
isBurnable: true,
issueChainId: 'the chain of the issuer (data type)',
});
  1. Check the transaction result
const txResult = await aelf.chain.getTxResult(TransactionId)
  1. Issue token
 const issueResult = await tokenContract.Issue({
symbol: 'TEST TOKEN',
to: '5MjQGbZysnE9ivbFkM1z1T7KCRpo7PorisdL7mSjcgxewyu3N',
amount: 1000000000_00000000
})