Consider alternatives to XOR distance metric
- Dominant language
- JavaScript
- Stars
- 1.1k
- Forks
- 297
- Avg merge
- 5h 50m
- Merged PRs (30d)
- 1
Description
As far as I know, Ethereum uses a variant of Kademlia protocol. The distance of two node is based on the common prefixes of node ids (hashed actually).
In this way, the whole space of node ids are divided into two branches, one branch ids starting with 0 and another branch ids starting with 1. In theory, the nodes in branch 0 have near neighbors only from branch 0 and nodes in branch 1 have near neighbors from branch 1. Therefore, there is no neighbor connections between branch 0 and branch 1. In practice, bootstrap nodes have eased this problem probably.
I found this issue when I was designing my own blockchain algorithm/protocol. My fix is pretty simple as well, replacing xor metric by hamming distance, i.e. changing from `distance = id1 xor id2` to `distance = sum bits of(id1 xor id2)`. With hamming distance, the network has the same diameter as xor metric, but not partitioned.
P.S. I post this on ethresear.ch yesterday, but maybe here is a better place for it.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.