Skip to main content

Module typed_bytes

Module typed_bytes 

Source
Expand description

Typed byte newtypes for the Swarm protocol.

Mirrors bee-go’s pkg/swarm/typed_bytes.go (which itself mirrors bee-js’s src/utils/typed-bytes.ts). Each type is a length-validated wrapper over a fixed-size byte array; on the wire each is encoded as lowercase hex without 0x prefix.

Structs§

BatchId
Postage batch identifier (32 bytes).
EthAddress
Ethereum address (20 bytes). EthAddress::to_checksum returns the EIP-55 mixed-case representation with 0x prefix.
FeedIndex
Feed index: 8 bytes, big-endian u64. The all-0xff value is a “before first” sentinel matching bee-js FeedIndex.MINUS_ONE.
Identifier
Arbitrary 32-byte identifier (SOC / GSOC). Use Identifier::from_string for the keccak256-of-utf8 variant.
PeerAddress
Peer overlay address (32 bytes).
Signature
Ethereum signed-message signature: R || S || V with V normalized to {27, 28} on the wire, matching bee-js.
Span
Chunk span: 8 bytes, little-endian u64.
Topic
Feed / PSS topic (32 bytes). Use Topic::from_string for the keccak256-of-utf8 variant.
TransactionId
Ethereum transaction hash (32 bytes).

Enums§

Reference
Swarm content reference. 32 bytes for a plain CAC reference, 64 bytes for an encrypted reference (CAC address || encryption key).

Constants§

BATCH_ID_LENGTH
Length of a postage batch identifier.
ENCRYPTED_REFERENCE_LENGTH
Length of an encrypted content reference (key suffix appended).
ETH_ADDRESS_LENGTH
Length of an Ethereum address.
FEED_INDEX_LENGTH
Length of a feed index (big-endian u64).
IDENTIFIER_LENGTH
Length of an arbitrary identifier (SOC / GSOC).
PEER_ADDRESS_LENGTH
Length of a peer overlay address.
PRIVATE_KEY_LENGTH
Length of a secp256k1 private key.
PUBLIC_KEY_LENGTH
Length of a secp256k1 public key (uncompressed X || Y).
REFERENCE_LENGTH
Length of a plain content reference.
SIGNATURE_LENGTH
Length of an Ethereum signed-message signature (R || S || V).
SPAN_LENGTH
Length of a chunk span (little-endian u64).
TOPIC_LENGTH
Length of a feed / PSS topic.
TRANSACTION_ID_LENGTH
Length of a transaction hash.