Skip to content

Conversation

@mfw78
Copy link

@mfw78 mfw78 commented Jan 21, 2026

Summary

This SWIP introduces a fork digest mechanism for network upgrade coordination and cleans up the BzzAddress underlay encoding by replacing custom serialization with idiomatic protobuf.

Key Features

Fork Digest

  • 4-byte identifier derived from genesis hash and current fork version
  • Handshake integration - nodes reject connections where fork digests do not match
  • Hive protocol integration - fork-aware peer gossip filtering prevents accumulating stale peer lists

BzzAddress Encoding

  • repeated bytes underlays replaces bytes underlay with custom encoding
  • Removes custom serialization - no more 0x99 magic prefix or varint length encoding
  • Protobuf handles wire format - separates wire encoding from application logic

Signature Scheme (v1)

  • Simple concatenation of multiaddr bytes for signature (no padding needed)
  • Removes redundant "bee-handshake-" prefix (EIP-191 already provides domain separation)
  • Includes fork digest to bind signatures to specific forks

Migration Path

  1. Release N - Fork digest optional, accepts both legacy and new formats
  2. Release N+1 - Only new format accepted, legacy rejected

Feedback Requested

The exact composition of the genesis hash requires further discussion. Candidates for inclusion:

  • network_id (required)
  • genesis_timestamp
  • Contract addresses (postage stamp, staking, redistribution)
  • Other network-specific parameters

mfw78 added 3 commits January 21, 2026 11:30
Introduce a fork digest mechanism that enables nodes to identify
compatible peers during network upgrades via the handshake and
Hive peer gossip.

Key features:
- 4-byte fork digest derived from genesis hash and fork version
- Handshake integration for connection-time compatibility checks
- Hive protocol integration for fork-aware peer gossip filtering
- Updated BzzAddress signature scheme (v1) removing redundant prefix
- Two-release migration path for backwards compatibility
Extend the fork digest SWIP to also clean up underlay encoding:

- Change `bytes underlay` to `repeated bytes underlays` in protobuf
- Remove custom 0x99 prefix and varint length encoding
- Signature v1 uses simple concatenation of multiaddr bytes
- Add rationale for why no additional framing is needed
- Add test cases for signature verification and underlay encoding

This separates wire encoding (protobuf) from signature construction
(application logic) and simplifies implementations.
@mfw78 mfw78 changed the title Add SWIP: Fork Digest for Network Upgrade Coordination Add SWIP: Fork Digest and BzzAddress Encoding Jan 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant