iotex-antenna-go

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
// dep
dep ensure -add github.com/iotexproject/iotex-antenna-go
// go mod
go get github.com/iotexproject/iotex-antenna-go
Sample
package main
import (
"log"
"github.com/iotexproject/iotex-antenna-go/iotex"
)
const (
host = "api.testnet.iotex.one:443"
)
func main() {
https://github.com/iotexproject/iotex-tube
// Create grpc connection
conn, err := 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 := 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)
}
}