Reputation: 885
I would like to get USD price of DeFi tokens from Chainlink.
However, it looks like, I can get the price of an asset through either the Chainlink API calls, or Chainlink price feeds.
What are the costs associated with each and the differences and tradeoffs?
Upvotes: 0
Views: 3078
Reputation: 632
With Chainlink price feeds, each data feed is updated by a decentralized oracle network. 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.
Each oracle operator is rewarded for publishing data. On mainnet, sponsors are paying the LINK associated to keep those feeds live, decentralized, and secure, so they are not free. This allows the network to be a shared resource where everyone chips in a tiny bit and makes them even cheaper than running even your own centralized feed.
That being said, the price feeds are currently a simple view
function, and anyone can technically use them as access controls are on the roadmap to be built at some point. It’s not really economical or fair for those backers who are paying to support them for everyone else. Until access controls are built, please reach out if you are using them on mainnet and learn how you can contribute to keep them reliable honest, and secure.
With API calls, Chainlink enables your contracts to access any external data source, through their decentralized oracle network. Making a HTTP GET request will fail unless your deployed contract has enough LINK to pay for it, therefore one needs to fund that smart contract.
The best way to find a Chainlink oracle that might be able to serve your Any API request is to join the Chainlink Official Discord server, and post the details of your request to the #operator-requests channel. One of several willing community node operators in that channel will respond to your request with a jobId and oracle address that you can use for your smart contract.
Upvotes: 3