An oracle fetching oracle data from BandChain and posting to Nervos CKB
An oracle fetching oracle data from Band Protocol and posting to Nervos CKB
ckb-oracle-bridge
(Live Demo) provides a server to fetch Band Protocol oracle data and a web application to display oracle data and uses rich-node as ckb rpc and indexer server.
ckb-band-oracle
is a node.js
server fetching band oracle data and posting data to Nervos CKB per block.
band shows the workflow fetching oracle data of 11 tokens from BandChain.
Note: BandChain oracle data is updated every five minutes
poster shows the workflow posting oracle data to Nervos CKB per block.
ckb-band-oracle
has five stages to post band oracle data to Nervos CKB
Now ckb-band-oracle
provides 11 tokens’ oracle prices which are ['BTC', 'ETH', 'DAI', 'REP', 'ZRX', 'BAT', 'KNC', 'LINK', 'COMP', 'BAND', 'CKB']
.
And the cell data format:
utf8ToHex('band') + hex(index of token list) + u32(timestamp) + u64(price)
For example:
0x62616e64055f437c0c00000000000650e7
means the index of token list is 05 (BAT) and the timestamp is 5f437c0c
(1598258188) and the price of BAT is \$0.413927.
Note:
utf8ToHex('band') = 0x62616e64
ckb-band-oracle
provides two methods to generate and parse band oracle data in utils
Before starting the project, you should edit the .env
file with your private key to sign above transactions later.
You should make sure the balance of the account is enough and if you have not enough Testnet CKB, you can claim free Testnet ckb from CKB Faucet.
$ git clone https://github.com/duanyytop/ckb-band-oracle
$ cd ckb-band-oracle
$ yarn install
$ yarn start