uploadFile method in the JavaScript SDK (@lumera-protocol/sdk-js) runs all three for you. You can also run them individually for fine-grained control.
Prepare the file
- It converts the input file (a
Uint8Array,File, orBlob) to aUint8Array. - It computes a BLAKE3 hash over the file bytes. This hash becomes the permanent content identifier stored on-chain.
Register the action on-chain
Fetch action parameters
The SDK queries the chain for the current action parameters.Generate the RaptorQ layout
The SDK runs the file through the RaptorQ WASM module to generate an erasure coding layout.rq_ids_icis a random counter seed in[0, max_raptor_q_symbols).- The layout contains block-level encoding metadata that SuperNodes need to store and reconstruct the file.
- The layout JSON is compacted (no whitespace) to match the Go reference implementation.
Sign the layout with ADR-036
The compacted layout bytes are signed with ADR-036signArbitrary. ADR-036 is the Cosmos standard for signing arbitrary data outside a transaction.
Derive layout IDs
Layout IDs are deterministic identifiers derived from the layout and its signature. The algorithm must match the on-chain Go implementation exactly.Build the LEP-1 index file
LEP-1 (Lumera Enhancement Proposal 1) defines a compact index that aggregates the layout IDs and the layout signature.Create the auth signature
The SDK creates a separate signature over thedataHash. This auth signature later authenticates the file upload to the SN-API, the HTTP API served by SuperNodes.
Broadcast MsgRequestAction
The SDK simulates the transaction to estimate gas, then signs and broadcasts it.action_registered event. The SDK extracts the action_id from the event attributes. The action_id is your permanent reference to the stored file.
Send the file to SuperNodes
- The SDK sends the file as multipart form data to
POST /api/v1/actions/cascade. - The SN-API distributes chunks to the SuperNode mesh.
- The SDK polls
GET /api/v1/actions/cascade/tasks/{task_id}at the configured interval. - The upload completes when the task reaches a terminal status.
Upload in one call
For most use cases, calluploadFile to run all three phases.
Action states on chain
After registration, the on-chain action moves through four states.
The storage fee is escrowed at registration. If the action fails or expires, the fee is refunded. The current fee is a 10000
ulume base plus 10 ulume per KB. A 1 MB file costs about 0.02 LUME. Fee parameters can change through governance.
SDK task states
The SDK reports progress through task statuses.Retry behavior
The SDK retries the SN-API upload up to 5 times with a 3-second delay between attempts. This covers the window where a SuperNode has not yet indexed the on-chain action. The chain and the SN-API are eventually consistent.Next steps
Download lifecycle
How authenticated downloads stream files back from SuperNodes.
Erasure coding
How RaptorQ encoding and LEP-1 layout IDs work.
Error handling
Handle failed task states and retries in production.