Skip to content

Instantly share code, notes, and snippets.

@Chanutg
Created August 13, 2019 09:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Chanutg/9a966d11b82b6a7b6b4d6fc1f150cf6a to your computer and use it in GitHub Desktop.
Save Chanutg/9a966d11b82b6a7b6b4d6fc1f150cf6a to your computer and use it in GitHub Desktop.
const Web3 = require('web3');
const web3js = new Web3('https://testnet.tomochain.com');
const Tx = require('ethereumjs-tx').Transaction;
count = c;
hexamount = web3js.utils.toHex(amount * 1e5);
var rawTransaction = {"from":walletFromAdresse, "gasPrice":web3js.utils.toHex(20* 1e9),"gasLimit":web3js.utils.toHex(50000000),"to":token.adresse,"value":"0x0","data":tokenContract.methods.transfer(walletTo.publicAdresse, hexamount).encodeABI(),"nonce":web3js.utils.toHex(count)}
var transaction = new Tx(rawTransaction);
transaction.sign(walletFromprivateKey);
console.log(transaction);
web3js.eth.sendSignedTransaction('0x'+transaction.serialize().toString('hex'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment