Betanet Version 1.1 – Official Implementation Specification
Normative document. All requirements marked MUST, MUST NOT, or SHALL are mandatory for compliance.
0 Status & Scope
Betanet is a fully decentralised, censorship-resistant network intended to replace the public Internet.
This revision finalises covert transport indistinguishability, removes linkability vectors, specifies liveness for naming, hardens governance and bootstrap economics, and standardises adaptive calibration.
PQ requirement. From 2027-01-01, the inner key agreement (L2 §5.3) MUST be hybrid -Kyber768. The outer TLS handshake (L2 §5.1) MUST mirror the front origin and MUST NOT advertise PQ that diverges from the origin’s canonical fingerprint.
Algorithm agility. Implementations MUST expose a registry of cryptographic parameters keyed by OIDs; future substitutions MUST be negotiated via governance (L7) without changing wire formats where lengths permit.
3 Layer Model
Layer
Function
L0
Access media (any IP bearer: fibre, 5G, sat, LoRa, etc.)
Type MUST be 0x01 (single path) or 0x03 (path list).
Each AS-hop signature in every segment MUST verify before forwarding; otherwise drop.
4.2 Transition Across Non-SCION Links (HTX-Tunnelled)
Gateways bridging non-SCION segments MUST encapsulate SCION packets inside an HTX control session (L2) between gateways:
Establish an HTX session using §5 (origin-mirrored TLS).
Negotiate a Transition Control Stream opened by the gateway acting as the server, with stream_id=2 (first even stream).
The control stream payload is a single CBOR map:
code
{ prevAS, nextAS, TS, FLOW, NONCE, SIG }
where TS = unix-sec, FLOW = 8B random, NONCE = 8B random, and
SIG = Ed25519 over (prevAS ‖ nextAS ‖ TS ‖ FLOW ‖ NONCE ‖ "bn-t1").
Gateways MUST verify TS within ±300 s, reject duplicate (FLOW,TS) for 2 h, and apply per-peer token buckets.
SCION payloads are carried on subsequent HTX streams. No per-packet transition header appears on the public wire.
Gateways MUST close and re-establish the control stream on rekey (§5.3). Out-of-date control streams are invalid.
Public-Internet requirement. The legacy on-wire transition header is PROHIBITED on public networks. It MAY be used only on private, administratively controlled links (§11).
4.3 Path Maintenance
Maintain up to 3 disjoint validated paths per peer.
Switch within 300 ms when an alternative validated path exists.
Probe with exponential back-off (min 1 s, max 60 s); MUST NOT exceed 1 probe per destination per 10 s under persistent loss.
Clients MUST mirror the front origin’s fingerprint class (JA3/JA4 family, ALPN set, extension order, GREASE, H2 SETTINGS, H3 availability).
A per-connection calibration pre-flight to the same origin (or same CDN POP if indicated) MUST be performed before inner handshake; any deviation MUST fail closed.
Tolerances: ALPN set and order MUST match exactly. Extension order MUST match exactly. H2 SETTINGS values MUST be within ±15 % of calibrated origin values where the origin publishes variable ranges; otherwise MUST match exactly.
POP selection: If the origin presents /POP variance, clients MUST calibrate against the same POP as the target connection as indicated by authoritative DNS co-location or CDN route headers; otherwise calibration MUST be repeated until equality is achieved.
ALPN selection MUST match the origin; fixed global distributions are PROHIBITED.
Session resumption MUST follow origin policy; 0-RTT MUST NOT be used for HTX initiation.
Client generates cliPriv/cliPub () and 32-B nonce32.
sharedSecret = <REDACTED>(cliPriv, ticketPub).
hour = floor(unixTime/3600) (UTC).
salt = SHA256("betanet-ticket-v1" ‖ ticketKeyID ‖ uint64_be(hour)).
accessTicket = HKDF(sharedSecret, salt, "", 32).
Client sends exactly one carrier chosen per policy with variable-length padding to match len:
Cookie (recommended):Cookie: <site-name>=Base64URL( 0x01 ‖ cliPub32 ‖ ticketKeyID8 ‖ nonce32 ‖ accessTicket32 ‖ pad )
A __Host- prefix is RECOMMENDED.
Query parameter:...?bn1=<Base64URL(payload)>
Body (POST) with Content-Type: application/x-www-form-urlencoded containing bn1=<Base64URL(payload)>.
Server verification:
recompute for hour ∈ {now-1, now, now+1},
reject duplicates for tuple (cliPub, hour) within 2 h,
enforce per-/24 IPv4 and /56 IPv6 token buckets.
Servers MUST parse fields in order (version, cliPub32, ticketKeyID8, <REDACTED>, accessTicket32) and MUST ignore trailing bytes (padding). Accepted padding range is 24..64 bytes.
On duplicate rejection, clients SHOULD rotate cliPub.
On failure, server serves only decoy content.
5.3 Noise XK Handshake & Inner Keys (with PQ)
Inner handshake MUST be Noise XK over the outer TLS tunnel.
From 2027-01-01, initiators MUST use hybrid (-Kyber768); prior to that, is RECOMMENDED.
AEAD Nonce: nonce = NS XOR (LE64(counter) ‖ LE32(0)); counter starts at 0 and increments per frame.
Rekeying (MUST meet all):
Send KEY_UPDATE when any: ≥ 8 GiB, ≥ 2¹⁶ frames, or **<DATE_TIME> since last (re)key per direction.
New keys: K' = <REDACTED>, "next", transcript_hash, 64); reset counter; derive NS'.
Ordering: Receivers MUST accept KEY_UPDATE out-of-order relative to data frames and MUST discard frames that verify only under the previous key after receiving and acknowledging KEY_UPDATE. Senders MUST cease using the old key immediately after transmitting KEY_UPDATE.
H2 SETTINGS MUST mirror origin within tolerances learned during pre-flight (§5.1).
PING cadence MUST be random in [10 s, 60 s] with ±10 % jitter; periodicity is PROHIBITED.
PRIORITY frames SHOULD follow the origin’s baseline rate; if unknown, send on [0.5 %, 3 %] of connections at random.
Idle padding: if no DATA for [200 ms, 1 200 ms], send [0, 3 ] dummy encrypted DATA (uniform in both).
5.6 UDP Variant & Anti-Correlation Fallback
Attempt QUIC v1 on UDP-443 with MASQUE CONNECT-UDP.
On failure, retry TCP with randomized back-off [200 ms, 1 200 ms], fresh ClientHello randomness, no session resumption, and fresh QUIC CIDs when applicable.
To defeat induced linkability, clients MUST launch cover connections to ≥ 2 unrelated origins (non-HTX) within [0, 1 000 ms] of the retry; HTX start MUST be delayed by an additional [100, 700 ms] chosen independently.
Cover connections MUST NOT exceed 2 retries per minute and MUST be torn down within [3, 15] s unless they carry user traffic.
BeaconSet(epoch) = XOR32(drand(epoch), nistRBv2(epoch), ethL1_finalized_hash(epoch)), each a 32-byte value; components MAY be substituted by governance.
If all components are unavailable, use fallback
BeaconSet(epoch) = SHA256("bn-fallback" ‖ K0c ‖ uint64_be(epoch)) and MUST log the condition.
For each stream, initiator picks 16-B streamNonce.
Each sig is Ed25519 over ("bn-aa1" ‖ payloadHash ‖ epoch). Verifiers MUST validate weights per §10.2–§10.3 and reject duplicates or lower-epoch certificates.
9 Payment System (L6)
9.1 Federated Cashu Mints
Each mint = *(n ≥ 5, t = 3)** group.
Keyset ID = SHA-256(sorted pubkeys).
Mints announce on betanet.mints with ≥ 22-bit PoW and an HTX contact endpoint.
Voucher (128 B):
code
keysetID32 ‖ secret32 ‖ aggregatedSig64
aggregatedSig64 is the 64-B Ed25519 aggregate signature over secret32.
Relays MUST accept vouchers only for known keysets; unknown keysets MAY be cached pending validation.
Per-keyset and per-peer rate-limits MUST apply.
9.2 Settlement
Relays MAY redeem ≥ 10 000 sat via their own Lightning node or swap with peers.
Vouchers MUST NOT leave encrypted streams.
Σ weight(ACK) ≥ 0.67 × Σ weight(active_nodes_14d), where active_nodes_14d are nodes seen on HTX within 14 days.
ACKs span ≥ 24 distinct AS groups and ≥ 3 SCION ISDs; no single AS contributes > 20 % nor single Org > 25 % of ACK weight.
ACKs are observed over ≥ 2 disjoint path classes per §4 with consistent reachability (median loss < 2 %).
A partition check confirms the median path diversity and ACK composition did not degrade by > 20 % in the 7 days prior to close.
10.4 Upgrade Delay
After threshold, activation waits ≥ 30 days. If §10.3 fails at any time ≥ 7 days before activation, activation MUST be deferred until criteria are met for 7 consecutive days.
Raven Development Team publishes a time-lock hash of the final text.
11 Compliance Summary
An implementation is compliant if it:
Implements HTX over TCP-443 and QUIC-443 with origin-mirrored TLS + ECH; performs per-connection calibration (§5.1).
Uses negotiated-carrier, replay-bound access tickets (§5.2) with variable lengths and rate-limits.
Performs inner Noise XK with key separation, nonce lifecycle, and rekeying (§5.3); uses hybrid -Kyber768 from 2027-01-01.
Emulates HTTP/2/3 with adaptive cadences and origin-mirrored parameters (§5.5).
Bridges non-SCION links by HTX-tunnelled transition; no on-wire transition header on public networks (§4.2).
Offers /betanet/htx/1.1.0 and /betanet/htxquic/1.1.0 transports (§6.2).
Bootstraps via rotating rendezvous IDs derived from BeaconSet with PoW and multi-bucket rate-limits; deterministic seeds not used (§6.3–§6.5).
Selects mixnodes using BeaconSet randomness with per-stream entropy and path diversity (§7.2); “balanced” mode enforces ≥ 2 hops until trust ≥ 0.8 (§7.1–§7.3).
Verifies alias ledger with finality-bound 2-of-3 and applies Emergency Advance liveness only under §8.2 conditions; validates quorum certificates as specified.
Accepts 128-B Cashu vouchers for known keysets with PoW adverts and rate-limits; supports Lightning settlement (§9).
Enforces anti-concentration caps, diversity, and partition checks for governance (§10).
Implements anti-correlation fallback with cover connections on UDP→TCP retries (§5.6).
Builds are reproducible and publish SLSA 3 provenance artifacts for release binaries.
12 Interoperability Notes (1.0 Compatibility)
1.1 peers MAY offer /betanet/htx/1.0.0 ALPN for legacy interop.
Legacy on-wire transition headers MUST NOT be used on public networks; bridge via HTX tunnels.
64-B vouchers MAY be issued only to legacy peers; 1.1 receivers MUST accept both for the operator-defined deprecation window.
13 End of Betanet Specification 1.1
Please list errors in this spec that was written by an LLM
This is a highly ambitious and detailed specification that synthesizes many advanced concepts in decentralized networking, cryptography, and covert transport. However, the attempt to combine numerous complex requirements leads to critical logical flaws, contradictions, severe security vulnerabilities, and impractical implementation mandates.
Here is a list of significant errors found in the Betanet Version 1.1 specification.
Critical Protocol-Breaking Errors
These errors prevent the protocol from functioning correctly or lead to consensus failures.
1.1. Broken BeaconSet and Bootstrap Paradox (L3 §6.3, L4 §7.2)
The BeaconSet provides global, shared randomness required for functions like the Rotating Rendezvous DHT (§6.3). The fallback mechanism, used when external beacons (drand, NIST, ETH) are unavailable, is critically flawed:
BeaconSet(epoch) = SHA256("bn-fallback" ‖ K0c ‖ uint64_be(epoch))
K0c (§5.3) is a connection-specific secret key. This causes two fatal issues:
Consensus Failure: Different nodes will calculate different BeaconSet values during the same epoch, destroying the required consensus on global randomness (e.g., disagreement on rendezvous points).
Bootstrap Paradox: Bootstrap discovery (§6.3) happens before a connection is established; therefore, K0c does not exist. This creates a circular dependency that prevents bootstrapping if external oracles are blocked.
1.2. Endianness Contradiction (L2 §5.3 vs §1)
There is a direct contradiction in the encoding rules:
Section 1 states: "Multi-byte integers: unsigned big-endian."
Section 5.3 defines the AEAD Nonce construction using formats: nonce = NS XOR (LE64(counter) ‖ LE32(0)).
This ambiguity in the core encryption mechanism guarantees interoperability failures between implementations.
1.3. Rekeying Race Condition and Data Loss (L2 §5.3)
The rekeying procedure creates a race condition that can lead to unrecoverable data loss:
Senders MUST cease using the old key immediately after transmitting KEY_UPDATE.
The sender does not wait for acknowledgment before switching keys. If the KEY_UPDATE frame is delayed, lost, or simply reordered behind data frames in transit, the synchronization between sender and receiver is broken. For example, the sender may transmit data with the new key before the receiver has processed the KEY_UPDATE, causing the receiver to discard the data.
Security and Stealth Vulnerabilities
2.1. Protocol Advertisement via BN-Ticket Header (L2 §5.2)
The specification requires the decoy site to publish a BN-Ticket header to define the carrier policy:
BN-Ticket: v1; carriers=cookie:0.5,query:0.3,body:0.2; len=24..64
This completely undermines the stealth goal (§0, "covert transport indistinguishability"). A censor can trivially identify, flag, or block any site advertising this specific, non-standard HTTP header.
2.2. Predictable Rendezvous Points (L3 §6.3)
The primary bootstrap method uses 64 ephemeral IDs derived from the BeaconSet (§7.2), which itself is derived from public sources (drand, NIST, ). Since an adversary can also access these public beacons, they can pre-calculate all 64 rendezvous IDs for the day and proactively block them, making the primary bootstrap mechanism easily censorable.
2.3. Anti-Correlation "Panic Signal" (L2 §5.6)
When a connection fails (e.g., QUIC blocked) and the client retries (TCP), the mandate to launch ≥ 2 cover connections to unrelated origins immediately creates a strong behavioral signature. Observing a failed connection instantly followed by a burst of connections to disparate sites is a clear indicator of automated obfuscation (a "panic" response), making the traffic easier to correlate, not harder.
2.4. Ambiguous Signature Input Concatenation (L1 §4.2)
The Transition Control Stream signature SIG is defined over (prevAS ‖ nextAS ‖ TS ‖ FLOW ‖ NONCE ‖ "bn-t1"). If prevAS or nextAS identifiers are variable-length, this concatenation is ambiguous as no length prefixes or delimiters are specified. This can lead to signature verification failures or potential forgery attacks.
2.5. Anomalous Access Ticket Payload Size (L2 §5.2)
The access ticket payload structure requires 105 bytes of fixed data (Version 1B + cliPub 32B + ticketKeyID 8B + nonce 32B + accessTicket 32B) plus padding. Embedding over 105 bytes of high-entropy data into a cookie or query parameter is highly anomalous for most websites and serves as a strong signal for traffic classification.
Impractical and Brittle Transport Requirements (L2)
The HTX Cover Transport (L2) requirements are excessively strict, likely leading to a "Self-DoS" scenario where the network is unusable under real-world conditions.
3.1. Excessively Strict TLS Mirroring (§5.1)
The requirements for origin mirroring are practically impossible to maintain reliably:
Tolerances: ALPN set and order MUST match exactly. Extension order MUST match exactly.
Large origins and CDNs dynamically change these parameters due to A/B testing, rolling updates, and load balancing. Mandating an exact match and requiring the connection to "fail closed" on any deviation will cause frequent, unpredictable connection failures.
3.2. Impractical POP Calibration (§5.1)
The requirement that clients MUST calibrate against the same POP is difficult to guarantee. DNS co-location is imprecise, and Anycast/CDN routing is opaque to the client. The mandate to repeat calibration "until equality is achieved" could lead to excessive delays or infinite loops.
3.3. Contradictory Behaviour Emulation (§5.5 vs §5.1)
Section 5.5 mandates fixed randomization ranges for PING cadence ([10 s, 60 s]) and idle padding. This contradicts the goal of §5.1 (Origin Mirroring). If the origin server uses different timing (e.g., pings every 120s), these fixed ranges will not mirror the origin and become a distinguishing fingerprint.
Performance and Specification Errors
4.1. Severe Throughput Limitation (L2 §5.4)
Flow-control window: 65 535
A 64 KiB window is far too small for modern high-bandwidth, high-latency links (low Bandwidth-Delay Product). This will severely bottleneck the throughput of the network.
4.2. Access-Ticket Length Mismatch (L2 §5.2)
The required payload components total 105 bytes (see 2.5 above). However, the example carrier policy advertises a length range that is too small: len=24..64.
4.3. Replay Protection Window Mismatch (L2 §5.2)
Servers verify tickets across a window spanning up to 3 hours (hour ∈ {now-1, now, now+1}). However, they only reject duplicates within a 2 h window. The replay cache duration must be ≥ 3 hours to prevent boundary condition replay attacks.
4.4. Missing ECH Specification (L2 §5.1 / §11)
Section 11 (Compliance Summary, Item 1) mandates implementation of ECH (Encrypted Client Hello). However, ECH is not mentioned or specified anywhere in Section 5. The specification must detail how ECH keys are distributed and how calibration handles ECH states.
4.5. L1/L2 Interaction Instability (L1 §4.2 / L2 §5.3)
Section 5.3 requires L2 rekeying at least every hour. Section 4.2 requires L1 transition tunnels (running over L2) to close and re-establish upon L2 rekeying. This introduces excessive connection churn, overhead, and instability at the routing layer.
Centralization and Governance Issues
5.1. Reliance on External Oracles (L4 §7.2, L5 §8.2)
The specification aims for a "fully decentralised" network (§0) but relies heavily on external systems. Core functions (bootstrapping, mixnet selection) depend on external beacons (drand, NIST, Ethereum L1). The naming system depends on three specific external blockchains (Handshake, Filecoin, Ethereum L2). If access to these services is blocked, the network fails (compounded by the broken fallback mechanism in 1.1).
5.2. Emergency Advance Centralization (L5 §8.2)
The "Liveness rule" allows 67% of governance weight to override the blockchain consensus. This introduces a centralized point of control. If the governance quorum is compromised or compelled, the naming system can be hijacked.
5.3. Uptime Score (L7 §10.1)
Basing voting power partly on uptime_score is vulnerable. An attacker can run many low-resource nodes to cheaply accumulate a large total uptime score and influence governance.