Skip to content

Getting relay error: unable to decode bundle. #12

@harsh-98

Description

@harsh-98

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions