Skip to main content

Arbitrum One Chainlink Oracle Jobs

Arbitrum One is a layer 2 scaling solution for Ethereum, employing optimistic rollups to significantly increase transaction throughput and reduce fees by processing transactions off-chain and settling them periodically on the Ethereum mainnet.

The below documentation illustrates how to integrate a custom Chainlink data feed for your smart contract or dApp running on the Arbitrum One 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
Please complete our request survey to receive our mainnet Addresses and Job IDsPlease see our pricing page

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. Important: This information varies by chain, oracle, and job:

docs/services/direct-request-jobs/mainnets/Arbitrum-One/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/Arbitrum-One/uint256/uint256.sol
loading...

3. Retrieve the response (example):

docs/services/direct-request-jobs/mainnets/Arbitrum-One/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 data feed 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 verifiable random number (VRN / RNG)

Retrieve a random uint256 number

This on-demand job initiates an oracle request for a verifiable random number within the specified range using our Verifiable Random Numbers (VRN) service, 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
Please complete our request survey to receive our mainnet Addresses and Job IDsPlease see our pricing page

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. Important: This information varies by chain, oracle, and job:

docs/services/direct-request-jobs/mainnets/Arbitrum-One/uint256/vrn_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/Arbitrum-One/uint256/vrn_uint256.sol
loading...

3. Retrieve the response (example):

docs/services/direct-request-jobs/mainnets/Arbitrum-One/uint256/vrn_uint256.sol
loading...

4. Verify the result

You have two options for verifying your random number(s):

tip

You must wait for respective seed's epoch to end (every 6 hours) before you can verify your random number(s). Epochs end at the following times each day:


  • 00:00:00 UTC
  • 06:00:00 UTC
  • 12:00:00 UTC
  • 18:00:00 UTC

For more info on verifying numbers through our VRN Service, please visit our VRN Guide.

Option 1 (off-chain): Using our website

  1. Call the getHash(requestId) function, passing in the requestId in question

  2. Visit our seed verification page, entering your chain ID and hash as URL parameters:

    https://linkwellnodes.io/VRN-Seed.html?chain=ENTER_CHAIN_ID_HERE&hash=ENTER_HASH_HERE
    • chain: The chain ID for your respective blockchain network can be found at chainlist.org
    • hash: The hash obtained from the getHash(requestId) call within your contract
  3. If the seed is available, it will be shown on the page

  4. Call verifyResult(requestId, seed) with the requestId and the retrieved seed

    • A return value of true confirms that the randomness was verified on-chain

Option 2 (on-chain): Using an oracle request

  1. Ensure your contract has sufficient LINK token balance

  2. Call requestSeedFromOracle(requestId) with your requestId

    • This will send LINK to our oracle as payment for this transaction
    • The required amount of LINK has been pre-specified within this function, and cannot be changed
  3. Wait several blocks for our oracle to call fulfillSeedFromOracle()

    • If the seed is available, this will write the seed to your contract's storage
  4. Call verifyResult(requestId)

    • A return value of true confirms that the randomness was verified on-chain
tip

For more info on how our VRN Service works, including how to programmatically verify your random number output, please visit our Verifiable Random Numbers (VRN) guide.

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!