alderconfidential DA on Solana
Getting Started

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

  1. Open /app/publish and connect a Solana wallet from the studio bar.
  2. Enter or paste a payload, choose the coding width k (2..16, default 4 producing an 8 x 8 coded matrix of 64 cells), set TCDA retention depth d (1..4, default 2), and select a disclosure policy (private, privacy-rings, auditor-scoped, or public-audit).
  3. Select Encrypt, Sign & Anchor. The browser generates a 32-byte AES-256-GCM key, encrypts the payload locally, encodes the ciphertext into n x n GF(256) cells, computes the 32-byte commitmentRoot, and requests an unsigned v0 anchor_blob transaction from POST /v1/blobs/anchor/build.
  4. Sign the transaction in your wallet. The studio submits the signed transaction (POST /v1/transactions/submit), which verifies the confirmed anchor_blob instruction on chain and automatically executes on-chain attest_availability, returning both signature and attestationSignature.
  5. Save the local contentKeyBase64 from the receipt, then open /app/sample?blob=<blobId> to fetch BlobRecord.commitment_root from Solana RPC, run a random cell sample (POST /v1/blobs/:id/sample), and verify every cell's Merkle inclusion path locally without exposing plaintext.
  6. Open /app/vault?blob=<blobId>, paste contentKeyBase64, 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:

ts
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)
TIP
Store 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:

ts
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:

ts
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:

ts
const recovered = await sdk.reconstructBlob(published.blobId, {
  contentKeyBase64: published.contentKeyBase64,
})

console.log('cellsUsed:', recovered.cellsUsed)
console.log('plaintext:', recovered.plaintextText)

Next Steps