Skip to main content

Module server_id

Module server_id 

Source
Expand description

§Server identity with proof-of-work birth certificate

ServerId is the stable identity of a single server node. Unlike crate::tools::client_id::ClientId, which costs nothing to produce, a ServerId is expensive: the server’s 32-byte Id is the reversed bytes of a PoW hash computed over the server’s keys, a random sponsor id, a timestamp, and a random content hash — with a minimum leading-zero-bit count (SERVER_KEY_POW_MIN) configured in crate::tools::config.

Reversing the PoW hash means the id naturally has a large number of trailing zero bits. The Kademlia DHT distributes responsibility by XOR distance, and the trailing-zero structure spreads servers evenly across the keyspace while making every id independently verifiable: anyone can recompute the PoW from the fields embedded in the ServerId and confirm the id is real.

The PoW therefore acts as a “birth certificate” that gates server identities — you can’t cheaply spin up thousands of sybil servers targeting a specific keyspace region because each id costs real CPU time.

Beyond identity:

Structs§

ServerId