简体   繁体   English

如何从 Chainlink 获取价格信息?

[英]How to get price information from Chainlink?

I would like to get USD price of DeFi tokens from Chainlink.我想从 Chainlink 获得 DeFi 代币的美元价格。

However, it looks like, I can get the price of an asset through either the Chainlink API calls , or Chainlink price feeds .但是,看起来,我可以通过Chainlink API 调用Chainlink price feeds获得资产的价格。

What are the costs associated with each and the differences and tradeoffs?与每个相关的成本以及差异和权衡是什么?

With Chainlink price feeds , each data feed is updated by a decentralized oracle network.使用 Chainlink 价格馈送,每个数据馈送都由分散的 oracle 网络更新。 Each oracle in the set publishes data during an aggregation round.集合中的每个 oracle 在聚合轮次期间发布数据。 That data is validated and aggregated by a smart contract, which forms the feed's latest and trusted answer.该数据由智能合约验证和汇总,forms 是提要的最新且受信任的答案。

Each oracle operator is rewarded for publishing data.每个 oracle 算子因发布数据而获得奖励。 On mainnet, sponsors are paying the LINK associated to keep those feeds live, decentralized, and secure, so they are not free.在主网上, 赞助商支付相关的 LINK以保持这些提要的实时、分散和安全,因此它们不是免费的。 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.话虽如此,价格信息目前是一个简单的view function,任何人都可以在技术上使用它们,因为访问控制正在某个时间点构建的路线图上。 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.通过 API 调用,Chainlink 使您的合约能够通过其分散的 oracle 网络访问任何外部数据源。 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.除非您部署的合约有足够的 LINK 支付费用,否则发出 HTTP GET 请求将失败,因此需要为该智能合约提供资金。

If your contract is calling a public API endpoint, an Oracle job may already exist for it.如果您的合约正在调用公共 API 端点,则 Oracle 作业可能已经存在。 To check available jobs and GET request prices, visit https://market.link/要查看可用工作和获取请求价格,请访问https://market.link/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM