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 storageStamp: A postage stamp proving payment for chunk storageStampIndex: The bucket and position index within a stampStampDigest: The data to be signed when creating a stampPostageContext: Context for batch expiry calculationsBatchEvent: Events emitted by the postage stamp contract (requiresstd)
§Traits
StampValidator: Validate stamps against batchesBatchStore: Persist and retrieve batches (requiresstd)BatchEventHandler: Handle batch events from the blockchain (requiresstd)
§Features
std(default): Enable standard library support, BatchStore, eventsserde: Enable serde serialization/deserializationparallel: Enable parallel verification with rayon
Modules§
- parallel
parallel - Parallel verification utilities.
Structs§
- Batch
- A postage batch represents a prepaid storage allocation in the Swarm network.
- Batch
Params - Parameters for creating a new batch.
- Postage
Context - Context for postage validation.
- 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.
- Store
Validator std - A validator that uses a
BatchStorefor validation.
Enums§
- Batch
Event std - Events emitted by the postage stamp contract.
- Batch
Store Error std - Errors that can occur when working with a batch store.
- 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 std - A handler for batch events.
- Batch
Store std - A trait for storing and retrieving batches.
- Batch
Store Ext std - Extension methods for
BatchStore. - Stamp
Validator - 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.
- Stamp
Bytes - A serialized postage stamp as a fixed-size byte array.
- Verifying
Key ecdsa - ECDSA/secp256k1 verification key (i.e. public key)