Expand description
Postage stamp issuing and signing for Ethereum Swarm.
This crate provides the issuing and signing functionality for postage stamps,
designed for use by CLI tools (like dipper) that create and sign stamps.
For verification-only use cases (like vertex nodes), use
nectar-postage directly.
§Features
std(default) - Enables standard library supportserde- Enables serialization/deserializationlocal-signer- Enables local key signing withalloy-signer-localparallel- Enables parallel signing with rayon
§Example
ⓘ
use nectar_postage_issuer::{BatchStamper, MemoryIssuer, Stamper};
use nectar_primitives::SwarmAddress;
use alloy_primitives::B256;
use alloy_signer_local::PrivateKeySigner;
// Create an issuer for a batch
let issuer = MemoryIssuer::new(B256::ZERO, 20, 16);
// Combine with any SignerSync implementation to create a stamper
let signer = PrivateKeySigner::random();
let mut stamper = BatchStamper::new(issuer, signer);
// Stamp chunks
let stamp = stamper.stamp(&chunk_address)?;Structs§
- Batch
- A postage batch represents a prepaid storage allocation in the Swarm network.
- Batch
Params - Parameters for creating a new batch.
- Batch
Stamper - A stamper that combines an issuer (for bucket tracking) with a signer.
- Create
Result - The result of creating a batch.
- Memory
Batch Factory - An in-memory batch factory for testing.
- Memory
Issuer - An in-memory stamp issuer that tracks bucket utilization.
- Postage
Context - Context for postage validation.
- Sharded
Issuer - A sharded stamp issuer for high-throughput parallel stamping.
- Stamp
- A postage stamp represents proof of payment for storing a chunk.
- Stamp
Digest - The digest that must be signed to create a valid stamp.
- Stamp
Index - A stamp index representing the position of a chunk within a batch.
- Stamp
Result - Result of a parallel stamp operation.
- Store
Validator - A validator that uses a
BatchStorefor validation.
Enums§
- Batch
Event - Events emitted by the postage stamp contract.
- Batch
Store Error - Errors that can occur when working with a batch store.
- Memory
Batch Error - Error type for memory batch factory operations.
- Signing
Error - Errors that can occur when signing stamps.
- Stamp
Error - Errors that can occur when working with stamps.
Constants§
- STAMP_
SIZE - The size of a serialized stamp in bytes.
Traits§
- Batch
Event Handler - A handler for batch events.
- Batch
Factory - A trait for creating postage batches.
- Batch
Store - A trait for storing and retrieving batches.
- Batch
Store Ext - Extension methods for
BatchStore. - Stamp
Issuer - A trait for managing stamp issuance within a batch.
- Stamp
Validator - A trait for validating postage stamps.
- Stamper
- A trait for entities that can stamp chunks.
Functions§
- calculate_
bucket - Calculates which collision bucket a chunk belongs to based on its address.
- current_
timestamp - Returns the current timestamp in nanoseconds since the Unix epoch.
- sign_
stamps_ parallel - Signs multiple chunks in parallel using the provided signer.
Type Aliases§
- BatchId
- A 32-byte batch identifier.
- Stamp
Bytes - A serialized postage stamp as a fixed-size byte array.
- Verifying
Key - ECDSA/secp256k1 verification key (i.e. public key)