wallet-sdk

module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 26, 2026 License: Apache-2.0

README

KernelFlow Wallet SDK

Go Reference License

A multi-chain, offline wallet SDK in Go: account derivation, address generation, transaction building, and signing across major blockchain families — with no network access required. It is the signing core behind KernelFlow's white-label wallet products, extracted and open-sourced so it can be independently audited and reused.

Features

  • Offline signing — keys never leave the process; no RPC, no node, no network.
  • Unified interfaces — every chain implements the same AccountHandler and TxBuilderHandler contracts, so callers integrate new chains with the same code shape.
  • MPC / cold-signer friendly — the Build → Sign → ConcatSignature split separates sig-hash generation from signature assembly, so the signing step can run in an isolated process (HSM, MPC node, air-gapped signer).
  • Mobile bindings — a flat, gomobile-friendly façade lives in the separate wallet-mobile repo (iOS / Android).

Supported chains

Family Generate Address Build & Sign Tx
EVM
UTXO (BTC-like)
Solana
Tron
Aptos
Sui
Kaspa
Substrate
MultiversX

Install

go get github.com/KernelFlowLabs/wallet-sdk

Requires Go 1.23+. The Kaspa package builds a vendored C secp256k1 via cgo, so a C toolchain (gcc/clang) must be available if you import chain/kaspa.

Quick start

import (
    "github.com/KernelFlowLabs/wallet-sdk/chain"
    "github.com/KernelFlowLabs/wallet-sdk/chain/evm"
)

// Derive an account.
acc, _ := evm.NewAccountFromMnemonic(mnemonic, "m/44'/60'/0'/0/0")

// Build → Sign → assemble an EIP-1559 native transfer, fully offline.
b := evm.NewTxBuilder(&evm.Ingredient{
    TxType:          chain.TxTypeTransfer,
    ContractAddress: chain.MagicContactAddressForNative,
    Sender:          acc.Address(),
    Recipient:       recipient,
    Amount:          "1000000000000000",
    Nonce:           "0",
    GasLimit:        "21000",
    GasFeeCap:       "30000000000",
    GasTipCap:       "1500000000",
    IsLegacyTx:      "false",
}, "1")

_ = b.Build()
sig, _ := b.Sign(acc.PrivateKey())
rawTx, _ := b.ConcatSignature(sig, false) // broadcast this with your own RPC layer

A runnable version lives in example/evm.

Architecture

Package Responsibility
chain Shared interfaces (AccountHandler, TxBuilderHandler), constants, shared types, and the struct-tag Validator.
chain/<family> Per-chain account derivation + transaction builder.
crypto Self-contained cryptographic layer (no dependency on chain/): mnemonic generation, keystore, Shamir secret sharing.
crypto/bip, crypto/key BIP-32/39/44 derivation and the ECDSA / Ed25519 / Schnorr / sr25519 signing primitives.

The dependency direction is unidirectional: chain → crypto, with crypto as a self-contained leaf layer. This SDK deliberately stops at the signed transaction. Broadcasting, balance queries, and chain indexing are out of scope — bring your own RPC layer.

Building and testing

go build ./...
go test ./...

Security

This is cryptographic signing software. Please read SECURITY.md before use, and report vulnerabilities privately as described there.

License

Apache License 2.0 — see LICENSE. Portions of this SDK vendor third-party code under their own licenses; see NOTICE.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL