hoprnet / hoprnet

HOPR is an open incentivized mixnet which enables privacy-preserving point-to-point data exchange. HOPR is similar to Tor but actually private, decentralized and economically sustainable.
https://hoprnet.org
GNU General Public License v3.0
210 stars 90 forks source link

Promiscious mode in RPCh alpha #4533

Closed robertkiel closed 11 months ago

robertkiel commented 1 year ago

Rationale

RPCh introduces three kind of peers:

In addition there are

In order to send messages, aka. rpc requests from a wallet through an entry node using at least one hop, the intermediate node(s) to an exit node, the entry node needs have an open payment channel from the entry node towards the intermediate node. When selecting longer paths, meaning 2-hop or 3-hop packets, each intermediate node needs to have an open payment channel the next downstream intermediate node.

Note that the very same applies for replying to RPCh requests.

Initial topology

This strategy guarantees that wallets can use the network. It is not meant as a longterm solution.

Entry nodes get funded by the funding service and run by default the promiscious strategy with with a high target of open payment channels, e.g square root of number of nodes in the network. Since there is no payment channel necessary to the last hop, entry nodes can always construct a path through an intermediate node towards the desired exit node.

In order to reply to RPC requests, exit nodes run as well promiscious strategy with a high target of open payment channels, .e.g square root of number of nodes in the network. This guarantees that exit nodes can always construct a path towards the desired entry node. To achieve this, exit nodes continuously receive funding by the funding service.

All other nodes run the promiscious strategy as well, but with a low target number of payment channels, i.e. double square root of total number of nodes in the network. Having these additional payment channels allows the path selection algorithm to construct 2-hop and 3-hop paths.

Path selection algorithm

The algorithm takes the current payment channel graph and the destination, which is an entry node or an exit node.

  1. Randomly select the intermediate hop (int_0) out of the list of open and outgoing payment channels.
  2. If int_0 has an open and outgoing payment channel to a node int_1 that is different from entry node and exit node, add int_0 to the path. If int_0 has no open and outgoing payment channels, return the path.
  3. If there are payment channels, repeat step 2 for int_1 and int_2, otherwise return the path.

Road to longer paths

When opening payment channels, aka staking funds in the hopr network, maximize for the achievable number long paths that run through well-connected hops.

tolbrino commented 1 year ago

I believe this is covered with the current implementation of promiscuous mode and can be closed.