Hello Flashbots community. Im trying to send my first bundle to flashbots relay. Im getting this error message here when trying to send it.
error in signature check (my wallet address)
I guess something is wrong with how Ive set up the signature. I would appreciate any help! Here is my code
async function sendAsyncTransaction() {
try {
const pending = await provider.getTransactionCount(signer.address, “pending”);const exampleTx = { to: "0x0C7172c8c5C000F39E2A11b04c52805aF29d945b", value: 1, gasLimit: "21000", maxFeePerGas: 50000000000, nonce: pending, type: 2, chainId: 1, }; // sign tx const txs = await signer.signTransaction(exampleTx); // get current block const blockNumber = '0x' + (await provider.getBlockNumber() + 1).toString(16); const data = { jsonrpc: '2.0', id: '1', method: 'eth_sendBundle', params: [{txs, blockNumber}], }; const signature = signer.address + ":" + await signer.signMessage(utils.id(data)); const config = { headers: { 'Content-Type': 'application/json', 'X-Flashbots-Signature': `${signature}`, // Add your Flashbots signature here }, }; axios.post('https://relay.flashbots.net', data, config) .then((response: { data: any; }) => { console.log(response.data); }) .catch((error: any) => { console.error(error); }); } catch (error) { console.error(error); }
}
Thanks in advance!