Skip to content

Instantly share code, notes, and snippets.

@MariusVanDerWijden
Created July 8, 2020 09:12
Show Gist options
  • Save MariusVanDerWijden/ebf1f036543f420feccb574e426bbef8 to your computer and use it in GitHub Desktop.
Save MariusVanDerWijden/ebf1f036543f420feccb574e426bbef8 to your computer and use it in GitHub Desktop.
// Retrieve a block by number
ctx := context.Background()
block, err := cl.BlockByNumber(ctx, big.NewInt(123))
// Get Balance of an account (nil means at newest block)
addr := common.HexToAddress("0xb02A2EdA1b317FBd16760...")
balance, err := cl.BalanceAt(ctx, addr, nil)
// Send transaction
tx := new(types.Transaction)
err = cl.SendTransaction(ctx, tx)
// Get sync progress of the node
progress, err := cl.SyncProgress(ctx)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment