Avail’s core innovation is its data availability layer built on Kate polynomial commitments (also known as KZG commitments). This enables light clients to verify data availability through efficient random sampling without downloading entire blocks.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/availproject/avail/llms.txt
Use this file to discover all available pages before exploring further.
Overview
The data availability layer ensures that block data is available and can be retrieved, even if you don’t download the entire block. This is critical for:- Rollups: Publishing transaction data to Avail
- Validiums: Storing data off-chain with DA guarantees
- Light Clients: Verifying data availability without full nodes
- Modular Blockchains: Separating data availability from execution
Data Matrix Construction
Extrinsic to Matrix Transformation
Transactions are arranged into a 2D matrix for erasure coding (runtime/src/kate/native.rs:27-54):
Arrange into Grid
Extrinsics are serialized and placed into the matrix cell-by-cell:
runtime/src/kate/native.rs:39-41
Cell Structure
Each cell in the matrix contains:- Original Cells: Actual transaction data (first 50% of columns)
- Extended Cells: Erasure-coded redundancy (second 50% of columns)
- Cell Size: 31 bytes per cell (fits in a BLS12-381 scalar field element)
The chunk size is 32 bytes, but only 31 bytes are used for data to ensure the value fits within the scalar field:
BLOCK_CHUNK_SIZE = 32Kate Polynomial Commitments
Kate commitments are KZG (Kate-Zaverucha-Goldberg) polynomial commitments over the BLS12-381 elliptic curve.How It Works
Polynomial Commitment Basics
Polynomial Commitment Basics
Step 1: Interpolate PolynomialEach row of the matrix is interpolated as a polynomial:Step 2: Commit to PolynomialUsing a trusted setup SRS (Structured Reference String), compute:where τ is a secret value from the trusted setup, and G is a generator point.Step 3: Generate ProofsFor any cell at position i, create a proof:Step 4: VerifyAnyone can verify that a cell value v is correct at position i:using elliptic curve pairings.
Implementation
The Kate implementation uses thekate crate with runtime interfaces (runtime/src/kate/native.rs):
Proof Types
Avail supports two proof types:- Single Cell Proof
- Multiproof
GDataProof: Proves a single cell’s correctness
runtime/src/kate/mod.rs:24
- GRawScalar: The 256-bit cell value (U256)
- GProof: 48-byte KZG proof
Header Extension
The Kate commitment is stored in the block header extension (avail_core::header::HeaderExtension).
Extension Builder
The runtime API builds header extensions (runtime/src/apis.rs:49-60):
runtime/src/apis.rs
Extension Contents
TheHeaderExtension contains:
- Commitments: Kate commitments for each row
- Data Root: Merkle root of all extrinsics
- Dimensions: Matrix rows and columns
- App Lookup: Mapping of AppId to row ranges
The header extension is verified during block import (
node/src/da_block_import.rs:81-111), ensuring blocks without valid commitments are rejected.Data Availability Sampling
Light clients perform Data Availability Sampling (DAS) to gain confidence that data is available:Sampling Process
Random Cell Selection
Light client randomly selects N cells from the extended matrix (e.g., 16 cells).
Reconstruction Guarantee
Due to 2x erasure coding:- If >50% of cells are available, the full block can be reconstructed
- Light clients gain high confidence with just a few samples
- No need to download the entire block
Example: A 256×512 matrix has 131,072 cells. A light client only needs to sample ~20 cells (0.015% of the block) to achieve 99.9999% confidence that the block is available.
Application-Specific Data Retrieval
Avail supports multiple applications submitting data to the same block, each identified by anAppId.
AppId System
Applications register keys through theda_control pallet (pallets/dactr/src/lib.rs:158-178):
Data Submission
Applications submit data with an implicit or explicit AppId:pallets/dactr/src/lib.rs:186-200
CheckAppId extension extracts the AppId from the transaction for matrix placement.
App Data Retrieval
Clients can retrieve only their application’s data using the Kate API (runtime/src/kate/native.rs:141-168):
- Download only their own data rows
- Avoid downloading unrelated application data
- Verify data integrity with Kate proofs
Block Length Dynamics
The matrix dimensions can be adjusted via governance (pallets/dactr/src/lib.rs:204-254):
Dimension Constraints
Data Root Calculation
In addition to Kate commitments, Avail computes a data root - a Merkle root of all extrinsics. This provides:- Fast inclusion proofs for specific transactions
- Compatibility with standard Merkle proof systems
- Additional data integrity verification
Security Guarantees
Data Availability Guarantee
Honest Majority
As long as >50% of validators are honest, data availability is guaranteed
Erasure Coding
50% of cells are sufficient to reconstruct the full block
Cryptographic Proofs
Kate proofs are cryptographically binding and verifiable
Sampling Confidence
Light clients achieve >99.99% confidence with minimal samples
Attack Resistance
Block Withholding Attack
Block Withholding Attack
Attack: Block producer creates invalid erasure coding or withholds dataDefense:
- Header extension verification during block import ensures valid commitments
- Light clients detect unavailable data through sampling failures
- Validators download and verify random cells before voting
- Invalid blocks are rejected by GRANDPA consensus
Data Withholding After Finality
Data Withholding After Finality
Attack: Validators finalize a block, then all collude to delete dataDefense:
- Honest minority (even 1 node) can store and redistribute full block
- Economic incentives: archival nodes earn fees for serving data
- Redundancy: 2x erasure coding means multiple copies exist
- Slashing: Provable data unavailability results in validator slashing
Performance Characteristics
Proof Generation
- Single Proof: ~1-5ms per cell (parallel generation)
- Multiproof (1024 cells): ~50-100ms
- Full Block Commitment: ~100-500ms depending on size
Proof Size
- Single Proof: 48 bytes (constant)
- Multiproof: 48 bytes + (32 bytes × number of cells)
- Header Extension: ~10-50 KB depending on block size
Verification
- Single Proof Verification: ~2-10ms
- Multiproof Verification: ~5-15ms (amortized cost)
- Light Client Sampling (20 cells): ~50-200ms total
RPC API for Data Availability
The Kate RPC provides access to DA proofs (runtime/src/apis.rs:68-73):
--enable-kate-rpc flag.
Next Steps
Architecture Overview
Understanding the overall system architecture
Runtime Architecture
Deep dive into runtime pallets
Consensus
Learn about BABE and GRANDPA