This repository contains all relevant projects necessary to have polkadot and substrate chains interact with chainlink.
This is WIP and will evolve frequently.
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.
- Rust
- Docker
- Docker Compose version >1.26
- jq
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
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.
const alice = ...;
const txHash = await api.tx._exampleModule_
.sendRequest("ACCOUNT_ID")
.signAndSend(alice);
console.log(`Submitted with hash ${txHash}`);
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.
Complete documentation is accessible in the pallet README.
See the full example for more details.