metachris / flashbotsrpc

Golang client for Flashbots Relay, mev-geth and standard Ethereum JSON-RPC API endpoints
https://docs.flashbots.net/flashbots-auction/searchers/advanced/rpc-endpoint/
MIT License
165 stars 55 forks source link

Getting relay error: unable to decode bundle. #12

Open harsh-98 opened 2 years ago

harsh-98 commented 2 years ago

I am getting list of ts and then calling rpc method eth_sendbundle. But flashbot server is not able to parse it.

       // generate the transact opts
        topts, err := bind.NewKeyedTransactorWithChainID(wallet.PrivateKey, big.NewInt(cfg.ChainId))
    log.CheckFatal(err)
    topts.NoSend = true
    topts.GasLimit = 10000000
//  array of the txs
        txs := []string{}
    tx, err := erc20.Transfer(topts, to, amount)
    log.CheckFatal(err)
    txBytes := &bytes.Buffer{}

    err = tx.EncodeRLP(txBytes)
    log.CheckFatal(err)
    txs = append(txs, "0x"+hex.EncodeToString(txBytes.Bytes()))
// generate the bundle
    sendBundleArgs := flashbotsrpc.FlashbotsSendBundleRequest{
        Txs:         txs,
        BlockNumber: fmt.Sprintf("0x%x", blockNum),
    }
    var sigKey, _ = crypto.GenerateKey()
    result, err := p.RPC.FlashbotsSendBundle(sigKey, sendBundleArgs)
// check error
    if err != nil {
        if errors.Is(err, flashbotsrpc.ErrRelayErrorResponse) {
            // ErrRelayErrorResponse means it's a standard Flashbots relay error response, so probably a user error, rather than JSON or network error
            log.Error(err.Error())
        }
    }

Can you tell not I am doing wrong, plz?

Error:

relay error response: unable to decode bundle
metachris commented 1 year ago

Is this still happening?