Documentation
¶
Overview ¶
Package ptype holds the frozen registry of proof type codes and the registry names that travel on the wire.
A bundle's `type` is a registry NAME (`block`, `beacon`, `item`, `entropy_nist`, `entropy_stellar`, `entropy_bitcoin`). The signed payload (Appendix E.16) carries the frozen integer CODE for that name, so the two halves of the registry are both permanent: a name is never renamed and never reused, a code is never renumbered and never reassigned.
Category ranges (blocks of 10):
10-19 subject: block family (10 = block, 11 = beacon) 20-29 subject: item 30-39 subject: entropy sources 40-49 commitment chains (reserved; never on the wire) 50+ reserved for future categories
Beacon (11) shares the block structural shape (no `subject`, no `inclusion_proof`, same `block` + `commitments`) but is a distinct code for domain separation: because the code is part of the signed payload, a `block` and a `beacon` bundle for the same block produce different signatures.
The commitment chains `stellar` (40) and `bitcoin` (41) are named on the wire by `commitments[].chain` only; their codes are documented history and are reserved so nothing else ever claims them.
Index ¶
Constants ¶
const ( NameBlock = "block" NameBeacon = "beacon" NameItem = "item" NameEntropyNIST = "entropy_nist" NameEntropyStellar = "entropy_stellar" NameEntropyBitcoin = "entropy_bitcoin" )
Registry names of the six subject types, in code order.
const ( ChainStellar = "stellar" ChainBitcoin = "bitcoin" )
Chain names carried in `commitments[].chain`.
Variables ¶
var SubjectNames = []string{ NameBlock, NameBeacon, NameItem, NameEntropyNIST, NameEntropyStellar, NameEntropyBitcoin, }
SubjectNames lists every registered subject type name, in code order. It is the vocabulary a `type` field must draw from (Appendix E.6, E.24).
Functions ¶
func IsBlockLikeSubject ¶
IsBlockLikeSubject reports whether c is a block-family subject type, a plain block (10) or a beacon (11). The two share one wire shape: no `subject`, no `inclusion_proof`, `subject_hash == block_hash`.
func IsChainName ¶ added in v0.13.0
IsChainName reports whether name is one of the two registered commitment chain names.
func IsEntropySubject ¶
IsEntropySubject reports whether c is one of the entropy subject types.
func IsSubjectName ¶ added in v0.13.0
IsSubjectName reports whether name is one of the six registered subject type names.
func IsValidSubject ¶
IsValidSubject reports whether c is a registered subject type code.
Types ¶
type Code ¶
type Code uint16
Code is the frozen integer code for a registry name. Subject codes are emitted as uint16 big-endian in the signed payload.
const ( Block Code = 10 Beacon Code = 11 Item Code = 20 EntropyNIST Code = 30 EntropyStellar Code = 31 EntropyBitcoin Code = 32 )
Registered subject type codes.
Reserved commitment chain codes. They are never written to the wire and never appear in a preimage; `commitments[].chain` names the chain instead.