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 crate | What’s re-exported |
|---|---|
chia-protocol | All wire types: Message, Handshake, ProtocolMessageTypes, NodeType, etc. |
chia-sdk-client | Peer, Client, ClientError, ClientState, Network, PeerOptions, rate limiting, TLS connectors |
chia-ssl | ChiaCertificate |
chia-traits | Streamable trait |
chia_streamable_macro | #[streamable] proc macro |
| DIG extensions | DigMessage, DigMessageType, the 200..=222 opcode band, RegisterPeer, RegisterAck, introducer wire types |
| DIG peer link | DigLink, LinkOptions, LinkError, Admission, OpcodeRateLimiter, OpcodeRateLimits |
§Feature flags
| Flag | Forwards to | Effect |
|---|---|---|
native-tls | chia-sdk-client/native-tls | OS-native TLS; enables Client, ClientState, Connector, create_native_tls_connector, DigLink::connect |
rustls | chia-sdk-client/rustls | Pure-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§
- Block
Record - Bytes
- Bytes
Impl - Challenge
Block Info - Challenge
Chain SubSlot - Chia
Certificate - Classgroup
Element - Coin
- Coin
Spend - Coin
State - Coin
State Filters - Coin
State Update - DigLink
- A live websocket link to one peer, framing every message as a
DigMessage. - DigMessage
- Wire message with raw
u8opcode — handles both Chia (0–107) and DIG (200–219) opcodes. - EndOf
SubSlot Bundle - FeeEstimate
- FeeEstimate
Group - FeeRate
- Foliage
- Foliage
Block Data - Foliage
Transaction Block - Full
Block - Handshake
- Header
Block - Infused
Challenge Chain SubSlot - Link
Options - Tunables for a single link.
- Mempool
Items Added - Mempool
Items Removed - Message
- Network
- NewCompactVDF
- NewPeak
- NewPeak
Wallet - NewSignage
Point OrEnd OfSub Slot - NewTransaction
- NewUnfinished
Block - NewUnfinished
Block2 - Opcode
Rate Limiter - A sliding-window outbound limiter over
OpcodeRateLimits. - Opcode
Rate Limits - Chia’s
V2_RATE_LIMITS, re-keyed fromProtocolMessageTypesto the wire byte. - Peer
- Peer
Options - Pool
Target - Program
- Proof
Block Header - Proof
OfSpace - Puzzle
Solution Response - Rate
Limit - Rate
Limiter - Rate
Limits - Recent
Chain Data - Register
Ack - Introducer acknowledgement.
success == falseis a valid wire outcome (policy rejection). - Register
ForCoin Updates - Register
ForPh Updates - Register
Peer - Registration request: advertise this node’s P2P reachability to the introducer.
- Reject
Additions Request - Reject
Block - Reject
Block Headers - Reject
Blocks - Reject
Coin State - Reject
Header Blocks - Reject
Header Request - Reject
Puzzle Solution - Reject
Puzzle State - Reject
Removals Request - Removed
Mempool Item - Request
Additions - Request
Block - Request
Block Header - Request
Block Headers - Request
Blocks - Request
Children - Request
Coin State - Request
CompactVDF - Request
Cost Info - Request
FeeEstimates - Request
Header Blocks - Request
Mempool Transactions - Request
Peers - Request
Peers Introducer - Empty introducer “get peers” request (protocol opcode 63).
- Request
Proof OfWeight - Request
Puzzle Solution - Request
Puzzle State - Request
Removals - Request
Remove Coin Subscriptions - Request
Remove Puzzle Subscriptions - Request
SesInfo - Request
Signage Point OrEnd OfSub Slot - Request
Transaction - Request
Unfinished Block - Request
Unfinished Block2 - Respond
Additions - Respond
Block - Respond
Block Header - Respond
Block Headers - Respond
Blocks - Respond
Children - Respond
Coin State - Respond
CompactVDF - Respond
Cost Info - Respond
EndOf SubSlot - Respond
FeeEstimates - Respond
Header Blocks - Respond
Peers - Respond
Peers Introducer - Introducer peer list response (protocol opcode 64).
- Respond
Proof OfWeight - Respond
Puzzle Solution - Respond
Puzzle State - Respond
Removals - Respond
Remove Coin Subscriptions - Respond
Remove Puzzle Subscriptions - Respond
SesInfo - Respond
Signage Point - Respond
ToCoin Updates - Respond
ToPh Updates - Respond
Transaction - Respond
Unfinished Block - Reward
Chain Block - Reward
Chain Block Unfinished - Reward
Chain SubSlot - Send
Transaction - Spend
Bundle - SubEpoch
Challenge Segment - SubEpoch
Data - SubEpoch
Segments - SubEpoch
Summary - SubSlot
Data - SubSlot
Proofs - Timestamped
Peer Info - Transaction
Ack - Transactions
Info - Unfinished
Block - Unfinished
Header Block - Unknown
DigMessage Type - Error returned by
TryFrom<u8>when the wire value is not a known DIG discriminant. - VDFInfo
- VDFProof
- Weight
Proof
Enums§
- Admission
- The verdict on one outbound message.
- Client
Error - DigMessage
Type - DIG L2 wire discriminants (
200..=219) extending Chia’s protocol namespace. - Link
Error - Everything that can go wrong on a DIG peer link.
- Mempool
Remove Reason - Node
Type - Plot
Size - Protocol
Message Types - Reject
State Reason
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§
Traits§
Functions§
- calculate_
ip_ iters - calculate_
sp_ interval_ iters - calculate_
sp_ iters - expected_
plot_ size - is_
dig_ opcode - Whether
opcodebelongs 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.