Im trying to use the following code with nodejs to create a raw transaction:

const ethTx = require('ethereumjs-tx').Transaction;

const txParams = {
  nonce: '0x0',
  gasPrice: '0x3B9ACA00', 
  gasLimit: '0x30000',
  to: '0x8b74c9f20Da3Eb2F77a93f23563F605742C37b34', 
  value: '0x00',
  chainId: '0x3'

const tx = new ethTx(txParams);
const privKey = Buffer.from('26c3bc1ed44e198f044309325f424734a9557c531473738c3e12ee15f08953d8', 'hex');

const serializedTx = tx.serialize();
const rawTx = '0x' + serializedTx.toString('hex');

Inputting the result in geth console gives me the following error:

Error: invalid sender
    at web3.js:6365:9(45)
    at send (web3.js:5099:62(34))
    at <eval>:1:23(4)

1 Answer 1


This was solved by removing chainId in txParams and changing the const tx = new ethTx(txParams); line to const tx = new ethTx(txParams, { chain: 'goerli' });

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.