Skip to main content

Crate dig_peer_protocol

Crate dig_peer_protocol 

Source
Expand description

§dig-peer-protocol

DIG Network L2 protocol types — a superset of chia-protocol.

This crate re-exports the entire Chia protocol ecosystem (chia-protocol, chia-sdk-client, chia-ssl, chia-traits) plus DIG’s own extensions: the 200..=222 opcode band, the DigMessage framing that can express it, and DigLink, the websocket peer link that carries it. Consumers depend on dig-peer-protocol alone instead of importing multiple chia-* crates individually.

§The closed-enum problem, and how this crate closes it

chia_protocol::Message stores its opcode as ProtocolMessageTypes, an enum that stops at RespondCostInfo = 107 with no Unknown(u8). A DIG opcode has no value in that enum, so it is neither constructible nor decodable through it — and worse, chia-sdk-client’s receive loop calls Message::from_bytes, so one inbound DIG frame drops the whole connection rather than that one frame.

DigMessage answers the first half: the same wire bytes with a raw u8 opcode. DigLink answers the second: a websocket link that frames DigMessage end to end. Together they replace the vendored chia-protocol / chia-sdk-client forks DIG used to carry, so chia-protocol is an ordinary dependency with no [patch.crates-io].

§What’s included

Source crateWhat’s re-exported
chia-protocolAll wire types: Message, Handshake, ProtocolMessageTypes, NodeType, etc.
chia-sdk-clientPeer, Client, ClientError, ClientState, Network, PeerOptions, rate limiting, TLS connectors
chia-sslChiaCertificate
chia-traitsStreamable trait
chia_streamable_macro#[streamable] proc macro
DIG extensionsDigMessage, DigMessageType, the 200..=222 opcode band, RegisterPeer, RegisterAck, introducer wire types
DIG peer linkDigLink, LinkOptions, LinkError, Admission, OpcodeRateLimiter, OpcodeRateLimits

§Feature flags

FlagForwards toEffect
native-tlschia-sdk-client/native-tlsOS-native TLS; enables Client, ClientState, Connector, create_native_tls_connector, DigLink::connect
rustlschia-sdk-client/rustlsPure-Rust TLS; enables Client, ClientState, Connector, create_rustls_connector, DigLink::connect

Neither feature is enabled by default. The crate builds without either but TLS-dependent items (Client, ClientState, Connector, and DigLink::connect) become unavailable; DigLink::from_websocket and DigLink::from_server_websocket stay available, since adopting an already-established socket needs no TLS backend of its own.

Structs§

BlockRecord
Bytes
BytesImpl
ChallengeBlockInfo
ChallengeChainSubSlot
ChiaCertificate
ClassgroupElement
Coin
CoinSpend
CoinState
CoinStateFilters
CoinStateUpdate
DigLink
A live websocket link to one peer, framing every message as a DigMessage.
DigMessage
Wire message with raw u8 opcode — handles both Chia (0–107) and DIG (200–219) opcodes.
EndOfSubSlotBundle
FeeEstimate
FeeEstimateGroup
FeeRate
Foliage
FoliageBlockData
FoliageTransactionBlock
FullBlock
Handshake
HeaderBlock
InfusedChallengeChainSubSlot
LinkOptions
Tunables for a single link.
MempoolItemsAdded
MempoolItemsRemoved
Message
Network
NewCompactVDF
NewPeak
NewPeakWallet
NewSignagePointOrEndOfSubSlot
NewTransaction
NewUnfinishedBlock
NewUnfinishedBlock2
OpcodeRateLimiter
A sliding-window outbound limiter over OpcodeRateLimits.
OpcodeRateLimits
Chia’s V2_RATE_LIMITS, re-keyed from ProtocolMessageTypes to the wire byte.
Peer
PeerOptions
PoolTarget
Program
ProofBlockHeader
ProofOfSpace
PuzzleSolutionResponse
RateLimit
RateLimiter
RateLimits
RecentChainData
RegisterAck
Introducer acknowledgement. success == false is a valid wire outcome (policy rejection).
RegisterForCoinUpdates
RegisterForPhUpdates
RegisterPeer
Registration request: advertise this node’s P2P reachability to the introducer.
RejectAdditionsRequest
RejectBlock
RejectBlockHeaders
RejectBlocks
RejectCoinState
RejectHeaderBlocks
RejectHeaderRequest
RejectPuzzleSolution
RejectPuzzleState
RejectRemovalsRequest
RemovedMempoolItem
RequestAdditions
RequestBlock
RequestBlockHeader
RequestBlockHeaders
RequestBlocks
RequestChildren
RequestCoinState
RequestCompactVDF
RequestCostInfo
RequestFeeEstimates
RequestHeaderBlocks
RequestMempoolTransactions
RequestPeers
RequestPeersIntroducer
Empty introducer “get peers” request (protocol opcode 63).
RequestProofOfWeight
RequestPuzzleSolution
RequestPuzzleState
RequestRemovals
RequestRemoveCoinSubscriptions
RequestRemovePuzzleSubscriptions
RequestSesInfo
RequestSignagePointOrEndOfSubSlot
RequestTransaction
RequestUnfinishedBlock
RequestUnfinishedBlock2
RespondAdditions
RespondBlock
RespondBlockHeader
RespondBlockHeaders
RespondBlocks
RespondChildren
RespondCoinState
RespondCompactVDF
RespondCostInfo
RespondEndOfSubSlot
RespondFeeEstimates
RespondHeaderBlocks
RespondPeers
RespondPeersIntroducer
Introducer peer list response (protocol opcode 64).
RespondProofOfWeight
RespondPuzzleSolution
RespondPuzzleState
RespondRemovals
RespondRemoveCoinSubscriptions
RespondRemovePuzzleSubscriptions
RespondSesInfo
RespondSignagePoint
RespondToCoinUpdates
RespondToPhUpdates
RespondTransaction
RespondUnfinishedBlock
RewardChainBlock
RewardChainBlockUnfinished
RewardChainSubSlot
SendTransaction
SpendBundle
SubEpochChallengeSegment
SubEpochData
SubEpochSegments
SubEpochSummary
SubSlotData
SubSlotProofs
TimestampedPeerInfo
TransactionAck
TransactionsInfo
UnfinishedBlock
UnfinishedHeaderBlock
UnknownDigMessageType
Error returned by TryFrom<u8> when the wire value is not a known DIG discriminant.
VDFInfo
VDFProof
WeightProof

Enums§

Admission
The verdict on one outbound message.
ClientError
DigMessageType
DIG L2 wire discriminants (200..=219) extending Chia’s protocol namespace.
LinkError
Everything that can go wrong on a DIG peer link.
MempoolRemoveReason
NodeType
PlotSize
ProtocolMessageTypes
RejectStateReason

Constants§

ALL_DIG_OPCODES
Every opcode DIG has assigned, ascending — the 20 consensus opcodes plus the 3 free-band ones.
DIG_BAND_START
First opcode of the DIG band. Everything below this belongs to Chia.
DIG_MESSAGE
Wire opcode for a directed dig-message envelope (WU6, epic #796).
FREE_BAND_START
First opcode of the free half of the DIG band — application protocols, not L2 consensus.
HOLDINGS_ANNOUNCE
Wire opcode for a holdings-announce broadcast (#1428, spec #1394).
STORE_MELTED
Wire opcode for a store-melted broadcast (epic #1316).
UI_ACTUAL_SPACE_CONSTANT_FACTOR

Statics§

V2_RATE_LIMITS

Traits§

ChiaProtocolMessage
Streamable

Functions§

calculate_ip_iters
calculate_sp_interval_iters
calculate_sp_iters
expected_plot_size
is_dig_opcode
Whether opcode belongs to the DIG band rather than Chia’s namespace.
is_overflow_block
load_ssl_cert
Loads an SSL certificate, or creates it if it doesn’t exist already.

Type Aliases§

Bytes32
Bytes48
Bytes96
Bytes100

Attribute Macros§

streamable