Error in signature check wallet

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!

1 Like

Issue solved!

1 Like

How did you solve it?:slight_smile:

Hi @cguth, would you mind to share how you solved it? I am also having the same issue. Thanks!

Hey @cguth, Please share the solution. I have been trying this for a long time. Not getting the fix. Please

Thanks in Advance

Hey, I got fix for it!!
Below is my script:

  const api_url = 'https://relay.flashbots.net'
  const hexBlockNumberToSend = '0x' + targetBlock.toString(16);

  const requestData = {
    jsonrpc: '2.0',
    id: 1,
    method: 'eth_sendBundle',
    params: [{
        txs: transactions,
        blockNumber: hexBlockNumberToSend,
      }]
  };
  const provider = new ethers.providers.JsonRpcProvider(RPC_URL);
  const wallet = new ethers.Wallet(PRIVATE_KEY, provider);

  const bodyText = JSON.stringify(requestData);
  const messageSignature = await wallet.signMessage(ethers.utils.id(bodyText));
  const signature = `${wallet.address}:${messageSignature}`;


  try {
    const response = await axios.post(api_url, requestData, {
      headers: {
        'Content-Type': 'application/json',
        'X-Flashbots-Signature': `${signature}`, // Add your Flashbots signature here
          },
    });

1 Like

Getting incorrect request error. Please help.

let resolvePromise: (value: SnipeResponse) => void, rejectPromise: (reason?: any) => void
		const promise = new Promise<SnipeResponse>(async (resolve, reject) => {
			resolvePromise = resolve
			rejectPromise = reject
		})
		const builders = ['flashbots', 'f1b.io', 'rsync', 'beaverbuild.org', 'builder0x69', 'Titan', 'EigenPhi', 'boba-builder', 'Gambit Labs', 'payload', 'Loki', 'BuildAI', 'JetBuilder', 'tbuilder', 'penguinbuild', 'bobthebuilder']

		const wallet = new Wallet(buyWalletPrivateKey[0], this.provider)
		const router = new Contract(this.ROUTER_ADDRESS, routerAbi, wallet)
		const txRequest = await router.swapETHForExactTokens.populateTransaction(amountOut, [this.WETH, tokenAddress], wallet.address, Date.now() + 1000 * 60 * 10, ethToCoinBase, {
			value: amountInMax[0] + ethToCoinBase,
			maxPriorityFeePerGas: parseUnits(extraPriorityFee, 'gwei'),
			maxFeePerGas: parseUnits('100', 'gwei'),
		})
		const tx = await wallet.signTransaction(txRequest)

		// send request on event
		this.provider.once('block', async blockNumber => {
			try {
				console.log('New block:', blockNumber)
				const maxBlockNumber = '0x' + (blockNumber + 2).toString(16)

				const requestData = {
					jsonrpc: '2.0',
					id: 1,
					method: 'eth_sendPrivateTransaction',
					params: [
						{
							tx: tx,
							maxBlockNumber: maxBlockNumber,
							preferences: {
								fast: true,
								privacy: {
									hints: ['transaction_hash'],
									builders: builders,
								},
								validity: {
									refund: [{ address: wallet.address, percent: 0 }],
								},
							},
						},
					],
				}

				const bodyText = JSON.stringify(requestData)
				const messageSignature = await wallet.signMessage(id(bodyText))
				const signature = `${wallet.address}:${messageSignature}`

				const response = await axios.post(this.RELAY, requestData, {
					headers: {
						'Content-Type': 'application/json',
						'X-Flashbots-Signature': `${signature}`, // Add your Flashbots signature here
					},
				})
				resolvePromise({ message: 'Transaction sent', data: response.data })
			} catch (error) {
				console.log((error as any).message)
				rejectPromise(error)
			}
		})

		return promise