Receipts and the provenance inspector
A figure on Rails can carry a receipt: a short record of where the figure comes from on the chain and how to check it.
Turning it on
The inspector has one switch: Inspector, under Advanced in the profile menu at the top right. Once on, it stays on from page to page, on the pages that support it. While it is on, a teal crosshair stands beside the profile menu on any page with something to inspect; hover over it for a reminder of what to do. The same switch turns the inspector off.
Underlined figures
While the inspector is on, each figure with a receipt has a dotted underline. A click or a tap on one opens its receipt beside it; on a phone the receipt opens as a sheet at the foot of the screen. A click elsewhere closes it. Escape closes an open receipt, and a second Escape turns the inspector off.
What a receipt holds
The receipt below is a real one, for the collateral a Liquity V2 trove held after one event. The TroveManager contract recorded it at block 25,258,660. Its parts, top to bottom:
- Head
- Coloured dots for the kind of figure, then its name and its value as the page shows it.
- Summary
- What the figure means on the chain, in plain words.
- Whole number
- The integer the chain stores, and how it becomes the figure shown.
- Via line
- The log or contract call the figure comes from, its field, the raw value and the divisor. The log’s name links to the transaction’s event logs on Etherscan.
- Source row
- The block, the transaction and the contract. The transaction and the contract link to Etherscan; the block and the transaction each have a copy button.
Other receipts add a line opening “To check:”, a formula opening “=” with one row per input, or the full figure under a rounded one.
Kinds of figure
The dots in a receipt’s head name the kind of figure. Pressing them opens the distance ladder, which ranks the kinds by their distance from the chain. The first three can be checked on the chain without Rails.
- Emitted
- A field in a transaction’s event log. Any block explorer shows it.
- State
- A value a contract returned at a stated block. Any archive node returns it again.
- Oracle
- A price from a feed on the chain. The feed’s log for that round holds it.
- Indexed
- Built by Rails’s index from the events it recorded. No third party holds it.
- Off-chain
- No anchor on the chain, such as a price from an outside service. Nothing on the chain confirms it.
A figure worked out from others is computed. Its head shows one dot for each kind among its inputs, and it is as checkable as its furthest input.
Checking a figure
A receipt names where its figure can be checked. A figure read from a contract has a line naming the call and the block: “To check: ask any Ethereum archive node for the vault’s totalAssets() at block 26400704.” A block explorer shows a contract’s current state, so a past block needs an archive node. A figure from an event links to its transaction. The example above checks in four steps:
- Open the transaction, tx 0x2a44…58d4. Etherscan opens on its event logs.
- Find the TroveUpdated log from TroveManager 0x7bcb…cf5a.
- Read its _coll field: 660277137183731377026.
- Move the decimal point 18 places to the left, for WETH’s 18 decimal places: 660.277137183731377026. The page rounds it to 660.2771.
Limits of a receipt
- A price is one source’s price at one block. The receipt names the source, and a dollar figure is an amount times that price.
- When the latest read fails, a card shows its last stored read and says so: “Stored read at block …; the latest read failed.” Its figures stand at that block.
- While the inspector is on, a figure with no underline has no receipt. The inspector works only on pages Rails has checked for such figures; elsewhere the switch keeps its setting for the next one.
Read more
- How the data gets to the page · the index, the chain reads and the API behind each figure
- How the figures are counted · the positions Rails covers and the value they hold
- Coverage · how deep each explorer goes, chain by chain