Go SDK
The Go SDK is the full-coverage Mintlayer SDK: it wraps the node RPC, the indexer REST API, and the wallet RPC as typed Go clients, and embeds the WASM cryptography runtime for key management and transaction building without the wallet daemon.
go get github.com/mintlayer/go-sdk
- Requires Go 1.21+, no CGO (the WASM runtime is embedded via wazero)
- Canonical API reference: pkg.go.dev/github.com/mintlayer/go-sdk
- Source: github.com/mintlayer/go-sdk
Architecture
A top-level Client wires four independent sub-clients. Import only what you need.
| Package | Purpose | Default port |
|---|---|---|
sdk/node | JSON-RPC 2.0 client for the node daemon | 3030 (mainnet) |
sdk/indexer | REST client for the indexer (api-web-server) | 3000 (mainnet) |
sdk/wallet | JSON-RPC 2.0 client for the wallet daemon | 3034 (mainnet) |
sdk/wasm | Cryptography and transaction building via WASM | none (embedded) |
The sub-clients map 1:1 to the services documented in Developer Setup, and the indexer client mirrors the API endpoints endpoint-for-endpoint.
Quick start
package main
import (
"context"
"fmt"
"log"
sdk "github.com/mintlayer/go-sdk"
)
func main() {
client := sdk.New(sdk.Config{
NodeURL: "http://127.0.0.1:3030",
IndexerURL: "http://127.0.0.1:3000",
WalletURL: "http://127.0.0.1:3034",
})
defer client.Close()
ctx := context.Background()
// Query the chain tip from the indexer.
tip, err := client.Indexer.GetTip(ctx)
if err != nil {
log.Fatal(err)
}
fmt.Printf("chain tip: height=%d id=%s\n", tip.BlockHeight, tip.BlockID)
// Optionally initialise the embedded WASM runtime (~400 ms).
if err := client.InitWASM(ctx); err != nil {
log.Fatal(err)
}
privKey, err := client.WASM.MakePrivateKey()
if err != nil {
log.Fatal(err)
}
_ = privKey
}
Guides
| Guide | Contents |
|---|---|
| Node client | Chainstate, mempool, P2P, block submission |
| Indexer client | Chain, blocks, transactions, addresses, pools, tokens, orders, statistics |
| Wallet client | Wallet lifecycle, accounts, balances, transactions |
| WASM client | Keys, addresses, inputs, outputs, signing, fees |
| Transactions | Building and signing transactions without the wallet daemon |
| Staking | Pool creation, delegation, withdrawal |
| Tokens | Fungible tokens and NFTs: issuance, minting, freezing |
Runnable examples live in the repository under examples/ (send-coins, issue-token) and testnet-live/.