Expand description
Foundational types for the Swarm protocol: typed bytes, BMT chunk addressing, SOC primitives, and the crate-level error type.
Mirrors pkg/swarm in bee-go.
Re-exports§
pub use bmt::CHUNK_SIZE;pub use bmt::Chunk;pub use bmt::MAX_PAYLOAD_SIZE;pub use bmt::MIN_PAYLOAD_SIZE;pub use bmt::SEGMENT_SIZE;pub use bmt::SEGMENTS_COUNT;pub use bmt::calculate_chunk_address;pub use bmt::keccak256;pub use bmt::make_content_addressed_chunk;pub use cid::CidType;pub use cid::DecodedCid;pub use cid::FEED_CODEC;pub use cid::MANIFEST_CODEC;pub use cid::convert_cid_to_reference;pub use cid::convert_reference_to_cid;pub use duration::Duration as BeeDuration;pub use errors::Error;pub use errors::RESPONSE_BODY_CAP;pub use errors::Result;pub use errors::redact_url;pub use file_chunker::ChunkerRoot;pub use file_chunker::FileChunker;pub use file_chunker::MAX_BRANCHES;pub use file_chunker::SealedChunk;pub use gsoc::GSOC_DEFAULT_PROXIMITY;pub use gsoc::GSOC_MINE_START;pub use gsoc::gsoc_mine;pub use gsoc::proximity;pub use keys::PrivateKey;pub use keys::PublicKey;pub use keys::eth_signed_message_digest;pub use network::Network;pub use size::Size;pub use soc::SingleOwnerChunk;pub use soc::calculate_single_owner_chunk_address;pub use soc::make_single_owner_chunk;pub use soc::unmarshal_single_owner_chunk;pub use tokens::BZZ_DIGITS;pub use tokens::Bzz;pub use tokens::DAI_DIGITS;pub use tokens::Dai;pub use typed_bytes::BATCH_ID_LENGTH;pub use typed_bytes::BatchId;pub use typed_bytes::ENCRYPTED_REFERENCE_LENGTH;pub use typed_bytes::ETH_ADDRESS_LENGTH;pub use typed_bytes::EthAddress;pub use typed_bytes::FEED_INDEX_LENGTH;pub use typed_bytes::FeedIndex;pub use typed_bytes::IDENTIFIER_LENGTH;pub use typed_bytes::Identifier;pub use typed_bytes::PEER_ADDRESS_LENGTH;pub use typed_bytes::PRIVATE_KEY_LENGTH;pub use typed_bytes::PUBLIC_KEY_LENGTH;pub use typed_bytes::PeerAddress;pub use typed_bytes::REFERENCE_LENGTH;pub use typed_bytes::Reference;pub use typed_bytes::SIGNATURE_LENGTH;pub use typed_bytes::SPAN_LENGTH;pub use typed_bytes::Signature;pub use typed_bytes::Span;pub use typed_bytes::TOPIC_LENGTH;pub use typed_bytes::TRANSACTION_ID_LENGTH;pub use typed_bytes::Topic;pub use typed_bytes::TransactionId;
Modules§
- bmt
- Binary Merkle Tree (BMT) chunk addressing. Mirrors bee-go’s
pkg/swarm/bmt.goandpkg/swarm/chunk.go. - bytes
- Hex parsing / display helpers shared by every typed-byte newtype.
Mirrors bee-go’s
pkg/swarm/bytes.goBytesbase type, but in Rust we don’t need a runtime base struct — instead we expose free helpers that thedefine_typed_bytes!macro (inswarm::typed_bytes) uses to build each newtype’sfrom_hex,to_hex, and serde impls. - cid
- Swarm reference ↔ CID conversion (manifest and feed codecs).
- duration
- Bee-flavored
Durationtype. Mirrors bee-go’spkg/swarm/duration.goand bee-jsDuration. - errors
- Crate-level error type. Mirrors bee-go’s
BeeError/BeeArgumentError/BeeResponseErrorhierarchy as a single Rust enum so callers canmatchon the variant. - file_
chunker - Streaming Swarm content-addressed chunker. Mirrors bee-go’s
pkg/swarm/file_chunker.goand the bee-jsMerkleTreechunker fromcafe-utility. - gsoc
- GSOC (Graffiti SOC) primitives. Mirrors bee-go’s
pkg/swarm/gsoc.go. - keys
PrivateKey/PublicKeyand the Ethereum signed-message signer.- network
- Block-time aware network selector. Used by stamp duration math — Bee mainnet is on Ethereum (15-second blocks); Gnosis Chain is the production Swarm settlement chain (~5-second blocks).
- size
- Decimal-base file size type. Mirrors bee-go’s
pkg/swarm/size.go(and bee-jsSize): all conversions use 1000 as the base so they stay aligned with the Swarm theoretical/effective storage tables. - soc
- Single Owner Chunks (SOC). Mirrors bee-go’s
pkg/swarm/soc.go. - tokens
- BZZ / DAI fixed-point token math. Mirrors bee-go’s
pkg/swarm/tokens.goand bee-jsBZZ/DAI. - typed_
bytes - Typed byte newtypes for the Swarm protocol.