flashbots / ethers-provider-flashbots-bundle

Flashbots provider for ethers.js
543 stars 212 forks source link

Always prompt Error: Request failed with status 400 (URL: https://relay.flashbots.net): {"error": "unable to decode txs"} #123

Open wozailashi94 opened 4 months ago

wozailashi94 commented 4 months ago

Oh, my God, no matter how much I debug, it shows this.

Here is the part of my code

const flashbotsProvider = await FlashbotsBundleProvider.create(provider, sendWallet);

const bnbTx = { chainId: 56, type: 2, to: Wallet2.address, value: ethers.parseEther('0.001'), maxFeePerGas: ethers.parseUnits("3", "gwei"), maxPriorityFeePerGas: ethers.parseUnits("2", "gwei"), gasLimit: 21000, data: "0x", }; const usdtTx = { chainId: 56, type: 2, to: "Contract address", data: '0xa9059cbb000000000000000000000000' + receivingWallet.address.substring(2) + ethers.toBeHex(ethers.parseUnits('1', 18), 32).substr(2), maxFeePerGas: ethers.parseUnits("3", "gwei"), maxPriorityFeePerGas: ethers.parseUnits("2", "gwei"), gasLimit: 21000, value:ethers.parseUnits("0", 18), };

var signedBundle = await flashbotsProvider.signBundle([
    {
        signer: receivingWallet,
        transaction: bnbTx,
    },
    {
        signer:sendingWallet2,
        transaction: usdtTx,
    }
]);

const minTimestamp = (await provider.getBlock(blockNumber)).timestamp
const maxTimestamp = minTimestamp + 120

const res = await flashbotsProvider.sendRawBundle(signedBundle, blockNumber,{
    minTimestamp,
    maxTimestamp
  });

Package two transactions and submit them to the same block, but in the transaction are two different wallets

May God bless you. You can help me. God will bless you. I swear.

0xted97 commented 4 months ago

Yeah, i also got this error. Here my code.

const transaction = {
        from: signer.address,
        to: "0x4429B1e0BE0Af0dFFB3CAb40285CBBb631EE5656",
        data: "0x",
        value: ethers.parseEther("0.01"),
        maxFeePerGas: ethers.parseUnits("3", "gwei"),
        maxPriorityFeePerGas: ethers.parseUnits("2", "gwei"),
        gasLimit: 21000,
        chainId: 97
    }
    const transactionBundle = [
        {
            signer: signer, // ethers signer
            transaction: transaction // ethers populated transaction object
        }
    ]
    const simulation = await flashbotsProvider.simulate(signedTransactions, targetBlockNumber)
aneebiqbal commented 1 month ago

Error sending bundle with Flashbots: Error: Request failed with status 400 (URL: https://relay.flashbots.net): {"error":"unable to decode txs"} getting this error and so far i don't think anything i'm doing differently