Kylin Testnet Launch (and Guide!)

Kylin Network
6 min readMay 25, 2021

--

Dear Kylians,

Aside from our Web3 Grant and our TGE, this next milestone is as — if not more(!) — important. The testnet launch represents the first ‘real’ step toward product and functionality that we envisioned from a very early stage: that is to say it’s a vision that involves our community members directly and also underscores the flexibility and power of decentralized data architecture: an open sandbox where innovation in this new area is only limited by imagination.
We look forward to the further galvanization of our community’s expertise by some of our first Kylians, who will undertake some of the first experiments in imaginative API calls that no one else has yet conceived. These first pioneers will likely also be some of the first OPs (Oracle Programers) within the network. We look forward to your work.
On an ad-hoc and case-by-case basis, we will provide incentives to this early group of pioneers to support their work through Kylin Labs and our Ecosystem Development Fund. All are welcome to experiment, and the best OPs out of this group will be given our direct support and interfacing as we move to mainnet and interface with partners, projects, and enterprises alike.

The next chapter begins!

— Kylin Core Team

Kylin Testnet Guide

Introduction

This is a beginner’s guide to help you setup your node on the testnet. To simplify the deployment of the node the team has used Docker.

Docker is a form of containerization that makes it much simpler to start your node, the container contains all the dependencies and start up scripts needed. This means your operating system is irrelevant, whether you are running Windows/Mac/Linux our goal is that you should only run one command to get everything up and running! This is exactly what we are going to do with docker-compose.

This guide is aimed at the very basic beginner, the team has a far more advanced step-by-step tutorial which can be found here

Prerequisites!

Docker!

Hardware Requirements

Any machine _may_ handle building a Kylin node, but it is a very resource intensive process! We suggest running these builds on a machine with no less than:

  • 8 GB of RAM (16 is suggested)
  • 2 CPU cores (3 is suggested)
  • 50 GB of free HDD/SSD space

Let’s start building!

The first thing you need to do is install Docker locally, the easiest way to do this is to download Docker Desktop from here. Next you have to install Github because that is where all the code is hosted, you can download a Github client here.

The next step is to clone the repo, which is just tech speak for downloading a copy of the repository to your local drive.

Once that is done, believe it or not you are more than halfway there. The final step in the build process is open up a terminal/command prompt then navigate to repo root directory (basically the folder where the code was downloaded) run the following command:

“cd scripts; docker-compose up -d”

What we are doing in that command is two things

  1. Cd scripts -> navigate to the scripts directory
  2. Docker-compose up -d -> this tells docker to build the entire infrastructure using the “docker-compose.yaml” file, the -d stands for detached so it runs in the background

Almost there

Now go take a break because the docker image can take up to 40 mins or so to build for the very first time, the good news is it’s then cached for the next time you run the command it will only take seconds to spin up the entire infrastructure

Let’s explore the UI

Once the docker containers are started you can now explore the UI

Open up a web browser and navigate to “http://localhost:3001/#/explorer

Finally, you have to switch to the local node that is running

Last bit of setup.

This is the second to last step! We need to add some oracle functionality. Before we do that we need to tell the node the format of the data arriving. To do that navigate to the `Settings` tab then `Developer` and paste the below:

{
“Address”: “AccountId”,
“LookupSource”: “AccountId”,
“DataInfo”: {
“url”: “Text”,
“data”: “Text”
}
}

Next up we need to add an account to store the data in, this is done in two steps.

The first one is creating the account itself so navigate to the accounts page and add a new one. You can use the below mnemonic seed

clip organ olive upper oak void inject side suit toilet stick narrow

You can validate the successful addition of the account by transferring some funds, this is exactly how you would transfer funds in the mainnet.

Oracle Time!

Finally we are ready to add some oracle functionality.

Click on the `Developer` tab then go to `Extrinsics`, once there choose th kylinOracleModule and the method you are looking for is called “addFetchDataRequest”

The way things work here is that you will have to put in the address of the API in Hexadecimal format. For example if I wanted to query the price of BTC the original URL might look something like this

https://min-api.cryptocompare.com/data/price?fsym=BTC&tsyms=USD

In Hex that becomes

“0x68747470733a2f2f6d696e2d6170692e63727970746f636f6d706172652e636f6d2f646174612f70726963653f6673796d3d425443267473796d733d555344”

The table below gives you a few example currencies and their Hex equivalent

BTC-price

URL: https://min-api.cryptocompare.com/data/price?fsym=BTC&tsyms=USD

Hex: 0x68747470733a2f2f6d696e2d6170692e63727970746f636f6d706172652e636f6d2f646174612f70726963653f6673796d3d425443267473796d733d555344

ETH-price

URL: https://min-api.cryptocompare.com/data/price?fsym=ETH&tsyms=USD

Hex: 0x68747470733a2f2f6d696e2d6170692e63727970746f636f6d706172652e636f6d2f646174612f70726963653f6673796d3d455448267473796d733d555344

XAP-price

URL: https://min-api.cryptocompare.com/data/price?fsym=XAP&tsyms=USD

Hex: 0x68747470733a2f2f6d696e2d6170692e63727970746f636f6d706172652e636f6d2f646174612f70726963653f6673796d3d584150267473796d733d555344

BCH-price

URL: https://min-api.cryptocompare.com/data/price?fsym=BCH&tsyms=USD

Hex: 0x68747470733a2f2f6d696e2d6170692e63727970746f636f6d706172652e636f6d2f646174612f70726963653f6673796d3d424348267473796d733d555344

LTC-price

URL: https://min-api.cryptocompare.com/data/price?fsym=LTC&tsyms=USD

Hex: 0x68747470733a2f2f6d696e2d6170692e63727970746f636f6d706172652e636f6d2f646174612f70726963653f6673796d3d4c5443267473796d733d555344

EOS-price

URL: https://min-api.cryptocompare.com/data/price?fsym=EOS&tsyms=USD

Hex: 0x68747470733a2f2f6d696e2d6170692e63727970746f636f6d706172652e636f6d2f646174612f70726963653f6673796d3d454f53267473796d733d555344

XMR-price

URL: https://min-api.cryptocompare.com/data/price?fsym=XMR&tsyms=USD

Hex: 0x68747470733a2f2f6d696e2d6170692e63727970746f636f6d706172652e636f6d2f646174612f70726963653f6673796d3d584d52267473796d733d555344

Tip

If you want to point to a url of your choosing you can use this page (https://onlinestringtools.com/convert-string-to-hexadecimal) to convert the page to Hex. Just be sure to remember to have the “Prefix Bytes” checked to add a “0x” to the start

Now that you added it, let’s test the functionality. Navigate to `Network` and click on `Chain State` then choose the `kylinOracleModule` again but this time choose `requestedOffChainData`, uncheck the “include option” and finally click on the orange button on the right to kick off the query. You should see price results for all the currency pairs you added.

Clean-up and go home!

If you would like to return some of the resources back to your machine then stop the node and shutdown the docker containers, run the following command in your terminal:

docker-compose down

That is pretty much it! Go forth Kylians!

--

--

Kylin Network
Kylin Network

Written by Kylin Network

Building a Cross-chain Platform Powering the Data Economy on Polkadot

Responses (5)