๐ 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
- Typescript
- Javascript
Install the needed packages:
- npm
- Yarn
- pnpm
npm init -y
npm install @kiltprotocol/sdk-js dotenv ts-node typescript
yarn init -y
yarn add @kiltprotocol/sdk-js dotenv ts-node typescript
pnpm init -y
pnpm add @kiltprotocol/sdk-js dotenv ts-node typescript
Install the needed packages:
- npm
- Yarn
- pnpm
npm init -y
npm install @kiltprotocol/sdk-js dotenv
yarn init -y
yarn add @kiltprotocol/sdk-js dotenv
pnpm init -y
pnpm add @kiltprotocol/sdk-js dotenv
Project Folderโ
The project structure looks like the following:
- Typescript
- Javascript
โโ 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
โโ kilt-rocks/ # project
โโ attester/ # all attester code
โโ claimer/ # all claimer code
โโ verify.js # 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.
WSS_ADDRESS=wss://peregrine.kilt.io/parachain-public-ws
That's it for the basic setup - We're good to go!