1

I know this method

var transaction = new Tx(rawTransaction, {chain:'ropsten'});

I tried

var transaction = new Tx(rawTransaction, {chain:'192.168.XX.XX:8545'});

But get Error: Chain with name 192.168.XX.XX:8545 not supported

Any help with this is much appreciated, thank you!

2
  • that's not a chaid id, that's a connection string. Jul 20, 2020 at 12:02
  • Please edit your title. I do not find any link between it and your question. Jul 20, 2020 at 14:55

1 Answer 1

2

You can do this way :

    const EthereumTx = require('ethereumjs-tx').Transaction;
    import Common from 'ethereumjs-common';

        const customCommon = Common.forCustomChain(
        'mainnet',
        {
            name: 'my-private-blockchain',
            networkId: NETWORK_ID,
            chainId: CHAIN_ID,
        },
        'istanbul',
    );

    const tx = new EthereumTx(txParams, { common: customCommon });

With CHAIN_ID and NETWORK_ID numbers.

Here is the full exemple from the official documentation : https://github.com/ethereumjs/ethereumjs-tx/blob/master/examples/custom-chain-tx.ts .

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.