How to use the Skycoin Explorer API

iaufmc
Skyfleet Captain’s Log
5 min readMay 9, 2019

--

This tutorial shows you the most convenient way to use the Skycoin Explorer API on a windows machine using the Skycoin Wallet. With access to the API, you can start developing applications that utilize the connectivity to the Skycoin Explorer.

The Skycoin Explorer is a fantastic tool. It gives you the option to search for an address, block hash or number or even a transaction ID. Ever wondered who is Sky-rich? The Top-20 Wallets are available via the Rich List.

However, some of you may want to learn how you can make use of the data the Skycoin Explorer provides. For that reason, the developers behind the Skycoin Explorer added an API to the Skycoin Explorer.

API stands for Application Programming Interface. You may have heard of APIs before because most services offer these. The idea of an API is to give you access to a service (read or even write).

The Skycoin Explorer API Documentation

The Skycoin Explorer API is described as a tool to interact with Skycoin ecosystem. You can find the full documentation here: Skycoin Explorer API Documentation.

But how can you make use of these requests?

Step 1: You need a Skycoin Node

Some of you may have heard about the Skyminer before. A Skyminer is a cluster of single board computers mainly used as Skywire nodes. You can also install a full Skycoin wallet client on one to create a Skycoin node. Since Skycoin uses open source hardware you can either by an official miner or build your own. But hey, you don’t even need one!

There are three options for you to run a Skycoin Node:

  • Purchase an official Skyminer and install the wallet client
  • Build a DIY-Skyminer and install the wallet client
  • Download & install the Skycoin Wallet on your computer

Yes, it is as simple as that: The Skycoin Wallet gives you access to the Explorer. That means running the Skycoin Wallet Application gives you access to the Skycoin Explorer API.

For this tutorial, we chose the Skycoin Wallet option. It is easy and no dedicated hardware is needed.

You can download the Skycoin Wallet here: Skycoin Wallet. After the first start, you have to create a wallet. Please store the wallet seed securely.

Make sure to store your wallet seed securely

Step 2: Find your Node’s Port

By default, the Skycoin node should be running on port 6420. However, in my experience, this isn’t always the case.

If you type localhost:6420 in your browsers address bar and you see the Skycoin Wallet interface, everything is fine and you can go to Step 3. If not, we have to find out which port Skycoin is using.

There are two methods (maybe even more) to find out the port Skycoin Wallet is listening to.

The more convenient is to press Ctrl +Shift + I while you are within the Skycoin Wallet application and look at the sources tab (Thank you, @bksquared1024 for pointing out that method).

The Port is visible at the sources tab

Another option is to use the netstat command.

Open the Command Prompt ( Press Windows-Key, enter “Command Prompt”, right-click on the Command Prompt-Application and select “Run as Administrator”) and enter the command

netstat -b

Search for the [skycoin.exe] entry. You should find more than one.

There should be more than one Skycoin.exe processes running

The Skycoin Wallet should visible on your browser as you get redirected to

http://localhost:yourportnumber/#/wallets

Great, now let’s make our first API call!

Step 3: Make your first API Call

The hard part is already behind us and you are now ready to make the first calls to the Skycoin Explorer. From a quick view to the Skycoin Explorer API Documentation we can look for an interesting call to start with.

Let’s get the circulating supply number as a first API call

So I decided to have a look at Skycoins current coin supply. The documentation gives us two possible requests. As we are working with our local Skycoin Node, we use the Internal Skycoin node path which is

/api/v1/coinSupply

Just type http://localhost:yourportnumber/api/v1/coinSupply and make your first, successful API call!

/coinSupply gives you even more information than just the current supply

As you can see, /coinSupply gives you not just the current supply but also information about the total and max supply, the Coin Hour supply, and the (un-)locked distribution addresses.

Bonus step: Make calls via the Command Prompt

Making an API call via the Browser is convenient, but using the Command Prompt gives us more options. We are using the curl command to make an API call:

curl http://localhost:yourportnumber/api/v1/coinSupply

This command returns the same information we got before so how can you extract specific information? For that we are using findstr:

curl http://localhost:yourportnumber/api/v1/coinSupply | findstr “current_supply” 

returns one line only:

findstr returns one line only

Conclusion

The developers of Skycoin gave us the option to make API calls to the Skycoin Explorer so we should use them! The goal of this tutorial was to show you have to make the first calls and how easily it can be done using the Skycoin Wallet.

If you liked the information provided you can send me a tip ( Sky: 2BAEQ9tdibebL5XrozW4nQ7ciu4JnFXhcAS ). If you have any questions or recommendations I would love to read your comment!

--

--