I have sent the following transactions to the account 0x2D76d8729F9Cfa5bC3CEba8a504400FE30bb53D2:

However, when I try to query the balance using the code below, I get a balance of 0

package main

import (

var myenv map[string]string

const envLoc = ".env"

func loadEnv() {
    var err error
    if myenv, err = godotenv.Read(envLoc); err != nil {
        log.Printf("could not load env from %s: %v", envLoc, err)

func main() {

    ctx := context.Background()

    client, err := ethclient.Dial("http://kovan.infura.io/v3/<!REDACTED>)
    if err != nil {
        log.Fatalf("could not connect to Ethereum gateway: %v\n", err)
    defer client.Close()

    accountAddress := common.HexToAddress("0x2D76d8729F9Cfa5bC3CEba8a504400FE30bb53D2")
    balance, _ := client.BalanceAt(ctx, accountAddress, nil)
    fmt.Printf("Balance: %d\n", balance)

I would appreciate pointers as to what I am doing wrong


Infura doues not allow unencrypted HTTP requests. Should be https://kovan.infura.io/v3/....

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.