Skip to main content
Version: Next

Visualizing topology of HOPR network

Before data packets can be sent between HOPR nodes, nodes need to possess HOPR tokens (or tHOPR for testnets) and open payment channels with other nodes in the HoprChannels smart contract. By monitoring opening, closing and updates of payment channels through events emitted from HoprChannels, the topology of the current HOPR network can be effectively mapped out.

HoprChannel Events

The following events are relevant for visualizing the network topology:

  • ChannelUpdated
  • ChannelOpened
  • ChannelFunded
  • ChannelClosureInitiated
  • ChannelClosureFinalized

Connection (incluiding the direction of payment channels), stake (amount of HOPR tokens as channel balance), ticket redemption (number of tickets being redeemd per channel) and change change in channel status can be visualized with on-chain events.

A full specification of all the events from HoprChannels smart contract is detailed in section "Smart Contract Overview"

Importance score

With the latest channel balances, importance score can be calculated per channel. This score is used as an indicator for cover traffic nodes to prioritize the distribution of cover traffic. The importance score is calculated as a product of the stake of a node and the sum of weights of all the outgoing channels.

Ω(Ni)=st(Ni)jw(CNiNj)\Omega(N_i) = st(N_i) \cdot \sum_{j} w(C_{N_iN_j})

where NiN_{i} is the node, CNiNjC_{N_iN_j} is an outgoing channel of node NiN_{i}, w(CNiNj)w(C_{N_iN_j}) is the weight of the channel CNiNjC_{N_iN_j}.

w(CNiNj)=B(CNiNj)St(Nj)St(Ni)w(C_{N_iN_j}) = \sqrt{B(C_{N_iN_j}) \cdot \dfrac{St(N_j)}{St(N_i)}}

where B(CNiNj)B(C_{N_iN_j}) is the balance of the channel between node NiN_i and NjN_j, and St(Ni)St(N_i) is the stake of the node NiN_i.

The stake of a node can be denoted as below, which is the sum of the unreleased tokens of a node NiN_i and the total of outgoing channels of NiN_i

St(Ni)=uT(Ni)+jB(CNiNj)St(N_i) = uT(N_i) + \sum_{j} B(C_{N_iN_j})

In the protocol, the importance score is implemented as the function importance in the packages/cover-traffic-daemon/src/utils.ts

Deployed Channel contracts

HoprChannels smart contract of the previous public testnet - "Wildhorn v2" is deployed on Gnosis Chain at 0xF69C45B4246FD91F17AB9851987c7F100e0273cF.

HoprChannels smart contract of the last public testnet - "Matterhorn" is deployed on Gnosis Chain at 0xD2F008718EEdD7aF7E9a466F5D68bb77D03B8F7A.

Other statistics

For reference, HOPR xDAI Testnet - Wildhorn v2 Dashboard shows some statistics about this public testnet. The analysis is done with on-chain data of emitted events and transaction calls.

The HOPR protocol - xDAI: Matterhorn Testnet shows the recently completed public testnet. Read more on the retrospective of this testnet in the medium blog.