Decentralized Data Model
This page describes how data aggregation is applied to produce Chainlink Data Feeds.
Data Aggregation
Each data feed is updated by multiple, independent Chainlink oracle operators. Aggregation is handled on-chain by FluxAggregator
.
Shared Data Resource
Each data feed is built and funded by the community of users who rely on accurate, up-to-date data in their smart contracts. As more users rely on and contribute to a data feed, the quality of the data feed improves. For this reason, each data feed has its own properties depending on the needs of its community of users.
Decentralized Oracle Network
Each data feed is updated by a decentralized oracle network. Each oracle operator is rewarded for publishing data. The number of oracles contributing to each feed varies. In order for an update to take place, the data feed contract must receive responses from a minimum number of oracles or the latest answer will not be updated. You can see the minimum number of oracles for the corresponding feed at data.chain.link.
Each oracle in the set publishes data during an aggregation round. That data is validated and aggregated by a smart contract, which forms the feed's latest and trusted answer. Developers wishing to use an asset's latest and trusted answer can do so easily by following the example from the Get the Latest Price page.
Aggregation Parameters
Each aggregation round is triggered based on one or more aggregation parameters. Whichever condition is met first will trigger an update to the data.
Deviation Threshold
A new aggregation round starts when a node identifies that the off-chain values deviate by more than the defined deviation threshold from the on-chain value. Individual nodes monitor one or more data providers for each feed.
Heartbeat Threshold
A new aggregation round starts after a specified amount of time from the last update.
Contracts Overview
All source code is open source and available in our Github repository.
Consumer
A Consumer contract is any contract that uses Chainlink Data Feeds to consume aggregated data. Consumer contracts simply reference the correct AggregatorV3Interface
and call one of the exposed functions.
...
AggregatorV3Interface feed = AggregatorV3Interface(address);
return feed.latestRoundData();
Learn how to create a consumer contract to Get the Latest Price of an asset.
Proxy
Proxy contracts are on-chain proxies that store the most up-to-date Aggregator for a particular data feed. Using proxies enables the underlying Aggregator to be upgraded without any interruption of service for consuming contracts.
See the AggregatorProxy
contract on Github.
Aggregators
Aggregators are the contracts that receive periodic data updates from multiple Oracles. They aggregate and store data on-chain so that consumers can retrieve it and and act upon it within the same transaction.
This data can be accessed by referencing the Data Feed address using the AggregatorV3Interface
contract.
To learn how to consume price data from a data feed, see the Get the Latest Price page.