Beacon block roots for QRL 2.0: letting smart contracts verify the staking side
We opened a draft QIP that brings Ethereum's EIP-4788 to QRL 2.0. It gives smart contracts an authenticated view of validators, balances and finality, and it comes with working code in both clients.
This is a draft proposal for review by the QRL team and the community. Nothing in it is scheduled for any network, and the values in the reference code are experimental.
Today we opened a draft QRL Improvement Proposal: Beacon Block Roots for QRL Contracts. It brings a feature to QRL 2.0 that Ethereum has run since March 2024, and it comes with working code in both QRL clients.
The gap it closes
QRL 2.0 has two halves. One runs transactions and smart contracts. The other runs proof of stake: the validators, their balances, their penalties and their exits. A contract lives in the first half and cannot see the second. A staking pool that wants to know whether one of its validators was slashed has to trust whoever reports it.
The proposal closes that gap with one small addition. Every block records the root of the previous staking block in a history contract. That single value commits to the whole staking state, so a short proof against it can establish any fact the state holds, and a contract can check that proof itself. Anyone can supply the proofs. Nobody has to be trusted for them.
What it makes possible
- Staking pools that account for rewards, penalties and exits from proven values, with no reporting committee as the source of truth.
- Operator bonds and slashing cover that pay out or forfeit on a proven slashing.
- Exact reward accounting for any withdrawal address. Staking payouts arrive without a transaction or a log, and a proof shows the exact amount per validator.
- Proposer facts, so a tip-sharing agreement can see which block paid whom.
- Validator identity in other applications: voting by stake, validator registries and verified validator names.
- Finality and history: contracts that act only on finalized events, which bridges and swap settlement need, and that can reach further back than the last 256 blocks.
Closer to home, QuantaPool could account for its validators from proofs, and QNS and ShorScan could show verified validator names.
Standing on Ethereum’s work
The design is Ethereum’s. EIP-4788, by Alex Stokes, Ansgar Dietrichs, Danny Ryan, Martin Holst Swende and lightclient, went live there with the Cancun upgrade. QRL 2.0’s clients descend from Ethereum’s at a point just before that upgrade was finished, which is why QRL does not have the feature today.
Our draft keeps the mechanism and adapts it to QRL: 64-byte addresses and VM words, a history contract that the client installs itself, and a stricter rule for a block whose root cannot be recorded. The QIP lists every difference in one table.
Working code, tested on a network
The proposal comes with a reference implementation in both clients: go-qrl and Qrysm. The feature stays off unless a network switches it on.
On 18 November we ran both on a local test network with 64 validators. The feature was active from the first block, all 10 checks passed and the chain finalized. A Hyperion contract read the root inside a transaction, and replaying that transaction gave the same answer.
The limits are in the QIP as well. The test used a single node, reorganisations are untested, and the cost of the extra write has not been benchmarked on validator hardware.
What happens next
The draft asks the QRL team to settle a handful of open points, among them the reserved addresses, how much history to keep and how a failed write is treated. Review and discussion happen on the pull request.
A second draft will follow for the other half of contract-controlled staking: exits that a validator’s withdrawal address can request, based on Ethereum’s EIP-7002.
Thanks to the QRL core developers for the clients this builds on, and to the authors of EIP-4788 for the design.