Seedelf-Wallet

Seedelf Messaging v1: the construction

How a message is encrypted to a re-randomized Seedelf register, and how its recipient finds and reads it. security.md covers what this guarantees and what it doesn’t.

1. Notation

2. Registers

A recipient with secret y has a register R = (g, v) with v = [y]g. A root register has g = G. A Seedelf datum’s g is itself a re-randomized point, and nothing below needs g = G.

Re-randomization. Anyone holding R picks a nonzero scalar b and forms

(p, w) = ([b]g, [b]v).

Then w = [b][y]g = [y]p. The relation holds with the same y, and no secret was needed to make the new register. Both points must use the same b: (p, [b′]v) with b′ ≠ b is no one’s register.

Matching. The recipient tests [y]p = w. That’s one G1 scalar multiplication and a comparison, with no pairing. An envelope carries p and a tag of w, not w (§4): its recipient computes w = [y]p and compares tags.

Unlinkability. Deciding whether (p, w) re-randomizes (g, v) means deciding whether (g, v, p, w) is a Diffie–Hellman tuple. That’s the DDH problem in G1. BLS12-381 is a type-3 pairing: there’s no efficient map from G1 to G2, and a pairing can only test a G1 tuple against a G2 point that carries y. So DDH in G1 is believed hard (the XDH assumption), and Seedelf’s on-chain registers already rely on it. It holds only while no [y]h for a G2 point h is public: with one, anyone could test e(p, [y]h) = e(w, h). An envelope shows less than (p, w): p and a hash of w, which anyone holding w could compute, so it gives a distinguisher nothing (p, w) wouldn’t.

3. Why there is no pairing

An earlier idea borrowed PEACE’s capsule: C₁ = [r]p, C₂ = [a]p + [r]w, and the key e([a]p, h₀), which the recipient recovers as e(C₂, h₀) − e(C₁, [y]h₀). The identity holds, but by bilinearity that’s e(C₂ − [y]C₁, h₀), and C₂ − [y]C₁ = [a]p. So for one recipient it is ElGamal on the point [a]p with a pairing on top. The pairing adds no secrecy, costs a fourth point, needs a GT byte encoding no standard fixes, and needs [y]h₀ kept secret. It only earns its place with PEACE’s transfer of decryption rights, which messaging doesn’t use. v1 is plain ECIES on the register (the owner, 2026-11-20).

4. v1: ECIES on a re-randomized register

4.1 Encrypt

Input: the recipient’s register R = (g, v), checked as in §4.4, and a plaintext m of at most 65,536 bytes.

  1. Draw nonzero scalars b and r from the operating system’s generator. The session layer derives both from the message key and the ratchet salt instead (protocol.md §16.2).
  2. p = [b]g, w = [b]v.
  3. c = [r]p, the ephemeral point.
  4. z = [r]w, the shared point.
  5. tag = SHA-256(Seedelf-Messaging|v1|envelope|tag ‖ w), 32 bytes.
  6. H = 0x01 ‖ p ‖ tag ‖ c, the 129-byte header. w itself is in no byte of the envelope.
  7. key ‖ nonce = HKDF-SHA256(salt = Seedelf-Messaging|v1|HKDF-SHA256|salt, ikm = z, info = Seedelf-Messaging|v1|AES-256-GCM|key|nonce ‖ H, 44 bytes). The key is 32 bytes and the nonce 12.
  8. ct = AES-256-GCM(key, nonce, aad = H, m): the ciphertext and AES-GCM’s 16-byte tag.
  9. The envelope is H ‖ ct:

    0x01 | p (48) | tag (32) | c (48) | AES-256-GCM ciphertext | AES-GCM's tag (16)
    

4.2 Decrypt

With the secret y:

  1. Scan (matches_envelope): the version is 1, the length is 145 to 145 + 65,536 bytes, and p is canonical, in G1 and not O. Then w′ = [y]p, and unless SHA-256(Seedelf-Messaging|v1|envelope|tag ‖ w′) is the tag, compared in constant time, the envelope isn’t theirs, and c is never looked at.
  2. Parse (Envelope::from_bytes): c is checked as p was. y never touches a point that hasn’t been checked. The tag is any 32 bytes: only the scan judges it.
  3. Shared point: z = [y]c.
  4. Open: derive the key and nonce from z and H, then open with aad = H. A failure releases nothing.

Correctness: [y]p = [y][b]g = [b]v = w, so the tags agree, and [y]c = [y][r]p = [r][y]p = [r]w = z.

4.3 What is bound, and why

The whole header goes into both HKDF’s info and the AEAD’s associated data:

Either binding alone protects integrity. Both cost nothing, and each layer stays sound on its own.

Why a tag, and not w. (p, w) is a register of the recipient’s key, and a Seedelf wallet treats every register of its key as its own: it counts a payment at the Seedelf contract, or a Lovejoin box, under one as received, and spends it. An envelope carrying w handed whoever read the pool a register to pay: under (p, w), to follow its reader into whatever the spend joins; under (p + g_S, w + v_S), to learn whether it was for the Seedelf S; under the sum of two envelopes’ registers, to learn whether they share a reader. The spend answered on chain (the gate review’s chain-reaction#1). With the tag:

A conversation’s own registers are the session layer’s matter: protocol.md §2.

The nonce is derived, not sent. Each envelope has a fresh r, so a fresh c and z, so a fresh key, and a nonce is used once under it. A repeat would need r to repeat, a broken generator that breaks everything else too. In the session layer r comes from the message key and the salt, so a repeat needs a rolled-back state and a repeated salt (protocol.md §4.2). Deriving the nonce saves 12 bytes.

Domain separation:

4.4 Encodings

4.5 Test vectors

tests/vectors/messaging_v1.json has four cases: empty, ASCII, every byte value under a re-randomized root generator, and UTF-8. Each gives every intermediate value: y, the root register, b, r, (p, w), the tag, c, z, the key, the nonce, the header and the envelope. The file names w; the envelope doesn’t hold it.

4.6 Cost

The envelope is 145 bytes plus the plaintext.

Operation Work
Encrypt Four G1 scalar multiplications and a SHA-256
Scan One subgroup check, one scalar multiplication and a SHA-256
Open a match The full parse’s two subgroup checks, then two scalar multiplications: discovery again, then [y]c