Skip to content

status-im/go-wallet-sdk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go Reference Checks codecov Go Report Card

Go Wallet SDK

A modular Go SDK for building multi-chain cryptocurrency wallets and blockchain applications.

Requirements

  • Go: 1.24.0 or higher
  • Optional: RPC endpoint (Infura, Alchemy, or your own node) for examples

Installation

go get github.com/status-im/go-wallet-sdk

For development and contributing:

git clone https://github.com/status-im/go-wallet-sdk
cd go-wallet-sdk
go mod download

API reference

Available Packages

Area Package Use it when… Key entrypoints (start here)
RPC client pkg/ethclient You need chain-agnostic JSON-RPC (or a go-ethereum compatible surface) NewClient, Eth* methods, BalanceAt
Balances pkg/balance/fetcher You need fast native/ERC20 balance reads with fallback strategies FetchNativeBalances, FetchErc20Balances
Batching pkg/multicall You want to batch thousands of contract reads via Multicall3 Build*Call, RunSync, RunAsync
Multi-standard balances pkg/balance/multistandardfetcher You want native+ERC20+ERC721+ERC1155 balances via one API FetchBalances, FetchConfig
Gas pkg/gas You need fee suggestions + inclusion estimates across L1/L2s GetTxSuggestions, GetChainSuggestions
Transaction generation pkg/txgenerator You need to generate unsigned transactions for ETH/ERC20/ERC721/ERC1155 TransferETH, TransferERC20, ApproveERC20, TransferFromERC721, SafeTransferFromERC721, TransferERC1155
Transfers pkg/eventfilter You need to efficiently query ERC20/721/1155 transfers via eth_getLogs FilterTransfers, TransferQueryConfig
Log parsing pkg/eventlog You need to detect/parse standard token events ParseLog, Event
Accounts pkg/accounts/extkeystore You need HD (BIP32) keystore + signing NewKeyStore, DeriveWithPassphrase, SignHash
Mnemonics pkg/accounts/mnemonic You need BIP39 mnemonics + seeds/extended keys CreateRandomMnemonic, CreateExtendedKeyFromMnemonic
Token types pkg/tokens/types You need core token data structures and key generation Token, TokenList, TokenKey, IsNative
Token parsers pkg/tokens/parsers You need to parse token lists from various formats StandardTokenListParser, StatusTokenListParser, CoinGeckoAllTokensParser
Token fetcher pkg/tokens/fetcher You need HTTP fetching with ETag caching and validation New, Fetch, FetchConcurrent
Token autofetcher pkg/tokens/autofetcher You need automated background refresh of token lists NewAutofetcherFromTokenLists, NewAutofetcherFromRemoteListOfTokenLists
Token builder pkg/tokens/builder You need to incrementally build and merge token collections New, AddTokenList, AddNativeTokenList
Token manager pkg/tokens/manager You need high-level token management with auto-refresh New, Start, GetTokenByChainAddress, UniqueTokens
ENS pkg/ens You need forward/reverse ENS resolution NewResolver, AddressOf, GetName, IsSupportedChain

Building the C Library

The SDK can be compiled as a C library (shared or static) for use in non-Go applications:

Shared Library:

make shared-library

This creates:

  • build/libgowalletsdk.dylib (macOS) or build/libgowalletsdk.so (Linux)
  • build/libgowalletsdk.h (C header file)

Static Library:

make static-library

This creates:

  • build/libgowalletsdk.a (static library)
  • build/libgowalletsdk.h (C header file)

The C library exposes core SDK functionality through a C-compatible API, including:

  • Ethereum client operations (RPC calls, chain ID, balances)
  • Multi-standard balance fetching (Native ETH, ERC20, ERC721, ERC1155)
  • Transaction generation (ETH transfers, ERC20, ERC721, ERC1155 operations)
  • Account management (extended keystore and standard keystore)
  • Mnemonic generation and key derivation utilities

See examples/c-app for a complete C usage example.

Examples

Web-Based Balance Fetcher

cd examples/balance-fetcher-web
go run .

Access: http://localhost:8080

Ethereum Client Usage

cd examples/ethclient-usage
go run .

Gas Comparison Tool

cd examples/gas-comparison

# Test with local mock data
go run . -fake

# Test with real networks (requires Infura API key)
go run . -infura-api-key YOUR_API_KEY

Transaction Generator Example

cd examples/txgenerator-example
go run .

Access: http://localhost:8080

Web interface for generating unsigned Ethereum transactions for ETH transfers, ERC20, ERC721, and ERC1155 operations.

Multicall Usage

cd examples/multiclient3-usage
go run .

Event Filter Example

cd examples/eventfilter-example
go run . -account 0xYourAddress -start 19000000 -end 19100000

Accounts Example

cd examples/accounts
go run .

Access: http://localhost:8081

Interactive web interface for testing extkeystore and standard keystore functionality, including mnemonic generation, account creation, derivation, import/export, and signing.

C Application Example

# Build the shared library first
make shared-library

# Then build and run the C example
cd examples/c-app
make build
cd bin
./c-app

Demonstrates how to use the Go Wallet SDK from C applications using the shared library. The example includes:

  • Ethereum client operations (creating clients, retrieving chain ID, fetching balances, making JSON-RPC calls)
  • Multi-standard balance fetching (Native ETH, ERC20, ERC721, ERC1155)
  • Account management with extended keystore and standard keystore
  • Mnemonic generation and key derivation
  • Account creation, import/export, signing, and derivation

Token Management Examples

# Token Builder - Incremental token collection building
cd examples/token-builder
go run .

# Token Fetcher - HTTP-based token list fetching
cd examples/token-fetcher
go run .

# Token Manager - High-level token management
cd examples/token-manager
go run .

# Token Parser - Parse different token list formats
cd examples/token-parser
go run .

ENS Resolver Example

cd examples/ens-resolver-example

# Forward resolution (ENS name to address)
go run . -rpc https://eth.llamarpc.com -name vitalik.eth

# Reverse resolution (address to ENS name)
go run . -rpc https://eth.llamarpc.com -address 0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045

Testing

go test ./...

Documentation

Package Documentation

Example Documentation

Specifications

Contributing

See CONTRIBUTING.md for guidelines on:

  • Code style and conventions
  • Testing requirements
  • Pull request process
  • Development workflow

License

Mozilla Public License Version 2.0 - see LICENSE


Built by the Status team.

About

Collection of functional modules for the development of a multi-chain crypto wallet

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors