Designing Wallet Identity Management in Bitcoin SDKs
Research status: Theoretical SDK design. Examples are illustrative and have not been built or tested against the live engine.
Identity is not a session
Treat the wallet identity as distinct from the local engine state that makes it usable. The factory is the creation boundary. A client constructor must not create identities or silently import recovery material. Initialization should be free of irreversible actions. Explicit workflow methods are easier to audit and test.
The published creation interface carries acceptance of a permanent fee policy. A proposed SDK must make the user review and authorize that policy before invoking creation. Do not present an SDK-side checkbox as a new server-side contract. Preserve the actual factory interface and verify its response before promising a typed creation result.
Import and lifecycle
The documented restore request includes identity, authorization key and recovery secret. Removal clears the engine's local wallet records rather than deleting Bitcoin funds. Recovery retrieves sensitive material under key authorization. Expose these operations separately from ordinary receive and balance calls.
// Proposed client types, not a released implementation.
type RestoreInput struct {
ID string `json:"btc_id"`
Key string `json:"btc_key"`
Secret string `json:"btc_secret"`
}
type IdentityState string
const (
Unknown IdentityState = "unknown"
Imported IdentityState = "imported"
LocalRemoved IdentityState = "local_removed"
)These states describe client observations, not a complete list of engine states. A successful import does not by itself demonstrate that balance synchronization is complete. Keep readiness separate from import status.
Operational boundaries
Bind a client to one wallet credential context. Multiple wallet identities require explicit selection and isolated state. Do not cache a recovery secret in ordinary request traces, and never derive identity from an address. A local state removal requires deliberate confirmation, not a cleanup hook invoked when a client closes. Preserve the recovery materials securely before any destructive local test.
Acceptance plan
Use a dedicated test identity to verify import, authorized identity lookup, deliberate removal and restoration. Compare resulting wallet identity and chain observations after synchronization. Test invalid credentials and interrupted restoration separately. Record only redacted outcomes. A recovery test is successful when the expected authorized behavior is observed, not when the secret is printed.
Primary reference
https://thamer.org/api
Related reading in this stage
https://thamer.org/docs/wab-sdk-designing-bitcoin-sdk
https://thamer.org/docs/wab-sdk-api-engine-application-boundaries
https://thamer.org/docs/wab-sdk-cross-language-interfaces
https://thamer.org/docs/wab-sdk-typed-json-contracts
https://thamer.org/docs/wab-sdk-authentication-credential-management
