package eth import ( "context" "fmt" "math/big" "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/ethclient" ) func EthLastBlock() (uint64, error) { client, err := ethclient.Dial(ethNode.rpcNode) if err != nil { return 0, err } last_eth_block, err := client.BlockNumber(context.Background()) if err != nil { return 0, err } return last_eth_block, nil } func EthBlockByNumber(blockNumber uint64) (*types.Block, error) { client, err := ethclient.Dial(ethNode.rpcNode) if err != nil { return nil, err } _blockNumber := big.NewInt(int64(blockNumber)) fmt.Println("Block fetch: ", _blockNumber) block, err := client.BlockByNumber(context.Background(), _blockNumber) if err != nil { return nil, err } return block, nil }