Skip to main content

Crate nectar_postage

Crate nectar_postage 

Source
Expand description

Postage stamp primitives for Ethereum Swarm.

This crate provides the core types and traits for postage stamps in the Swarm network. It is optimized for verification use cases (such as vertex nodes).

For stamp issuing and signing, use the nectar-postage-issuer crate.

§Core Types

  • Batch: A postage batch representing prepaid storage
  • Stamp: A postage stamp proving payment for chunk storage
  • StampIndex: The bucket and position index within a stamp
  • StampDigest: The data to be signed when creating a stamp
  • PostageContext: Context for batch expiry calculations
  • BatchEvent: Events emitted by the postage stamp contract (requires std)

§Traits

§Features

  • std (default): Enable standard library support, BatchStore, events
  • serde: Enable serde serialization/deserialization
  • parallel: Enable parallel verification with rayon

Modules§

parallelparallel
Parallel verification utilities.

Structs§

Batch
A postage batch represents a prepaid storage allocation in the Swarm network.
BatchParams
Parameters for creating a new batch.
PostageContext
Context for postage validation.
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.
StoreValidatorstd
A validator that uses a BatchStore for validation.

Enums§

BatchEventstd
Events emitted by the postage stamp contract.
BatchStoreErrorstd
Errors that can occur when working with a batch store.
StampError
Errors that can occur when working with stamps.

Constants§

STAMP_SIZE
The size of a serialized stamp in bytes.

Traits§

BatchEventHandlerstd
A handler for batch events.
BatchStorestd
A trait for storing and retrieving batches.
BatchStoreExtstd
Extension methods for BatchStore.
StampValidator
A trait for validating postage stamps.

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.

Type Aliases§

BatchId
A 32-byte batch identifier.
StampBytes
A serialized postage stamp as a fixed-size byte array.
VerifyingKeyecdsa
ECDSA/secp256k1 verification key (i.e. public key)