CHAINLINK
DECENTRALIZED
ORACLE NETWORK
By Gene Leybzon
7/1/2021
WHAT ARE ORACLES?
A blockchain oracle is a third-party service that provides
smart contracts with information from the outside world. It
is the layer that queries, verifies, and authenticates
external data sources, usually via trusted APIs and then
relays that information.
CHAINLINK VISION:
ANY INPUT, ANY BLOCKCHAIN, ANY
OUTPUT
UNDER THE HOOD
CHAINLINK COMMON USE CASES
Pre-Built Decentralized Price Feeds
A Verifiable Random Function
Modular External Adapters
DATA FEEDS
PRICE AGGREGATOR
SMART CONTRACT INTEGRATION
WITH ORACLE
DEMO “TIME” Alarm Clock
USE CASE
AlarmClockSample.so
l
Alarm Requestor
requestAlarmClock()
sendChainlinkRequestTo()
fulfillAlarm()
AlarmForMeetup
PLAN
o Compile Alarm Requestor code
oDeploy to Kovan testnet
oTransfer $LINK to contract to pay for the service
oSet alarm
oWait for alarm
ALARM CONSUMER SMART
CONTRACT
SENDING SOME $LINK TO THE OUR
CONTRACT
REQUESTING AN ALARM
/** * Receive the response in the form of uint256 */
event AlarmForMeetup(bytes32 _requestId, uint256 _volume);
function fulfillAlarm(bytes32 _requestId, uint256 _volume) public
recordChainlinkFulfillment(_requestId) {
alarmDone = true;
emit AlarmForMeetup( _requestId, _volume);
}
CHECKING REQUEST STATUS
CHECKING EVENTS
CALLING ANY API CryptoCompare
MAKING GET FROM SMART
CONTRACT
https://min-api.cryptocompare.com/data/pricemultifull?fsyms=ETH&tsyms=USD
SMART CONTRACT CODE -
REQUEST
function requestVolumeData() public returns (bytes32 requestId)
{
Chainlink.Request memory request = buildChainlinkRequest(jobId, address(this),
this.fulfill.selector);
request.add("get", "https://min-
api.cryptocompare.com/data/pricemultifull?fsyms=ETH&tsyms=USD");
request.add("path", "RAW.ETH.USD.VOLUME24HOUR");
int timesAmount = 10**18;
request.addInt("times", timesAmount); // remove decimals
// Sends the request
return sendChainlinkRequestTo(oracle, request, fee);
}
SMART CONTRACT CODE –
RESPONSE
/**
* Receive the response in the form of uint256
*/
function fulfill(bytes32 _requestId, uint256 _volume) public
recordChainlinkFulfillment(_requestId)
{
volume = _volume;
}
LINK TOKENOMICS “LINK” token
$LINK TOKEN PRICE STATISTICS
$LINK TOKEN
1.$LINK token is ChainLink’s native
cryptocurrency and was set up on the
Ethereum network using an ERC677
2.Chainlink nodes are paid in $LINK tokens only
3.$LINK tokens are used as collateral value
WANT TO LEARN MORE ABOUT
CHAINLINK?
https://www.reddit.com/r/Chainlink/
https://chainlinklabs.com/jobs
QUESTIONS?
STAY IN TOUCH
Gene Leybzon https://www.linkedin.com/in/leybzon/
https://www.meetup.com/members/90744
20/
https://www.leybzon.com

Chainlink

Editor's Notes

  • #4 https://blog.chain.link/44-ways-to-enhance-your-smart-contract-with-chainlink/
  • #5 Image from https://www.kaleido.io/blockchain-blog/how-chainlink-works-under-the-covers
  • #7 https://data.chain.link/ethereum/mainnet/crypto-usd
  • #8 https://data.chain.link/ethereum/mainnet/crypto-usd/eth-usd
  • #13 https://github.com/leybzon/solidity-baby-steps/blob/master/contracts/125_AlarmClockSample.sol
  • #14 Get test $LINK tokens from https://kovan.chain.link/ prior to this step
  • #16 https://kovan.etherscan.io/address/0x9076F45c9D064E400a7Fc0d146E6c4292234f10b
  • #17 https://kovan.etherscan.io/address/0x9076F45c9D064E400a7Fc0d146E6c4292234f10b#events
  • #19 https://min-api.cryptocompare.com/data/pricemultifull?fsyms=ETH&tsyms=USD
  • #20 https://docs.chain.link/docs/make-a-http-get-request/
  • #21 https://docs.chain.link/docs/make-a-http-get-request/
  • #23 https://coinmarketcap.com/currencies/chainlink/