0

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!

  • that's not a chaid id, that's a connection string. – goodvibration Jul 20 at 12:02
  • Please edit your title. I do not find any link between it and your question. – Florian Castelain Jul 20 at 14:55
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 .

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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