alderconfidential DA on Solana
Core Concepts

Viewing Keys and Privacy Rings

Asymmetric X25519 viewing-key envelopes, disclosure policies, and composability with Solana Privacy Rings.

Confidential applications on Solana often need to prove compliance to an auditor, regulator, or counterparty without exposing encrypted state to DA nodes or the public ledger. Alder supports selective disclosure through disclosure policies and asymmetrically encrypted viewing-key envelopes (X25519 + HKDF-SHA256 + AES-256-GCM) that reveal zero bits of the content key without the auditor's private key.

Disclosure Policies

Every BlobRecord carries a policyId string in the API and its 32-byte SHA-256 hash (policy_id_hash) on chain. The contract defines four policy kinds (PolicyKindValues in @alder/contract):

Policy IDIntended Use
privateOwner-only encrypted blobs; no viewing keys issued by default
privacy-ringsEncrypted UTXO state diffs and compliance ring envelopes bound to Solana Privacy Rings
auditor-scopedInstitutional or regulated payloads configured for named auditor viewing-key envelopes
public-auditBlobs whose viewing keys are published to designated public audit verifiers

Custom policy strings up to 64 characters are also accepted by AnchorBlobBuildRequest.policyId and hashed to policy_id_hash on chain.

Asymmetric X25519 Viewing-Key Wrapping (v2)

@alder/sdk implements asymmetric viewing-key wrapping in generateAuditorKeypair, wrapViewingKey, and unwrapViewingKey (backend/packages/sdk/src/crypto.ts):

  1. Auditor keypair: The auditor calls generateAuditorKeypair(), which generates a Web Crypto X25519 keypair. The auditor shares the 32-byte raw public key (publicKeyBase64) with publishers and keeps the PKCS8 private key (privateKeyBase64) strictly on their own device.
  2. Ephemeral X25519 ECDH: To grant access, the publisher generates a fresh ephemeral X25519 keypair and computes a 256-bit shared secret via ECDH against auditorX25519PubkeyBase64.
  3. HKDF-SHA256 key derivation: Derives a 256-bit AES-GCM wrapping key bound to the ephemeral public key (salt) and context info:
text
   info = "alder:viewing-key:x25519:v2:" || blobId || ":" || scope
  1. AES-256-GCM key wrap: Encrypts the 32-byte blob content key with a random 12-byte IV, producing a 48-byte ciphertext + tag.
  2. 93-byte envelope layout: Packs [version=2 (1B) | ephemeralX25519Pub (32B) | iv (12B) | ciphertext+tag (48B)] into wrappedKeyBase64.
  3. Envelope registration: grantViewingKey posts { issuer, auditorPubkey, scope, wrappedKeyBase64, expiresAt } to POST /v1/blobs/:id/viewing-keys, returning a ViewingKeyEnvelope record.
IMPORTANT
Because wrappedKeyBase64 is encrypted with ephemeral X25519 ECDH to the auditor's public key, storing or reading the envelope publicly on GET /v1/blobs/:id/viewing-keys exposes zero bits of the content key. Only the holder of the auditor's X25519 private key can unwrap it.

Auditor Decryption

An auditor holding auditorPrivateKeyBase64 calls sdk.reconstructBlob(blobId, { wrappedKeyBase64, auditorPrivateKeyBase64, scope }) or opens /app/vault:

  1. Fetches coded cells from GET /v1/blobs/:id/cells.
  2. Reconstructs the ciphertext locally via decodeTcda.
  3. Extracts the ephemeral X25519 public key and IV from the 93-byte v2 envelope, runs ECDH with auditorPrivateKeyBase64, derives the HKDF-SHA256 wrap key for (blobId, scope), and decrypts the 32-byte content key via unwrapViewingKey.
  4. Decrypts the blob ciphertext locally via decryptPayload.

If the auditor supplies the wrong private key, a mismatched blobId or scope, or a tampered envelope, AES-GCM authentication fails immediately on the client.

Solana Privacy Rings Composability

Solana Privacy Rings (live on mainnet November 2026) keeps encrypted token balances and custom compliance rings composable on chain. Applications using Privacy Rings can:

  • Set policyId: 'privacy-rings' when calling putPrivateBlob to bind encrypted state diffs, ring proofs, or settlement memos to a Privacy Ring workflow.
  • Anchor only the 32-byte commitment_root in BlobRecord (223 bytes) on Solana instead of paying L1 rent for raw ciphertext bytes.
  • Issue time-bounded X25519 viewing-key envelopes (expiresAt ISO-8601 UTC timestamp) to ring compliance auditors who verify availability in /app/sample and decrypt in /app/vault.

Next Steps