Skip to main content

๐ŸŽ’ Setup

Node.jsโ€‹

You need to have Node.js installed. Any stable (LTS >= 14.0) version is sufficient.

Dependenciesโ€‹

Navigate into your newly created folder kilt-rocks, initialize the project and install dependencies.

  • KILT SDK-JS - for KILT functionality
  • dotenv - to help us load variables from .env
  • (Only in case you are using Typescript and not Javascript) ts-node and Typescript - to execute our TS code

Install the needed packages:

npm init -y
npm install @kiltprotocol/sdk-js dotenv ts-node typescript

Project Folderโ€‹

The project structure looks like the following:

โ””โ”€ kilt-rocks/ # project
โ”œโ”€ attester/ # all attester code
โ”œโ”€ claimer/ # all claimer code
โ”œโ”€ verify.ts # all verifier code
โ”œโ”€ .env # environment variables
โ”œโ”€ package.json # the project file
โ””โ”€ yarn.lock # dependency lock file

You can set up the directories now or later when we need them.

PILT Tokensโ€‹

In this workshop, you will interact with the Peregrine blockchain. You are required to pay for each transaction with PILT coins. But worry not! PILT coins don't have any value and can be requested from the faucet.

Blockchain Connectionโ€‹

Before you call any SDK functionality, you need to initialize the crypto libraries and configure the SDK. For this workshop, we'll be using Peregrine Testnet. This is done by calling await Kilt.connect(address) where address is the address of the full node you want to connect to. For this workshop, use wss://peregrine.kilt.io/parachain-public-ws. Add the address to your .env file.

.env
WSS_ADDRESS=wss://peregrine.kilt.io/parachain-public-ws

That's it for the basic setup - We're good to go!