Skip to content
Golang SDK for IoTeX bloclchain
Go Makefile Shell
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.circleci Update ci to go1.12.5 and use go mod May 16, 2019
account
errcodes
iotex
utils
version
.gitignore
LICENSE
Makefile
README.md
buildlibsecp256k1.sh
go.mod
go.sum

README.md

iotex-antenna-go

CircleCI Go version LICENSE

Welcome to the official Go implementation of IoTeX Golang SDK! IoTeX is building the next generation of the decentralized network for IoT powered by scalability- and privacy-centric blockchains. Please refer to IoTeX whitepaper for details.

Get started

Minimum requirements

Components Version Description
Golang ≥ 1.11.5 Go programming language

Add to your project

// go mod
go get github.com/iotexproject/iotex-antenna-go/v2

Sample

package main

import (
	"context"
	"fmt"
	"log"

	"github.com/iotexproject/iotex-address/address"
	"github.com/iotexproject/iotex-antenna-go/v2/account"
	"github.com/iotexproject/iotex-antenna-go/v2/iotex"
	"github.com/iotexproject/iotex-proto/golang/iotexapi"
)

const (
	host = "api.testnet.iotex.one:443"
)

func main() {
	// Create grpc connection
	conn, err := iotex.NewDefaultGRPCConn(host)
	if err != nil {
		log.Fatal(err)
	}
	defer conn.Close()
	
	// Add account by private key
	acc, err := account.HexStringToAccount("...")
	if err != nil {
		log.Fatal(err)
	}
	
	// create client
	c := iotex.NewAuthedClient(iotexapi.NewAPIServiceClient(conn), acc)
	
	// transfer
	to, err := address.FromString("to...")
	if err != nil {
		log.Fatal(err)
	}
	hash, err := c.Transfer(to, big.NewInt(10)).Call(context.Background())
	if err != nil {
		log.Fatal(err)
	}
}
You can’t perform that action at this time.