The current relay packet routing algorithm (proximity routing) only take latency and packet loss into consideration, but has no preference over node stability. As we have seen recently, massive amount of nodes getting online and offline, although having no impact on off-chain data transmission (relay), can potentially cause issues to block propagations. Therefore, I’m proposing a routing algorithm that also prefers to relay packets to nodes that have stay online for longer time. This mechanism can economically incentivize nodes to stay online for longer time and be more reliable without any centralized monitor.
The current routing algorithm can be briefly described as follows: A node actively measures the latency from it to all its neighbors. When the node is given X (currently 3) next hop candidates, it will choose the one with lowest latency.
The proposed routing algorithm can be briefly described as follows: A node actively measures the latency from it to all its neighbors. In addition, it keeps track of how long each neighbor connection has been established, which will be reset if the connection lost. when a node is given X next hop candidates, it will compute a score that depends on both latency and the connection uptime, and will choose the neighbor with highest score. An example of such function is
Expected results of using such algorithm:
- Nodes will prefer to stay online for longer and minimize downtime.
- Nodes with more stable network (but same latency) will get higher rewards.
- Nodes will prefer to upgrade to latest nknd version because nodes restart together with most other nodes will have higher connection uptime from other nodes’ perspective.
These exceptions, if achieved, will make the network more stable.
Please vote if you think we should or shouldn’t implement this proposal. Also welcome to share your thoughts in the comments.