/chainlink-polkadot

Primary LanguageRustOtherNOASSERTION

Chainlink-polkadot

This repository contains all relevant projects necessary to have polkadot and substrate chains interact with chainlink.

This is WIP and will evolve frequently.

What is Polkadot and Chainlink?

Chainlink is a decentralized oracle technology that allows off-chain data to be connected to any chain. Polkadot is a scalable, heterogeneous, multi-chain technology, that can be used to create, maintain, and connect blockchains.

Run the example

Requirements

rust-toolchain is used to make sure the correct rust version is used. Make sure to install the WASM target using:

rustup target add wasm32-unknown-unknown

Running the example

You can view a youtube demo here.

substrate-node-example shows off out to use pallet-chainlink end-to-end. It first makes a local dummy substrate built parachain, and then spins up some local Chainlink nodes that have parameters to connect to the parachain. To test:

  • start the chain using make run-chain
  • install frontend dependencies cd substrate-node-example/front-end && yarn install && cd ../..
  • start the frontend using make run-front-end

To spin up some simple Chainlink nodes to intereact with the parachain you just created, run the setupcommand:

cd substrate-chainlink
./setup

This will run a number of docker commands that will spin up your Chainlink node. You can access them by going to your browser at: http://localhost:6691.

The password to this Chainlink node is notreal@fakeemail.ch and the password is twochains. You can see in the logs of ./setup if the address has moved.

note If you'd like to restart you will have to remove all the docker containers. You can do this by running:

docker-compose down
docker-compose up

You are now ready to send test requests and see the result being provided back by an Oracle. You can continue to follow the demo youtube video to see how to interact with the GUIs.

Send a test request using PolkadotJS

const alice = ...;
const txHash = await api.tx._exampleModule_
  .sendRequest("ACCOUNT_ID")
  .signAndSend(alice);
console.log(`Submitted with hash ${txHash}`);

Send a test request using PolkadotJS Apps

Make sure you add the following additional to Settings/Developer section:

{ "SpecIndex": "Vec<u8>", "RequestIdentifier": "u64", "DataVersion": "u64" }

Then in Extrinsincs, example / sendRequest can be submitted.

How to use pallet-chainlink?

Complete documentation is accessible in the pallet README.

See the full example for more details.