archethic-foundation / archethic-foundation/archethic-node
Network Coordinates Weighted Locally
- Dominant language
- Elixir
- Stars
- 82
- Forks
- 24
- PR merge metrics
- No merged PRs in 30d
Description
### Is your feature request related to a problem?
The BeaconChain is integrating global network coordinates aggregated on each BeaconChain's summary based on latency and distribution of nodes.
However, during the summary interval (daily based on the mainnet), the closest nodes are not adapted based on the current exchanges over time.
This reduces the accuracy of the network patch and closest nodes definition.
### Describe the solution you'd like
We should have an implementation such as Vivaldi algorithm, to support weighted network coordinates based on the remote connections exchanges and latency to adjust the network coordinates locally.
With the real time RTT of nodes, the network coordinates will adjust to the moving RTT.
### RTT changes
This is calculated after every interaction between the node and other nodes or when there is a significant change in RTT.
| Node X | RTT | RTT' |
|-|-|-|
| Node 1 | RTT1 | RTT1’ = (RTT1/RTTr)*√[(Xx-Xr)^2 + (Yx-Yr)^2] |
| Node 1 | RTT2 | RTT2’ = (RTT2/RTTr)*√[(Xx-Xr)^2 + (Yx-Yr)^2] |
| ... | ... | ... |
| Node r | RTTr | RTTr’ = √[(Xx-Xr)^2 + (Yx-Yr)^2] |
| Node x | RTTx = 0 | - |
| ... | ... | ... |
| Node n | RTTn | RTT1’ = (RTTn/RTTr)*√[(Xx-Xr)^2 + (Yx-Yr)^2] |
Node r being a random node chosen locally, which might change on regular basis (ie. beacon chain slot, or each P2P exchange depending on the complexity of execution from the algorithm)
X,Y coordinates conversion backed can be reduced on the 1st and 2nd digits as condensed coordinate based on ratio.
### Weighed coordinates
| Node X | Theta / angle (θ) | Weighted Coordinates (Xw, Yw) |
|-|-|-|
| Node 1 | θ1 = tan-1 [(Y1 - Yx) / (X1 - Xx)] | (Xx + RTT1’*Cosθ1 , Yx + RTT1*Sinθ1) |
| Node 1 | θ2 = tan-1 [(Y2 - Yx) / (X2 - Xx)] | (Xx + RTT2’*Cosθ2 , Yx + RTT2*Sinθ2) |
| Node 1 | θ3 = tan-1 [(Y3 - Yx) / (X3 - Xx)] | (Xx + RTT3’*Cosθ3 , Yx + RTT3*Sinθ3) |
| ... | ... | ... |
| Node x | 0 | (Xx, Yy) |
| ... | ... | ... |
| Node n | θn = tan-1 [(Yn - Yx) / (Xn - Xx)] | (Xx + RTTn*Cosθn , Yx + RTTn*Sinθn) |
Calculate the θ i.e the angle between nodes, and add the changes of the new RTT’ (i.e the live RTT) to θ, this will give the new (Xw,Yw) coordinates.
We can then convert the new (Xw, Yw) coordinates to network patch
### Additional context
@internet-zero
Epic: #155
Contributor guide
Research direction
No files, tests, or entry points are named. Start by reviewing Epic #155 and the existing BeaconChain summary and network-coordinate behavior, then clarify the Vivaldi-based RTT and weighting design. Done should include an agreed implementation scope and verification of locally adjusted coordinates and their network-patch conversion.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- elixir
- Domain
- blockchain, networking
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100