Emercoin NVS lib written in Go
go get github.com/sagleft/go-nvs
Create client:
client, err := gonvs.NewClient(gonvs.CreateClientTask{
RPCUser: os.Getenv("USER"),
RPCPassword: os.Getenv("PASSWORD"),
})
if err != nil {
log.Fatalln(err)
}
Write new data to the blockchain:
err = client.Write(gonvs.WriteEntryTask{
Name: "test:" + uuid.NewString(),
Value: []byte("entry value"),
Days: 30,
})
if err != nil {
log.Fatalln(err)
}
Get a list of records at the address:
address := os.Getenv("ADDRESS")
entrys, err := client.GetEntrysByAddress(gonvs.GetEntrysByAddressTask{
Address: address,
})
if err != nil {
log.Fatalln(err)
}
fmt.Println("NVS entrys for address `" + address + "`:")
for _, entry := range entrys {
fmt.Println(" " + entry.Name)
}
Ed1epQAF8TW5VDhZUusf4MsMNpNh9UMzm2