Golang SDK for the NEO blockchain
Golang SDK for the NEO blockchain.
go get github.com/CityOfZion/neo-go-sdk
package main
import (
"log"
"github.com/CityOfZion/neo-go-sdk/neo"
)
func main() {
nodeURI := "http://test1.cityofzion.io:8880"
client := neo.NewClient(nodeURI)
ok := client.Ping()
if !ok {
log.Fatal("Unable to connect to NEO node")
}
block, err := client.GetBlockByHash(
"3f0b498c0d57f73c674a1e28045f5e9a0991f9dac214076fadb5e6bafd546170",
)
if err != nil {
log.Fatal(err)
}
log.Printf("Block found, index is: %d", block.Index)
}
See GoDoc for full documentation.
Debugging a NEO public and private key pair is a common task when interacting with the blockchain. Make use of the neo-go-sdk CLI to help with this process:
./neo-go-sdk --wif KxQREAjBL6Ga8dw9rPN45pwoZ5dxhAQacEajQke6qmpB7DW6nAWE
This will output the full details about the key pair. See releases to download the CLI.