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
I am getting list of ts and then calling rpc method eth_sendbundle. But flashbot server is not able to parse it.
Can you tell not I am doing wrong, plz?
Error: