Innovation Blockchain

Documentation · Coston2 testnet prototype · invented data

Documentation Flows

Flows

The eight flows of the prototype as diagrams. Under each one the same steps are written out in words.

In every diagram, dark boxes are parties, filled grey boxes are steps off the chain, outlined boxes are contracts, dashed boxes are files or records, boxes with a heavy line are Flare's own network, and the tinted box is the extension's machine or the second fact planned for it. No diagram is wider than three columns.

The first three flows are the signed record: built and tested on a local chain, not deployed by the owner on Coston2 yet. The extension flow is registry v1, the earlier demo shown on Coston2.

From the inspection to the loan gate#

The whole path, from a GPU answering with its serial number to a draw being allowed or refused.

From the inspection to the loan gate Facility hosts GPUs answer with their serial numbers Inspector kit match, findings, report, hashes Proof record result, counts, scope, dates, hashes Lender checks the folder alone, pins key and schedule Signed record the record and its signature envelope Inspector signs the digest with his own key Second fact, later coverage check bound to the record digest LoanVaultV2 reads only the pinned key’s record ProofRegistryV2 recomputes the digest, recovers the signer Borrower asks for a draw capture build digest signs folder anyone relays pins reads holds? draw
From the inspection to the loan gate. The whole path with the signed record. Dark boxes are parties, grey boxes are steps off the chain, outlined boxes are contracts. The tinted box is the second fact, a later package. Built and tested on a local chain; the owner has not deployed these contracts on Coston2 yet.
The same flow in words
  1. The inspector reads every host of the facility with the capture script.
  2. The inspector kit matches the serial numbers to the collateral schedule, adds the findings and builds the report and the proof record. It prints the record digest.
  3. The inspector signs the digest once, with his own key and his own tool. The kit checks the signature and files it. The signature shows who issued the record and that it was not changed. It does not show that the facts are true.
  4. The lender gets the report folder. With the key id from the engagement letter it can check the folder alone, with no chain.
  5. Anyone relays the signed record to the registry. The registry recomputes the digest from the fields, recovers the signer from the signature, and files the record under the signing address.
  6. The lender’s vault is pinned to one signing address and one schedule hash. It reads only that key’s record.
  7. The borrower asks the vault for a draw. The vault allows it only when every check of the lender’s gate passes.
  8. Later package: a second fact about private inputs, checked by the Flare Confidential Compute extension and bound to the record digest. The vault has a place for it. Nothing fills that place yet.

A signed record, from the digest to a draw#

Who does what with the signature, and what the registry and the vault do with it. A signature shows who issued the record and that it was not changed. It does not show that the facts are true. Details: Report and proof record and Contracts.

A signed record, from the digest to a draw inspect build computes the digest from the job’s files Record digest SHA-256 over 480 bytes Inspector cast wallet sign, his own key Anyone relays record, signer and signature inspect verify rebuilds, compares, checks the signer inspect sign checks the envelope, files the signature ProofRegistryV2 recomputes the digest, recovers the signer Slot of the signer one record per facility and signer LoanVaultV2 pinned inspector key, pinned schedule hash Refused one of 19 named errors, nothing stored Borrower draws if every check passes Lender sets pin, age, scope and pause prints to sign signature verified submit stores reads if not draw pins
A signed record, from the digest to a draw. Who does what with the signature. The kit never holds a key. The registry has no owner and takes a record from anyone, if the signature over its recomputed digest belongs to the address it is filed under.
The same flow in words
  1. inspect build builds the record from the job’s files and prints its digest: SHA-256 over 15 words of 32 bytes. It signs nothing.
  2. The inspector signs that digest himself with cast wallet sign, from his own keystore. The kit never opens a key.
  3. inspect sign recomputes the digest, checks the form of the signature, asks cast wallet verify whether that key signed it, and files the signature in the job folder.
  4. inspect verify rebuilds every output from the evidence, recomputes the digest and checks the signer against the key id the caller gives.
  5. Anyone may relay the record, the signing address and the signature to the registry with submit. The relayer has no standing.
  6. The registry recomputes the digest from the fields it is given and recovers the signer. If the signature does not recover to the named address, or any other rule fails, it reverts with a named error and stores nothing.
  7. A record that passes is stored in the slot of that facility and that signer. Only a later record from the same signer replaces it.
  8. The lender’s vault reads only the slot of the address the lender pinned, and only for the schedule hash the lender pinned.
  9. The borrower draws when every check of the vault passes. The lender can change the pin, the maximum age and the required procedures, and can pause.

One inspection with the inspector kit#

What the inspector does, and which file each step produces. Details: Inspector kit.

One inspection with the inspector kit inspect new copies the schedule, draws the day’s code ibc-capture.sh on each host: serials, telemetry, time, code captures/ one file per host, hashed as captured findings.json the inspector’s own findings inspect build match, ratings, result, record digest result/ report, proof record, evidence index Inspector signs the digest with his own key inspect sign checks and files the signature inspect verify rebuilds, compares, checks the signer code writes writes digest signature
One inspection with the inspector kit. One inspection is one folder. The kit takes it from the first step to a signed and checked proof record. The signature is made by the inspector, outside the kit.
The same flow in words
  1. inspect new starts the job folder: the schedule, an empty findings file, the capture script and a code for this inspection.
  2. On each GPU host the capture script runs read-only queries and writes one file with the serial numbers, a telemetry snapshot, the time and the code.
  3. The capture files go into the job’s captures/ folder. The inspector enters findings in findings.json.
  4. inspect build matches serials to the schedule, checks each capture, rates every exception, writes the report, the proof record and the evidence index, and prints the record digest.
  5. The inspector signs the digest himself, with his own key. The kit signs nothing.
  6. inspect sign checks the signature and files it, so the record and the report carry it.
  7. inspect verify rebuilds everything from the evidence files, recomputes the digest and checks the signature.

What the vault checks before a draw#

The order of the checks of the lender's vault and the error each one gives. Details: Contracts.

What the vault checks before a draw draw(amount) called by the borrower Is the amount above zero? ZeroAmount reason ZERO_AMOUNT Is the vault open, not paused by the lender? VaultPaused reason PAUSED Is there a record signed by the pinned key? ProofMissing reason NO_RECORD Is the pinned key not revoked? InspectorRevoked INSPECTOR_REVOKED Does the schedule hash equal the pinned one? ScheduleMismatch SCHEDULE_MISMATCH Inside valid-until and the lender’s maximum age? ProofStale reason STALE Is the result other than FAIL? ProofFailed reason FAILED Are all required procedures covered? ScopeTooNarrow SCOPE_TOO_NARROW PASS, or exceptions allowed by the lender? ProofHasExceptions EXCEPTIONS_NOT_ALLOWED No second fact set, or it holds? SecondFactMissing SECOND_FACT_MISSING Within the credit limit? CreditLimitExceeded OVER_CREDIT_LIMIT Draw allowed event DrawAllowed no yes no yes no yes no yes no yes no yes no yes no yes no yes no yes no yes
What the vault checks before a draw. LoanVaultV2. The checks run in this order. The first one that fails refuses the draw with the error on the right.
The same flow in words
  1. The amount must be above zero, or the draw reverts with ZeroAmount.
  2. The lender must not have paused the vault, or VaultPaused.
  3. The registry must hold a record for the facility in the slot of the pinned signing address, or ProofMissing. A record signed by any other address is not read.
  4. The pinned address must not be revoked, or InspectorRevoked.
  5. The record’s schedule hash must equal the one the lender pinned, or ScheduleMismatch.
  6. The block time must not be past the record’s valid-until, or past the inspection date plus the lender’s maximum age, or ProofStale. No transaction is needed for a record to go stale: the clock does it.
  7. The result must not be FAIL, or ProofFailed.
  8. The record must cover every procedure the lender requires, or ScopeTooNarrow.
  9. A PASS_WITH_EXCEPTIONS record lets a draw through only if the lender allowed it, or ProofHasExceptions.
  10. If the lender named a second-fact contract, it must answer true for this record’s digest, or SecondFactMissing.
  11. The amount must fit under the credit limit, or CreditLimitExceeded.
  12. Otherwise the draw goes through and the vault emits DrawAllowed with the record’s digest and the pinned address.

A check through the extension, registry v1#

Who sends what when a record is checked against the private coverage file. This is the earlier demo. Details: FCC extension.

A check through the Flare Confidential Compute extension (registry v1) Provisioner holds the private coverage numbers Extension machine compares the record with the coverage file Machine’s proxy serves the signed result Flare data providers relay above 50 % of signing weight Anyone fetches the result and submits it Inspector holds the proof record InstructionSender requestVerification, submitResult FlareTeeManager is the signer a machine of this extension? ProofRegistry v1 takes records from the sender contract only encrypted signs fetch request instruction relay submitResult signer? record
A check through the Flare Confidential Compute extension (registry v1). The earlier demo, as run on Coston2 against registry v1. Who sends what. The provisioner and the inspector are separate roles; in the demo both were the owner’s test wallet. The machine is a test machine with no enclave, and it checks no inspector signature.
The same flow in words
  1. The provisioner sends the coverage file to the machine as a direct action, encrypted to the machine’s key and signed.
  2. The inspector calls requestVerification with the proof record and pays the fee.
  3. Flare’s data providers relay the instruction. It reaches the machine only above 50 % of signing weight.
  4. The machine compares the record with the coverage file against the threshold (80 % in the demo) and signs the result with the machine’s key.
  5. Anyone fetches the result from the machine’s proxy and calls submitResult.
  6. The contract recovers the signer and asks FlareTeeManager whether it is a machine of this extension in production.
  7. If so, the record goes to registry v1. That registry takes records from this contract and from nobody else.

A repayment proven through the Flare Data Connector#

How a payment on another ledger is credited to a loan. Details: Repayment proof.

A repayment proven through the Flare Data Connector Borrower pays XRP Ledger testnet, memo = loan reference FDC client prepares the request, holds no key FdcHub takes the request and its fee RepaymentLedger checks the proof, credits once Payment proof fetched after the round Data providers agree on the payment in a voting round RepaymentAwareVault counts only proven repayments tx hash request agreed proof credited
A repayment proven through the Flare Data Connector. A payment on the XRP Ledger testnet is credited to a loan on Coston2 from a proof, not from anyone’s word.
The same flow in words
  1. The borrower pays on the XRP Ledger testnet. The payment’s memo carries the loan’s 32-byte reference.
  2. The client prepares a request of type Payment. It only reads, and handles no key.
  3. The request and its fee go to FdcHub on Coston2.
  4. Flare’s data providers check the payment and agree on it in a voting round.
  5. After the round the proof is fetched and handed to creditRepayment. Anyone may do this.
  6. The ledger checks the proof with Flare’s verification contract, checks the receiving address and the reference, and credits the loan once.
  7. The vault counts only repayments the ledger has credited. The borrower cannot report one.

One cycle of the runner#

What the automatic container does every two hours. Details: Runner.

One cycle of the runner Timer a cycle every 2 hours Test suites nine suites, run as they are Next scenario a whole inspection with the kit Runner’s vault draw allowed or refused Runner’s registry checks the signature, then stores Sign and check test wallet signs, inspect verify passes activity.json results, hashes, test counts Test activity page reads the feed in your browser verified read write publish
One cycle of the runner. The automatic container, as the code in the repository runs it. Every cycle it tests the code, plays one invented inspection with a signed record, and publishes what happened. Its signer is a test wallet, not an inspector.
The same flow in words
  1. A timer starts a cycle every two hours, while the computer the container lives on is awake.
  2. The runner runs nine of the repository’s test suites as they are.
  3. It plays the next of twelve scenarios: a whole invented inspection made with the inspector kit.
  4. Its test wallet signs the record digest the kit prints. inspect sign files the signature, and inspect verify must pass with that wallet’s address before anything is posted.
  5. It posts the record to its own registry, which checks the signature again before it stores anything. This does not pass through Flare Confidential Compute.
  6. It reads what its vault does with a draw, and compares that with what the scenario said should happen.
  7. It writes the feed and uploads it to its own Cloudflare Pages project.
  8. The test activity page reads that feed in your browser.

The parties of the multi-party testbed#

Each role as a separate program with its own account, on a local chain only. Details: Multi-party testbed.

The parties of the multi-party testbed Operator runs the capture script, has no account Inspector builds, signs the digest, delivers the folder Lender checks the folder alone, deploys its own vault Relayer posts a record it was handed Wallet gates one per party, one account each Borrower draws and repays with its own account Refused by the gate another account, node control, raw sends Local chain, id 31337 ProofRegistryV2 and each lender’s LoanVaultV2 Harness, not a party reads the chain, holds the clock captures folder signed record signs vault, terms post draw if not own account observes
The parties of the multi-party testbed. Each party is a separate program with its own account and its own files, on a local chain only. A party reaches the chain through its own wallet gate and in no other way. The gate is a stand-in for the keystore a party would hold. The deployer, which deploys the registry once and then has no role, is not drawn.
The same flow in words
  1. The lender hands the schedule to the inspector and notes the engagement: the inspector id and the key id it will accept.
  2. The inspector makes the job and gives the operator the inspection code. The operator runs the capture script on the stand-in hosts and hands the captures back. The operator has no account and no way to the chain.
  3. The inspector builds the record, signs its digest with its own account through its own gate, and delivers the report folder. A signature shows who issued the record and that it was not changed. It does not show that the facts are true.
  4. The lender checks the delivered folder alone, with the key id from its own engagement note. Only then does it deploy its own vault, pinned to that key and to its own schedule hash.
  5. The inspector hands the signed record to a relayer, who posts it. The relayer has no standing: the registry refuses a record with a changed field with SignerMismatch.
  6. The borrower draws and repays from the lender’s vault with its own account.
  7. Each wallet gate passes on only what its one party sends or signs as itself. Another party’s address, a node-control method, a raw transaction or a batch that hides one of these is refused and never reaches the chain.
  8. The harness is not a party. It reads the chain to check what each party reports, and it alone holds the clock.
  9. The deployer, not drawn, deploys the registry once through its own gate. After that it has no role: the registry has no owner.