Skip to content

Instantly share code, notes, and snippets.

@zlumer
Last active March 30, 2019 10:17
Show Gist options
  • Save zlumer/b2f1f6e50c4c4240bb24eaf5a4af4cdb to your computer and use it in GitHub Desktop.
Save zlumer/b2f1f6e50c4c4240bb24eaf5a4af4cdb to your computer and use it in GitHub Desktop.
web3 transfer tx generation
let tx = (nonce, gasPrice, to, amount) => ({
nonce: Web3.utils.toHex(nonce),
gasPrice: Web3.utils.toWei(gasPrice.toString(), 'gwei'),
gasLimit: "0x5208",
to,
value: Web3.utils.toWei(amount.toString()),
data: "0x",
chainId: 1
})
@zlumer
Copy link
Author

zlumer commented Mar 30, 2019

import Web3 = require('web3')
let web3 = new Web3()
// let PK = ''
let me = web3.eth.accounts.privateKeyToAccount(PK)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment