Created
February 15, 2017 10:44
-
-
Save yaronvel/9acf67fe44fe282ddd5f144f4bf86d6f to your computer and use it in GitHub Desktop.
This file contains hidden or 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 ( | |
| "fmt" | |
| "log" | |
| "github.com/ethereum/go-ethereum/accounts/abi/bind/backends" | |
| "github.com/ethereum/go-ethereum/common" | |
| "github.com/ethereum/go-ethereum/rpc" | |
| ) | |
| func main() { | |
| // Create an IPC based RPC connection to a remote node | |
| // TODO!!!!!!!!!! change path to local path | |
| conn, err := rpc.NewIPCClient("/home/yaron/.ethereum/testnet/geth.ipc") | |
| if err != nil { | |
| log.Fatalf("Failed to connect to the Ethereum client: %v", err) | |
| } | |
| // Instantiate the contract and display its name | |
| token, err := NewToken(common.HexToAddress("0x21e6fc92f93c8a1bb41e2be64b4e1f88a54d3576"), backends.NewRPCBackend(conn)) | |
| if err != nil { | |
| log.Fatalf("Failed to instantiate a Token contract: %v", err) | |
| } | |
| name, err := token.Name(nil) | |
| if err != nil { | |
| log.Fatalf("Failed to retrieve token name: %v", err) | |
| } | |
| fmt.Println("Token name:", name) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment