Innovation Blockchain

Documentation · Coston2 testnet prototype · invented data

Documentation Flows

Flows

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

In every diagram, filled grey boxes are steps off the chain, outlined boxes are contracts on Coston2, boxes with a double line are Flare's own network, and the tinted box is the extension's machine.

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, dates, report hash Private coverage file from the borrower, encrypted Extension machine checks coverage, signs PASS or FAIL InstructionSender the extension’s contract Borrower asks for a draw Loan vault allows a draw only on a fresh pass ProofRegistry latest record per facility Lender reads the result, never the private data capture build request direct check result record draw reads reads
From the inspection to the loan gate. The whole path. Grey boxes are off the chain, outlined boxes are contracts on Coston2, and the machine is the Flare Confidential Compute extension.
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.
  3. The borrower’s private coverage file goes to the extension machine, encrypted, as a direct action. It is never published.
  4. The inspector asks the extension’s contract for a check. Flare’s data providers relay the instruction to the machine.
  5. The machine compares the record with the coverage file and signs PASS or FAIL.
  6. Anyone submits the signed result. The contract checks the signer with FlareTeeManager and passes the record to the registry.
  7. The borrower asks the vault for a draw. The vault reads the registry and allows the draw only on a fresh pass.
  8. The lender reads the result on chain. The private inputs stay with the machine.

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, capture checks, ratings, result result/ report, proof record, evidence index coston2-job.sh posts the record through the machine inspect verify rebuilds from the evidence and compares code writes writes verified
One inspection with the inspector kit. One inspection is one folder. Three commands and one script take it from the first step to the proof record.
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 and writes the report, the proof record and the evidence index.
  5. inspect verify rebuilds everything from the evidence files and says whether the hashes still hold.
  6. coston2-job.sh posts the record to the Coston2 testnet, and refuses a job that does not verify.

A check through the extension#

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

A check through the Flare Confidential Compute extension 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 takes records from the sender contract only encrypted signs fetch request instruction relay submitResult signer? record
A check through the Flare Confidential Compute extension. Who sends what. The provisioner and the inspector are separate roles; in the demo both are the owner’s test wallet.
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.
  5. Anyone fetches the signed 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 the registry. The registry takes records from this contract and from nobody else.

What the vault checks before a draw#

The order of the vault's checks 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 Does the registry hold a record? ProofMissing reason NO_RECORD Is it inside its valid-until date? ProofStale reason STALE Is the result other than FAIL? ProofFailed reason FAILED PASS, or exceptions allowed by this vault? ProofHasExceptions EXCEPTIONS_NOT_ALLOWED Within the credit limit? CreditLimitExceeded OVER_CREDIT_LIMIT Draw allowed event DrawAllowed no yes no yes no yes no yes no yes no yes
What the vault checks before a draw. 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 registry must hold a record for the facility, or ProofMissing.
  3. The record must be inside its valid-until date, or ProofStale. No transaction is needed for a record to go stale: the clock does it.
  4. The result must not be FAIL, or ProofFailed.
  5. A PASS_WITH_EXCEPTIONS record lets a draw through only if this vault was set to allow it, or ProofHasExceptions.
  6. The amount must fit under the credit limit, or CreditLimitExceeded.
  7. Otherwise the draw goes through and the vault emits DrawAllowed with the record’s digest.

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 seven suites, run as they are Next scenario a whole inspection with the kit Runner’s vault draw allowed or refused Runner’s registry record posted by the runner’s test wallet Evidence check inspect verify, before anything is posted 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. Every cycle it tests the code, plays one invented inspection, and publishes what happened.
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 the repository’s seven test suites as they are.
  3. It plays the next of ten scenarios: a whole invented inspection made with the inspector kit.
  4. It checks that the report follows from its evidence. If not, nothing is posted.
  5. It posts the record to its own registry with its own test wallet. 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.