[NKP-0010] NVPN - Virtual private network functionality in the NKN core

First of all: Thanks for making the internet better with NKN, great project, well done, just needs some more features probably! I worked in IT for 5years, been in the blockchain space for 2 years so I hope i can contribute a bit also.

Maybe it collides with " [NKP-0009] NKN Transport layer", feel free to close it.

Background story of this proposal:

I tried to transfer binary files (1MB+) using NKN in 8kb chunks, they arrived sometimes out of order or some packets were dropped.
I guess this happens because of the data passing through multiple nodes in international locations of variying stability.

Also it was kind of a hassle to setup code to just have 2 clients communicate over the network, why can’t we simply provide a virtual network with regular IPs and ports?

There are tons of open source codes for raw TCP sockets, protocol documentations etc. I am not a high level network engineer, but I am sure someone could use existing systems or even codes as a template to implement it!

I call it “NVPN”:

General:

User should be able to install a virtual network adapter (Like OPENVPN or PPTP), pay (or hold/freeze?) a small fee to create a network, allow others to join + allow them to authorize others to join. Maybe also a small fee per gigabyte transferred, in case the will put too much load on the network.

Or generate access codes other can use to join.
The network adapter software should handle thing like requesting ACKnowledgement messages from the recipients, reorder packets if they arrive out of order and retransmit if they
got dropped etc.

Just like what TCP does already:

  • TCP flow control “Flow Control basically means that TCP will ensure that a sender is not overwhelming a receiver by sending packets faster than it can consume.” - https://www.brianstorti.com/tcp-flow-control/

  • TCP automatic retransmission: “When the TCP transmits a segment containing data, it puts a copy on a retransmission queue and starts a timer; when the acknowledgment for that data is received, the segment is deleted from the queue. If the acknowledgment is not received before the timer runs out, the segment is retransmitted.” https://www.saminiir.com/lets-code-tcp-ip-stack-5-tcp-retransmission/

Advantages this systems brings:

  1. Developers and users do not need to reinvent the wheel - they can use existing, known, tested and performant workflow like having IP adresses with ports or joining networks (like WIFI).

  2. Users and developers can leverage existing software on NKN e.g. using the Windows file browser or Firefox to browse a website or network shared folder. Or they could torrent or other swarm software in a virtual network, so many possibilities.

  3. NKN gets a builtin new use case - providing VPN networks. Maybe even some existing paid VPN providers could join NVPN and let the internet traffic terminate at their existing servers as a kind of load balancing.

3 Likes

I think virtual network is useful, but it’s better to be done by community on top of nkn sdk because of a few reasons:

  1. “on top of sdk”: It’s in the application layer and better to be separated from nkn node (otherwise each updates requires a hard fork/reset)
  2. “by community”: Virtual private network is not always supported by all governments. It should be ok if people use nkn to build such thing, but it might not be ok nkn officially provides it because many team members are not anonymous :joy:

But I agree that providing reliability would be very convenient, and we can talk about that in NKP-0009.

PS: The title should be “NKP” (stands for New Kinds of Proposal) instead of “NKN” :slight_smile:

hello,

thanks for your reply, i renamed the title.
yes, sure it would be very usel since with VPN you have regular virtual IPs and can use existing infrastructure e.g. network file sharing, streaming server, web server, firefox browser etc. without the need to build extra connection tools to connect them to NKN.

to be clear, the target of NVPN would be to have NKN internal communication e.g. reach your private webserver or remote desktop from a remote place e.g. when vacationing, not to browse blocked websites or something.

anyways, so we need a community member to help here, i do not have enough skills to make NVPN. anyone who can help, please help!