Skip to content

[DOCS] Tutorial: send a confidential payment - #128

Open
haimbj1 wants to merge 12 commits into
docs/sdk-1.0.1from
docs/confidential-payment
Open

haimbj1 wants to merge 12 commits into
docs/sdk-1.0.1from
docs/confidential-payment

Conversation

@haimbj1

@haimbj1 haimbj1 commented Oct 20, 2026 •

Copy link
Copy Markdown
Collaborator

TL;DR
No tutorial shows a full confidential token transfer from start to end. New developers cannot see how little code CoFHE needs.
Add one tutorial page with a project that CI tests. Alice pays Bob, Bob reads his balance, and Eve cannot.

Jira: DOC-77. Stacked on #126: merge that first, then this PR moves to main.

What

  • A new page, cofhe/tutorials/confidential-payment: Alice pays Bob 100 tokens. Bob reads his balance, and Eve cannot.
  • A complete Hardhat project at cofhe/tutorials/examples/confidential-transfer/:
    • a short FHERC20 token
    • a test on local mocks
    • a Sepolia script
  • Readers download the project with npx degit FhenixProtocol/fhenix-docs/cofhe/tutorials/examples/confidential-transfer.
  • The page is the first tutorial in the nav and in the Tutorials overview.

How the page stays correct

  • New workflow Tutorial examples. It runs npm ci && npm test in every example project from a clean checkout.
  • New check check-example-regions.py. Each code block on the page has an invisible marker naming a region in a project file. The check fails if the block and the region differ. So the code on the page is the code CI tested.
  • check-versions.py now also checks the example's package.json pins against the compatibility page.

Checks

  • npm ci && npm test from a clean copy: 2 passing.
  • Region check: 0 errors. Its self-test passes 6 of 6.
  • A wrong pin in the example makes check-versions --docs fail. With the pin restored, it passes.
  • The page's Solidity compiles against the pinned contracts.
  • Structure linter: 0 errors. Vale: 0 errors.
  • mint validate and mint broken-links --check-anchors --check-redirects pass.

Sepolia run (2026-10-20)

npm run sepolia passed, with only Alice's key. Bob was a fresh random wallet.

Gas on Sepolia, 1.0.0 (not in this PR)

Action Measured "Gas and benchmarks" page
confidentialTransfer to a new holder 1,360,076 474,400
confidentialTransfer to an existing holder 1,142,202 421,500
confidentialTransferFrom by an operator 1,145,233 424,800
setOperator 128,680 46,700

setOperator runs no FHE and writes one storage slot, but it also costs 2.75 times the page value. So the gap does not come from 1.0.0. Sepolia's gas pricing has changed since the page was measured. The page needs a separate decision: which network it describes, and a new measurement.

@haimbj1
haimbj1 force-pushed the docs/confidential-payment branch from 71d62de to bb6c655 Compare October 20, 2026 09:06
@haimbj1
haimbj1 force-pushed the docs/confidential-payment branch from a14d792 to 3813a75 Compare October 29, 2026 15:05

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant