flashbots / flashbots/ethers-provider-flashbots-bundle

ChainID gets erroneously overridden

Open
#68 6 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
566
Forks
211
PR merge metrics
No merged PRs in 30d

Description

**BLOCKCHAIN**: Binance Smart Chain - Testnet
**PROVIDER**: Moralis speedy nodes

I am unable to send transaction since it seems that the library overrides erroneously the `chainId` of the transaction. Here's the relevant parts of the code:

```
this.ethers_provider = new providers.WebSocketProvider(this.WEBSOCKET_PROVIDER)
this.signer = new Wallet("0x" + this.private_keys[0], this.ethers_provider);
this.flashbotsProvider = await FlashbotsBundleProvider.create(
this.ethers_provider,
this.signer
);
const block_number = await this.ethers_provider.getBlockNumber()
const BLOCKS_IN_THE_FUTURE = 3
const populatedTransaction = await this.signer.populateTransaction(
{
gasLimit: "0x7A120",
data: '0x',
to: "0x51d522dfb50056ab41a1f6c248077ba85a2b97d5",
value: "0x1",
gasPrice: this.web3.utils.toHex(this.web3.utils.toWei("30", 'gwei')),
}
);
//populatedTransaction.chainId = await this.signer.getChainId(); //Even with it I still have the same error
const signedTransaction = await this.signer.signTransaction(populatedTransaction);
const signedBundle = await this.flashbotsProvider.signBundle([{ signedTransaction }]);
this.flashbotsProvider.simulate(signedBundle, block_number + BLOCKS_IN_THE_FUTURE).then(
(simulation : any) => {
if ('error' in simulation) {
console.warn(`Simulation Error: ${simulation.error.message}`)
process.exit(1)
} else {
console.log(`Simulation Success: ${JSON.stringify(simulation, null, 2)}`)
}
}
);
```

And I always end getting the same error:
`Simulation Error: err: invalid chain id for signer; txhash 0x408c5a3a561f51e04ee1da4c534d8f385291a444deac871c065f5b25dc77b33f`

Either the library overrides the `chainId` of the transaction, or it overrides the provider used with another on chainId, I cannot explain to me why I keep getting alwas this same exact error

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.