Skip to main content

Celo Chainlink Oracle Jobs

Celo is a blockchain platform focused on enabling financial inclusion through mobile-first decentralized finance (DeFi) solutions. It aims to provide accessible and affordable financial services to billions of people worldwide, leveraging mobile technology and a proof-of-stake consensus mechanism for efficiency and scalability.

The below documentation illustrates how to integrate a custom Chainlink data feed for your smart contract or dApp running on the Celo network. If you run into any trouble, head on over to our Discord server for the fastest assistance, or feel free to contact us here.

tip

Looking for a custom price feed?

We can update any of your contract's data at a set frequency, and/or deviation-based trigger condition. Fill out our request survey to get this set up - we'll typically deliver your new feed to you in 24 hours or less!

Select the data type that you need:

What do you want to retrieve?

Data from the internet (HTTP request)

Retrieve a uint256 from the internet

This on-demand job initiates an HTTP GET, POST, PUT, or DELETE request to the internet, optionally parses a JSON-based response body for a numeric value at the given path, multiplies this value by the given multiplier, and returns the resulting 256-bit unsigned integer (uint256) to your smart contract.

info

This job writes a single uint256 object to your contract, which can store any integer from 0 to 115792089237316195423570985008687907853269984665640564039457584007913129639935 ((2 ^ 256) - 1).

Request metadata

Oracle Address and Job IDFee Per Request
Please complete our request survey to receive our mainnet Addresses and Job IDs0.1 LINK *

* Fee notes:

  • We offer discounts for high volume. Please fill out our request survey to get started.
  • We support payment in alternative currencies (ie, CELO or fiat). Please indicate this in our request survey if interested, as this can be arranged in the form an up-front payment for a set number of oracle requests.

Request parameters

This job requires the following parameters to be set within your contract's request() function:

ParameterTypeValue exampleDescription
methodstring'POST'The HTTP method to use in initiating your request for data (GET, POST, PUT, or DELETE).
urlstring'https://myRequestURL.com/path?var1=abc&var2=xyz'The URL to which to send your HTTP request for data.
headersstring'["my-header-1", "header 1 value", "my-header-2", "header 2 value"]'An array of headers to send with the HTTP request, represented as an even-numbered array of strings. If no headers are desired, you must pass an empty string ('').
bodystring'My request body'A body to send with the HTTP request (POST, PUT requests only). If no body is desired or applicable, you must pass an empty string ('').
pathstring'data,0,val'The JSON Path at which to extract the result returned by the requested HTTP endpoint (JSON results only). To return the full result without parsing, you must pass an empty string (''). If the provided path cannot be found in the response, the request will not be fulfilled.
multiplierint25610 ** 18The number by which to multiply the result returned to the contract. This is important, as Solidity cannot handle decimal objects. If no multiplication is desired, enter 1. If the result cannot be multiplied (ie, it is not a number), the request will not be fulfilled.
contactstring'derek_linkwellnodes.io'Enter your Discord handle, email address, or other contact info here. This is important for allowing prompt communication from us regarding outages or other technical issues that we may notice with your request. If you prefer to stay anonymous, you must pass an empty string ('').

Try it for yourself

Add the following sample code to your consumer contract.

tip

For easy editing, you can also open our sample contract directly in Remix.

1. Add the constructor:

The constructor specifies important information about the request destination and payment for your request. Important: This information varies by chain, oracle, and job:

docs/services/direct-request-jobs/mainnets/Celo/uint256/uint256.sol
loading...

2. Add your request function (example):

The request() function defines the request parameters and sends a request to the Chainlink oracle. For detailed information on each required parameter, reference the above 'Request parameters' section:

docs/services/direct-request-jobs/mainnets/Celo/uint256/uint256.sol
loading...

3. Retrieve the response (example):

docs/services/direct-request-jobs/mainnets/Celo/uint256/uint256.sol
loading...

Need to send sensitive information?

danger

Data entered into a smart contract is visible to the general public.

If you need to send sensitive information along with your HTTP request (ie, an API key), you can instead store this information off-chain on our secure infrastructure. Please fill out our Request Survey to get started, and specify within the notes that you'd like us to store your API key for you - once we receive your information, we'll provide you with a custom job ID that will send your sensitive data safely along with your request.

Troubleshooting

Having trouble with your request? Check our Chainlink Direct Requests FAQ.

caution

This job has a configured gas limit of 1,000,000 for writing your result on-chain. If your transaction isn't returning any value after more than 60 seconds of waiting, click the above 'Oracle Address' for this job to see if any recent transaction(s) have failed due to an 'out of gas' error. If so, you'll need to either A) Return a smaller response, B) Split your request into multiple oracle transactions, or C) Contact us to request a higher gas allowance for your specific use case (may result in higher job pricing).

Still need more help?

Please reach out to us in Discord if you require additional assistance with this request.

Simulating the above request logic

Let's walk through each step of the above sample request, to better understand how it all works together:

1. Send the HTTP request:

The following curl command simulates the same HTTP request that our Chainlink node makes shortly after you trigger the request() function within your consumer contract:

curl 'https://min-api.cryptocompare.com/data/pricemulti?fsyms=BTC,ETH&tsyms=USD,EUR' \
--request 'GET' \
--header 'content-type: application/json' \
--header 'set-cookie: sid=14A52'

2. Analyze the response:

The following is a sample response body returned to our Chainlink node by the above HTTP request (abbreviated for clarity):

{
"BTC":{
"USD":30575.12,
"EUR":27810.9
},
"ETH":{
"USD":1875.87,
"EUR":1706.29
}
}

3. Apply the JSON path:

After receiving the above sample response, our Chainlink node will attempt to filter the result by the provided path parameter value (ETH,USD). After applying the provided path, we get the following result:

1875.87

4. Apply the multiplier:

After filtering the sample response by the provided JSON path, our Chainlink node will multiply the result by the provided multiplier parameter value (10 ** 18). After applying this multiplier, we get the following value, which is ultimately written to your smart contract as a uint256 object by our Chainlink oracle:

1875870000000000000000
A random number (nVRF)

Retrieve a random uint256 number (nVRF)

This on-demand job initiates an oracle request for a random number within the specified range, and returns the resulting 256-bit unsigned integer (uint256) to your smart contract.

TIP: Need to retrieve multiple random numbers at once? Check out our uint256[] or int256[] jobs instead.

info

This job writes a single uint256 object to your contract, which can store any integer from 0 to 115792089237316195423570985008687907853269984665640564039457584007913129639935 ((2 ^ 256) - 1).

Request metadata

You'll set the following attributes within your contract's constructor function (see below):

Oracle Address and Job IDFee Per Request
Please complete our request survey to receive our mainnet Addresses and Job IDs0.05 LINK *

* Fee notes:

  • We offer discounts for high volume. Please fill out our request survey to get started.
  • We support payment in alternative currencies (ie, CELO or fiat). Please indicate this in our request survey if interested, as this can be arranged in the form an up-front payment for a set number of oracle requests.

Request parameters

This job requires the following parameters to be set within your contract's request() function:

ParameterTypeValue exampleDescription
minValint2560The lower bound of the desired random number range (inclusive).
maxValint256500The upper bound of the desired random number range (inclusive).
contactstring'derek_linkwellnodes.io'Enter your Discord handle, email address, or other contact info here. This is important for allowing prompt communication from us regarding outages or other technical issues that we may notice with your request. If you prefer to stay anonymous, you must pass an empty string ('').

Try it for yourself

Add the following sample code to your consumer contract.

tip

For easy editing, you can also open our sample contract directly in Remix.

1. Add the constructor:

The constructor specifies important information about the request destination and payment for your request. Important: This information varies by chain, oracle, and job:

docs/services/direct-request-jobs/mainnets/Celo/uint256/nvrf_uint256.sol
loading...

2. Add your request function (example):

The request() function defines the request parameters and sends a request to the Chainlink oracle. For detailed information on each required parameter, reference the above 'Request parameters' section:

docs/services/direct-request-jobs/mainnets/Celo/uint256/nvrf_uint256.sol
loading...

3. Retrieve the response (example):

docs/services/direct-request-jobs/mainnets/Celo/uint256/nvrf_uint256.sol
loading...

Need more help?

Please reach out to us in Discord if you require additional assistance with this request.

Something else

Have a custom requirement?

We've got you covered:

  1. Fill out our Request Survey with the relevant details about your request.
  2. We'll assess your request and provide you with a custom job ID that works for you in 24 hours or less!
info

Join our Discord to get the fastest service for your request!