1

For some reason whenever I submit my transaction it is always included 2 or more blocks behind the current block. There's an address that always has their transaction included in the same block as the current block.

I tried a lot of public RPCs.

  • dRPC
  • BlockPI
  • QuickNode
  • Unifra
  • Tenderly
  • BlastAPI

I also tried increasing the max priority fee per gas but to no avail. Finally, I got a semi-private node from a 3rd party provider, as well as a VPS located in the same city as the node - unfortunately, my transaction is always 2 blocks behind.

I've heard that it is possible to send the transaction directly to the sequencer but I have no clue how to do that.

There could be something wrong with my code, I doubt it though lol.

Maybe there's someone who has their own Base node and could tell me if they also experience this on their own dedicated node?

Whoever can help me with my issue will be sent $10 in Ethereum.

Thank you for your help.

My code:

package main

import (
    "context"
    "fmt"
    "math/big"

    "github.com/ethereum/go-ethereum/accounts/abi/bind"
    "github.com/ethereum/go-ethereum/common"
    "github.com/ethereum/go-ethereum/core/types"
    "github.com/ethereum/go-ethereum/crypto"
    "github.com/ethereum/go-ethereum/ethclient"
)

func main() {
    reqclient, err := ethclient.Dial("##########") // my private node ip here

    chainId, err := reqclient.ChainID(context.Background())
    if err != nil {
        fmt.Println("failed to query chainid")
        return
    }

    privateKey, err := crypto.HexToECDSA("########") // my private key here
    transactor, err := bind.NewKeyedTransactorWithChainID(privateKey, chainId)

    sendTo := common.HexToAddress("0x8F40BE47BbcA263e8b202F351A34F69Db29e049c")

    nonce, _ := reqclient.NonceAt(context.Background(), transactor.From, nil)

    signedTx, err := types.SignNewTx(privateKey, types.LatestSignerForChainID(chainId), &types.DynamicFeeTx{
        To:        &sendTo,
        Nonce:     nonce,
        Value:     big.NewInt(0),
        Gas:       21000,
        GasFeeCap: big.NewInt(1000000000),
        GasTipCap: big.NewInt(1000000000),
    })

    currentBlock, err := reqclient.BlockNumber(context.Background())
    if err != nil {
        fmt.Println(err)
        return
    }

    fmt.Println("current block:", currentBlock)

    err = reqclient.SendTransaction(context.Background(), signedTx)
    if err != nil {
        fmt.Println("tx err:", err)
        return
    }

    fmt.Println("https://basescan.org/tx/" + signedTx.Hash().Hex())
}
2
  • you mean single Transaction or multiple transactions? It most likely has to do with the code or gas limit. Is it possible for you to share the code?
    – porquini
    Commented Aug 24, 2023 at 12:01
  • I mean multiple transactions. The address that has their txs included always in the current block is a sniper. I'll update the question with the code in a second
    – shlx
    Commented Aug 24, 2023 at 12:12

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.