Overview

Check it yourself

Three ways, cheapest first: with no account and no keys, in the browser, and on your own deployment on NEAR testnet.

1. With no account and no keys

About five minutes. You need Rust and Node.js 22.

git clone https://github.com/martinvibes/pari && cd pari

(cd near/enclave && cargo test)     # the deal's rules, with the deal's numbers
(cd near/contract && cargo test)    # roles, the lock, the money caps

cd near/scripts && npm install
npm run prove:privacy               # reads NEAR testnet; needs no key
npm run verify:proof                # checks one fact from a sealed view; needs no key

You should see:

  • cargo test in near/enclave: 28 tests pass (five files: 3, 5, 4, 11 and 5).
  • cargo test in near/contract: 26 passed.
  • npm run prove:privacy ends with PASS: 0 secrets in … bytes of public data. Its full output is under The leak test.
  • npm run verify:proof ends with PASS: the fact is what the enclave put in this party’s view, and the proof shows no other. Its full output is under Prove one fact.

The scripts and the app read NEAR through a free public RPC. When it answers Rate limits exceeded they wait and try again, so a step can pause, for up to four minutes after a long run of reads. To use another RPC, set NEAR_RPC_URL (and NEAR_ARCHIVAL_RPC_URL, which the leak test reads old transactions from).

You can also read the live deal as the public does, in the app, with no keys:

cd web && npm install
npm run dev       # then open http://localhost:3000/visibility

You should see the page titled Who sees what with a panel You are reading as the public: the contract’s facts, one total per interest request, the record of every action, and eight sealed envelopes that this server cannot open, each beside its commitment.

2. Play the deal in the browser

This needs the demo’s keys. The hosted demo holds them and plays the builder’s live deal on NEAR testnet; it is wherever the last visitor left it, so its numbers differ from the ones below. For the exact walk, use your own deployment. Each action usually takes 10 to 30 seconds on testnet, because the contract waits for the enclave. When OutLayer’s testnet workers are busy it can take a minute or more.

The numbers below are for a fresh deal. Every screen is one party’s own view: pick the party’s seat from the place cards down the left side (along the top in a window under 1440 pixels wide), or press its number key (1 to 8; 9 opens Who sees what, 0 your own seat).

Interest, and the Revlon mistake

  1. Open /agent. Under Next interest period, press Fix rate. You see: Base rate fixed at 4.30% to 15 Dec 2026. All-in 7.80%.
  2. Under Request interest, replace the total with 900,000,000.00 and press Request interest. You see: Refused. You entered 900,000,000.00; the register says 1,971,666.66. Nothing changed: the books and the money are as they were.
  3. Type 1,971,666.66 (a reload prefills it) and press Request interest. You see: Interest requested: 1,971,666.66. The chain shows the total; each lender’s share stays sealed.
  4. Open /borrower and press Pay. You see: Paid 1,971,666.66 of test USDC into the deal.
  5. Back on /agent, press Settle all 3 lenders. You see: Settled. Every lender was credited in one step. The chain shows one total, 1,971,666.66, and no lender’s share.
  6. Open /lender/alder. You see Alder was paid 985,833.33, and nothing about Birch or Cedar. /lender/birch shows 591,500.00 and /lender/cedar shows 394,333.33. /auditor shows all three.
  7. Open /visibility. The Public chain column has one payment total and no register line, payment leg, trade price or DQ list. Under The public chain you see the total 1,971,666.66, the books’ fingerprint, eight sealed envelopes, and the refusal from step 2 on the public record. Under Checked live, eight claims read Holds.

A trade, screened against a list the buyer never sees

  1. On /agent, press Fix rate again (the next period, to 15 Mar 2027).
  2. On /borrower, under the DQ list, tick Rival and press Save DQ list. You see: DQ list updated. It went to the enclave sealed: the chain carries only ciphertext.
  3. On /lender/rival press Pay in, then the same on /lender/delta (12,000,000.00 of test USDC each).
  4. On /lender/alder, under Sell part of your position, choose Rival and press Offer trade. On /lender/rival press Accept. On /agent press Settle. You see: Not settled. Nothing moved, and the buyer is told nothing more. Rival’s screen says not settled and gives no reason. The agent’s screen says The buyer is on the DQ list.
  5. Do the same with Delta as the buyer. You see: Trade settled. Cash, register and both positions moved in one step. Delta holds 10,000,000.00 and paid 9,950,000.00. Alder holds 40,000,000.00 with 845,000.00 of interest due at period end: 780,000.00 on what it kept, plus the 65,000.00 it earned on the part it sold, up to the trade date. /borrower shows the trade and no price.

A short payment, and the period that pays the rest

  1. On /agent, press Request interest. The form is prefilled with 1,950,000.00, the second period’s interest for the four lenders.
  2. On /borrower, replace the amount with 975,000.00 and press Pay. You see: Paid 975,000.00 of test USDC into the deal.
  3. On /agent, press Settle the short payment pro rata. Every lender was paid the same half of what it was owed. /lender/alder shows 422,500.00 paid of 845,000.00 due, and the other half still owed. Birch got 292,500.00, Cedar 195,000.00 and Delta 65,000.00, each on its own screen only.
  4. On /agent, press Fix rate (the third period, to 15 Jun 2027). The request form now reads 2,968,333.32: the third period’s interest plus every unpaid half. Press Request interest, then Pay on /borrower, then Settle all 4 lenders on /agent. /lender/alder shows 1,219,833.33 paid, and nothing left owed from the short period.

With an account only you control

  1. Open /you (the You seat, last of the place cards, or press 0). Sign in with Privy, or press Use a key made in this browser. You see: a NEAR testnet account named by a key. The demo server never holds that key.
  2. Press the six buttons in order: Get test funds, Register view key, Pay in, Ask Alder for an offer, Accept, Ask the agent to settle. Each step says whose account signs it. The faucet, Alder and the agent sign on the demo server. Your three are signed in your browser and sent to NEAR from there. You see: Trade settled. Your cash went to Alder and the loan came to you in one step. You hold 250,000.00 of the loan, bought at 99.50 for 248,750.00, with 1,250.00 of cash left in the books.

3. Your own deployment on testnet

About ten minutes. You need Rust, cargo-near, the near CLI, Node.js 22, and a testnet account holding about 18 NEAR whose key is in ~/.near-credentials/testnet/.

# a new testnet account, funded by the faucet, with its key saved where the scripts look
near account create-account sponsor-by-faucet-service YOU.testnet \
  autogenerate-new-keypair save-to-legacy-keychain network-config testnet create

export PARI_ROOT=YOU.testnet
cd near && ./build.sh                 # the contract, the test USDC and the enclave program
cd scripts && npm install
npm run setup                         # accounts, contracts, the enclave build, the sealed deal
npm run e2e                           # plays the whole deal and checks every figure
npm run prove:privacy                 # the leak test, on the run you just made
cd ../../web && npm install
npm run dev         # http://localhost:3000/agent

npm run setup is safe to run again: every step checks the chain first and does only what is missing. npm run setup -- --fresh starts a new deal with new books. The faucet starts a new account with 10 NEAR, so top it up before running setup.

npm run e2e ends with All green. and the books’ fingerprint. It plays the interest payment (with the mistyped total refused), a withdrawal, the DQ list, Rival’s refused trade and Delta’s settled one, Birch’s attempt to reuse Alder’s sealed offer, then a short payment and the period that pays the rest, and checks each party’s envelope after every step.