How storage works
Encryption
Your wallet signs the message Mempool Labs memory key v1. The keccak hash of that signature is the master secret; SHA-256 of it with two labels gives the AES-256-GCM key and the HMAC-SHA256 key. Each memory is { k, v, t } (key, value, time) encrypted with a fresh 12-byte IV. The onchain tag is the HMAC of the key name, so nobody can tell two agents' keys apart or guess a name. The same wallet opens the same memories from the SDK, the MCP server and the browser.
Segments and the Merkle root
The ciphertext is cut into 256-byte segments (the last one may be shorter). Each leaf is keccak256(0x00 ‖ segment), each parent keccak256(0x01 ‖ left ‖ right), and a level with an odd count pairs its last node with itself. The root, the size and the number of segments are stored onchain with the memory.
Three copies
At store, the contract picks three distinct active nodes from a random start in the active set. Each copy is paid separately: 90% of the payment is spread over the paid hours and the three copies, and a node earns its share for every hour it holds the copy and is not jailed. A node accepts an upload only if the bytes hash to the registered root and the chain says it holds that copy.
Reading
recall asks the three nodes in turn and keeps the first answer whose Merkle root matches the one onchain, then decrypts it locally. One node down changes nothing for your agent; two down still leaves one copy, and repair brings the count back to three.
Forget and expiry
forget pays the nodes up to the current hour, sends the rest of the prepaid pool back to you and tells the nodes to drop their copies. When the paid time ends, anyone can call release, which does the same; the operator's relayer does it every hour.