Created
January 2, 2018 13:58
-
-
Save ezynda3/551155e9b6447224d9ff2431c1f57488 to your computer and use it in GitHub Desktop.
Golang Ethereum Connection Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"context" | |
"fmt" | |
"log" | |
"github.com/ethereum/go-ethereum/common" | |
"github.com/ethereum/go-ethereum/ethclient" | |
) | |
func main() { | |
conn, err := ethclient.Dial("https://mainnet.infura.io") | |
if err != nil { | |
log.Fatal("Whoops something went wrong!", err) | |
} | |
ctx := context.Background() | |
tx, pending, _ := conn.TransactionByHash(ctx, common.HexToHash("0x30999361906753dbf60f39b32d3c8fadeb07d2c0f1188a32ba1849daac0385a8")) | |
if !pending { | |
fmt.Println(tx) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment