Step 0: Install geth, start geth (with "--unlock 0xYOURACCOUNT"), sync the blockchain, open up a geth terminal in another window with "geth attach".
Or using personal.unlockAccount to unlock your acount
personal.unlockAccount("0xYOURACCOUNT","Account Password")
Step 1: Save the ERC20 ABI to a variable. This is the interface for interacting with the token contract.
var omisegoAbi = [{"constant":true,"inputs":[],"name":"mintingFinished","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"name","outputs":[{"name":"","type":"string"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_spender","type":"address"},{"name":"_value","type":"uint256"}],"name":"approve","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transferFrom","outputs":[],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"name":"","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[],"name":"unpause","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_amount","type":"uint256"}],"name":"mint","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"paused","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"}],"name":"balanceOf","outputs":[{"name":"balance","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[],"name":"finishMinting","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":false,"inputs":[],"name":"pause","outputs":[{"name":"","type":"bool"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"name":"","type":"string"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"name":"transfer","outputs":[],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"_to","type":"address"},{"name":"_amount","type":"uint256"},{"name":"_releaseTime","type":"uint256"}],"name":"mintTimelocked","outputs":[{"name":"","type":"address"}],"payable":false,"type":"function"},{"constant":true,"inputs":[{"name":"_owner","type":"address"},{"name":"_spender","type":"address"}],"name":"allowance","outputs":[{"name":"remaining","type":"uint256"}],"payable":false,"type":"function"},{"constant":false,"inputs":[{"name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"payable":false,"type":"function"},{"anonymous":false,"inputs":[{"indexed":true,"name":"to","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Mint","type":"event"},{"anonymous":false,"inputs":[],"name":"MintFinished","type":"event"},{"anonymous":false,"inputs":[],"name":"Pause","type":"event"},{"anonymous":false,"inputs":[],"name":"Unpause","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"owner","type":"address"},{"indexed":true,"name":"spender","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"name":"from","type":"address"},{"indexed":true,"name":"to","type":"address"},{"indexed":false,"name":"value","type":"uint256"}],"name":"Transfer","type":"event"}];
Step 2: Create the contract variable using the web3 contract method:
var omisegoContract = web3.eth.contract(omisegoAbi).at('0xd26114cd6EE289AccF82350c8d8487fedB8A0C07');
// 0xd26114cd6EE289AccF82350c8d8487fedB8A0C07 is the omisego contract addr. Other tokens will have different addresses
Optional step, check an account balance (# of OMG tokens for this acct):
web3.fromWei(omisegoContract.balanceOf("0xYOURACCOUNT"),"ether");
or check all of your accounts in the .ethereum/keystore directory
eth.accounts.forEach(function(e,i){console.log("eth.accounts["+i+"]: " + "\tbalance:" + web3.fromWei(omisegoContract.balanceOf(eth.accounts[i]),"ether") + " OMG")})
Step 3: Send a small amount of the token (here, 1) to the destination address.
omisegoContract.transfer("0xDESTINATIONADDRESS",web3.toWei(1,"ether"),{from:"0xGASPAYINGADDRESS"});
// here, 0xGASPAYINGADDRESS is the account from which to pay gas to make this tx. Probably the same as the source address.
【Transfer ERC20 tokens using geth】Step 4: Transfer the rest. Same command as above with a greater value
推荐阅读
- 以太坊|King of the Ether
- 区块链|以太坊(ETH)挖矿教程,minerOS系统
- 区块链|以太坊中的iban地址是什么()
- 区块链|2018年最新XMR挖矿教程,CPU、GPU同时挖矿【有图有真相】
- 区块链|JAVA开发区块链1
- 区块链|【以太坊钱包_ETH钱包_以太坊ERC20代币钱包】
- 以太坊|以太坊将成为新互联网的支柱
- 比特币|【加精】一键代币创建,让以太坊ERC-20代币创建简化
- 以太坊|eth 创建钱包,转账 web3j
- 比特币|【精华】5分钟学会创建属于自己的以太坊ERC20代币