Guest User

Untitled

a guest
May 23rd, 2018
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1. web3 = new Web3(new Web3.providers.HttpProvider("<TOKEN>"));
  2. var tokenContract = web3.eth.contract(human_standard_token_abi);
  3. var tokenRunning = tokenContract.at('0x5780a5928becc986edd597991a1a1af6357fdf05');
  4. console.log('Balance is equal to ' + tokenRunning.balanceOf('" . $ETH_ADDRESS . "').toNumber() + ' tokens');
  5.  
  6. var Tx = require('ethereumjs-tx');
  7. var privateKey = new Buffer.from('42d14f44661a68167622a3200f3a2555665b2f4f4d0e4f0e8ce878c0c3d6e6bf','hex')
  8.  
  9. var rawTx = {
  10. nonce: '0x00',
  11. gasPrice: '0x09184e72a000',
  12. gasLimit: '0x2710',
  13. to: '0x0Cf9Dd61389Be41CD620C99579B6Ff1A8Be3B3fb',
  14. value: '20',
  15. data: '0x7f7465737432000000000000000000000000000000000000000000000000000000600057'
  16. }
  17.  
  18. var tx = new Tx(rawTx);
  19. tx.sign(privateKey);
  20.  
  21. var serializedTx = tx.serialize();
  22.  
  23. //console.log(serializedTx.toString('hex'));
  24.  
  25. web3.eth.sendRawTransaction(serializedTx.toString('hex'), function(err, hash) {
  26. if (!err)
  27. console.log(hash);
  28. });
  29.  
  30. <script src="https://cdn.jsdelivr.net/npm/web3@0.20.1/dist/web3.min.js"></script>
Add Comment
Please, Sign In to add comment