Message format
This page is normative: the app, the CLI and the program encode exactly these bytes.
All integers are little-endian, except inside LMS, which uses RFC 8554's big-endian encoding. Every length is fixed. A decoder rejects unknown tags, wrong lengths, zero amounts and trailing bytes.
#Signature scheme
| LMS type | LMS_SHA256_M32_H10 (6): 1,024 leaves |
| LM-OTS type | LMOTS_SHA256_N32_W4 (3): n = 32, w = 4, p = 67 |
| Signature | 2,508 bytes, RFC 8554 §5.4 |
| Root | 48 bytes: identifier I (16) ‖ Merkle top T[1] (32) |
#Key derivation
seed64 = BIP-39 seed of the 24 words (no passphrase)
binding = options (epoch 0) | vault_id (epoch ≥ 1)
info = "epoch" ‖ u32le(epoch) ‖ u8(network) ‖ program (32) ‖ binding
okm = HKDF-SHA256(ikm = seed64, salt = "HASHVAULT/LMS/v1", info, 48)
SEED, I = okm[0..32], okm[32..48]
#Identity and addresses
options = u8(1) ‖ u8(has_cosigner) ‖ [cosigner (32)]
vault_id = SHA-256("HASHVAULT/vault-id/v1" ‖ root_0 ‖ options)
state = PDA(["state", vault_id])
vault = PDA(["vault", state]) the address that holds assets
buffer = PDA(["sig", state, payer, u32le(epoch), u32le(leaf)])
Network ids: 1 localnet, 2 devnet, 3 testnet, 4 mainnet.
#The signed message
"HASHVAULT-v1" (12) ‖ network u8 ‖ program (32) ‖ kind u8 ‖ state (32) ‖ epoch u32 ‖ leaf u32 ‖ payload
Kinds: 1 withdraw (execute), 2 rotate, 3 close. The prefix is 86 bytes.
#Execute payload
count u8 (1..8) followed by the actions:
| Tag | Action | Fields | Size |
|---|---|---|---|
0x01 | Send SOL | to (32) ‖ lamports u64 | 41 |
0x02 | Send token | mint (32) ‖ token program (32) ‖ destination token account (32) ‖ amount u64 | 105 |
0x03 | Close token account | mint (32) ‖ token program (32) ‖ rent to (32) | 97 |
The token program is SPL Token or Token-2022, nothing else.
#Rotate payload
The next key's 48-byte root. It must differ from the current one.
#Close payload
The 32-byte address that receives the rent.
#Leaf rules
next_leaf ≤ leaf < 1,024, then next_leaf = leaf + 1. Leaf 1,023 only for a rotation.