var BasicToken = artifacts.require('./BasicToken.sol');
const EthereumTx = require('../node_modules/ethereumjs-tx')
const userAccount = '0x5239d2bec5c8ee929ec27944cffc7b2667710b51';
//Create transaction
const txParams = {
nonce: web3.eth.getTransactionCount(userAccount),
from: userAccount,
gasPrice: '0x6FC23AC00',
gasLimit: '0xF93E0',
to: BasicToken.address,
value: '0x00',
data: '0xa9059cbb000000000000000000000000' + accounts[0].substr(2) + '00000000000000000000000000000000000000000000000000000000000000c8',
// EIP 155 chainId - mainnet: 1, ropsten: 3
chainId: 3
};
//Sign transaction with private key
var tx = new EthereumTx(txParams);
tx.sign(privateKey);
var serializedTx = tx.serialize();
Created
October 18, 2017 05:24
-
-
Save chiro-hiro/66c5c1a57c415d77af2de39a43ac98b8 to your computer and use it in GitHub Desktop.
Create and sign raw transaction
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment