A GenLayer intelligent contract that answers one question: can this web page settle this claim?
check(url, claim) -> validators render the page, judge it against the claim, agree on a verdict
get_verdict(url, claim) -> the newest agreed verdict for that exact (url, claim) pair
The contract is permissionless and append-only. Anyone can call check, anyone can re-run
it, and nothing is ever overwritten. It has no owner, no configuration, and no constructor
arguments.
"Does the page load?" is the wrong question. Many pages load and still cannot settle anything:
- a cookie or consent wall loads, but the content behind it was never captured;
- a login or paywall page loads, but the fact is behind it;
- a captcha or "verify you are human" page loads;
- a perfectly readable page loads, but it is about something else. A league's homepage renders fine and says nothing about last night's score.
A probe that only checks that some text rendered marks all of these as fine. The last case
is the important one: readability is a property of the page, but usefulness is a property
of the page and the claim together. The same results page is usable for "Team A won the
2026 final" and readable_irrelevant for "The stadium sold out". So the contract takes the
claim, shows it to every validator next to the rendered page, and the validators agree on
whether the page can settle that claim.
It follows that verdicts are keyed by the (url, claim) pair:
- One page can carry different verdicts for different claims.
- The contract derives the key from the url and claim itself. There is no caller-supplied lookup key, so nobody can file a verdict for their own page under a key someone else reads. A verdict can only be read back under the url and claim it was produced for.
- Normalization is deliberately small, so two keys only collapse when they cannot mean different things (see Canonicalisation).
The status set is closed. The LLM is shown this list; anything outside it is stored as
error, never verbatim. Validators compare the status and nothing else.
| Status | Meaning | Typical caller action |
|---|---|---|
usable |
Readable, and it carries the fact needed to settle the claim, or it is the kind of page (live scoreboard, results table, official feed, status page) that will publish it by settlement time | use the source |
readable_irrelevant |
Loads fine, but will not answer this claim | pick a deeper or different URL |
paywall |
Content is behind a subscription or purchase | pick another source |
login |
Content requires signing in | pick another source |
consent |
A cookie/consent interstitial was captured instead of the content | try a deeper URL, or another source |
bot_check |
Captcha, "verify you are human", or another anti-bot interstitial | pick another source; validators cannot pass it |
empty |
Rendered, but no meaningful content | retry later or pick another source |
error |
An error page, or none of the above applies (also: an LLM status outside this set) | retry later or pick another source |
Each stored verdict also carries why (one sentence from the leader, at most 400
characters, not compared in consensus) and checked_at (ISO 8601, UTC).
| Method | Returns |
|---|---|
get_verdict(url, claim) |
{found, status, why, checked_at, index}; found: false and index: -1 when there is none |
get_check_count() |
number of stored checks |
get_check(index) |
{url, claim, status, why, checked_at} for one stored check |
get_statuses() |
the closed status list above |
A failed check stores nothing. Every failure inside the nondeterministic block carries one
prefix, and the validator compares failures by prefix. This is the part of a shared
verdict/error reference that applies to this contract.
| Prefix | Raised when | Validator rule | Outcome |
|---|---|---|---|
[TRANSIENT] |
the render raised, or rendered no text (render failed for …, no content rendered for …) |
agree only if the validator's own run is also [TRANSIENT] |
transaction fails, nothing stored; resubmit later |
[LLM_ERROR] |
the model call failed or its answer is not a JSON object (prompt failed for …, unparseable judgement for …) |
never agree | consensus rotates to a new leader instead of locking in a broken run |
[EXTERNAL] |
reserved for deterministic outside refusals; check does not raise it today |
agree only on an exact message match | transaction fails with that message |
| (none) | input validation before any web call: url is required, url is too long, url must be an http(s) URL, claim is required, claim is too long |
not reached: deterministic, raised before consensus | transaction fails, nothing stored |
Other validator rules: the leader succeeded but the validator's run failed → disagree; both succeeded → agree only if the normalized statuses are equal and non-empty.
An empty render is never recorded as empty. If it were, an outage on the validators' side
would be written on chain as a fact about the page. empty is only stored when the page
rendered text and the model judged it contentless.
check and get_verdict derive the key with the same functions.
- url: trim surrounding whitespace, drop the
#fragment(it never reaches the server), lowercase the scheme and host (case-insensitive by RFC 3986). The path, query and a trailing slash are kept as given, because each can select a different resource. SoHTTPS://Example.com/Results#liveandhttps://example.com/Resultsshare a key, andhttps://example.com/resultsandhttps://example.com/Results/do not. - claim: collapse runs of whitespace to one space. Wording and case are kept: they are part of the claim.
Limits: url at most 2,048 characters and http:// or https://; claim at most 2,000
characters; the rendered page is cut to its first 12,000 characters before it reaches the
prompt.
The first line of contracts/source_check.py pins the runner:
# { "Seq": [{ "Depends": "py-genlayer:kzybg95x1gn21dw72m7hyg0maaap04n4nx55j9yt6fkdqxtz6bz0" }] }
That is py-genlayer from GenVM v0.6.0-rc17, the GenVM that Testnet Bradbury (Phase 3)
and Testnet Clarke nodes run (node v0.6.1). The line after it must stay blank: GenVM reads
every leading comment line as part of the header.
| Network | Status |
|---|---|
| Testnet Bradbury | deployed 2026-12-04 at 0x37B9D9c8A0256679cF2808a1227E4157d7e5BF54; two live checks, see Cost and latency |
| Testnet Clarke | same GenVM as Bradbury; no public GenLayer node RPC yet, so not checked |
Studio (studionet) |
runs GenVM v0.2. The CLI translates the source to the v0.2 SDK on the fly (runner 1jb45aa8…); deployed there with a throwaway key and two live checks run, see Cost and latency |
When a network upgrades GenVM, change the pin, then run the tests, the linter and
load-check against that network.
npm install
node scripts/source-check.mjs load-check # no key, no transaction
export SOURCE_CHECK_PRIVATE_KEY=0x... # a funded testnet key
node scripts/source-check.mjs deploy # prints the contract address
export SOURCE_CHECK_ADDRESS=0x...
node scripts/source-check.mjs check "https://example.com/results" "Team A won the 2026 final."
node scripts/source-check.mjs verdict "https://example.com/results" "Team A won the 2026 final."
node scripts/source-check.mjs count
node scripts/source-check.mjs get 0| Env var | Purpose |
|---|---|
SOURCE_CHECK_NETWORK |
testnetBradbury (default), testnetClarke, studionet, localnet |
SOURCE_CHECK_PRIVATE_KEY |
signer for deploy and check |
SOURCE_CHECK_ADDRESS |
deployed contract, for check and the reads |
SOURCE_CHECK_RPC |
override the chain RPC that transactions go to |
SOURCE_CHECK_GENLAYER_RPC |
GenLayer node RPC for reads (gen_call). On Bradbury it defaults to https://rpc.bradbury.genlayer.com: the chain RPC serves no gen_call, and the node RPC does not accept raw transactions |
new-key prints a fresh throwaway key for testnets. It is not stored anywhere.
check reads get_check_count first and only reports a verdict whose index is newer, so a
failed check never shows an older verdict as its result.
client/sourceCheck.ts is a small, dependency-light client for genlayer-js 2.2.0:
import { makeClients, checkSource, getVerdict } from "./client/sourceCheck";
const clients = makeClients({
network: "testnetBradbury",
privateKey: process.env.SOURCE_CHECK_PRIVATE_KEY as `0x${string}`,
});
const address = process.env.SOURCE_CHECK_ADDRESS as `0x${string}`;
// Cheap: read what is already on chain.
const cached = await getVerdict(clients, address, url, claim);
// Expensive: run a new check (one transaction, minutes of consensus).
const fresh = await checkSource(clients, address, url, claim);
if (fresh.status === "usable") {
// the page can settle this claim
}checkSource estimates fees where the network has a fee policy, waits until the transaction
is decided, and throws if nothing new was recorded (a [TRANSIENT] or [LLM_ERROR]
failure). Treat that as "retry later", not as a bad source.
A sensible caller caches verdicts off chain by (canonical url, claim) with a TTL, reads
get_verdict first, and only calls check on a miss or when the cached verdict is too old
for its purpose. Pages change: a usable verdict says what validators saw at checked_at,
not what the page will show at settlement.
- A
checkis one transaction. Its leader and every validator each render the page (with a 10-second post-load wait for scripts) and run one LLM call over at most 12,000 characters of page text. Validators must also agree on the status, so a disagreement adds rounds. - Observed on StudioNet: up to about 4 minutes for a slow page (one source took 4m10s in
earlier use). In this repo's own Studio run (2026-12-04, python.org downloads page) two
checks took 73 s (
usablefor "Python 3.13 has been released as a stable version.") and 80 s (readable_irrelevantfor an unrelated claim on the same page), wall clock from submit to decided. Plan for minutes, poll with back-off, and do not block a user flow on it. - Testnet Bradbury (measured 2026-12-04): contract
0x37B9D9c8A0256679cF2808a1227E4157d7e5BF54, deploy tx0x7cd02411…1600(44 s to ACCEPTED, ~0.004 GEN). Two checks on the python.org downloads page, wall clock from submit to ACCEPTED: 68 s forusable("Python 3.13 has been released as a stable version.", tx0x58cc5210…d5e0) and 58 s forreadable_irrelevant("The Kansas City Chiefs won Super Bowl LVIII.", tx0x2d3a3a4b…484b). Each cost ~0.004 GEN (balance delta, fee policy default budget: 100 leader / 200 validator time units, 3 rotations). ACCEPTED is when the verdict is readable; finalization follows after the appeal window. - The public Bradbury node cannot simulate a
check(itsgen_callanswers "Internal error" for a web + LLM call), so the CLI and the client fall back to the fee policy's default budget, which a check fits. Fee estimates go to the GenLayer node RPC, never the chain RPC. - Testnet Clarke: not measured (no public GenLayer node RPC yet).
- Fees depend on the network's fee policy at the time; the CLI and the client estimate them
before each write. Reads (
get_verdict,get_check_count,get_check) are free calls. get_verdictscans at most the 2,000 most recent checks, newest first, so the cost of a read is bounded however large the log grows.
- Untrusted inputs. The claim is caller text and the page is third-party text. Both, and
the url, go into the prompt JSON-encoded, inside labelled sections, with an explicit
instruction to ignore instructions found in them. This lowers prompt-injection risk; it
does not remove it. A page written to fool LLMs may still get a wrong
usable. Because every validator judges independently and must agree, a single fooled run is not enough, but a page that fools the model reliably will fool all of them. - Permissionless writes. Anyone can append checks, including spam and checks of their own
pages. Verdicts are keyed by the contract-derived (url, claim), so spam cannot change the
verdict stored for your pair. It can push your verdict out of the 2,000-entry scan window;
then
get_verdictreturnsfound: falseand you re-check. That costs you a transaction but never returns wrong data. Spam costs its sender a transaction per entry. - Anyone can re-check. The newest verdict for a pair wins. Someone can call
checkagain on your pair; they cannot choose the result, which still comes from consensus, but a page that changed (or a validator-side outage that happens to produce a different agreed status) will replace whatget_verdictreturns. Readchecked_atandindex, or pin a specificget_check(index), if you need a stable reference. - What validators can reach. Validators render the url from their own machines. The
contract only accepts
http://andhttps://; it does not block private addresses or hostnames, and it relies on the validators' web renderers to refuse them. Do not put secrets in urls or claims: both are stored on chain and readable by everyone. - A verdict is a snapshot, taken at
checked_atby the validators' renderers. Geo-blocks, A/B tests and rate limits can make a page look different to validators than to you, which is exactly why the check runs on validators rather than on your own machine. - No owner, no upgrade path. A fix means deploying a new contract and moving callers to it. The old contract keeps serving its log.
uv venv -p 3.13 .venv
uv pip install -p .venv/bin/python --prerelease allow 'genlayer-test>=0.30.2' pytest cloudpickle pillow pycryptodome
.venv/bin/pytest # direct mode, real GenVM v0.6.0-rc17 std lib
GENVM_REPO=genlayerlabs/genvm-manager GENVM_VERSION=v0.6.0-rc17 \
uvx --prerelease allow --from 'genvm-linter>=0.11.1rc2' genvm-lint check contracts/source_check.py
npm install && npm run typecheck # client/sourceCheck.ts
node scripts/source-check.mjs load-check # the live network's GenVM loads itDirect-mode tests run the leader path in-process against the real GenVM standard library
named by the runner pin, with the web render and the LLM mocked. Validator behaviour is
tested by replaying the captured validator (direct_vm.run_validator) against different
mocks and leader results. Unpicklable nondeterministic blocks fail the suite, as they would
fail on a node.
MIT