Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- web3 = new Web3(new Web3.providers.HttpProvider("<TOKEN>"));
- var tokenContract = web3.eth.contract(human_standard_token_abi);
- var tokenRunning = tokenContract.at('0x5780a5928becc986edd597991a1a1af6357fdf05');
- console.log('Balance is equal to ' + tokenRunning.balanceOf('" . $ETH_ADDRESS . "').toNumber() + ' tokens');
- var Tx = require('ethereumjs-tx');
- var privateKey = new Buffer.from('42d14f44661a68167622a3200f3a2555665b2f4f4d0e4f0e8ce878c0c3d6e6bf','hex')
- var rawTx = {
- nonce: '0x00',
- gasPrice: '0x09184e72a000',
- gasLimit: '0x2710',
- to: '0x0Cf9Dd61389Be41CD620C99579B6Ff1A8Be3B3fb',
- value: '20',
- data: '0x7f7465737432000000000000000000000000000000000000000000000000000000600057'
- }
- var tx = new Tx(rawTx);
- tx.sign(privateKey);
- var serializedTx = tx.serialize();
- //console.log(serializedTx.toString('hex'));
- web3.eth.sendRawTransaction(serializedTx.toString('hex'), function(err, hash) {
- if (!err)
- console.log(hash);
- });
- <script src="https://cdn.jsdelivr.net/npm/web3@0.20.1/dist/web3.min.js"></script>
Add Comment
Please, Sign In to add comment