400 Client Error: Bad Request in flashbots.py

Hello! I am using flashbots.py to simulate and distribute the bundle.
I wrote a python script and everything worked a week ago. however now I am getting an exception:

   File "/home/u/.local/lib/python3.9/site-packages/web3/_utils/request.py", line 114, in make_post_request
     response.raise_for_status()
   File "/usr/lib/python3/dist-packages/requests/models.py", line 940, in raise_for_status
     raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://relay.flashbots.net/

to understand what’s going on, I modified the web3/_utils/request.py file and displayed the request parameters:

endpoint_uri: https://relay.flashbots.net 

data: b'{"jsonrpc": "2.0", "method": "eth_callBundle", "params": [{"txs": ["0xf86d82011c850359787955825208944add366e483386870049da86548df92c661d65b1873543e44dbbf6da801ba023b0e907eb70b90e0bed1a608a8cdaeefbedd1b9b5c01b961f6131a5d1b82f05a0182eb079d0ad1792467b58da4c45c7bac28d7d01c2180f37841eaafc044c0dc2", "0xf8a90885035978795582b63294c12d1c73ee7dc3615ba4e37e4abfdbddfa38907e80b844095ea7b30000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488dffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1ba065a53fb4a725c175b84d1fbbc9c6a0d58c271bccdf171e19908bd830721a5610a036ffedd26853c4d946710647d294a4d384343878cffb2c74c5671d3aae7e68a2", "0xf9016b09850359787955830f4240947a250d5630b4cf539739df2c5dacb4c659f2488d80b9010418cbafe5000000000000000000000000000000000000000000000000000050d809593800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000ad6e8fe89155f69673d7e6707f7198ee94f26de70000000000000000000000000000000000000000000000000000000068dfc4a70000000000000000000000000000000000000000000000000000000000000002000000000000000000000000c12d1c73ee7dc3615ba4e37e4abfdbddfa38907e000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc21ca0aab60944050547b5295deacb138bd827771790a05aae7ce7a2c1fb7d3b48c21ea07d86f85b48873ef49ed9d3f14dded74bb60814eb56ed16ab6f0a7cd14f67383c"], "blockNumber": "0xf98e9d", "stateBlockNumber": "0xf98e9c", "timestamp": 1673095331}], "id": 0}' 

args: () 

kwargs: {'headers': {'Content-Type': 'application/json', 'User-Agent': "Web3.py/5.31.3/<class 'flashbots.provider.FlashbotProvider'>", 'X-Flashbots-Signature': '0x2CA0aFCccf07a18c10F27de1217138b34B32494b:0x4a585ed1300fe3bd32959bed869b2763f5276c4f8cc0377cffd8c99fe044e7617bae14c681a7c5e80571f3b5fce913e35d8dfef7eff483573858ba01f853d9dc1c'}, 'timeout': 10}

everything is falling apart on the simulation call…

Help to understand what’s the matter, everything worked.
I tried to generate a new access key - but it did not work.

Hi,
I debugged your transaction. You are missing chainID in your transaction.If your transaction missing chainID then Geth converts this empty value as zero value( Comment from GETH -For legacy transactions which are not replay-protected, the return value is zero) .
Please parse your transaction. We recently added chaindID validation check. If you are missing or sending wrong value it won’t be processed.

Also will check the python client to fix parsing issue if needed.
I agree error translation are little bit harder as errors can not be updated now for legacy reason.
Thank you for reporting. But going forward, please report it in discord. I usually respond or some one/other searchers will help you there or tag me @Euler6.

3 Likes

Hello. Thank you very much!
Everything worked!
The problem was the lack of chainId. Should have made a separate error code for this case :slight_smile: