alderconfidential DA on Solana
Core Concepts

Encrypted Blobs

Client-side AES-256-GCM encryption, 32-byte per-blob content keys, envelope wrapping, and zero-plaintext availability guarantees.

Every payload published through Alder is encrypted locally before a single byte is encoded or transmitted. The alder_da Solana program stores only a 32-byte commitment_root, a 32-byte blob_id_hash, and a 32-byte policy_id_hash, while DA nodes store erasure-coded ciphertext cells.

Encryption Construction

@alder/sdk uses Web Crypto (globalThis.crypto.subtle) so the exact same implementation runs in browsers and Node.js 20+:

  1. Key generation: Generates a fresh 32-byte (256-bit) random content key via crypto.getRandomValues(new Uint8Array(32)).
  2. Nonce generation: Generates a fresh 12-byte (96-bit) random IV via crypto.getRandomValues(new Uint8Array(12)).
  3. Authenticated encryption with `blobId` AAD: Encrypts UTF-8 string or raw Uint8Array plaintext with AES-256-GCM, appending a 16-byte authentication tag. When blobId is provided (always set by putPrivateBlob), alder:blob:v1:<blobId> is bound as AES-GCM Additional Authenticated Data (AAD) so ciphertext cannot be re-anchored under another blobId and still decrypt.
  4. Encoding: Returns ciphertext (Uint8Array), contentKeyBase64, nonceBase64, and encryptionAlg: 'AES-256-GCM'.

All client encryption in @alder/sdk and the Alder Studio uses AES-256-GCM (encryptionAlg: 'AES-256-GCM').

Ciphertext Length Framing

Before 2D Reed-Solomon encoding, encodeTcda prepends a 4-byte big-endian unsigned integer (exactLen) holding ciphertext.length to the ciphertext buffer and pads the buffer to k * k * cellSizeBytes, where:

ts
cellSizeBytes = Math.max(32, Math.ceil((ciphertext.length + 4) / (k * k)))

During reconstruction, decodeTcda reads the 4-byte length header and slices flat.slice(4, 4 + exactLen) before passing the exact ciphertext bytes and GCM authentication tag to decryptPayload. Any corrupted or tampered cell that escapes verification fails AES-GCM tag authentication during decryption.

What Leaves the Client

FieldSent to API / DA NodesStored on Solana (BlobRecord)
Plaintext payloadNeverNever
32-byte content key (contentKeyBase64)NeverNever
12-byte IV (nonceBase64)Yes (metadata for reconstruction)No
Coded ciphertext cells (n x n matrix)Yes (dispersed to bonded nodes)No
32-byte commitmentRootYesYes (commitment_root: [u8; 32])
blobId / blob_id_hashYes (blobId string)Yes (SHA-256(blobId))
policyId / policy_id_hashYes (policyId string)Yes (SHA-256(policyId))
IMPORTANT
Because contentKeyBase64 never leaves the publisher's environment, losing the content key (and any wrapped viewing keys) makes the blob permanently unreadable even when 100% of coded cells are available.

Direct Crypto Helpers in @alder/sdk

You can call encryptPayload and decryptPayload independently of the network API:

ts
import { encryptPayload, decryptPayload } from '@alder/sdk'

const encrypted = await encryptPayload('private settlement batch #402')
// encrypted.ciphertext: Uint8Array (plaintext + 16-byte GCM tag)
// encrypted.contentKeyBase64: string (32 random bytes, base64)
// encrypted.nonceBase64: string (12 random bytes, base64)
// encrypted.encryptionAlg: 'AES-256-GCM'

const plainBytes = await decryptPayload(
  encrypted.ciphertext,
  encrypted.contentKeyBase64,
  encrypted.nonceBase64,
)
console.log(new TextDecoder().decode(plainBytes))

Size Limits and Validation

  • alder_da enforces MAX_CELL_BYTES = 512 on chain (payload_size_bytes <= k^2 * 512, AlderError::PayloadTooLargeForK, code 6008), guaranteeing that any single cell plus its Merkle proof fits comfortably inside a Solana transaction for respond_challenge.
  • On chain, anchor_blob enforces payload_size_bytes > 0 (AlderError::InvalidPayloadSize, code 6007).
  • blobId must be 4 to 64 characters matching /^[a-zA-Z0-9_-]+$/.

Next Steps