Skip to content
CA0x6176…4096

[ Docs ]

Compare, commit, record, settle. What each step does, who can do what, and what the ledger cannot know.
01

Compare

Two tasks, each with a reward, a data price and a compute estimate. Net = reward − data − compute. The page shows both nets and the gap as you type (browser arithmetic, checked against the contract's compare() by eth_call).

02

Commit

commitPair(asset, poster, A, B, chosen, settleWindow) stores both quotes, the task chosen and the block time. Asset: USDG (0x5fc5…d168) or native ETH. Task references are hashes of your text. Nothing can be changed afterwards.

03

Record

Real costs of the chosen task, as they happen: pay the provider through the ledger (Paid), or record an invoice paid elsewhere signed with EIP-712 by the manager or a reporter (Signed), optionally co-signed by the provider (Confirmed). The reward: paid through the ledger to the manager, or declared.

04

Settle

settle() computes, on chain: estimated net of the chosen task, actual net (reward received − all costs), the component that came in worst against the quote (data, compute, costs not in the quote, or a reward shortfall) and the largest single cost. Stored for good.

Roles and powers

There is no owner, admin, fee, pause or upgrade. CasiqQuoteLedger never holds a balance between transactions: every payment is forwarded in the same call, and plain ETH sent to it is refused.

RoleWhoCan
ManagerThe wallet that committed the pair.Records and pays costs, declares a reward received elsewhere, adds or removes reporters, settles any time. Cannot edit or delete the quote or any line, cannot pay itself a cost or a reward.
ReporterAdded by the manager for one quote (for example the agent's own key).Pays and signs cost lines for that quote. Nothing else: no reward, no settle, no reporters.
ProviderWhoever is paid or charged for data or compute.Receives payments directly. May co-sign a line so it shows as Confirmed. Has no other power over the quote.
PosterOptional, named at commit.When named, the only address that can pay the reward through the ledger. When not named, anyone but the manager can.
AnyoneEvery other address.Reads everything, submits lines the manager or a reporter signed (and pays their gas), settles after the settle deadline. Settling moves no money.

Line kinds

Paid

payCost / payReward: the money went through the ledger to the counterparty in that transaction. The transfer itself is the evidence.

Confirmed

recordCost with two signatures: the manager or a reporter, and the provider named in the line, signed the same EIP-712 line.

Signed

recordCost with one signature from the manager or a reporter. It is their statement; the provider did not sign it.

Declared

declareReward: the manager states a reward received outside the ledger, with an evidence hash. The ledger cannot check it; the report labels it.

Why invoices, not metering

An agent's compute runs on its own machines or a cloud account; a web page cannot measure that honestly, and timing a script in your browser would measure your laptop, not the job. So Casiq records the costs where they really are: a payment made through the ledger to the provider, or the provider's bill as a line signed by the manager or the agent's reporter key and, when the provider agrees, co-signed by the provider. Each line says which of these it is, and the report never mixes them up.

What the ledger cannot know: whether a Signed line or a Declared reward is true. It records who said it and when, binds the amount and the evidence hash to the signature, and refuses the same signed line twice. A manager paying itself a cost or a reward is refused; a provider that is the manager's other wallet cannot be detected.

EIP-712 cost line

domain   { name: "CasiqQuoteLedger", version: "1", chainId: 4663, verifyingContract: 0xb802cd9a3c8d11450e31d97098155f74e0d58cc8 }
type     CostLine(uint256 quoteId,uint8 component,address provider,uint256 amount,bytes32 evidence,bytes32 salt)
         component: 1 data, 2 compute, 3 other · amount: integer in the asset's smallest unit
         evidence: keccak256 of your invoice text · salt: any 32 bytes, makes identical lines distinct
submit   recordCost(line, signerSig, providerSig)   providerSig = 0x when there is none
refused  a signature that is not from the manager or a reporter, a provider signature from anyone but the provider,
         a high-s or malformed signature, a line already recorded, any line on a settled quote

Agent script

An agent outside the browser can sign, co-sign, submit and pay lines with examples/casiq-cost-line.mjs in the source (Node 20, viem). The key comes from your shell, never from a file in the repository.

export CASIQ_LEDGER=0xb802cd9a3c8d11450e31d97098155f74e0d58cc8
export CASIQ_RPC_URL=https://rpc.mainnet.chain.robinhood.com
export CASIQ_KEY=<the reporter key, 0x + 64 hex>        # set in your shell only

# the reporter signs a 12.5 USDG compute bill for quote 7 (no gas)
node examples/casiq-cost-line.mjs sign --quote 7 --component compute --provider 0xProvider… --amount 12.5 --decimals 6 --evidence "gpu invoice 2211" --out line.json
# the provider co-signs the same line with its own key
CASIQ_KEY=<provider key> node examples/casiq-cost-line.mjs cosign --file line.json
# anyone submits it (pays the gas)
node examples/casiq-cost-line.mjs submit --file line.json
# what settle() would record now
node examples/casiq-cost-line.mjs report --quote 7

Data and limits

  • Every number on a quote page is read from CasiqQuoteLedger on Robinhood Chain: getQuote() and report() at request time, lines from its events. The list says which blocks were scanned and if any range is missing.
  • The compare step is browser arithmetic on the numbers you type; it is an estimate you enter, not a forecast.
  • ETH amounts are shown in USD only with Chainlink ETH/USD on Robinhood Chain (0x78F3…d3A9) and its update time.
  • Tokens that take a fee on transfer are refused (the provider must receive exactly the amount). Only USDG and ETH are offered on the site; the contract accepts any ERC-20 with code.
  • Proof of this deployment: /api/proof. Status: 0xb802cd9a3c8d11450e31d97098155f74e0d58cc8 (deployed at block 128,973,791; source verified on Sourcify (creation and runtime match), and npm run verify-deployment prints MATCH against this build).
Compare two tasks