planetr.io
Oct 27, 2018 · 3 min read

This blog is to explain all the steps needed to install Planetr.io decentralized master node, and how to execute APIs from the Planetr marketplace.

Steps followed:

  1. Install and Planetr.io master node on your laptop or desktop (or even on a cloud server)
  2. Create an EOS crypto testnet account and run the node.
  3. Execute and find the weather in a city using “Weather marketplace API”.

What is needed:

  1. A laptop or desktop running Mac, Linux or Windows and connected to internet. It must be 64bit.
  2. Basic understanding of Docker. Ensure Docker is supported on your computer.
  3. Basic understanding of curl.

Step 1 — Install and run Planetr.io master node

For this tutorial, a Mac laptop is assumed but it can be easily adapted to other operating systems.

Install the latest version of Docker on your laptop. Follow Docker Installation steps. Community edition is sufficient. See Docker Getting Started if needed.

Open a terminal from Launchpad.

Confirm that docker installation and permissions are working by running:

$ sudo docker info

enter the laptop password when prompted.

Pull Planetr master node image from docker hub:

$ sudo docker pull planetr/master

Check if the node is running by executing the following command

$ sudo docker run planetr/master -h

Create a folder mydata to persist the database and related files of master node:

$ mkdir ~/mydata


Step 2 — Create an EOS account and run the master node

Create a EOS account on Testnet and get free PLANET tokens.

$ sudo docker run planetr/master -c tom123

Note: replace tom123 with any name you like.

You should see a response like this:

*** PLANETR EOS TESTNET ***

Account Name: tom123
Private Key: 5K3SpdD*********************pKcW
Public Key: EOS6RuWuTMKLGYm6GWcSanCe4gPYcbq6aT1AZrQdJpuS9cBjWEyw4
Token Balance: 100.00000000 PLANET

Your EOS account tom123 is created and 100 PLANET tokens are added to it on the Testnet.

Now with that account let us start the master node and expose port 8000 and mount ~/mydata folder using tom123 EOS account.

$ sudo docker run -it -p 8000:8000 -v ~/mydata:/data planetr/master -a tom123

You will be prompted to enter the private key of the tom123 account

info: Planetr Master Node v0.7 beta
info: Network: TESTNET
Enter EOS Account Private Key to enable transactions (used only in this machine for this session):

Enter the private key (in this case 5K3SpdDHzfZ8XBYjG2pMszVT2nv7zj2EEhd3XJs7MLmDznwpKcW)

Press enter.

You should see that the node is running at port 8000

info: Validating EOS Account tom123
info: EOS Account, Balance: 100.00000000 PLANET
info: Planetr app running at: http://localhost:8000


Step 3 — Execute and fetch the weather

Go to Planetr marketplace and find the weather API.

Planetr Marketplace at https://planetr.io/marketplace/

Open a terminal on your Mac (or try using browser itself)

Execute

curl http://localhost:8000/exec/PLANETR:zdpuAq1CB3ax5QpM46XM5ftomj4roBTQikX6fegfFCYBpJJUk?city=Texas

Note that we are passing a parameter city = Texas. You can pass any city name as needed.

You will be seeing the response JSON similar as below:

{“request”:”5b9008eb298240003281e26f”}

This is the ID of the asynchronous request we just executed on the Testnet. Depending on the network traffic and complexity of the code it may take a moment to complete the execution. You can view the results by accessing the following URL:

curl http://localhost:8000/result/5b9008eb298240003281e26f

Note: In your case you may have a different request ID.

If the execution is complete and is successful, you will see a similar response JSON.

{
"type": "FUNCTION",
"usage": 4.2925,
"attempted": 1,
"_id": "5bd2c44da2aac80038f79256",
"signature": "PLANETR:zdpuAq1CB3ax5QpM46XM5ftomj4roBTQikX6fegfFCYBpJJUk",
"status": "COMPLETED",
"req": "{\"city\":\"Texas\"}",
"res": "{\"status\":\"SUCCESS\",\"data\":{\"temperature\":\"52\",\"skycode\":\"31\",\"skytext\":\"Clear\",\"date\":\"2018-10-26\",\"observationtime\":\"02:20:00\",\"observationpoint\":\"Texas\",\"feelslike\":\"52\",\"humidity\":\"99\",\"winddisplay\":\"2 mph West\",\"day\":\"Friday\",\"shortday\":\"Fri\",\"windspeed\":\"2 mph\",\"imageUrl\":\"http://blob.weather.microsoft.com/static/weather4/en-us/law/31.gif\"}}",
"log": ""
}

Congratulations! You have successfully executed an API from marketplace on Planetr decentralized compute network.

You may also notice that PLANET tokens are been transferred to from your EOS account tom123 to the compute node which executed your code.

Good luck!

Planetr.io Channel

Decentralized Serverless Computing - Planetary Scale

planetr.io

Written by

Planetary Scale Serverless Computing

Planetr.io Channel

Decentralized Serverless Computing - Planetary Scale

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade