Created
August 13, 2019 09:10
-
-
Save Chanutg/9a966d11b82b6a7b6b4d6fc1f150cf6a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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