Documentation Multi-party testbed
Multi-party testbed
Until now one wallet played every role. In the testbed each role is a separate program with its own account and its own files, and the programs run the whole flow between them with real transactions on a local chain. It shows who can do what, and who refuses what.
Local chain only. The testbed runs on a chain on the same computer (anvil, chain id 31337) and refuses any other chain id. It sends nothing to Coston2 or to any other network. All data is invented, and inspector ids start with TEST-. Nothing here is live, reviewed by an outside party or used by a lender. Not legal or financial advice.
The same flow in words
- The lender hands the schedule to the inspector and notes the engagement: the inspector id and the key id it will accept.
- 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.
- 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.
- 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.
- 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. - The borrower draws and repays from the lender’s vault with its own account.
- 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.
- The harness is not a party. It reads the chain to check what each party reports, and it alone holds the clock.
- The deployer, not drawn, deploys the registry once through its own gate. After that it has no role: the registry has no owner.
What it is#
The folder prototype/testbed in the repository. It uses the inspector kit and the signed-record contracts (ProofRegistryV2, LoanVaultV2) as they are, unchanged. It needs Node and Foundry and no packages.
There are two modes. They run the same scenarios with the same code.
| Mode | A party is | What keeps a party to its own account and files |
|---|---|---|
| Without containers | A separate program on one computer | Its wallet gate, and the party program's own checks of every path |
| One container per party | A container of its own | Its wallet gate, and what is mounted: its own network and its own volume |
A signature shows who issued a record and that it was not changed. It does not show that the facts in the record are true.
The parties#
| Party | What it does | Account |
|---|---|---|
| Operator | The borrower's facility staff. Runs the kit's read-only capture script with the code the inspector gave, and hands the capture files to the inspector | None. It has no way to the chain |
| Inspector | Makes the job, takes the captures, builds the record, signs its digest, delivers the report folder. Publishes its inspector id and key id. Can relay its own record and revoke its own key | Its own |
| Lender | Hands out the schedule. Checks the delivered folder alone, with the key id from its own engagement note. Deploys its own vault, pinned to that key id and to its own schedule hash. Sets terms, pauses, repins | Its own |
| Borrower | Draws and repays from the lender's vault. Can relay a record, and can choose to withhold one | Its own |
| Relayer | Any third party. Posts a record it was handed. Has no standing | Its own |
| Deployer | Deploys the registry once. After that it has no role, because the registry has no owner | Its own |
There is a second inspector with an account of its own, and one more whose key is revoked in scenario 8. The hosts are the kit's stand-in tools, and every serial number is invented.
The harness is not a party. It starts the chain, reads it as an observer so that what a party reports is checked against what the chain holds, and holds the clock. No party can move time.
The wallet gate, a stand-in for key custody#
On a local chain the accounts are the chain's unlocked test accounts. Anyone who can reach the chain can send as any of them. So each party gets a wallet gate: a small proxy in front of the chain that limits the party to one account. A party is given the address of its gate, never the address of the chain.
Limit. The gate is a stand-in, and it is labelled as one. On a real network the limit is the keystore each party holds. The gate holds no key and reads none. It knows one address. It shows that a party limited to one account cannot act as another. It says nothing about how a real party keeps a real key.
| Call | What the gate does |
|---|---|
| A read of the chain | Passed on |
eth_accounts | Answered by the gate: the party's own address only |
eth_sendTransaction | Passed on only when the sender is the party's own address. Otherwise FROM_NOT_OWN |
eth_sign, personal_sign | Passed on only for the party's own address. Otherwise SIGNER_NOT_OWN |
Node control (anvil_*, hardhat_*, evm_*, debug_*), raw transactions, and any method not on the list | METHOD_REFUSED |
| A batch with a refused call in it | BATCH_HIDES_REFUSED. None of it is passed on |
A refused call never reaches the chain. The gate keeps a log of what it passed on and what it refused, and the harness reads that log when it checks a step.
Files between parties#
Each party has a private folder. What passes between parties goes through hand-off folders with one writing role each: the lender's schedule to the inspector, the inspection code to the operator, the captures back to the inspector, the report folder to the lender and the borrower, the signed record to the relayer, and one public folder per publisher.
A reader treats what it is handed as hostile. A link in a hand-off folder is never followed out of that folder. A handed record is checked field by field against its type in the contract before any of it is used. The operator runs its own copy of the capture script; the copy it is handed is compared, never run.
The scenarios#
There are eleven. A scenario passes only when every step went as its story says, for the stated reason. Some other failure does not count.
| # | Scenario | Who does what | What must happen |
|---|---|---|---|
| 1 | clean-pass | The lender engages, the operator captures, the inspector builds, signs and delivers, the lender checks alone and opens its vault, a relayer posts, the borrower draws and repays | PASS on chain under the inspector's address. The draw goes through |
| 2 | lender-checks-alone | One file of the delivered folder is changed before the lender reads it | The lender's own check says DIFFERENT. Its program opens no vault: DELIVERY_NOT_VERIFIED. Nothing reaches the chain |
| 3 | relayer-changes-a-field | The relayer adds a day to the valid-until time and posts the record with the signature it had. Then it posts the record as it was | The registry refuses the changed record with SignerMismatch and stores nothing. The true record posts |
| 4 | wrong-inspector-pinned | The lender pinned inspector B. Inspector A's valid record is posted | The registry takes A's record. The lender's vault does not read it: NO_RECORD, and a draw is refused with ProofMissing |
| 5 | other-schedule | A valid record for another schedule hash is posted | The vault reads SCHEDULE_MISMATCH. A draw is refused with ScheduleMismatch |
| 6 | fail-is-posted-by-the-inspector | The borrower is handed a FAIL and withholds it. The inspector relays its own record | While the FAIL is withheld the vault still allows a draw. Once it is posted the vault reads FAILED and a draw is refused with ProofFailed |
| 7 | withheld-and-aged-out | Nobody posts a new record. The harness moves the clock four days on | The lender's maximum record age shuts the vault: STALE, although the record is inside its own validity. A draw is refused with ProofStale |
| 8 | revoked-key | The relayer signs a revocation of the inspector's key with its own account. Then the inspector revokes its own key. The lender repins | The relayer's revocation is refused with SignerMismatch. After the inspector's own: INSPECTOR_REVOKED. After the repin: NO_RECORD, until the new inspector's record is posted |
| 9 | lender-pauses | The lender pauses its vault, then lifts the pause | PAUSED, and a draw is refused with VaultPaused. Allowed again afterwards |
| 10 | second-fact-required | The lender names a second-fact contract for its vault | SECOND_FACT_MISSING, and a draw is refused with SecondFactMissing, until the stand-in holds for this record's digest |
| 11 | crossing-the-line | Parties try what is not theirs to do | Every attempt is refused by the one named in the next table. The vault and the chain are as they were |
Crossing the line#
| Attempt | Refused by |
|---|---|
| The borrower sends a transaction as the lender | The gate: FROM_NOT_OWN |
| The borrower changes the vault's terms from its own account | The contract: NotLender |
| The relayer signs as the inspector | The gate: SIGNER_NOT_OWN |
| A party impersonates an account, sets a balance, moves the clock or sends a raw transaction | The gate: METHOD_REFUSED |
| The lender draws | The contract: NotBorrower |
| A batch that hides a refused call | The gate: BATCH_HIDES_REFUSED |
| The relayer reads the inspector's private folder | The party's own program: PATH_NOT_ALLOWED. In containers the folder is not there to read |
| The lender runs an inspector command | The party's own program: ROLE_NOT_ALLOWED |
How a step is checked#
What a party's program reports is checked against the chain wherever the chain can say it.
- A transaction counts only when the chain holds it, it did not revert, and the chain says it was sent from that party's own address.
- For a refusal by the gate, the gate's own log shows the refusal and shows that the call was not passed on.
- For a refusal by a contract, the data the contract reverted with starts with the selector of the named error. For every refused draw the harness makes the same call itself, as a read, and must get the same error.
- The registry must be the contract the deployer's transaction made, with the code compiled from the unchanged source. A vault must be the contract the lender's transaction made, and must itself name the lender, the borrower and the pinned inspector: three different addresses.
A contract refusal is found when the transaction is prepared, so a refused step has no transaction hash.
Run it#
Two commands, both from prototype/testbed. Both start their own chain and stop it again.
node bin/testbed-local.mjs # every scenario, as separate programs. Needs Node 22 and Foundry
./testbed.sh test # the same in one container per party, with the separation checked from inside. Needs Docker
The first writes build-output/results.json and build-output/transcript.txt: per scenario and per step, who did what, the transaction hash or the refusal, and who refused. The second builds an image, starts the chain, the gates and the parties, checks the separation from inside each container, runs every scenario, and removes everything it started. It publishes no port.
In containers each party sits alone on its own network with its own volume. It can reach its own gate and nothing else: not the chain, not another party, not the internet. Every container runs as a user without rights, with a read-only root filesystem and no capabilities.
Tests#
Counts as measured on 23 November 2026, from the project's facts file.
| Suite | Command | Count |
|---|---|---|
| The gate, the hand-offs under a hostile party, and every scenario twice on one chain | node --test | 37 tests |
| The separation, checked from inside the containers, then every scenario | ./testbed.sh test | 125 checks |
The runner is set to run the first suite every cycle, once its image is rebuilt. Its image has no Docker inside, so it does not run the second.
What it shows#
- A party held to one account cannot send or sign as another. The gate refuses, and the chain never sees the call.
- The lender can check a delivered folder alone, and opens no vault when the check does not pass.
- A relayer cannot change a record. The borrower cannot keep a FAIL off the chain when the inspector relays its own record.
- A vault reads only the record of the key its lender pinned, for the schedule its lender pinned.
- The lender's own controls work from the lender's account and from no other: maximum age, pause, repin, a second fact.
What it does not show#
- No real GPU host. The hosts are stand-in tools with invented serial numbers.
- No enclave. Nothing runs in a trusted execution environment, and nothing is checked by one.
- No Flare Confidential Compute check. The second fact of scenario 10 is a test mock that anyone can set and that checks nothing. Flare Confidential Compute is not on Flare mainnet.
- No key custody. The accounts are the local chain's unlocked test accounts. The gate stands in for the keystore each party would hold.
- No second machine. Every party runs on one computer. Whoever runs that computer can reach everything.
- No real network. A local chain only. Fees and waiting for blocks are not exercised.
- One computer, one Docker version. The container mode was run on the owner's Mac only.
What comes next#
Neither step below has been done.
- The same on Coston2. The same parties and the same scenarios on Flare's Coston2 testnet, with one throwaway keystore per party. The owner creates and funds each keystore himself. No tool and no agent makes, reads or holds a key. The keystore then takes the place of the wallet gate, and the roles are apart by key and not by a stand-in. The clock cannot be moved on a public network, so the stale scenario has to wait out a short maximum age.
- The Flare Confidential Compute step. Once the extension reads signed records, its check takes the place of the test mock in scenario 10: a second fact about private inputs, bound to the record's digest. The extension does not check an inspector signature yet. See FCC extension.