Expand description
ANT protocol implementation for the saorsa network.
This module implements the wire protocol for storing and retrieving data on the saorsa network, compatible with the autonomi network protocol.
§Data Types
The ANT protocol supports a single data type:
- Chunk: Immutable, content-addressed data (hash == address)
§Protocol Overview
The protocol uses postcard serialization for compact, fast encoding. Each data type has its own message types for PUT/GET operations.
§Chunk Messages
ChunkPutRequest/ChunkPutResponse- Store chunksChunkGetRequest/ChunkGetResponse- Retrieve chunksChunkQuoteRequest/ChunkQuoteResponse- Request storage quotes
§Payment Flow
- Client requests a quote via
ChunkQuoteRequest - Node returns signed
PaymentQuoteinChunkQuoteResponse - Client pays on Arbitrum via
PaymentVault.payForQuotes() - Client sends
ChunkPutRequestwithpayment_proof - Node verifies payment and stores chunk
§Example
ⓘ
use saorsa_node::ant_protocol::{ChunkMessage, ChunkPutRequest, ChunkGetRequest};
// Create a PUT request
let address = compute_address(&data);
let request = ChunkPutRequest::with_payment(address, data, payment_proof);
let message = ChunkMessage::PutRequest(request);
let bytes = message.encode()?;
// Decode a response
let response = ChunkMessage::decode(&response_bytes)?;Re-exports§
pub use chunk::ChunkGetRequest;pub use chunk::ChunkGetResponse;pub use chunk::ChunkMessage;pub use chunk::ChunkMessageBody;pub use chunk::ChunkPutRequest;pub use chunk::ChunkPutResponse;pub use chunk::ChunkQuoteRequest;pub use chunk::ChunkQuoteResponse;pub use chunk::ProtocolError;pub use chunk::XorName;pub use chunk::CHUNK_PROTOCOL_ID;pub use chunk::DATA_TYPE_CHUNK;pub use chunk::MAX_CHUNK_SIZE;pub use chunk::MAX_WIRE_MESSAGE_SIZE;pub use chunk::PROTOCOL_VERSION;
Modules§
- chunk
- Chunk message types for the ANT protocol.