Skip to main content

Crate nectar_postage_issuer

Crate nectar_postage_issuer 

Source
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 support
  • serde - Enables serialization/deserialization
  • local-signer - Enables local key signing with alloy-signer-local
  • parallel - 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.
BatchParams
Parameters for creating a new batch.
BatchStamper
A stamper that combines an issuer (for bucket tracking) with a signer.
CreateResult
The result of creating a batch.
MemoryBatchFactory
An in-memory batch factory for testing.
MemoryIssuer
An in-memory stamp issuer that tracks bucket utilization.
PostageContext
Context for postage validation.
ShardedIssuer
A sharded stamp issuer for high-throughput parallel stamping.
Stamp
A postage stamp represents proof of payment for storing a chunk.
StampDigest
The digest that must be signed to create a valid stamp.
StampIndex
A stamp index representing the position of a chunk within a batch.
StampResult
Result of a parallel stamp operation.
StoreValidator
A validator that uses a BatchStore for validation.

Enums§

BatchEvent
Events emitted by the postage stamp contract.
BatchStoreError
Errors that can occur when working with a batch store.
MemoryBatchError
Error type for memory batch factory operations.
SigningError
Errors that can occur when signing stamps.
StampError
Errors that can occur when working with stamps.

Constants§

STAMP_SIZE
The size of a serialized stamp in bytes.

Traits§

BatchEventHandler
A handler for batch events.
BatchFactory
A trait for creating postage batches.
BatchStore
A trait for storing and retrieving batches.
BatchStoreExt
Extension methods for BatchStore.
StampIssuer
A trait for managing stamp issuance within a batch.
StampValidator
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.
StampBytes
A serialized postage stamp as a fixed-size byte array.
VerifyingKey
ECDSA/secp256k1 verification key (i.e. public key)