Block data acquisition and availability
Celestia nodes follow trusted headers, obtain the extended data square (EDS) named by each header, retrieve shares when needed, and decide if block data is available. Bridge nodes build and serve data from Core, while light nodes use headers and selected shares to check availability without holding every full square.
System boundary
Block data work joins four concerns: a trusted header, the EDS committed by that header, access to its shares, and an availability result. The data-availability header (DAH) binds the square to the header, so a node can check data from local storage or a peer before it uses that data. Core chain data access covers the Core boundary. Header synchronization covers header validation and propagation.
Header and data-square relationship
The Core path receives a signed block and builds its EDS from the transaction data. It creates an extended header with the DAH and stores the square when the node's retention policy allows it. If Core does not have the block, the node can obtain the extended header from peers and leave EDS retrieval to data-availability sampling. This separation lets header progress continue while data arrives through a later retrieval path.
References: core/exchange.go• L166-227 core/exchange.go• L244-308 header/header.go• L32-69
Empty block data
An empty block still has a data square and a data root. The system uses one canonical minimum square made from tail-padding shares. This keeps empty blocks distinct from missing block data and gives all node roles the same root to verify.
References: share/empty.go• L13-29 share/empty.go• L43-66 share/…/add.go• L18-26
Data lifecycle
The flow below shows how a block becomes a trusted header, how a node selects a data source, and how it reports availability.
flowchart LR
A[Core block or network header] --> B[Extended header with DAH]
B --> C{Node role}
C -->|Bridge| D[Build and store EDS]
C -->|Light| E[Request selected shares]
D --> F[Serve shares to peers]
E --> G[Verify shares against DAH]
D --> H[Full availability]
G --> I[Light availability]
H --> J[Availability result]
I --> J
References: core/exchange.go• L180-205 core/exchange.go• L268-289 share/…/testing.go• L39-87 share/…/sample.go• L137-161
Header following
Headers are the control plane for block data. A node must know the chain, verify the header and its DAH, and keep a usable header range before it can request or sample data at a height.
Core block intake
Bridge nodes follow Core block events and fetch signed blocks by height or hash. The Core exchange turns each block into an extended header and EDS, checks the expected chain and header identity, and stores the EDS under the configured retention policy. Header range requests fetch heights in parallel and return the largest contiguous prefix when a later height is unavailable. This lets callers keep useful progress without treating a missing chain tip as a complete failure.
The range contract is exclusive at to: it serves heights after from and before to. The exchange rejects a range where from is at or above to before it calculates the request size. This prevents an invalid upstream range from wrapping an unsigned size into a large allocation.
References: core/exchange.go• L76-164 core/exchange.go• L166-205 core/exchange_test.go• L21-43 core/exchange_partial_test.go• L37-73
Network header synchronization
Light nodes use the header network to follow the chain without receiving every block from Core. Header synchronization validates adjacent headers and exposes the local head, network head, tail, height lookups, and subscriptions that data retrieval and sampling need. The tail is the lowest retained height. Below it, header and normal share requests are not available through the running node.
References: nodebuilder/…/module.go• L25-49 nodebuilder/…/module.go• L64-110 nodebuilder/…/header.go• L16-53
EDS and share access
The data plane exposes an EDS at several levels. Callers can ask for a full square, a row, a coordinate, a namespace, or a range. Each form uses the header's DAH to select the block and verify that the returned data belongs to it.
The accessor contract also covers partial storage. An ODS-only source can serve original data but reports unavailable for parity-only positions instead of silently reconstructing them. Access remains safe for concurrent sample and share requests.
Getter path
The share getter is the common access boundary for local and remote data. A bridge tries its local EDS store first, then may use Share Exchange for data that was pruned. A light node uses the enabled network getters. The cascade tries sources in order and stops after a successful verified response.
Share Exchange routes recent headers to full peers and older headers to archival peers. It retries another peer when a request times out, finds no data, or meets a temporarily busy peer. Only verified transfers improve peer selection. Share retrieval protocols describes the peer paths and proof-backed response forms.
The EDS access path may retain recently used axes and their proof data to reduce repeated reads. The cache has a fixed memory budget and rebuilds evicted entries on demand. Remote request volume therefore does not create unbounded local state.
References: nodebuilder/…/constructors.go• L17-64 nodebuilder/…/share.go• L17-75 share/…/testing.go• L41-95 share/…/testing.go• L172-243 share/…/proofs_cache.go• L28-44 share/…/proofs_cache.go• L128-151 share/…/proofs_cache.go• L363-375 share/…/cascade.go• L30-43 share/…/cascade.go• L148-218
Square reconstruction
Square reconstruction turns partial, trusted share input into a complete EDS. The retriever requests quadrant data in stages and repairs the square when enough cells arrive. If the recovered data cannot match the committed row and column roots, the operation reports Byzantine data instead of presenting an untrusted square as available.
The EDS import path accepts row-major original shares from a stream. It permits the stream to stop only between shares and fills the rest with canonical tail-padding shares. An accepted stream must reproduce the committed square exactly, including that padding.
References: share/…/retriever.go• L54-103 share/…/retriever.go• L170-197 share/…/retriever.go• L224-331 share/…/rsmt2d.go• L181-198
Share Exchange and peer roles
Share Exchange is the peer protocol for serving and requesting EDS data and share proofs. A requester uses full peers for data in the normal availability window and archival peers for older data. A bridge advertises data-serving capability and can serve its retained square. A light node consumes these services.
The peer manager treats a data-root announcement as trusted for retrieval only after a matching extended header validates the data root. Before that match, it allows only a bounded number of provisional pools per peer. Requests prefer a matching data-root peer and fall back to discovery when needed. Share retrieval protocols describes this boundary in more detail.
The serving boundary also protects the node from costly or incomplete transfers. It validates each request, limits peer and stream resource use, reserves memory for the expected response, and reports missing data separately from internal store or stream errors. A source that stores only the original square returns not found for parity-only rows so the requester can try another peer.
References: share/…/request.go• L13-32 share/…/server.go• L28-46 share/…/server.go• L106-169 share/…/server.go• L172-280 share/…/exchange_test.go• L75-115 share/…/manager.go• L44-58 share/…/manager.go• L235-281 share/…/manager.go• L546-642
Verified retrieval forms
Remote responses are checked against the DAH before the getter returns them. A coordinate request returns one share with a proof. A row request can carry one half of a row because the other half can be recovered and checked. A namespace request returns only shares for that namespace with an inclusion or absence proof. A range request returns a rectangular part of the original data square with checks for incomplete edge rows.
Sample results keep the same positions as the requested coordinates. Their proof type and proof bounds must also match the requested row or column, so a peer cannot replace a requested coordinate with another valid share from the same axis. This lets callers use successful samples even when another peer request fails. Namespace and range streams must reproduce the requested original shares after their proofs pass.
References: share/…/sample.go• L27-33 share/…/sample.go• L137-165 share/…/sample_test.go• L81-108 share/…/row.go• L80-177 share/…/row_namespace_data.go• L104-155 share/…/range_namespace_data.go• L143-289
Availability decisions
Availability answers the question, “Can this node retrieve enough data committed by this header?” It is not the same as header validity. The light path samples selected shares, while the full path obtains enough data to rebuild and retain the square.
Light-node sampling
Light availability samples shares at random and verifies each result against the DAH. The default target is 16 samples. A light node can make a local availability check without downloading the full square. Sample progress is stored by data root, so later runs retry only unfinished coordinates. Data-availability sampling explains worker scheduling, checkpoints, retry behavior, and sampling statistics.
Each sampling job gets a deadline that includes a fixed setup allowance and a size-based allowance for the original data square. A slow or unavailable peer therefore fails one height for retry instead of holding the whole sampling worker indefinitely.
References: share/…/options.go• L7-27 share/…/availability.go• L76-183 das/worker.go• L18-26 das/worker.go• L83-117 das/worker.go• L120-181
Bridge-node reconstruction
Bridge availability requests a complete EDS and stores enough of it to support later access. Within the storage window it keeps the original data square and its extended quadrant. An archival bridge can keep the original square for older data. A non-archival bridge does not keep the old block. An already stored height is treated as available without rebuilding the square.
References: share/…/availability.go• L27-36 share/…/availability.go• L57-109 core/eds.go• L14-38
Availability window
The availability window aligns sampling, peer selection, header routing, and storage policy. The default sampling and request window is seven days. Storage allows one extra hour. A zero window disables the age check. Operators can override the window with CELESTIA_OVERRIDE_AVAILABILITY_WINDOW, so one setting affects both what a node requests and what it retains.
References: share/…/window.go• L12-20 share/…/window.go• L28-53 share/…/shrex.go• L388-396 core/routing_exchange.go• L14-25 core/routing_exchange.go• L79-145
DAS coordination
Data availability sampling (DAS) applies the availability policy to a stream of headers. It starts from the retained header tail and the latest known head, samples the gap, then reacts to new headers and retries failed heights.
Sampling progression
The DASer subscribes to new extended headers and gives them to a sampling coordinator. The coordinator runs bounded work for catch-up, recent headers, and retries. It records failed heights with backoff and reports whether all known headers have been sampled. DAS reports the network head, sampled chain head, head lag, worker use, latest sample time, and failure state.
References: das/daser.go• L20-29 das/daser.go• L71-94 das/coordinator.go• L60-153 das/worker.go• L120-181 das/metrics.go• L36-145
Restart and retention state
The DASer saves a checkpoint with its sampling position, network head, failed heights, and unfinished catch-up work. On restart it raises old positions to the current header tail and resumes only work that still has meaning. This keeps sampling progress consistent with header and data retention.
References: das/daser.go• L97-152 das/checkpoint.go• L7-41 das/state.go• L65-75 das/restart_catchup_test.go• L44-80
Node-role boundaries
The node builder selects the data source and availability policy from the node role. This separation lets a bridge ingest and serve block data while a light node follows headers and checks availability with a smaller local footprint.
Bridge role
A bridge connects Core to the data-availability network. It constructs and stores EDS data from Core blocks, serves retained data over Share Exchange, and uses full availability to recover data that is not already local. A pruned bridge can use network getters after local data ages out.
References: nodebuilder/…/type.go• L21-29 nodebuilder/…/module.go• L36-99 nodebuilder/…/module.go• L44-60 nodebuilder/…/module.go• L221-233
Light role
A light node follows headers over the header network and obtains only the shares needed for requests or sampling. It uses light availability and does not need to retain complete EDS data to check availability. Its getter discovers full peers and uses archival peers for data outside the normal window.
References: nodebuilder/…/type.go• L21-29 nodebuilder/…/module.go• L52-57 nodebuilder/…/module.go• L201-219 nodebuilder/…/constructors.go• L32-45 nodebuilder/…/p2p_constructors.go• L41-89
Change checklist
When these files or sections are changed, remember to consider these:
- Changes to the Core header range contract must preserve exclusive
tosemantics, rejectfrom >= to, and keep contiguous-prefix behavior for partial availability. - Changes to Core and P2P header fallback must preserve the distinction between a header-only result and an EDS that is ready for local data access.
- Changes to the DAH or extended-header contract must stay aligned with header verification, share proof checks, and EDS reconstruction.
- Changes to the availability window must be reviewed across sampling, SHWAP peer selection, header routing, and EDS retention.
- Changes to getter ordering or supported operations must preserve fallback paths and positional alignment for partial samples.
- Changes to namespace or range response formats must preserve proof completeness and exact reconstruction of the requested original shares.
- Changes to sample proof validation must preserve binding between proof bounds, proof axis, and the requested coordinate.
- Changes to EDS construction or import must preserve DAH equality, share-aligned stream handling, and canonical tail padding.
- Changes to bridge header intake must preserve the ordering between EDS storage and header publication.
- Changes to header tail or pruning rules must update DAS checkpoint recovery.
- Changes to node-role wiring must keep serving and consuming boundaries distinct.
- Changes to Share Exchange resource or stream handling must preserve separate not-found and incomplete-transfer outcomes.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
A Core range request has from at or above to | The request can calculate a wrapped size and attempt an unsafe allocation | Reject the range before size calculation |
| A requested range extends beyond the available chain tip | A caller can lose the useful headers that exist before the gap | Return the largest contiguous prefix and let the caller continue later |
| Core cannot provide a block needed for a header | The node cannot build the EDS from Core at that time | Fall back to the extended header from P2P and let DAS retrieve the EDS later |
| A fetched share, row, namespace result, or EDS does not match the header DAH | The data is rejected and the peer is not trusted for normal selection | Verify every response against the DAH before returning it |
| A peer returns a valid proof for a different coordinate on the requested axis | The caller could accept data that was not sampled | Check the proof bounds against the requested row and column before accepting the sample |
| A stream ends inside a share | The EDS cannot be safely reconstructed | Require share-aligned input and treat only a share-boundary end as tail padding |
| A stored response file ends during a streamed transfer | The requester could mistake incomplete data for a valid response | Report an internal transfer error and do not finish the stream as a complete response |
| A request targets parity-only data in an ODS-only source | The source cannot provide the requested row or share without the extended square | Return not found so the requester can use another peer |
| A proof or axis cache grows with remote requests | Repeated data requests can exhaust node memory | Use bounded caches and rebuild evicted proof data on demand |
| A bridge publishes a header before its EDS is stored | DAS can request data before the local source is ready | Store the square before publishing the header |
| DAS restarts with a checkpoint below the header tail | Sampling can target data that the node no longer retains | Clamp checkpoint work to the retained header range |
| A sampling deadline ignores the EDS size | Large blocks can consume a worker for too long | Derive the timeout from fixed setup cost plus original-square bytes |
Key files
| File | Why to read it |
|---|---|
| core/exchange.go | Shows Core block intake, EDS storage, P2P header-only fallback, bounded header fetching, and range validation. |
| core/exchange_test.go | Shows the contract for invalid ranges, stored EDS data, pruning, archival retention, and partial ranges. |
| core/routing_exchange.go | Shows how header ranges cross the availability-window boundary between Core and P2P. |
| header/header.go | Defines the extended header and the checks that bind the signed header to its data commitment. |
| nodebuilder/…/constructors.go | Shows local-first and network fallback paths for bridge and light roles. |
| share/…/retriever.go | Shows how partial data becomes a repaired EDS or a Byzantine-data error. |
| share/…/testing.go | Defines the shared accessor contract for full and partial data and concurrent access. |
| share/…/proofs_cache.go | Shows bounded reuse of EDS axes and proof data during share access. |
| share/…/cascade.go | Shows how multiple data sources are tried without changing the getter contract. |
| share/…/server.go | Shows request validation, store lookup, resource reservation, and streamed responses. |
| share/…/exchange_test.go | Shows not-found behavior for unavailable square regions and rejection of incomplete streamed data. |
| share/…/sample.go | Shows how a sampled share is bound to its proof axis and requested coordinate. |
| share/…/sample_test.go | Shows that coordinate substitution and malformed sample data are rejected. |
| share/…/shrex.go | Shows peer selection, retry, cooldown, and verified retrieval. |
| share/…/availability.go | Shows the light-node sampling decision and saved sample progress. |
| share/…/availability.go | Shows full EDS recovery and role-aware retention. |
| das/worker.go | Shows header lookup, size-aware sampling deadlines, retry results, and worker state reporting. |
| das/coordinator.go | Shows worker coordination for catch-up, recent headers, and retries. |
| nodebuilder/…/p2p_constructors.go | Shows full and archival peer wiring across node roles. |