Prerequisites
- A local Sonr network running. See the Validator Setup Guide for instructions
- Go version 1.24 or higher
1. Project Setup
1
2
2. Client Configuration and Setup
Let’s set up the Sonr client with proper configuration and key management.1
Create the Main File
Create a new file namedmain.go
.2
3
Create a Keyring Manager
Add key management to handle wallet operations:Important: In production, use secure keyring backends like “os” or “file” with proper passphrase protection. Never expose mnemonics in your code.
3. Querying the Blockchain
Now, let’s query the blockchain using the unified query client.1
2
3
4. Building and Broadcasting Transactions
Let’s build and broadcast transactions using the transaction builder.1
2
5. WebAuthn Gasless Transactions (Advanced)
Sonr supports gasless WebAuthn registration, allowing users to onboard without holding tokens.1
2
3
6. Working with DID Module
Create and manage decentralized identities:1
Create a DID Document
Next Steps
This quickstart has covered the fundamentals of the Sonr Go Client SDK:- Client Configuration: Setting up connections and network configurations
- Key Management: Creating and managing wallets with the keyring
- Querying: Reading blockchain state and module data
- Transactions: Building, signing, and broadcasting transactions
- Gas Estimation: Calculating optimal gas limits and fees
- WebAuthn: Gasless onboarding with WebAuthn credentials
- DID Module: Creating decentralized identities
Advanced Topics to Explore:
- DWN Module: Manage decentralized web nodes and data records
- Service Module: Register and verify services with domain verification
- UCAN Integration: Implement capability-based authorization
- Multi-signature: Create and manage multi-sig accounts
- IBC Transfers: Cross-chain token transfers
- Custom Modules: Interact with your own custom modules