alderconfidential DA on Solana
Guides

Run a DAS Light Client

Sample random ciphertext cells, verify Polynomial Multiproofs locally in browser or Node.js, and open on-chain challenges on missing cells.

Any browser tab, wallet, or Node.js service can audit an Alder blob's availability without holding the decryption key. This guide walks through blinded sampling, local Polynomial Multiproof verification, live SSE monitoring, and opening an on-chain missing-cell challenge when a DA node drops a cell.

1. Sample and Verify Against On-Chain Solana State

Pass matrixSizeN plus either rpcUrl and blobPda (to read BlobRecord.commitment_root directly from Solana RPC via fetchOnChainBlobCommitmentRoot) or an explicit expectedCommitmentRoot you already read from Solana:

ts
import { createAlderSdk } from '@alder/sdk'

const sdk = createAlderSdk('http://127.0.0.1:42102')

const blob = await sdk.api.getBlob(blobId)

const { sample, onChainCommitmentRoot, onChainSlot, localVerification } =
  await sdk.sampleAvailability(blob.id, {
    matrixSizeN: blob.n,
    sampleCount: 16,
    rpcUrl: 'http://127.0.0.1:42104', // or your Solana mainnet RPC URL
    blobPda: blob.blobPda,
  })

if (!localVerification.valid) {
  console.error('Sampling failed:', localVerification.reason)
  console.error('Missing cells:', sample.missingCells)
} else {
  console.log({
    onChainCommitmentRoot,
    onChainSlot,
    verifiedCells: localVerification.verifiedCells,
    confidencePct: localVerification.confidencePct, // 99.00 for 16 cells, 99.99 for 32+
    verifyTimeMs: localVerification.verifyTimeMs,
    proofSizeBytes: sample.multiproof.proofSizeBytes,
    plaintextExposed: sample.plaintextExposed,       // always false
  })
}

What verifyMultiproof Checks

  1. expectedCommitmentRoot is an explicit 64-character hex on-chain root (never falls back to the server's root) and matches sample.multiproof.commitmentRoot.
  2. Every cell coordinate is within 0..n-1, with zero duplicate (row, col) replays, exact merkleIndex === row * n + col, and exact Merkle depth ceil(log2(n * n)).
  3. Every cell's SHA-256("alder:cell:v1:<row>:<col>:" || data) matches cell.cellHash, and merklePath hashes up to expectedCommitmentRoot.
  4. Every client-requested coordinate in expectedCoordinates is present in sample.sampledCells.
  5. Recomputed challengeScalarHex, aggregatedEvalHex, and proofDigestHex match sample.multiproof byte for byte.
  6. sample.missingCells.length === 0 and failedCells === 0.

2. Sampling Specific Coordinates

To sample deterministic coordinates instead of random ones, call sdk.api.sampleBlob directly and pass the response into verifyMultiproof:

ts
import { createAlderSdk, verifyMultiproof } from '@alder/sdk'

const sdk = createAlderSdk('http://127.0.0.1:42102')

const sample = await sdk.api.sampleBlob(blobId, {
  sampleCount: 4,
  coordinates: [
    { row: 0, col: 0 },
    { row: 3, col: 5 },
    { row: 6, col: 2 },
    { row: 7, col: 7 },
  ],
  blindedSalt: 'a1b2c3d4e5f60718293a4b5c',
})

const result = await verifyMultiproof(sample, expectedCommitmentRoot)
console.log(result.valid, result.verifiedCells)

3. Open an On-Chain Challenge on a Missing Cell

When a DA node fails to answer a cell query, sample.missingCells lists each dropped cell with { row, col, expectedNode, reason }. Any wallet can open a missing-cell challenge on alder_da to force custody proof or earn 50% of the node's slash bounty:

ts
if (sample.missingCells.length > 0) {
  const dropped = sample.missingCells[0]!

  const challengeTx = await sdk.api.buildOpenChallenge({
    challenger: verifierPubkeyBase58,
    blobId,
    nodeOperator: dropped.expectedNode,
    row: dropped.row,
    col: dropped.col,
  })

  // Sign challengeTx.transactionBase64 with verifier wallet, then submit:
  const submitted = await sdk.api.submitTransaction({
    id: challengeTx.id,
    signedTransactionBase64: signedBase64,
  })

  console.log('Challenge PDA:', challengeTx.challengePda, 'sig:', submitted.signature)
}

If the challenged node does not call respond_challenge before deadline_slot, any caller can trigger slash_node via sdk.api.buildSlashNode(challengeId, { caller: callerPubkeyBase58 }).

4. Stream Live Sampling Telemetry (SSE)

Subscribe to /v1/events to observe blob.attested, sample.verified, and challenge.opened events in real time:

ts
const events = new EventSource(sdk.api.eventsUrl(blobId))

events.addEventListener('sample.verified', (event) => {
  const payload = JSON.parse((event as MessageEvent).data)
  console.log('Sample verified:', payload)
})

events.addEventListener('challenge.opened', (event) => {
  const payload = JSON.parse((event as MessageEvent).data)
  console.log('Challenge opened:', payload)
})

Next Steps