Sub-Protocols
WalletPair's core protocol handles pairing, encryption, and message transport. It is deliberately network-agnostic — it does not define any blockchain-specific logic.
All chain-specific behavior is defined in sub-protocols, one per blockchain ecosystem. Each sub-protocol specifies methods, events, data encoding, and security requirements for its network.
Architecture
| Layer | Responsibility | Network-Aware? |
|---|---|---|
| Core Protocol | Pairing, key exchange, encryption, transport, relay routing | No |
| Sub-Protocol | Methods, events, account formats, tx signing, data encoding | Yes |
The core protocol only sees opaque JSON payloads inside encrypted messages. The sub-protocol defines the schema of those payloads.
Available Sub-Protocols
| Sub-Protocol | Namespace | CAIP-2 Prefix | Status |
|---|---|---|---|
| EVM | evm | eip155 | Release Candidate |
| Solana | solana | solana | Planned |
| Sui | sui | sui | Planned |
| Bitcoin | bitcoin | bip122 | Planned |
| Tron | tron | tron | Planned |
Cross-Network Differences
Each blockchain ecosystem has fundamentally different primitives. Sub-protocols abstract these differences behind a consistent request/response pattern:
| Aspect | EVM | Solana | Sui | Bitcoin |
|---|---|---|---|---|
| Address format | 0x hex, 20B | base58, 32B | 0x hex, 32B | bech32 / base58check |
| Tx format | RLP / JSON | bincode / base64 | BCS / base64 | PSBT / raw hex |
| Signature | secp256k1, 65B | Ed25519, 64B | Ed25519 / secp256k1 | ECDSA / Schnorr |
| Fee model | gas × gasPrice | priority fee + CU | gas budget (SUI) | sat/vB × weight |
| Nonce model | per-account seq | recent blockhash | per-object seq | UTXO (no nonce) |
Capability Declaration
The wallet declares which sub-protocols it supports via the capabilities.version field during pairing:
{
"capabilities": {
"version": { "evm": 1 },
"methods": ["wallet_getAccounts", "wallet_signMessage", ...],
"events": ["accountsChanged", "chainChanged"],
"chains": ["eip155:1", "eip155:137"]
}
} A wallet that supports multiple ecosystems could declare multiple versions:
{
"capabilities": {
"version": { "evm": 1, "solana": 1 },
"chains": ["eip155:1", "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp"]
}
} Authoring a Sub-Protocol
To add WalletPair support for a new blockchain ecosystem, author a sub-protocol specification covering:
| Topic | What to Define |
|---|---|
| Namespace & version | Identifier (e.g., solana), version integer, CAIP-2 prefix |
| Chain identification | CAIP-2 format, chain ID encoding in params |
| Account identification | Address format, length, checksum, forbidden values |
| Capabilities | Required vs. optional methods, events, chains |
| Data encoding | Binary, integer, address, tx, signature encoding within JSON |
| Methods | Params schema, result schema, validation, user confirmation |
| Events | Data schema, trigger conditions, dApp handling |
| Error codes | Standard + sub-protocol-specific error codes |
| Security requirements | Confirmation UI, blind-sign policy, replay rules |
See the EVM sub-protocol as a reference implementation.