golang SDK for the NEM blockchain
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github
crypto
docs
examples
.gitignore
.travis.yml
Gopkg.lock
Gopkg.toml
LICENSE
README.md
account.go
account_test.go
chain.go
chain_test.go
doc.go
namespace.go
namespace_test.go
nemgo.go
nemgo_test.go
nodes.go
nodes_test.go
transaction.go
transaction_test.go
websockets.go

README.md

nemgo

Build Status

A pure golang SDK for the Nem blockchain.

This project is in it's infancy and looking for more contributors! If you are working in Go, are interested in blockchain technologies, or just want to join a friendly open source project you are welcome!

Getting Started

go get the package using the following command:

$ go get github.com/myndshft/nemgo

Open up your favorite text editor, create a new Client and interact with the blockchain!

package main

import (
    "fmt"
    "log"

    "github.com/myndshft/nemgo"
)

// testnet = byte(0x98)

// nemgo.New() will default to a sensible NIS on the mainnet

func main() {
    c, err := nemgo.New()
    if err != nil {
        log.Fatal(err)
    }

    // Custom Client
    c, err := nemgo.New(nemgo.WithNIS("MY.CUSTOM.NIS.HOST:7890", byte(0x68)))
    if err != nil {
        log.Fatal(err)
    }

    // Get account information
    address = "YOUR ACCOUNT ADDRESS"
    actInfo, err := c.AccountInfo(address)
    if err != nil {
        log.Fatal(err)
    }
    fmt.Println(actInfo)

    // Get the current height of the chain
    height, err := c.Height()
    if err != nil {
        log.Fatal(err)
    }
    fmt.Println(height)

    // Subscribe to transactions related to an account
    // This will return a go channel
    txs, err := c.SubscribeUnconfirmedTX(address)
    if err != nil {
        log.Fatal(err)
    }
    defer close(txs)
    for tx := range txs {
        fmt.Println(tx)
    }

Helping out

Check out the CONTRIBUTING.md documents in the docs folder. We always welcome any contribution, large or small!

The gopher logo is the work of Renee French. The Nem logo is licensed under CC0 1.0