How do I sign and send a transaction using web3.js and ethereumjs-tx on the BSC testnet?

I have found this question and answer:

Is it possible to send transaction in Binance Smart Chain using web3 and ethereumjs-tx?

This only seems to cover the mainnet:

const common = Common.default.forCustomChain('mainnet', {
  name: 'bnb',
  networkId: 56,
  chainId: 56
}, 'petersburg');

If I substitute the chainId for 97 (BSC Testnet Id) and replace 'petersburg' with Chapel. I get 'Error: Chain with name Chapel not supported'

Any help is greatly appreciated. Thanks in advance.

  • Not the answer, but Petersburg is the name of hardfork (update) and not the chain
    – Majd TL
    Commented May 15, 2021 at 20:54
  • Thank you. I hadn't noticed that. I assume the fork would be the same for the BSC Testnet then? I'll try swapping over just the networkId and chainId to 97.
    – ImJhardy
    Commented May 15, 2021 at 21:07

3 Answers 3


I gave up trying to ethereumjs-tx in the end as I came across this:


Managed to get that solution up and running it solved that particular error I was getting.


First argument can only have 5 possible values, mainnet, ropsten, rinkeby, goerli and kovan. You can confirm here.

But you can work around that by overriding parameters with second argument. So in your case...

var common = Common.forCustomChain(
        name: 'Binance Smart Chain Testnet',
        networkId: 97,
        chainId: 97,
        url: 'https://data-seed-prebsc-1-s1.binance.org:8545'

should work. 97 is BSC testnet network and chain id.


The following solution worked like charm for me:

    var common = Common.custom({ chainId: 97 }, { hardfork: 'istanbul' });

This works well for binance testnet.

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.