How OpenLayer Works

The OpenLayer ecosystem will contain following roles that work together with OpenLayer and restaking (Eigenlayer) smart contracts

  • Data consumers or requesters

  • Node operators (both large node operators and end users)

  • Notary service

  • Validators or slashers

Data consumers

Consumers specify a symbol and publish the request as a task on OpenLayer's smart contract, then when the task is completed, they can read the results from the smart contract. These could be done either within another smart contract, or from offchain.

The APIs to get data is similar with most existing major data oracles. In addition we provided ondemand pull model so real time updates could be requested for the less frequently updated feeds.

/**
 * Request new data fetch from another smart contract
 *
 * Network: Holesky
 * Data Feed: GOLD/USD
 * Address: 0x12345....abcde
 */
function readLatestGoldPrice() {
  priceFeed = OpenOraclePriceFeeds("0x12345....abcde");
	(
     uint requestHash,
     /*uint startedAt*/,
  ) = priceFeed.requestNewReport(opt=null);
}

/**
 * Reading latest data from another smart contract
 *
 * Network: Holesky
 * Data Feed: GOLD/USD
 * Address: 0x12345....abcde
 */
function readLatestGoldPrice() {
  priceFeed = OpenOraclePriceFeeds("0x12345....abcde");
	(
     int answer,
     /*uint startedAt*/,
     /*uint timeStamp*/,
  ) = priceFeed.latestRoundData();
}
// Request new data fetch from Javascript
const addr = "0x12345....abcde"
const priceFeed = new web3.eth.Contract(openOraclePriceFeedAbi, addr)
priceFeed.methods
  .requestNewReport(opt=null)
  .call()
  .then((requestData) => {
    console.log("Request Hash:", requestData[0])
  })
  
// Read latest data fetch from Javascript
const addr = "0x12345....abcde"
const priceFeed = new web3.eth.Contract(openOraclePriceFeedAbi, addr)
priceFeed.methods
  .latestRoundData()
  .call()
  .then((resultData) => {
    console.log("Request Hash:", resultData[0])
  }

Request a new data stream

On OpenLayer, you can easily add a new data type by specifying a publicly accessible URL and a piece of parser program, and wait for the data to be available in the system soon after.

More details coming soon.

Node operators

Node operators performs the following actions to start providing data into OpenLayer.

  • Register as an operator to the restaking protocol so they can start processing tasks supported by the restaking protocol

  • Register with the restaking protocol to run tasks for OpenLayer. This is to allow validators in OpenLayer to slash their restaked assets, and serve as a promise of quality execution.

  • Start subscribing to new tasks published to OpenOracleTaskManager

  • Set up 3 party TLS connection with Notary service and the API requested in the task, fetch API response and get an websession attestation from the Notary service

  • Process the API response according to the task’s requirement and extract requested data

  • Sign and post data back to OpenLayer contract

  • Archive raw API response and the websession attestation in relation to the task hash inside low cost decentralized storage

Aggregators

For certain task types, each operator would return different results. Here we need another operator type (aggregators) to aggregate results according to a standard to generate consistent results.

Notary service

The notary service is the witness on the side to confirm that the operator actually made the API call and is not reporting random information into the oracle. You can read more about how the 3 party TLS and websession attestation happens below.

The Notary service runs in a trusted execution environment (TEE) to ensure that they are executing what they claim to be doing.

Notary service decentralization (coming soon)

Validator

Validators are the safe guards of the ecosystem. They listen to new tasks and task responses from node operators, sample check random instances or those that don’t look right on

  • Whether the API response match with the websession commitments

  • Whether the extracted data matches with the API response and requested parsing program

When either of the two mismatches, validator generates a zero knowledge proof on

  • How the API response should match with a websession commitments different than the provided one

  • The execution of the parsing program over the API response should generate a result different than the provided result

When OpenOracle slashing contract verifies the proofs, corresponding node operator’s staked assets would be slashed, and part of that slashed assets will go to all the validators that have been performing validating tasks.

Last updated