# Archethic Patches: To Ensure Maximum P2P Data Availability (Part 2)

The Network Coordinates calculation for nodes is inspired from the distribution of stars in the galaxy.

The Network Coordinates calculation for nodes is inspired from the **distribution of stars in the galaxy**. Astrophysicists and Researchers have studied in a very profound way the distribution of stars in the galaxy and have deduced a mechanism to calculate the exact 3-dimensional position of a star by just using the distance between stars and center of mass of the stars. Archethic adopts a similar mechanism to calculate the Network Coordinates of a node by just having the latency between nodes and the center of mass of the nodes in the P2P network *(latency between two nodes is the minimum time taken to respond when a transaction is sent from one node to another).*

## How to Calculate Network Coordinates

**Step 1: Retrieving the Latencies from Beacons Chains**

From the Beacons Chains, every node in the P2P network will have the Latencies Matrix (dij) of shape (n×n)

Where,

- n is the number of nodes in the network.
- [N1, N2, N3.... ] are nodes in the network.
- Latency between nodes i and j is represented by dij where 1<= i <=n, 1<= j <=n.
- dii = 0 (there is no latency between the node i (Ni) and itself)

For Example: d23 = Latency between node N2 and N3.

**Step 2: Calculation of Distance of a Node from Center of Mass.**

- In physics, the center of mass 'c' of a distribution of mass in space is the unique point where the weighted relative position of the distributed mass sums to zero. In this case, the sum of vectors (Vjc) to all nodes from the center of mass is zero.
*(Note: Let all nodes be of unit mass)*

Hence,

- The traditional 'Law of Cosines' is used to calculate the distance between any two points, but here we are interested in calculating the distance between node and center of mass. To do this, the equation from 'Law of Cosines' and 'The Center of Mass' has to be combined as shown below.

- Hence, distance between a node and center of mass is given by,

**Step 3: Calculation of Gram Matrix (G)**

Derived from the Law of Cosines, Gram Matrix or 'G' or 'gij' is the dot product of the two vectors from the center of mass 'c' to points i and j respectively. G is calculated from Latencies Matrix (dij) and Center of Mass (dic).

**Step 4: Plotting the Nodes from Gram Matrix**

- Factorizing the Gram Matrix G using any factorization methods like Singular Value Decomposition, the Eigen Values [λ1,λ2,λ3,......λn] and their corresponding Eigen Vectors [E1, E2......En] can be obtained.
- The first 2 Eigen Values and Eigen Vectors yields the 2D plot for nodes.

[Xn,Y n] = [√λ1∗E1,√λ2∗E2]. - The nodes are then plotted in 2D plane with all the points obtained from [Xn,Yn]

**Step 5: Assigning Network Coordinates to plotted Nodes**

- The 2D plotted nodes are then drawn in a rectangle whose boundaries are maximum +X, +Y, minimum -X,-Y (from [Xn, Yn]).
- Then the rectangle is divided into 15 Big Patches (in red) and each Big Patch is in turn divided into 16 small patches (in green).
- The Network Coordinates of a node are represented by 3 digits. For example, the Network Coordinates of Node 1 are 1BD, '1' represents the Big Patch, 'B' represents the Small Patch and 'D' represents the throughput. The representation of the throughput of a node can vary between 0 to F
*(Throughput Data is obtained from the Beacons Chains just like Latency)*

## To Conclude

Patches are used inside mining and storage heuristics algorithms.

In mining, the nodes elected to validate a transaction represent a minimum of 3 different patches.

In storage, the data distribution in terms of geography (geographical coordinates) and replication availability (network coordinates) ensures swift retrieval and maximum availability of the data.

Patches are also designed for promoting global mass adoption:The mining and storage election algorithms incentivize more miners to join from areas that have less nodes per patch. Thereby creating an overall balance of nodes throughout the globe.

## . . . . . . .

If you are as interested in the development of Archethic network and Uniris-Biometric technology, check out Uniris team's previous articles!

Thanks for reading!

**Arch**e

**thic Public Blockchain**Archethic is a Layer 1 aiming to create a new Decentralized Internet.

Its blockchain infrastructure is the most scalable, secure & energy-efficient solution on the market thanks to the implementation of a new consensus: "ARCH".

Archethic smart contracts expand developers' boundaries by introducing internal oracle, time-triggers, editable content & interpreted language.

Through native integration for DeFi, NFTs & decentralized identity; Archethic offers an inclusive and interoperable ecosystem for all blockchains.

In order to achieve the long-term vision of an autonomous network in the hands of the world population, we developed a biometric device respecting personal data privacy (GDPR compliant).

Making the blockchain world accessible with the tip of a finger. Be the only key! https://www.archethic.net/

**Archethic Foundation** Non-profit in order to manage decentralized governance of the public blockchain

**Do you want to learn more?**

White Paper

Yellow Paper