Blockchain is evolving every week and we get to hear back about new innovations in the field. While it is important to adopt the blockchain for every industry and it is equally important as to bridge the blockchain to the external world so it can communicate to pull and push the data onto Decentralized network.
Plugin is one such network which is decentralized oracle that helps blockchain system to connect to the external world. Let’s dive in to the article and see how we can setup a Plugin node in development mode.
What is Plugin?
Secure, Scalable Blockchain Agnostic Decentralized Oracle
Decentralized Oracle Platform, provides cost effective solutions to any smart contract which runs on Xinfin Eco System.
Plugin enables the smart contract to connect with the real-time world and the data that it receives from the data feed provider is trustable by maintaining high degree of security. Off-chain computation it does takes care of receiving feed from multiple provider and aggregates the same.
System Requirements :
Operating System — Ubuntu / Linux Kernel
RAM — 2GB (minimum) — More the better
Storage Space — 50GB(minimum) — More the better
For the purpose of this demo, we use AWS EC2 intance
Let’s set the environment right by following these steps.
Step 1–- Install Go 1.17, and add your GOPATH’s bin directory to your PATH
sudo apt remove --autoremove golangsudo rm -rf /usr/local/gosudo tar -C /usr/local -xzf ~/Downloads/go*.linux-amd64.tar.gzsudo sh -c 'echo "export PATH=$PATH:/usr/local/go/bin" >> /etc/profile'
- sudo nano ~/.profile
export GOROOT=$HOME/go
export GOPATH=$HOME/work
export PATH=$PATH:$GOROOT/bin:$GOPATH/bin
- source ~/.profile
Step 2 — Install NodeJS 12.18 & Yarn
- curl -fsSL https://deb.nodesource.com/setup_12.x | sudo -E bash -
- sudo apt-get install -y nodejs
NVM
- https://github.com/nvm-sh/nvm#install--update-script
- wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash
- It might be easier long term to use nvm to switch between node versions for different projects:
nvm install 12.18 && nvm use 12.18
YARN
- sudo npm install — global yarn
Step 3 — Install Postgres (>= 11.x).
- You should configure Postgres to use SSL connection
- https://www.postgresql.org/download/linux/ubuntu/
- sudo apt-get install postgresql-12
- sudo systemctl start postgresql@12-main
Step 4 — Download Plugin: git clone https://github.com/GoPlugin/Plugin && cd Plugin
- sudo apt install make
- apt-get install build-essential
- make install
- yarn install
- Build and install Plugin:
make install
- If you get any errors regarding locked yarn package, try running
yarn install
before this step - If
yarn install
throws a network connection error, try increasing the network timeout by runningyarn install --network-timeout 150000
before this step
Step 5 — Run the node
By now, you are good with the environment setup & ready to bootstrap the PLUGIN node. Before you start the plugin node, you need a database to setup in POSTGRES.
sudo -u postgres psql
create database plugin_db;
alter user postgres PASSWORD 'YOURSTRONGPASSWORD';
Below environment variables need to be set in order to get connected with Apothem Network using websocket
export ETH_CHAIN_ID=51
export ETH_URL=wss://ws.apothem.network
export MIN_OUTGOING_CONFIRMATIONS=2
export PLI_CONTRACT_ADDRESS=0x0b3a3769109f17af9d3b2fa52832b50d600a9b1a
export PLUGIN_TLS_PORT=0
export SECURE_COOKIES=false
export ALLOW_ORIGINS=*
export DATABASE_TIMEOUT=0
export FEATURE_EXTERNAL_INITIATORS=true
export PLUGIN_DEV=true
export DATABASE_URL=postgresql://127.0.0.1:5432/plugin_db?sslmode=disable
export ENABLE_EXPERIMENTAL_ADAPTERS=true
Now, start your “Node” using below command
plugin node start
During initial setup, administrator has to set a Keystore password and the confirmation of the node account. It is important to keep note of this password somewhere. If it gets lost, there is no way to retrieve it and the funds managed by the private key also get lost. Each time you start, you need to enter this password to unlock the Keystore.
*** KEYSTORE PASSWORD SHOULD FOLLOW THIS CONDITIONS ***
- “must be longer than 12 characters”,
- “must contain at least 3 lowercase characters”,
- “must contain at least 3 uppercase characters”,
- “must contain at least 3 numbers”,
- “must contain at least 3 symbols”,
- “must not contain more than 3 identical consecutive characters”,
The node requires to sign the transaction through the private key of the Keystore and submit it to the blockchain.
You should be able to view the list of existing jobs using below command
plugin jobs list
Hope you are able to setup and see the PLUGIN running in the following url
http://<remote-ip or localhost>:6688
Login into Plugin using the email ID & password, you had setup using Step 5
— Let us know if you face any issues during the node setup in Discord
We will soon come back with another article to setup External Initiators & show you, how to get connected these two ( Plugin Node & External Initiator) to deploy your first oracle service.
!!!Happy Exploring!!!
Join our discord link for any questions with respect to setup the node — https://discord.com/invite/4ATypYHudd
— Docker mode setup is in progress, should be out soon —