I’m following this Authentication code to authenticate and launch the eth_callBundle function but I’m receiving 500 Internal server error without any other info.
This is the code:
def send_bundle(bundle):
// bundle is an array of signed raw transacion like: ["0x1234...", "0x1234"]
while True:
block = web3.eth.block_number
params = [{
"txs": bundle,
"blockNumber": str(web3.to_hex(block))
}]
body = '{"jsonrpc":"2.0","method":"eth_callBundle","params":' + json.dumps(params) + ',"id":1}'
message = messages.encode_defunct(text=Web3.keccak(text=body).hex())
signature = web3.eth.account.from_key(getenv("PRIV_KEY")).address + ':' + web3.eth.account.sign_message(message, getenv("PRIV_KEY")).signature.hex()
logging.debug("-> Simulating on block " + str(block))
try:
simulation_res = requests.post(getenv("FLASHBOTS_URL"), json=body, headers={'X-Flashbots-Signature': signature})
logging.debug("-> Simulation successful.")
except Exception as e:
logging.error("Simulation error", e)
return
Why does I’m getting that error?