面向开发者 / 现实世界资产
现实世界资产
这一层是一个价格层。33 个价格源,其中 19 个是现实世界资产,在协议内部发布,一次调用即可读取。本页讲的是你怎样拿到列表;下一页讲的是你怎样读取一个价格。
存在什么
通俗版文档描述了三层。其中正好有一层在本仓库里有代码,而本参考记录的就是那一层。
| 层 | 状态 |
|---|---|
| A price, published in the protocol | built, and documented here33 feeds written by block production into a registry predeploy, with one Chainlink-shaped adapter per feed |
| Exposure to a priced asset | designed, not present in this repositorya margin system denominated by a feed, with crypto collateral and crypto settlement. There is no contract to call |
| A registry admitting third-party tokenised assets as collateral | designed, not present in this repositorywith risk parameters and haircuts. Pickle would admit such a token, not issue one |
所以:有价格,也有持有并提供这些价格的合约。没有保证金引擎,没有抵押品注册表,也没有可以调用 的头寸合约。当它们存在时,它们会作为调用表面被记录在这里,而不是作为意图。
是一个价格,不是那个资产
A feed is the PRICE of a real-world asset. It is not the asset.
The chain publishes a number describing what something trades at somewhere else. It issues no tokenised share, holds no underlying instrument, offers no redemption and keeps no custody. Exposure measured against one of these prices is a claim on a margin system, not on an issuer, and this reference does not call it a tokenised asset. Nothing about a feed confers a shareholder right, and there is nothing to redeem.
Name it accordingly in your own interface. A contract reading XAU/USD is reading the price of gold; it is not holding gold, and a user who reads otherwise has been told something untrue.
这是一句关于这条链做了什么的陈述,而不是硬贴上去的免责声明。注册表里没有任何东西引用发行方、 托管方或储备,因为根本没有:Pickle 不发行任何现实世界资产,也不持有任何现实世界资产。一个名为 AAPL/USD 的价格源,是一个描述那只股票在别处的市场上成交于什么价位的数字,发布在 这条链上,仅此而已。
拿到资产列表
三种方式,而第一种几乎总是对的那一种。它不需要 ABI,不需要地址,也不需要密钥。
| 方式 | 调用 |
|---|---|
| Over JSON-RPC | pickle_pricesno params. Answers the whole registry: every feed with its symbol, feedId, adapter, decimals, class, policy, latest answer and age. One call, no ABI, no address |
| From a contract | feedCount() then feeds(offset, limit)on the price registry. limit is capped at 256; an offset past the end returns an empty array rather than reverting, so a reader can page blindly |
| From the source | oracle/catalog.jsonthe live feed set in the repository: what the oracle service prints and what l2-feeds-init (scripts/sync-feeds.sh) reconciles the registry to. The authority for what the chain should hold after a sync, not proof of what it holds now |
| The genesis input | oracle/catalog-genesis.jsonthe frozen copy the genesis allocation was generated from, and the authority for what the chain was born with. It is never edited on its own: a change to it is a genesis regeneration, a new chain |
# Every feed the chain carries, with its adapter, decimals, answer and age.
curl -s $RPC_URL \
-H 'content-type: application/json' \
-d '{"jsonrpc":"2.0","id":1,"method":"pickle_prices","params":[]}' \
| jq '.result.feeds[] | {symbol, feedId, adapter, decimals, price, statusName, staleOnchain}'
# The count alone, when you only want to know whether the catalog changed.
curl -s $RPC_URL \
-H 'content-type: application/json' \
-d '{"jsonrpc":"2.0","id":1,"method":"pickle_prices","params":[]}' \
| jq '.result.feeds | length'$RPC_URL 就是网络参数上的那个接入点。答案里还带着 blockNumber、timestamp,以及注册表点名的 publisher 和 owner:如果你想知道谁本可以写下你刚读到的东西,就去读它们。
下面那套创世集合是这条链出生时带着的东西。价格源之后可以由 owner 角色添加,所以一个把列表 写死的客户端会漏掉它们。请去分页读注册表,或者调用 pickle_prices 并从答案 出发。
33 个价格源
| 资产类别 | 数量 |
|---|---|
| crypto | 14 feedsclass 1. ETH, BTC, SOL, XRP, DOGE, LINK, ADA, XLM, BCH, TRX, BNB, HYPE, ZEC, XMR - all quoted in USD |
| equity | 9 feedsclass 2. AAPL, MSFT, NVDA, AMZN, GOOGL, META, TSLA, SPY, JPM |
| commodity | 2 feedsclass 3. XAU/USD and XAG/USD - gold and silver |
| fx | 5 feedsclass 4. EUR/USD, GBP/USD, USD/JPY, USD/CHF, USD/CNH |
| index | 3 feedsclass 5. PYTHOIL/USD, BRENT/USD, NATGAS/USD - energy indices, which trade around the clock |
33 个里有 19 个是现实世界资产。在运维上要紧 的是另一种划分:13 个价格源由现货交易所支撑, 而 20 个只来自 Pyth,也就是每一个现实世界价格源, 外加 XMR/USD,那个唯一没有交易所腿的加密资产交易对。
| 符号 | 类别 | 来源 | 发布策略 | 市场 |
|---|---|---|---|---|
| ETH/USD | 加密资产 | 5 个交易所 + Pyth | everyBlock | 始终开盘 |
| BTC/USD | 加密资产 | 5 个交易所 + Pyth | everyBlock | 始终开盘 |
| SOL/USD | 加密资产 | 5 个交易所 + Pyth | everyBlock | 始终开盘 |
| XRP/USD | 加密资产 | 5 个交易所 + Pyth | everyBlock | 始终开盘 |
| DOGE/USD | 加密资产 | 5 个交易所 + Pyth | everyBlock | 始终开盘 |
| LINK/USD | 加密资产 | 5 个交易所 + Pyth | everyBlock | 始终开盘 |
| ADA/USD | 加密资产 | 5 个交易所 + Pyth | 10 bps / 60 s | 始终开盘 |
| XLM/USD | 加密资产 | 5 个交易所 + Pyth | 10 bps / 60 s | 始终开盘 |
| BCH/USD | 加密资产 | 5 个交易所 + Pyth | 10 bps / 60 s | 始终开盘 |
| TRX/USD | 加密资产 | 5 个交易所 + Pyth | 10 bps / 60 s | 始终开盘 |
| BNB/USD | 加密资产 | 5 个交易所 + Pyth | everyBlock | 始终开盘 |
| HYPE/USD | 加密资产 | 5 个交易所 + Pyth | everyBlock | 始终开盘 |
| ZEC/USD | 加密资产 | 5 个交易所 + Pyth | 10 bps / 60 s | 始终开盘 |
| XMR/USD | 加密资产 | 仅 Pyth | 10 bps / 60 s | 始终开盘 |
| AAPL/USD | 股票 | 仅 Pyth | everyBlock | NYSE 交易时段 |
| MSFT/USD | 股票 | 仅 Pyth | 10 bps / 300 s | NYSE 交易时段 |
| NVDA/USD | 股票 | 仅 Pyth | everyBlock | NYSE 交易时段 |
| AMZN/USD | 股票 | 仅 Pyth | everyBlock | NYSE 交易时段 |
| GOOGL/USD | 股票 | 仅 Pyth | 10 bps / 300 s | NYSE 交易时段 |
| META/USD | 股票 | 仅 Pyth | everyBlock | NYSE 交易时段 |
| TSLA/USD | 股票 | 仅 Pyth | everyBlock | NYSE 交易时段 |
| SPY/USD | 股票 | 仅 Pyth | 10 bps / 300 s | NYSE 交易时段 |
| JPM/USD | 股票 | 仅 Pyth | 10 bps / 300 s | NYSE 交易时段 |
| XAU/USD | 大宗商品 | 仅 Pyth | everyBlock | 含每日休市的交易时段 |
| XAG/USD | 大宗商品 | 仅 Pyth | 5 bps / 300 s | 含每日休市的交易时段 |
| PYTHOIL/USD | 指数 | 仅 Pyth | 10 bps / 300 s | 始终开盘 |
| BRENT/USD | 指数 | 仅 Pyth | 10 bps / 300 s | 始终开盘 |
| NATGAS/USD | 指数 | 仅 Pyth | 10 bps / 300 s | 始终开盘 |
| EUR/USD | 外汇 | 仅 Pyth | 2 bps / 300 s | 外汇周 |
| GBP/USD | 外汇 | 仅 Pyth | 2 bps / 300 s | 外汇周 |
| USD/JPY | 外汇 | 仅 Pyth | 2 bps / 300 s | 外汇周 |
| USD/CHF | 外汇 | 仅 Pyth | 2 bps / 300 s | 外汇周 |
| USD/CNH | 外汇 | 仅 Pyth | 2 bps / 300 s | 含每日休市的交易时段 |
- 5 个交易所 + Pyth。 five spot venues, with a Pyth feed alongside as a cross-check and a stand-in
- 仅 Pyth。 Pyth only - no venue is listed for this feed, so an absent Pyth credential leaves it unpublished
市场这一列:始终开盘,open every day, all day;NYSE 交易时段,09:30-16:00 New York, Monday to Friday, with the exchange holiday list;外汇周,continuous Monday to Friday afternoon New York, closed Saturday, reopening Sunday evening;含每日休市的交易时段,a nearly-continuous session with a daily break and a closed Saturday。这些时间表是市场时段那一节的主题,而处理它们不是可选的。
五种发布策略,不是三十三种
| 策略 | 价格源 |
|---|---|
| everyBlock, no step cap | ETH/USD, BTC/USD, SOL/USD, XRP/USD, DOGE/USD, LINK/USD, BNB/USD, HYPE/USDwritten on every EVM block the publisher can fill. No deviation trigger, no heartbeat, no step cap - the whole crypto class carries a step cap of 0 whether or not it is on this policy. Ring capacity 16,384 for ETH/USD and BTC/USD, 1,024 for the other six |
| everyBlock, with step cap | AAPL/USD, NVDA/USD, AMZN/USD, META/USD, TSLA/USD, XAU/USDthe six real-world feeds moved onto everyBlock still carry their class's step cap (2,000 bps for the equities, 1,000 bps for gold), so a move wider than that is skipped unless the market status changed in the same update. Ring capacity 1,024 |
| 10 bps / 60 s | the other 6 crypto feedsrepublished on a 10 bps move or after 60 s, whichever is first. No step cap. Ring capacity 1,024 |
| 10 bps / 300 s, step 2,000 bps | the 4 remaining equities and the 3 energy indicesa move wider than 20 % is skipped by the contract unless the market status changed in the same update |
| 5 bps / 300 s, step 1,000 bps | XAG/USDthe metal moves less, so the trigger is tighter and the implausible-move cap is 10 %. XAU/USD kept the same trigger shape until it moved to everyBlock |
| 2 bps / 300 s, step 500 bps | the 5 FX pairsthe tightest trigger in the set, and a 5 % cap - an FX pair that moves further in one update is not moving, it is wrong |
步进上限是最常被读错的那一行。在每一个加密资产价格源上它都是 0,因而是关闭的; 在每一个现实世界价格源上它都是启用的,所以一次一步走得比这个上限更远的现实世界更新,会被合约跳过而不是被写入,除非市场状态在同一次更新里发生了变化。正是那个例外 让一个周末缺口能够落地。
一条价格源记录带着什么
| 字段 | 创世集合中的值 |
|---|---|
| symbol | BASE/QUOTE^[A-Z0-9.]+/[A-Z]+$, at most 32 bytes, unique. The contract enforces the same shape |
| description | free textthe Chainlink-style spaced form, "ETH / USD"; description() returns it and symbol() returns the canonical one |
| assetClass | crypto | equity | commodity | fx | indexstored as 1-5 |
| decimals | 8every feed in the catalog. The field allows 0-18, so read it rather than assuming |
| capacity | ring length in rounds16,384 for ETH/USD and BTC/USD, 1,024 for every other feed - including the twelve other feeds now on everyBlock. Rounds older than this are overwritten |
| policy | paused | everyBlock | deviationstored as 0, 1, 2. A paused feed is skipped rather than refused |
| deviationBps | 10, 5 or 2the move that triggers a republish. 0 on an everyBlock feed, which needs no trigger |
| heartbeatSecs | 60 or 300republish even without a move. 0 on an everyBlock feed |
| maxStepBps | 0, 500, 1,000 or 2,000the contract skips a move wider than this. 0 disables the check and is what every crypto feed carries; every real-world feed has it live. Bypassed whenever the status changed |
| minSources | 3 on an exchange-backed feed, 1 on a Pyth-only feedthe floor below which nothing is published |
| sources | { exchanges: {venue: productId}, pyth: id }the venue-native product id per venue, and the Pyth feed id without its 0x |
同样这些字段就是这个价格源在链上的配置,所以你从 pickle_prices 或从 feeds(offset, limit) 读到的,就是这条记录加上最新的一轮。今天每一个价格源的 decimals 都是 8,而这个字段允许 0 到 18:请去读它而不是假定它,因为弄错的代价 是一个差了八个数量级的价格。
价格源 id
一个价格源以它符号的哈希为键,不是以一个下标,也不是以一个地址:
bytes32 feedId = keccak256(bytes("ETH/USD"));The canonical symbol, upper case, with a single slash - keccak256("ETH/USD"), not "ETH-USD" and not "eth/usd". The same 32 bytes key the contract's mappings, name the feed on the RPC, and appear as the indexed topic of every FeedUpdated log. You can compute it offline with any keccak-256 implementation; nothing has to be fetched to know it.
The node and the service both accept ETH/USD, ETH-USD, eth-usd or 0x<64 hex feed id and normalise before looking up, so a URL-safe spelling costs nothing.
解析地址
本参考不打印任何合约地址
注册表和逐价格源的适配器是规范的预部署,在创世时就为这条链的一生固定下来,而这恰恰是发布 字面量最糟糕的情形。一次指向无代码账户的 EVM CALL 会成功: 一个打错的地址不会 revert,它什么都不返回,并被读成一个为零的价格。所以本站改为记录那个 解析机制。
The price registry and one adapter per feed are predeploys: their addresses are fixed at genesis and canonical for the life of the chain. That is precisely why this reference resolves them instead of printing them.
- pickle_prices answers with the registry's address in core and each feed's adapter in feeds[].adapter, checksummed. That is the shortest path and it needs no ABI.
- pickle_price(feed) carries that feed's adapter; pickle_ethUsdPrice carries the adapter, the registry and, under contract, the adapter again, which is what a Chainlink reader should be pointed at.
- On chain, adapterOf(feedId) returns the deployed adapter and adapterAddress(feedId) recomputes it: the adapter is CREATE2 from the registry with salt = feedId, so its address is a pure function of the registry address and the symbol.
- The first-party applications resolve every address they use at runtime rather than compiling one in - shared-ui/config.js merges the deployment's address files into config.addresses at load.
- The explorer shows that address as an account, with its code and its activity, which is the human-readable cross-check that something is deployed there. It publishes no source and no ABI: the repository is not public yet, and the explorer verifies no contract.
# The registry and one feed's adapter, resolved from the chain itself.
curl -s $RPC_URL \
-H 'content-type: application/json' \
-d '{"jsonrpc":"2.0","id":1,"method":"pickle_price","params":["ETH-USD"]}' \
| jq '{adapter: .result.adapter, feedId: .result.feedId}'
# Then prove the address has code before you call it.
curl -s $RPC_URL \
-H 'content-type: application/json' \
-d '{"jsonrpc":"2.0","id":1,"method":"eth_getCode","params":["<adapter>","latest"]}'Verify a resolved address with an eth_getCode before your first call. A CALL to an account with no code succeeds and returns nothing, so a wrong address does not revert - it reads as a price of zero.