A KIP20 token must implement the interface IKIP20 in IKIP20.sol. This is a template contract KIP20Token.template. Users just need to fill in _name, _symbol, _decimals and _totalSupply according to their own requirements:
constructor() public {
_name = {{TOKEN_NAME}};
_symbol = {{TOKEN_SYMBOL}};
_decimals = {{DECIMALS}};
_totalSupply = {{TOTAL_SUPPLY}};
_balances[msg.sender] = _totalSupply;
emit Transfer(address(0), msg.sender, _totalSupply);
}
Then users can use Remix IDE and Metamask to compile and deploy the KIP20 contract to OKTC.
Connect to OKTC’s public RPC endpoint
const Web3 = require('web3');
// testnet
const web3 = new Web3('https://exchaintestrpc.okex.org');
Create a wallet
web3.eth.accounts.create([entropy]);
Output:
web3.eth.accounts.create();
{
address: '0x03975c070801D6110EBD8301a0F159f89FB7a4C0',
privateKey: 'BB1C835AB9770454318D8F19079AA1498EFE3B57654E8084134ADB7854969D93',
signTransaction: [Function: signTransaction],
sign: [Function: sign],
encrypt: [Function: encrypt]
}
Recover a wallet
const account = web3.eth.accounts.privateKeyToAccount("BB1C835AB9770454318D8F19079AA1498EFE3B57654E8084134ADB7854969D93")
Check balance
web3.eth.getBalance(holder).then(console.log);
Output: The balance will be bumped by e18 for OKT.
6249621999900000000
Create transaction Parameters
// // Make a transaction using the promise
web3.eth.sendTransaction({
from: holder,
to: '0x0B75fbeB0BC7CC0e9F9880f78a245046eCBDBB0D',
value: '1000000000000000000',
gas: 4500000,
gasPrice: 17e8,
}, function(err, transactionHash) {
if (err) {
console.log(err);
} else {
console.log(transactionHash);
}
});