Quickstart
Encrypt, anchor, sample, and reconstruct your first private blob in the Alder Studio or with @alder/sdk.
You can publish and verify an encrypted blob on Alder in two ways: through the browser Studio (/app/publish, /app/sample, /app/vault) or directly from TypeScript using @alder/sdk.
Path 1: Alder Studio
- Open
/app/publishand connect a Solana wallet from the studio bar. - Enter or paste a payload, choose the coding width
k(2..16, default4producing an8 x 8coded matrix of 64 cells), set TCDA retention depthd(1..4, default2), and select a disclosure policy (private,privacy-rings,auditor-scoped, orpublic-audit). - Select Encrypt, Sign & Anchor. The browser generates a 32-byte AES-256-GCM key, encrypts the payload locally, encodes the ciphertext into
n x nGF(256)cells, computes the 32-bytecommitmentRoot, and requests an unsigned v0anchor_blobtransaction fromPOST /v1/blobs/anchor/build. - Sign the transaction in your wallet. The studio submits the signed transaction (
POST /v1/transactions/submit), which verifies the confirmedanchor_blobinstruction on chain and automatically executes on-chainattest_availability, returning bothsignatureandattestationSignature. - Save the local
contentKeyBase64from the receipt, then open/app/sample?blob=<blobId>to fetchBlobRecord.commitment_rootfrom Solana RPC, run a random cell sample (POST /v1/blobs/:id/sample), and verify every cell's Merkle inclusion path locally without exposing plaintext. - Open
/app/vault?blob=<blobId>, pastecontentKeyBase64, and select Reconstruct & Decrypt to fetch coded cells (GET /v1/blobs/:id/cells), run 2D Reed-Solomon decoding, and recover the original payload in the browser.
Path 2: TypeScript (@alder/sdk)
Prerequisites
- Node.js 20+ (or any modern browser with Web Crypto
crypto.subtle) - Access to an Alder API endpoint (default local endpoint:
http://127.0.0.1:42102) - A Solana publisher public key (base58)
1. Create the SDK Client and Publish a Blob
putPrivateBlob handles local AES-256-GCM encryption, GF(256) 2D Reed-Solomon encoding, commitment root calculation, and building the unsigned v0 anchor_blob transaction:
import { createAlderSdk } from '@alder/sdk'
const sdk = createAlderSdk('http://127.0.0.1:42102')
const published = await sdk.putPrivateBlob({
publisher: '<PUBLISHER_BASE58_PUBKEY>',
payload: JSON.stringify({ ringId: 'ring-04', epoch: 1064, noteCount: 12 }),
k: 4,
retentionDepth: 2,
policyId: 'privacy-rings',
expirySlots: 216_000,
})
console.log('blobId:', published.blobId)
console.log('commitmentRoot:', published.commitmentRoot)
console.log('contentKeyBase64:', published.contentKeyBase64)
console.log('unsigned v0 tx:', published.txBuild.transactionBase64)published.contentKeyBase64 securely on the client. Alder never receives or persists the content key.2. Submit and Auto-Attest the Blob
Sign published.txBuild.transactionBase64 with the publisher's Solana wallet and submit it to /v1/transactions/submit. Once anchor_blob confirms on chain, the API verifies the confirmed instruction and automatically executes attest_availability on chain:
const submitted = await sdk.api.submitTransaction({
id: published.txBuild.id,
signedTransactionBase64: '<SIGNED_V0_TX_BASE64>',
})
console.log('status:', submitted.status)
console.log('anchorSignature:', submitted.signature)
console.log('attestationSignature:', submitted.attestationSignature)
console.log('attestationSlot:', submitted.attestationSlot)
console.log('latencyMs:', submitted.attestationLatencyMs)3. Sample Availability Against On-Chain Solana State
Any light client can now read BlobRecord.commitment_root directly from Solana RPC and audit the blob without holding contentKeyBase64:
const { sample, onChainCommitmentRoot, localVerification } = await sdk.sampleAvailability(
published.blobId,
{
matrixSizeN: published.matrix.n,
sampleCount: 16,
rpcUrl: 'http://127.0.0.1:42104',
blobPda: published.txBuild.blobPda!,
},
)
console.log('onChainRoot:', onChainCommitmentRoot)
console.log('valid:', localVerification.valid)
console.log('verifiedCells:', localVerification.verifiedCells)
console.log('confidencePct:', localVerification.confidencePct)
console.log('verifyTimeMs:', localVerification.verifyTimeMs)
console.log('plaintextExposed:', sample.plaintextExposed)4. Reconstruct and Decrypt Locally
Recover the plaintext using either the owner's contentKeyBase64 or a scoped viewing key:
const recovered = await sdk.reconstructBlob(published.blobId, {
contentKeyBase64: published.contentKeyBase64,
})
console.log('cellsUsed:', recovered.cellsUsed)
console.log('plaintext:', recovered.plaintextText)Next Steps
- Understand how TCDA matrices and retention depth work in Tunable Coded Distributed Arrays.
- Learn how to issue auditor keys in Selective Disclosure.
- Inspect every endpoint in REST and SSE API.