This Chainlink has a dedicated connection to Google's BigQuery API for retrieving the Ethereum gas price.

Steps for using this oracle Steps for using this oracle

Write and deploy your Chainlinked contract using the network details below

Fund it with LINK (1 LINK is required per-request) Ropsten faucet Kovan faucet

Call your request method

Chainlink Network Details Chainlink Network Details

You will need to use the following LINK token address, oracle address, and Job ID in order to create the Chainlink request.

Ropsten Ropsten

LINK Token address: 0x20fE562d797A42Dcb3399062AE9546cd06f63280

Oracle address: 0x658E48c412F85939Ef5b977f00d3a3D9796ca9e6

JobID: 4f35b80476e14202ac742182ee556447

Kovan Kovan

LINK token address: 0xa36085F69e2889c224210F603D836748e7dC0088

Oracle address: 0x2f90A6D021db21e1B2A077c5a37B3C7E75D15b7e

JobID: 14d31bb7c28546e3af7d3cef604b3a2c

Create your Chainlinked contract Create your Chainlinked contract

Import ChainlinkClient.sol into your contract so you can inherit the ability to create Chainlink requests.

Solidity 4 Solidity 5 Solidity 6 pragma solidity ^0.4.24; import "@chainlink/contracts/src/v0.4/ChainlinkClient.sol"; contract BigQueryChainlink is ChainlinkClient { uint256 oraclePayment; constructor(uint256 _oraclePayment) public { setPublicChainlinkToken(); oraclePayment = _oraclePayment; } // Additional functions here: } pragma solidity ^0.5.0; import "@chainlink/contracts/src/v0.5/ChainlinkClient.sol"; contract BigQueryChainlink is ChainlinkClient { uint256 oraclePayment; constructor(uint256 _oraclePayment) public { setPublicChainlinkToken(); oraclePayment = _oraclePayment; } // Additional functions here: } pragma solidity ^0.6.0; import "@chainlink/contracts/src/v0.6/ChainlinkClient.sol"; contract BigQueryChainlink is ChainlinkClient { uint256 oraclePayment; constructor(uint256 _oraclePayment) public { setPublicChainlinkToken(); oraclePayment = _oraclePayment; } // Additional functions here: }

Tasks Tasks

Request Parameters Request Parameters

action action

Required

The action to perform, available values:

date (default)

(default) block

Solidity example Solidity example

req.add("action", "date");

block block

Required when action is block

The Ethereum main net block to retrieve information about.

Solidity example Solidity example

req.addUint("block", 7000000);

date

Required when action is date

The date to aggregate the gas price.

Solidity example Solidity example

req.add("date", "2019-05-15");

endpoint endpoint

Options:

gas-price (default)

(default) eth-price

address-attributes

The endpoint to reach out to.

Solidity example Solidity example

req.add("endpoint", "eth-price");

addr addr

Required when endpoint is address-attributes

The address to retrieve aggregates for.

Solidity example Solidity example

req.add("addr", "0x87002564F1C7b8F51e96CA7D545e43402BF0b4Ab");

copyPath copyPath

Required

The path of the desired data field to return to the smart contract.

Solidity example Solidity example

req.add("copyPath", "gasPrice");

times times

The number to multiply the result by (since Solidity can't handle decimal places).

Solidity example Solidity example

req.addInt("times", 100);

Chainlink Examples Chainlink Examples

This example shows how to create the request for the Chainlink node:

requestGasPriceByBlock requestGasPriceByDate requestEthPriceByDate requestAddressAttributes function requestGasPriceByBlock(address _oracle, bytes32 _jobId, uint256 _block) public onlyOwner { Chainlink.Request memory req = buildChainlinkRequest(_jobId, address(this), this.fulfillGasPrice.selector); req.add("action", "block"); req.addUint("block", _block); req.add("copyPath", "gasPrice"); sendChainlinkRequestTo(_oracle, req, oraclePayment); } function requestAddressAttributes ( address _oracle, bytes32 _jobId, string _date, string _path, string _addr ) public onlyOwner { Chainlink.Request memory req = buildChainlinkRequest(_jobId, address(this), this.fulfillAddressAttributes.selector); req.add("endpoint", "address-attributes"); req.add("date", _date); req.add("copyPath", _path); req.add("addr", _addr); req.addInt("times", 1000); sendChainlinkRequestTo(_oracle, req, oraclePayment); }

Here is an example of the fulfillGasPrice method: