Sentinel dVPN Node on Linux
===
About
===
Sentinel
Releases
===
Check out our latest releases on the [GitHub Repo](https://github.com/sentinel-official/sentinel/releases)
Objective
===
Enable users to set up a Sentinel dVPN OpenVPN and SOCKS5 Node.
Setup Instructions for Sentinel Node hosting
===
Below are the steps involved in getting a Sentinel dVPN OpenVPN and SOCKS5 Node up and running.
1. Configuring firewall
2. Install docker
3. Running the **Sentinel dVPN** docker image
4. Updating an existing Sentinel dVPN OpenVPN Node
## OpenVPN Sentinel Node
To run the sentinel dVPN OpenVPN node in Open VPN, we have to go through the following steps:
### Step 0 --- Configuring Firewall
---
Below are the instructions on configuring the firewall
1. First of all, we should open the specific ports on the firewall. Do not open all the ports.
2. UFW or Uncomplicated Firewall is installed by default on Ubuntu. If it has been uninstalled for some reason or needs an update, you can install or update it with
`sudo apt-get install ufw`
3. To check the status of the firewall type in terminal
`sudo ufw status verbose`
4. If firewall status is inactive, then type the below command to activate it
`sudo ufw enable`
5. For OpenVPN to work successfully, type the below command to allow the ports
`sudo ufw allow 3000`
`sudo ufw allow 1194`
6. Refer to the below image for all the steps explained above.

### Step 1 --- Installing Docker
---
##### OS Requirements
* A 64-bit installation
* Version 3.10 or higher of the Linux kernel.
As the first step to setting Sentinel dPVN OpenVPN node on Linux, you'll need to install Docker.
1. Update the apt package index:
`sudo apt-get update`
2. Install required dependencies to get docker installation script from get.docker.com
`sudo apt-get install curl`
`curl -fsSL get.docker.com -o /tmp/get-docker.sh`
2. Run the downloaded script to setup & install docker
`sudo sh /tmp/get-docker.sh`
3. Add current user to the docker group to give required access
`sudo usermod -aG docker $USER`
### Step 2 --- Running the Sentinel dVPN OpenVPN Node
---
You can setup and run VPN node in two ways:
1. Quick Run - download docker image from Docker Hub
2. DIY - build your own docker image from the Sentinel code repository
#### Method #1 [Download Docker Image from Docker Hub]
Using existing docker image:
1. Navigate to the User's home directory
`cd ~`
2. Create a new folder to pull the docker image and run it
`mkdir -p $HOME/.sentinel`
3. Pull the official Sentinel docker image from Docker Hub & configure the node
`sudo docker run -it --privileged --mount type=bind,source=$HOME/.sentinel,target=/root/.sentinel -p 3000:3000 -p 1194:1194/udp sentinelofficial/sentinel-vpn-node:0.0.8-alpha`
#### Method #2 [Build Your Own Docker Image]
Do-it-Yourself setup by building your own docker image
1. Navigate to the root folder or anywhere that you want to setup the project and download code from the repository
`cd ~`
2. Clone the Sentinel repository
`git clone https://github.com/sentinel-official/sentinel.git`
3. Navigate to the folder with code to build the docker image
`cd ~/sentinel/vpn-node-docker`
4. Build the docker image
`sudo docker build --file Dockerfile.prod --tag sentinel-vpn-node --force-rm --no-cache`
5. Navigate to the folder where the docker container was setup. In our case, it is the User's home directory.
`mkdir -p $HOME/.sentinel`
6. Run the image and configure the node
`sudo docker run -it --privileged --mount type=bind,source=$HOME/.sentinel,target=/root/.sentinel -p 3000:3000 -p 1194:1194/udp sentinel-vpn-node`
### Step 3 --- Updating an existing Sentinel dVPN OpenVPN Node
===
1. Stop the running docker container
`sudo docker stop $(sudo docker ps -aq -f ancestor=sentinelofficial/sentinel-vpn-node)`
2. Remove the older version of docker container
`sudo docker rm -f $(sudo docker ps -aq -f ancestor=sentinelofficial/sentinel-vpn-node)`
3. Remove the older version of docker image
`sudo docker rmi -f $(sudo docker images -aq -f reference=sentinelofficial/sentinel-vpn-node)`
4. Set the token value to an EMPTY STRING in the config file
Config file location: $HOME/.sentinel/config.data
Example: {"token": "", "enc_method": "AES-256-CBC", "account_addr": "0x656b756e6c6335302e676c343572357232786970", "price_per_gb": 125.0}
After completing the above steps, please follow the instructions on Method [#1 (Quick Run using Docker Hub)](https://hackmd.io/hOqfZ6pfSvOChSBx8QPsCw#Method-1-Download-Docker-from-Docker-Hub) to get the node up and running again.
## SOCKS5 Sentinel Node
To run the sentinel node in SOCKS5, we have to go through the following steps:
### Step 0 --- Configuring Firewall
---
Below are the instructions on installing firewall
1. First of all we should open the specific ports on the firewall. Do not open all the ports.
2. UFW or Uncomplicated Firewall is installed by default on Ubuntu. If it has been uninstalled for some reason, you can install it with
`apt-get install ufw`
3. To check the status of the firewall type in terminal
`ufw status verbose`
4. If firewall is inactive, then type the below command to activate it
`ufw enable`
5. For SOCKS5 to work successfully, type the below command to allow the ports
`ufw allow 3000`
`ufw allow 4200`
`ufw allow 4201`
`ufw allow 4202`
`ufw allow 4203`
### Step 1 --- Installing Docker
---
##### OS Requirements
* A 64-bit installation
* Version 3.10 or higher of the Linux kernel.
As the first step to setting Sentinel node on Linux, you'll need to install docker.
1. Install required dependencies to get docker installation script from get.docker.com
`sudo apt install -y curl`
`curl -fsSL get.docker.com -o /tmp/get-docker.sh`
2. Run the downloaded script to setup & install docker
`sudo sh /tmp/get-docker.sh`
3. Add current user to the docker group to give required access
`sudo usermod -aG docker $USER`
### Step 2 --- Running the Sentinel dVPN Socks Node
---
You can setup and run VPN node in two ways:
1. Quick Run - download docker image from Docker Hub
2. DIY - build your own docker image from the Sentinel code repository
#### Method #1 [Download Docker Image from Docker Hub]
Using existing docker image:
1. Navigate to the User's home directory
`cd ~`
2. Create a new folder to pull the docker image and run it
`mkdir -p $HOME/.sentinel`
3. Pull the official Sentinel docker image from Docker Hub & configure the node
`sudo docker run -it --privileged --mount type=bind,source=$HOME/.sentinel,target=/root/.sentinel -p 3000:3000 -p 4200:4200 -p 4201:4201 -p 4202:4202 -p 4203:4203 sentinelofficial/sentinel-socks5-node:0.0.8-alpha`
#### Method #2 [Build Your Own Docker Image]
Do-it-Yourself setup by building your own docker image
1. Navigate to the root folder or anywhere that you want to setup the project and download code from the repository
`cd ~`
2. Clone the Sentinel repository
`git clone https://github.com/sentinel-official/sentinel.git`
3. Navigate to the folder with code to build the docker image
`cd ~/sentinel/socks5-node-docker`
4. Build the docker image
`sudo docker build --file Dockerfile.dev --tag sentinel-socks-node --force-rm --no-cache`
5. Navigate to the folder where the docker container was setup. In our case it is the User's home directory.
`mkdir -p $HOME/.sentinel`
6. Run the image and configure the node
`sudo docker run -it --privileged --mount type=bind,source=$HOME/.sentinel,target=/root/.sentinel -p 3000:3000 -p 4200:4200 -p 4201:4201 -p 4202:4202 -p 4203:4203 sentinel-socks-node`
### Step 3 --- Updating an existing Sentinel dVPN SOCKS5 Node
===
1. Pull the latest version of docker
`sudo docker pull sentinelofficial/sentinel-socks5-node`
2. Stop the running docker container
`sudo docker stop $(sudo docker ps -a -q --filter="ancestor=sentinelofficial/sentinel-socks5-node")`
3. Remove the older version of docker image
`sudo docker rm $(sudo docker ps -a -q --filter="ancestor=sentinelofficial/sentinel-socks5-node")`
4. Set the token value to an EMPTY STRING in the config file
Config file location: $HOME/.sentinel/config.data
Example: {"token": "", "enc_method": "AES-256-CBC", "account_addr": "0x656b756e6c6335302e676c343572357232786970", "price_per_gb": 125.0}
After running the above commands, please follow the method [#1 (Quick Run using Docker Hub)](https://hackmd.io/hOqfZ6pfSvOChSBx8QPsCw#Method-1-Download-Docker-from-Docker-Hub) to get the node up and running again.
Helpful docker commands to interact with the Sentinel dVPN Node
===
* list a running Sentinel dVPN Node:
```sudo docker ps```
* list both, running and stopped Sentinel dVPN Nodes:
```sudo docker ps -a```
* stop a particular Sentinel Node:
* run ```sudo docker ps``` and copy the Container ID.
* run ```sudo docker stop ContainerID```
###### Note: stopping a dVPN Node does not remove the container
* remove a particular Sentinel dVPN Node:
```sudo docker rm ContainerID```
###### Note: The Sentinel dVPN Node must be stopped to be removed. Alternatively, you can use the `-f` flag to forcefully remove the Node if the node can not be stopped.
* remove all stopped Sentinel dVPN Nodes:
```sudo docker rm $(sudo docker ps -a -q)```
* stop all the running dVPN Nodes and remove them:
```sudo docker stop $(sudo docker ps -a -q) && sudo docker rm $(sudo docker ps -a -q)```
###### Note 1: In case you previously ran any version of Sentinel client, read the wallet from keystore file in .sentinel folder and use that same address for node setup
###### Note 2: once initialization sequence is complete, press ***ctrl + p + q*** to detach from the docker container and run it in the background.
*We're enabling developer console in this version for better error and log reporting. Please use it when submitting issues in the chat group or on our github repo*
```Please enable testnet from topbar for using the Sentinel dVPN```
#### When swix transaction is completed, please click on SENTINEL Logo present on the start of swixer web page in Swixer Tab, to start new swix transaction.
More specific steps depend on your operating system:
1. Linux
2. Mac
3. Windows
### For Mozilla Firefox users there's a caveat [ MacOS | Windows | Ubuntu ]:
Firefox users should change proxy settings in their browser. For that,
open firefox and navigate to ``` menu > preferences > network proxy ``` and enter the above details in the respective fields.
# Linux- Installation of Sentinel dVPN Desktop App
Select ubuntu. There will be two Debian packages, one will be for Linux 16.04, and another will be for Linux 18.04. Download the latest deb package for Linux from the Sentinel official https://www.sentinel.co/releases/
1. For downloading the Sentinel dVPN Desktop App on Linux, kindly visit and download the latest deb package for Linux from the Sentinel official https://www.sentinel.co/releases/alpha-0.1.0/ubuntu/. There will be two Debian packages, one will be for Linux 16.04, and another will be for Linux 18.04. In this guide, we will choose Linux 18.04.

2. After downloading the file, the deb package will be saved on the downloads path

3. Open the terminal. Go to the path where the Deb file is saved. Before installing the Deb file, run the below command in the terminal. After executing the command, a prompt will come asking whether to continue or not. Enter 'Y' and then again press enter to complete the execution of the command.
```
sudo apt install -f
```

3. Install the deb file by running the below command
```
sudo dpkg -i Sentinel***.deb
```

4. After successful installation, type `sentinel` in the terminal. One prompt will come to ask for the authentication. Enter your system password and continue to open the app.

# Mac- Installation of Sentinel dVPN Desktop App
1. Run the .dmg file and drag the Sentinel app to ***Applications*** folder.
2. Go to Applications Folder and right click on sentinel app and Click on ***Show Package Contents*** option.
3. Then go to ```Contents > MacOs``` and run sentinel by double clicking the package.
4. Additionally, You can create a shortcut of the app by right clicking the sentinel package and click ```make alias```, then copy the alias to your desktop for ease of use.
5. While connecting to VPN, in case of the error - 'Package ***brew*** is not installed' error. Then please install homebrew in your system and then try connecting to the vpn.
6. Please follow instructions from this [howtogeek tutorial](https://www.howtogeek.com/211541/homebrew-for-os-x-easily-installs-desktop-apps-and-terminal-utilities/) to install Homebrew
# Windows- Installation of Sentinel dVPN Desktop App
1. Download the installer from the Sentinel official https://www.sentinel.co/releases/alpha-0.1.0/windows/

2. Once it is downloaded, run the installer (Sentinel-{version}.exe). It is mostly in C:\Users\{user_name}\Downloads
3. In this version you can launch the app without Run As Administrator, anyhow a prompt will be shown to give admin access. If a popup 'Windows protected your PC' occur, click on More info and then click on Run anyway to start the installation.
5. Click yes to allow the changes to be made on Computer.
6. From next time onwards, you can run the app from folder:
```C:/ > Users > {Your Username} > AppData > Local > Sentinel > Sentinel.exe```
**Note:** If AppData is hidden, click on view on top bar and select `hidden items`.

Moreover, you can create a shortcut of the app and save it on your desktop for ease of use. For that right click on the sentinel.exe file and click ```Create Shortcut```. After that, you can copy that shortcut to your desktop and open the app from desktop everytime.
6. If you’re facing any issues while installing the app, like OpenVPN Is Not Installed or Something Went Wrong, please uninstall your already installed OpenVPN from control panel and then re-install OpenVPN from the following path on your local machine and re-run the Sentinel App.
`C:// > Users > {Your Username} > AppData > Local > Sentinel > app-{version} > resources > extras > openvpn-install-2.3.18-*.exe`

7. Your keystore file will be stored in the below path. Save this keystore to restore your wallet at any device.
`C:\Users\{Your Username}\.sentinel`

# Sentinel dVPN Desktop App
Sentinel is an interoperable, secure network layer offering the Sentinel Service Chain exclusively for distributed & decentralized native services like - dVPN, Sentrix (dChat and dVoIP) and more.
## A. On start-up
**Note:** On start-up, when you create an account, you are creating your Ethereum wallet. For the creation of Tendermint account, you need access to the dashboard.
### Create a new account
New initiatives and experiments we want to start improving
1. When you open the Sentinel dVPN Desktop App for the first time, you will get the option of either creating or restoring the wallet.

2. Click on Create/Restore wallet.

3. For **creating account**, enter your password to create your anonymous user ID. For **restoring account** skip to step 6.
4. When you create an account, the next screen will display your private key and your address. Kindly save it offline in a very secure place to avoid loss or theft of keys. Do not lose keys as it is the only way to unlock the wallet. It will also mention the path of the keystore file stored in your mobile. The Keystore file will help you to restore wallet. Click on “Yes, I have copied my keys in a secured place.” and then tap next to get the access to the dashboard.
5. The path where the keystore file is saved is:
**Windows:** C:\Users\{computer_name}\.sentinel
**Linux:** <*****>
**Mac:** <*****>

6. After saving your keys, click ‘go to Dashboard’ and get access to the features of Sentinel.
6. For **restoring the account**, you must have your keystore file in the system. To restore the account, select the file and enter your password associated with it. Then select ‘Restore keystore file’ to access the dashboard.

**Login**
1. If your keystore is at the place, then when you open your app it will directly ask you to enter the password.

2. After the successful login, you can access the dashboard.
## B. Ethereum Testnet
To select the Ethereum testnet, first turn on the testnet by sliding it right. After the test net is on, the list of testnet at the top right corner becomes active. By default, it selects tendermint testnet. To activate the Ethereum testnet, you can choose the Ethereum testnet from the list.
### Wallet Transfer - Receive Funds
**Note:** ‘Get free tokens’ is only applicable to the testnet. In mainnet, you can only receive SENT tokens from another wallet.
1. Click on the receive button on the left side of the app to view your address and to access to free test tokens.

2. To receive funds, share your address to the sender.
3. To get free tokens, click on ‘Get free tokens’ at the top. You will receive TestSENT and TestETH. Wait for few seconds for the wallet to show original balances. There is the limit of free tokens you can have.
### Wallet Transfer - Send Funds
1. To send funds, click on send symbol on the left side of the app.
2. Enter the address to send.
3. Enter the amount you want to send. You can select the token you want to send from the list- TestSENT or TestETH.
4. Set the gas limit and gas price. Set high gas for faster transaction.
5. After signing the transaction with your keystore password, click send. You cannot click send until you enter the password. In case of wrong password input, the tokens will not be sent.

6. After sending, you will get the notification of the transaction, and you can click on check status.

7. After clicking on check status, you can see the transaction details on rinkeby.

### Transaction History
1. To view transaction history, click on Tx History symbol on the left side of the app. There is option to see on the top right TestSENT and TestEth. Select the token to view its transaction history.
2. TestSENT transaction history

3. TestETH transaction history

### dVPN Service
1. Select the list symbol on the left side of the app to show the list of dVPN nodes.
2. You will be shown the list of VPN nodes.
3. There are two options available- Public and Private.
4. For private network, select the private network symbol. It will then ask you to enter auth code. Enter the code and click connect to access the private network.

5. By default, the public is selected. Under the public, there are again two options OpenVPN and SOCKS5.
6. **OpenVPN**
a. Select OpenVPN and, you can see the list of the nodes available to connect.
b. You can click on the node to see the information and connect button.

c. You can also use the map on the top right corner to select the node.

d. Or you can search by city name or country name.

e. Click on any node and click on connect.

f. For the first time use of the VPN service, you will get a popup ‘Initial Payment Alert.’

g. After clicking pay, you will be redirected to Wallet transfer- Send tokens. The address associated with the dPVN node and amount will be set by default. Set the gas limit and password and pay the initial amount to activate the service.

h. After successful payment, you can connect to the node, and you can see the node details below on the app like IP, speed, location, upload, and download.

i. You can check the IP on the browser also and match the queried result with the IP shown on the Sentinel dVPN Desktop App.

j. After the use of the service, you can disconnect the node anytime by clicking on the disconnect.
k. You will be asked for the rating. It is optional. You can rate or comment based on your experience with the usage of the Sentinel dVPN Desktop App.

l. Now when you try to connect the node for the VPN service next time, you have to pay the pending amounts else while connecting node, it will ask you to pay the tokens for the previous session by displaying the message on the bottom screen of the app.

m. To pay the due amount go to the VPN history symbol on the left side of the page and click on Pay now to pay the amount.

n. After clicking pay, you will be redirected to Wallet transfer- Send tokens. Set the gas limit and password and pay the pending amount to pay the due.
o. Kindly go to check status and visit rinkeby to copy your transaction hash so that you can view your transaction info anytime.
p. In case you have already paid, click on the Already Paid button and enter your transaction hash.

q. Report successfully message on the bottom screen will come when you press send.

r. After successful payment, you can use the dVPN services again. In the dVPN history, you can see your previous sessions and pending bills.

7. **SOCKS5**
a. Select SOCKS5 and, you can see the list of the nodes available to connect.
b. You can click on the node to see the information and connect button.

c. You can also select the map on the top right corner to select the node in the map.

d. The VPN session of SOCKS5 is similar to OpenVPN.
## C. Tendermint Testnet
When you toggle on the testnet, the tendermint testnet is selected by default.
### Account Creation
1. When accessing the tendermint testnet for the first time you have to enter the account details.

2. The next screen will ask you to save keys and seed at a safe place.

3. After saving the keys, click on the ‘Go to Sentinel tendermint wallet.’
### Wallet Transfer - Receive Funds
**Note:** ‘Get free tokens’ is only applicable to the testnet. In mainnet, you can only receive SENT tokens from another wallet.
1. Click on the receive button on the left side of the app to view your address and to access to free test tokens.
2. To receive funds, share your address to the sender.
3. To get free tokens, click on ‘Get free tokens’ at the top. You will receive TestSENT. You can get free TestSENTS many times. Wait for few seconds for the wallet to show original balances. There is the limit of free tokens you can have.

4. You can get the free test SENTs until your wallet balance is less than 1000.
### Wallet Transfer - Send Funds
1. To send funds, click on send symbol on the left side of the app.
2. Enter the address to send.
3. Enter the amount you want to send.
4. After signing the transaction with your tendermint account password, click send. You cannot click send until you enter the password. In case of wrong password input, the tokens will not be sent.

### Transaction History
To view transaction history, click on Tx History symbol on the left side of the app. There is an option to see on the top right TestSENT and TestEth and select the token to view its transaction history.

### dVPN Service
1. Select the VPN list in the left side of the app.
2. You will be shown the list of VPN nodes.
3. There are two options available- Public and Private.
4. Private Network (coming soon).
5. By default, the public is selected. Under public, there are again two options OpenVPN and SOCKS5.
6. **OpenVPN**
a. Select OpenVPN, and you can see the list of the nodes available to connect.
b. You can click on the node to see the information and connect button.

c. You can also select the map on the top right corner to select the node in the map.

d. Click on any node and click on connect.

e. For the use of the dVPN service, you will be redirected to the send tokens page to LOCK your test SENT tokens.

f. If you have consumed less than the 100 test SENTs, you will get back the unused tokens

g. You can check the IP on the browser also and match the queried result with the IP shown on the app.

h. After the use of the service, you can disconnect the node anytime by clicking on the disconnect.
i. After the full consumption of the locked test SENTs, it will automatically disconnect the service.
j. You can view session history by clicking on the VPN history symbol on the left side of the app.

7. **SOCKS5**
Coming Soon
## D. Main Net
### Wallet Transfer - Receive Funds
1. Click on the receive button on the left side of the app to view your address and to access to free test tokens.
2. To receive funds, share your address to the sender.

### Wallet Transfer - Send Funds
1. To send funds, click on send symbol on the left side of the app.
2. Enter the address to send.
3. Enter the amount you want to send. You can select the token you want to send from the list- TestSENT or TestETH.
4. Set the gas limit and gas price. Set high gas for faster transaction.
5. After signing the transaction with your keystore password, click send. You cannot click send until you enter the password. In case of wrong password input, the tokens will not be sent.

### Transaction History
1. To view transaction history, click on Tx History symbol on the left side of the app. There is an option to see on the top right TestSENT and TestEth and select the token to view its transaction history.
