Case Study: Building a P2P VPN Network Over the Ethereum Blockchain

in #ethereum7 years ago

At its core, a smart contract is a specialized blockchain wallet controlled by computer code. Its primary function is to send transactions when certain conditions are met. These conditions could be related to any information obtainable in the blockchain such as the current block height, the current block time, and blockchain transactions. There are already many substantial, proven use cases for smart contracts. They include the issuance of custom tokens, decentralized exchanges, decentralized casinoes, and even an insurance product from a multi-billion dollar insurance company. It’s arguable that the issuance of custom tokens has been the most revolutionary and impactful use case so far. Specifically, Ethereum, which is the first and most adopted smart contract blockchain today, is being used by tens of thousands of companies worldwide to crowdfund company initiatives through the issuance of custom ERC20 tokens. In fact, in China, ICOs were getting so popular and disruptive that the government decided to ban them earlier this month.

Smart contract technology is still very young and we’re far from realizing its full potential. There is a great deal of people and companies out there building ambitious, smart contract based projects. Most of these will flop but a select few will succeed… and probably succeed spectacularly.

In this blog post, I want to focus on one potential use case for smart contracts. Specifically, I’m interested in how a P2P VPN marketplace could be built on Ethereum. I know of at least two companies trying to build this, Mysterium and Privatix. I chose to study Privatix.

The team behind Privatix looks to be quite experienced in the cybersecurity and VPN space. The CEO, Dima Rusakov, has cofounded 3 privacy-oriented products in the past: Privatix VPN (consumer VPN with 50,000 DAU), 5VPN (professional VPN with 15,000 paid users), and Temporary Email Service (disposable email service with 250,000 DAU). All three have large and well established userbases. This gives Privatix a strong foundation with which to tackle a blockchain-based P2P VPN marketplace.

It’s important to keep in mind that Privatix’s ambitions go far beyond a P2P VPN marketplace. The Privatix network is intended to be an open source, generalized P2P bandwidth marketplace that’s open for anyone to build on. A P2P VPN marketplace will simply be a proof-of-concept product by the Privatix team aimed to drive adoption of the Privatix network.
fC5phTp.jpg

       What is a VPN? 

First of all, let’s go over what a VPN is. VPN stands for Virtual Private Network. It’s a service that allows you to connect to the Internet via another computer (often referred to as the server) run by a VPN provider. All your traffic appears to be originating from the server while the data between you and the server is fully encrypted. This means that your ISP and even the government, will not be able to block or spy on your Internet traffic (cough, cough China). Obviously, for your government to not block your traffic, the VPN provider’s server needs to be connected to an ISP outside your country’s jurisdiction.

Essentially, when you’re using a VPN, the VPN server becomes a secure and anonymous relayer of traffic between you and the rest of the Internet.

 How would a P2P VPN marketplace work? Is it better than centralized VPN services?

VPN providers are almost always centralized companies operating a fleet of servers. Customers would pay VPN providers for a connection to a server. These companies want to geographically distribute their servers as much as possible, since the closer a VPN server is to a customer, the better quality of service for the customer.

What if normal people, with their own home internet connections, setup their personal computers to act as VPN servers. This would create a network of “personal” VPN servers that customers can connect to. Customers would then be paying these “personal” VPN providers to use their home internet connections. This is essentially a decentralized, P2P marketplace. Instead of a company selling VPN services, network peers are buying and selling VPN services with each other.

This is a super interesting idea, since if a viable marketplace did exist, anyone can make money off their unused bandwidth and VPN customers would have a large network of low fee VPN providers to choose from.

    How is Privatix using smart contracts to power their VPN marketplace?

OMc2RM7.jpg

Privatix plans to build a P2P VPN marketplace powered by Ethereum. This system has 5 main components:

the agent (personal VPN provider) running gateway software which turns their personal computer into a VPN server
the user (VPN customer)
Service Blockchain Nodes (SBN) that is a centralized service that approves and stores a list of agents as well as a list of user subscriptions
Privatix smart contract running on Ethereum
the PRIX token will be used for all payments in the marketplace
In this system, the Privatix smart contract will not only act as a transparent and secure relayer of information between agents/users and the Service Blockchain Nodes, it will also be a transparent and secure payment processor for the marketplace.

Gateways register with SBNs through the Privatix smart contract

When someone wants to be an agent, they need to first download and run Privatix’s gateway software. This turns their personal computer into a Privatix VPN server (i.e. gateway). The gateway generates a wallet and connects to the Ethereum blockchain.

To be approved as a server, the gateway sends a transaction to Privatix’s smart contract containing an encrypted version of its IP address. The SBN receives the gateway’s IP address through looking over the smart contract’s transactions. The SBN will perform multiple checks on the gateway to ensure connection quality. Once approved, the SBN stores the gateway in a list of trusted gateways and sets the cost of the gateway based on its available bandwidth, IP type, and country. The SBN will occasionally check a trusted gateway to ensure that it’s still online and its available bandwidth hasn’t changed.

Users purchase subscriptions with SBNs through the Privatix smart contract

When a user wants to purchase a subscription, it sends a transaction to Privatix’s smart contract containing a purchase request. The request would specify country and bandwidth requirements.

As before, an SBN picks up the request through inspecting the smart contract’s transactions. It assigns the user a gateway and informs the user of the price in PRIX tokens. If the user sends a transaction to the smart contract with the right amount of tokens, the smart contract will send the user a subscription token and information to connect to the gateway.

Finally, once the smart contract detects the subscription has ended via the latest block time, it charges a small fee before paying the gateway PRIX tokens from the user to the agent.

Decentralizing Service Blockchain Nodes

SBNs are the primary centralized components of the system but this is only temporary. SBNs give the Privatix network room to grow without being stifled by blockchain fees. The long term solution would be to port SBN functionality to Plasma-powered dApps that use Ethereum’s yet-to-be released Whisper protocol. Plasma makes it significantly more efficient for dApps to run on Ethereum while the Whisper protocol allows dApps to communicate for free.

An SBN dApp would very likely still need an oracle service to perform tasks such as bandwidth checks on network nodes.

The bigger picture: P2P bandwidth marketplace

As mentioned above, the Privatix network aims to be an open P2P bandwidth marketplace. Users will be able to sell their bandwidth for a wide variety of applications such as VPNs, proxies, and CDNs. Developers will be able to build bandwidth-based applications on top of Privatix. All financial transactions on the network will be conducted through PRIX tokens.

The P2P VPN marketplace described above is a proof-of-concept product that Privatix plans to build on the network to drive initial adoption. They are also planning to build other proof-of-concept products such as a P2P proxy service for business intelligence data collection and even a decentralized CDN service.

This is a very high level summary of the Privatix network and I’d recommend reading their whitepaper if you’d like to learn more.

Smart contracts moving forward

The University of Waterloo, one of Canada’s best engineering schools, recently concluded their annual international hackathon called Hack the North. Hack the North attracts thousands of students globally and is Canada’s largest hackathon. Tech companies, including Google, Facebook, and Microsoft, go head over heels for a Hack the North sponsorship. This year, 30% of the hackathon’s projects were related to blockchain technology. The vast majority of which were Ethereum-based dApps. This is huge. It shows that there is significant interest in smart contract technology among computer science students, not only at the university, but all over the world.

Furthermore, the university will be hosting ETHWaterloo, a hackathon for Ethereum projects, next month. With 60 teams competing, ETHWaterloo is looking to be the world’s largest Ethereum hackathon. The hackathon also boasts a large group of high profile judges and speakers from the cryptocurrency community including: Vitalik Buterin, Joseph Lubin (Ethereum co-founder and ConsenSys founder), Stephan Tual (former COO of Ethereum and Slock.it founder), Martin KoeppelMann (Gnosis founder), Joey Krug (Augur founder), Linda Xie (Coinbase product manager), and many more. I’m personally very excited to see what kind of projects come out of this hackathon.

What I’m trying to say is, there is a lot of momentum going forward for Ethereum and smart contract technology in general. Not only is there a great deal of startups such as Privatix developing ambitious smart contract based projects, there is significant grass roots programmer interest in the technology as well. Excited to see what happens in the next few years.

Coin Marketplace

STEEM 0.16
TRX 0.15
JST 0.028
BTC 54349.85
ETH 2284.90
USDT 1.00
SBD 2.32