Libraries
There are several ways to interface with ZNS. The first-party SDKs below all wrap the same JSON-RPC API and memo protocol; they differ only in idiom. If your language isn’t here, hit the indexer directly via Direct RPC, or generate a typed client from /openrpc.json.
All first-party ports live in zcashme/ZNS/sdk and track the same version.
TypeScript / JavaScript
npm install zcashname-sdkimport { resolve } from "zcashname-sdk";
const reg = await resolve("alice");Source: sdk/typescript. Reference: TypeScript SDK.
React Native
npm install zcashname-sdk-react-native zcashname-sdkimport { ZNSProvider, useResolve } from "zcashname-sdk-react-native";
// wrap your app in <ZNSProvider />, then call hooksWraps zcashname-sdk with a context provider and data-fetching hooks. Source: sdk/react-native.
Rust
[dependencies]
zns-client = { git = "https://github.com/zcashme/ZNS", branch = "master" }use zns_client::Client;
let client = Client::new("https://light.zcash.me/zns-testnet")?;
let reg = client.resolve("alice").await?;Async client with optional reqwest-transport feature. Source: sdk/rust.
Python
pip install zcashname-sdkfrom zcashname import ZNSClient
client = await ZNSClient.create()
reg = await client.resolve("alice")Async, requires Python 3.10+. Source: sdk/python.
Kotlin / JVM / Android
dependencies {
implementation("com.zcashme:zns-sdk:0.4.0")
}import com.zcashme.zns.*
val client = ZNSClient.create()
val reg = client.resolve("alice")Built with coroutines and kotlinx.serialization. Source: sdk/kotlin.
Swift
.package(url: "https://github.com/zcashme/ZNS", branch: "master"),
// then depend on "ZcashNameSDK"import ZcashNameSDK
let client = try await ZNSClient()
let reg = try await client.resolve("alice")Zero external dependencies - Foundation + URLSession only. Swift 5.9+, macOS 12+/iOS 15+. Source: sdk/swift.
Go
go get github.com/zcashme/zns-sdk-goimport zns "github.com/zcashme/zns-sdk-go"
client := zns.NewClient("https://light.zcash.me/zns-testnet")
reg, err := client.Resolve("alice")Source: sdk/go.
Dart / Flutter
dependencies:
zcashname_sdk:
git:
url: https://github.com/zcashme/ZNS
path: sdk/dartimport 'package:zcashname_sdk/zcashname_sdk.dart';
final client = await ZNSClient.create();
final reg = await client.resolve('alice');Source: sdk/dart.
No SDK for your language?
Hit the indexer directly. The API is JSON-RPC 2.0 over HTTP - any language with an HTTP client and a JSON parser can talk to it in under 20 lines. See Direct RPC for curl, Rust, Python, and Go examples.
The canonical machine-readable spec is at /openrpc.json. Point any OpenRPC code generator at it to scaffold a typed client.
PRs adding ZNS helpers to existing Zcash libraries are welcome. Open an issue at zcashme/ZNS and we’ll help with review and test vectors.