Chainlink Developers

Welcome to the Chainlink documentation site. You'll find comprehensive guides and documentation to help you start working with Chainlink as quickly as possible, as well as support if you get stuck. Click here for an introductory walkthrough on how to create a Chainlink request on the Ropsten test network!

Adapters are the built-in functionality that every Chainlink node supports.

Bridge

The adapter is in charge of speaking with External Adapters.

Parameters

  • url: takes a string containing the location of the external adapter. Bridge can create pending task runs, and resume them via PUT requests to /runs/:RUN_ID.

Copy

The adapter walks the copyPath specified and returns the value found at that result.

Parameters

  • copyPath: takes an array of strings, each string being the next key to parse out in the JSON object or a single dot-delimited string.

Solidity Example

For the JSON object:

{"RAW": {"ETH": {"USD": {"LASTMARKET": "_someValue"}}}}

You would use the following for an array of strings:

string[] memory path = new string[](4);
path[0] = "RAW";
path[1] = "ETH";
path[2] = "USD";
path[3] = "LASTMARKET";
run.addStringArray("copyPath", path);

Or the following for a single dot-delimited string:

run.add("copyPath", "RAW.ETH.USD.LASTMARKET");

EthBytes32

The adapter formats its input into a string and then converts it into Solidity's bytes32 format.

Parameters

None taken.

EthInt256

The adapter formats its input into an integer and then converts it into Solidity's int256 format.

Parameters

None taken.

EthTx

The adapter takes the input given and places it into the data field of the transaction. It then signs an Ethereum transaction and broadcasts it to the network. The task is only completed once the transaction's confirmations equal the MIN_OUTGOING_CONFIRMATIONS amount.

If the transaction does not confirm by the time ETH_GAS_BUMP_THRESHOLD number of blocks have passed since initially broadcasting, then it bumps the gas price of the transaction by ETH_GAS_BUMP_WEI.

Parameters

  • address: the address of the Ethereum account which the transaction will be sent to.
  • functionSelector: (optional) the function selector of the contract which the transaction will invoke. functionSelector is placed before dataPrefix and the adapter's input in the data field of the transaction.
  • dataPrefix: (optional) data which will be prepended before the adapter's input, but after the functionSelector in the transaction's data field.

EthUint256

The adapter formats its input into an integer and then converts it into Solidity's uint256 format.

Parameters

None taken.

HttpGet

The adapter will report the body of a successful GET request to the specified url, or return an error if the response status code is greater than or equal to 400.

Parameters

  • url: takes a string containing the URL to make a GET request to.

Solidity Example

run.add("url", "http://example.com");

HttpPost

The adapter will report the body of a successful POST request to the specified url, or return an error if the response status code is greater than or equal to 400.

Parameters

  • url: takes a string containing the URL to make a POST request to.

Solidity Example

run.add("url", "http://post.example.com");

JsonParse

The adapter walks the path specified and returns the value found at that result.

Parameters

  • path: takes an array of strings, each string being the next key to parse out in the JSON object or a single dot-delimited string.

Solidity Example

For the JSON object:

{"RAW": {"ETH": {"USD": {"LASTMARKET": "_someValue"}}}}

You would use the following for an array of strings:

string[] memory path = new string[](4);
path[0] = "RAW";
path[1] = "ETH";
path[2] = "USD";
path[3] = "LASTMARKET";
run.addStringArray("path", path);

Or the following for a single dot-delimited string:

run.add("path", "RAW.ETH.USD.LASTMARKET");

Multiply

The adapter parses the input into a float and then multiplies it by the times field.

Parameters

  • times: the number to multiply the input by.

Solidity Example

run.addInt("times", 100);

NoOp

The adapter performs no operations, simply passing the input on as output. Commonly used for testing.

Parameters

None taken.

NoOpPend

The adapter performs no operations, and marks its task run pending. Commonly used for testing.

Parameters

None taken.

Sleep

The adapter will pause the current task pipeline for the given duration.

Parameters

  • until: the UNIX timestamp of when the job should stop sleeping and resume at the next task in the pipeline.

Solidity Example

run.addUint("until", now + 1 hours);