What to mention in place of 'chain' on Tx declaration for polygon testnet?

I have working code for ethereum signed transaction with ropsten test net, now i deployed same project and trying to interact with below code but i am facing problems

var Tx = require(‘ethereumjs-tx’).Transaction;
var privateKey = Buffer.from(‘e331b6d69882b4cb4ea581d88e0b604039a3de5967688d3dcffdd2270c0fd109’, ‘hex’);

var rawTx = {
nonce: ‘0x00’,
gasPrice: ‘0x09184e72a000’,
gasLimit: ‘0x2710’,
to: ‘0x0000000000000000000000000000000000000000’,
value: ‘0x00’,
data: ‘0x7f7465737432000000000000000000000000000000000000000000000000000000600057’
}

var tx = new Tx(rawTx, {‘chain’:‘ropsten’});
tx.sign(privateKey);

var serializedTx = tx.serialize();

web3.eth.sendSignedTransaction(‘0x’ + serializedTx.toString(‘hex’))
.on(‘receipt’, console.log);

1 Like

solved the problem
Thanks for your suggestion @anon63684144

but no one responded in chat

1 Like

What you do i am also facing same issue

1 Like

what did you mention in place of chain?

Solved this !! Below code snippet worked for me. :grin: :+1:
Only if @A_Nani would have commented his solution it would have saved a lot of time. :angry:

import Common from 'ethereumjs-common';

const common = Common.forCustomChain(
      'mainnet',
      {
        name: 'matic-mumbai', //polygon-mainnet
        networkId: 80001, //137
        chainId: 80001, //137
      },
      'petersburg',
    );

const transaction = new Tx(rawTransaction, {
      common,
    });