Solar certificates you can retire only once: burn and public receipt land together, or not at all. · Sijil solar yang hanya boleh dibersarakan sekali: bakar dan resit awam berlaku bersama, atau tidak langsung.
live demo · ▶︎ demo video, 159 s · judges in 3 minutes · cross-VM evidence · proof on testnet · judging criteria · run it · limits · AI usage · slides (PDF) · Bahasa Melayu
Built in Malaysia by Aiman Malib · Sasa Teguh

Watch the demo video on YouTube (narrated, English subtitles, under three minutes) · full-size MP4 on the demo site · smaller MP4 in this repo
An energy certificate is only worth something if it can be retired once. Most registries keep the burn in one system and the public record in another, and the two can drift apart.
Mentari puts both in one transaction on QoreChain. Retiring a certificate burns it in an EVM contract and writes a public
receipt into a Native contract through the Cross-VM bridge, in the same transaction. If either side fails, neither
happens. Every certificate starts as a solar meter reading signed with ML-DSA-87, which the contract checks with the
pqcVerify precompile. Certificates only move to accounts that have a registered post-quantum key.
Built for Build Before Q-Day: The QoreChain Developer Fest, Cross-VM track. I built it during the fest: the first
commit is 6012d2b on 21 November 2026.
Where it stands today (read from the testnet by
pnpm verifyat 15:56 UTC on 2 December 2026, EVM block 11,154,992,verify-2026-12-02.json):
- 1,417,797 Wh minted from meter readings, each ML-DSA-87 signature checked on chain (decision 0031).
- 45 retirements and 22,500 Wh retired, each matched to its Native receipt.
pnpm verifypassed 167 of 167 checks, v2 and the nine EVM windows included (123 of 123 on 28 November:verify.json).- Cases A to K recorded on testnet with their transactions (
testnet.json).- 13 recorded presses on the public site, 7 of them "Retire now" in a row, each moving both ledgers by one (
live.json).
Judge it in 3 minutes, with no wallet and no keys.
- Press. Open https://mentari.sasateguh.com/try and press "Retire now". One hybrid-signed Native transaction runs
the EVM contract, and the receipt count on both ledgers goes up by one. Then press a failure button: neither ledger
moves. The buttons send real testnet transactions, 5 an hour for each visitor (
config/limits.json). Then press "Pay and retire": one Native transaction pays the producer 0.01 QOR and retires, and the producer's balance and both ledgers move together; its twin asks for 1 Wh too many, the contract refuses it (InsufficientBalance) and the payment is undone (decision 0051). Lower on the page, press "Try to steal it" and "Forge a reading" (try to steal it). - Check. Open the transaction link the page shows; it opens the explorer on Testnet (
?network=testnet). A failure press shows "failed (code 14)", and each Native press shows "quantum-safe · verified on-chain · ML-DSA-87". On Verify, your browser re-checks the meters' ML-DSA-87 signatures read from the chain. - Re-run. In a fresh clone (Node 22, pnpm), run
pnpm install --frozen-lockfile && pnpm demo. It needs no key: it reads the public EVM and REST endpoints, matches every retirement to its Native receipt (sender, note, amount), checks minted - retired = supply and each recorded case, and exits 0 only when no check fails. Then QoreChain's own CLI (qore pq status,@qorechain/qore-cli) reads how the chain signed each recorded Native press: hybrid secp256k1 + ML-DSA-87, verified.
Everything below is on qorechain-diana (EVM chain id 9800).
| What | Value |
|---|---|
| EVM contract | Mentari 0xF5cb2c6048a7CE8c5A7ACcc66eB8efc33942a448 (Native name qor17h9jcczg5l8gckn6enrxaw80cvu59fzg2335fw) |
| Approved Native contract | qday-receipts qor1xjayq5ev55tkzpml9klxwyshr7gdrha0nurha9jhm0f0gdckksgs3gltw8, code id 865, listed in bridge_allowed_targets and pinned in /qorechain/crossvm/v1/params |
| EVM to Native call that succeeded | 0x08e96e38d8880b92eb676f621c7be5bab83725468470ff7a396d6e92c6401a03, block 10609362: 500 Wh burned and receipt 8 written by the contract's own qor1 address |
| EVM side reverted after the Native write | 0xdf7bc37dcbfed49096d4fa903120a20e8e7f9f2e3dc1a6ed1acafd605031926c, block 10609364: RevertedAfterNativeWrite(9), receipts 8 → 8 |
| Native side refused, EVM rolled back | 0x976f99cccc32b7aaf2a396a53e899f44e3e920c2f19e4ece8534ae35b11c9418, block 10609366: receipts 8 → 8 |
| Target not on the allowlist | 0x68f3f651f12f5b59cf868f9d724b1c7d2a8573596c4f4ce411b52baae9135114, block 10609368: receipts 8 → 8 |
| Native account into the EVM contract | MsgCrossVMCall 8E15D319B2971FC5102C027BA8E3C8A8AAF1FDD72AD8E2172CEE2303B453B40A (case H), and every "Retire now" from qor1skd69eq006yju57wykhx0dul82900u4nr4d3f4 |
| Native bank balance changed in the same transaction | C1503B00FEB65516D85DBC8832F32A3FD99625F807D4CEBB9A2B1BF0FB4B2527 (case J), block 10666328: a 0.1 QOR fee from the buyer to the registrar (6.0 → 6.1 QOR) and the retire, receipts 32 → 33. 3E2F2D8D3E0386F2162D0AE1EC49FBABDEFEDEE29202D480D70FC5557BF7E3AD (case J2), block 10666332: the retire reverted (code 14) and the fee transfer that ran first was undone, registrar 6.1 → 6.1 QOR, receipts 33 → 33 (decision 0041) |
Re-check all of it without keys: pnpm demo.
Every link opens the explorer on Testnet (?network=testnet); without that parameter the explorer starts on Mainnet and says "Transaction not found".
| Case | What it tries | What happened | Transaction |
|---|---|---|---|
| A | Retire 500 Wh through the EVM lane | Burned, and receipts went 7 → 8 | 5654336F… |
| B | Write a Native receipt, then revert on the EVM side | Reverted, receipts 8 → 8 | 9837A24B… |
| C | The Native contract refuses the message | Reverted, receipts 8 → 8 | A6D4F275… |
| D | Call a Native contract that is not on the allowlist | Reverted, receipts 8 → 8 | 55F936A6… |
| E | A reading signed with another account's key | BadSignature, receipts 25 → 25 |
5B7A5856… |
| E2 | A second reading for the same day | AlreadyAttested, receipts 8 → 8 |
C4589E9A… |
| F | A reading over the system's capacity | WhOutOfRange(40001, 40000), receipts 25 → 25 |
CD9DDAE7… |
| G | Transfer to an account without an ML-DSA-87 key | NotQuantumReady, receipts 8 → 8 |
E405CBAB… |
| H, step 1 | attest from the Native lane, no EVM window |
Reading minted: 344,115 → 393,197 Wh | FC13A895… |
| H, step 2 | retire from the Native lane, no EVM window |
Burned, receipts 13 → 14 | 8E15D319… |
| I, step 1 | retire signed with the secp256k1 key alone, no EVM window |
Refused before it reached a block: nonce 6 → 6, retirements 21 → 21 | none: the chain never took it |
| I, step 2 | The same retire from the Native lane |
Burned, receipts 30 → 31 | 97A5C807… |
| J | One Native transaction: MsgSend of a 0.1 QOR fee to the registrar, then retire |
Fee paid, registrar 6.0 → 6.1 QOR; burned, receipts 32 → 33 | C1503B00… |
| J2 | The same two messages, the retire asks for 1 Wh more than the buyer holds |
Failed (code 14): the fee went back too, registrar 6.1 → 6.1 QOR, receipts 33 → 33 | 3E2F2D8D… |
| Retire now, site | One press on the public site | Receipts 27 → 28, retirements 18 → 19 | 922C6AF2… |
| Write-then-revert, site | Case B as a Native transaction | Failed (code 14), receipts 28 → 28 | 4F9B5F8D… |
| Native refuses, site | Case C as a Native transaction | Failed (code 14), receipts 28 → 28 | 7D69CA4F… |
| Not allowlisted, site | Case D as a Native transaction | Failed (code 14), receipts 28 → 28 | C003B67F… |
Cases A to G went through the EVM lane. For those, the explorer shows the transaction that carried the EVM call, and
the revert reason is in the EVM receipt, which pnpm verify reads. The site's buttons are Native transactions, so the
explorer shows a failed one as failed. The verbatim node error for case I is in
testnet.json. In cases J and J2 the fee transfer runs first, so J2 shows a transfer that
ran being undone when the contract call after it reverts (decision 0041).
| Criterion (official wording) | Weight | Where to check it |
|---|---|---|
| Works as described | 25 % | Try it on the live site; pnpm demo and verify-2026-12-02.json (167 of 167); the presses in live.json; the proof table |
| QoreChain tech usage, verified in the repo and on chain | 25 % | Kits and network features: the bridge, pqcVerify, pqcKeyStatus, MsgCrossVMCall, @qorechain/sdk, QoreX; a bank transfer and a contract call in one transaction (case J); the qor1 addresses in the track table |
| Post-quantum correctness and security | 20 % | Mentari v2: retiring takes the holder's ML-DSA-87 signature, never msg.sender, live on Try it; Try to steal it: press it live, the chain refuses the classical key and the contract refuses a valid ML-DSA-87 signature from the wrong key; What is signed, and where; cases I and K; Verify re-checks ML-DSA-87 in your browser; docs/threat-model.md; docs/AUDIT.md: two QCAI audit runs on the same source (scores 82 and 78), every finding answered with its code and tests, and every pqcVerify/pqcKeyStatus check |
| Originality | 15 % | What is new here, next to the workshop example; What I found; docs/findings.md; docs/rec-fields.md |
| Clarity, UX and documentation | 15 % | This file and README.ms.md; the site in English and Malay; docs/architecture.md; 53 decision records, each with how to undo it; AI_USAGE.md |
The QoreChain Cross-VM reference lists the direction "Native account to EVM contract" as "Not yet tested against the
live network: this direction was not run for this page."
(docs). I ran it. One Native transaction,
signed with secp256k1 plus ML-DSA-87, called Mentari.retire with no EVM window open. The contract burned the
certificates and the bridge wrote the receipt on the Native ledger, in the same transaction: case H,
8E15D319….
Every "Retire now" on the site now goes this way, for example
922C6AF2….
Details and what I did not test: docs/findings.md.
Mentari starts from the fest's workshop 3 example
(workshop-3/02-cross-vm): an EVM
contract that writes a receipt into the shared qday-receipts book in the same transaction, with the same four
outcomes (it works, the EVM side reverts, the Native side refuses, the target is not approved). Cases A to D are those
four. The receipts book is the workshop's, and other entries write to it too. What Mentari adds on top:
- Certificates come only from signed meter readings. Each reading is signed with ML-DSA-87 and checked by the
pqcVerifyprecompile before anything is minted. Forge a reading shows the contract refusing a valid signature from the wrong key. - Certificates move only to accounts with a registered, proven ML-DSA-87 key (
pqcKeyStatus). - Every action on the site runs Native to EVM, as one hybrid-signed
MsgCrossVMCallwith no EVM window open. The workshop sends from the EVM side through a window. The docs listed this direction as not yet tested (what I found); Haven Ledger, another Cross-VM entry, now uses the route and credits this case (docs/findings.md). - A bank payment and the retirement in one Native transaction, both or neither (cases J and J2).
- Attacks you can press: try to steal it with the classical key alone, and forge a meter reading.
- The personal fields stay sealed. Site owner and address are encrypted with ML-KEM-1024 to the registrar's on-chain key, with only a hash on chain (sealed site details).
- Fields lined up with a real registry:
docs/rec-fields.mdmaps each certificate field to the I-REC(E) standard that Malaysia's mGATS uses, with sources, including what Mentari leaves out.
Imbang, another project of mine in this fest, retires Mentari certificates by calling
Mentari's deployed contract: its agent account 0x819Ebb9F7c1b21E2ac3A27E3AB63E5C89dD9714e holds
retirements 34, 35 and 36 (500 Wh each, Native receipts 119 to 121), from
0x1ebbeb0c9fa94e3bffa31a9d4473f014ee3f6150efd54eb0e222b39192adfdca (block 11143831),
0x176fff58c0095974ff1556a7923f2a2d1419b7b74e405028de380a88d6a70fb0 (block 11143894) and
0xe4c91851e5fe6801ae1d518d1439b6a068259d799a41a40d12ec2c75e60182ef (block 11144620). Anyone can read them with
retirement(34) to retirement(36). The same agent account also holds retirements 43, 44 and 45 (500 Wh each,
receipts 129, 131 and 132, 14:54 to 15:06 UTC on 2 December). Imbang's own check refuses to close a payment until the Mentari retirement it names
belongs to its agent and matches the paid watt-hours. It is the same author, so it shows the contract is usable from
outside this repository, not that a stranger adopted it.
Mentari v2 runs next to v1, which is unchanged (decision 0047). A
retirement or transfer is authorised by the holder's ML-DSA-87 signature over a plain-text claim in QoreSign's message
format (qorechain-msg-v1|qorechain-diana| then the text, the bytes QoreX shows and signs); the contract builds the same
bytes and checks them with pqcVerify against the holder's registered key, with a nonce and a deadline. msg.sender is
never the authority, so a classical key alone moves nothing. Each claim names its vintage (one system, one UTC day), and
no vintage is retired past what its meter signed for. Holders are checked by asset-kit's QoreChainHybridHolderGuard,
deployed with its ownership renounced.
| Deployment | Native side | State |
|---|---|---|
MentariV2Receipts 0xa38b5261c463f581d1d721fe2fd4e73f406fe2dc |
the shared qday-receipts book (already on the bridge allowlist); the EVM contract refuses over-retirement |
live, recorded below |
MentariV2 0x1a26e74203f7a06abb4d67bc1ac68e9ce0c4efd3 |
Mentari's own CosmWasm contract mentari-registry, which refuses over-retirement itself |
live since 21:15 UTC, recorded below: stored by the QoreChain team's proposal #71 (a resubmission of #70, which got no votes), on the bridge allowlist by #72 (pinned to code 871), no admin |
Recorded on testnet, each sent as one hybrid-signed Native transaction with no EVM window
(evidence/v2-receipts.json and evidence/v2.json, re-read by pnpm verify):
| Sent | Chain answer | Transaction |
|---|---|---|
| The producer's ML-DSA-87 key signs a transfer of 25,851 Wh to the buyer | accepted | 9ACA4089… |
| The buyer's key signs a retirement of 500 Wh against vintage 1/20786 | accepted, receipt #130 in qday-receipts | 15C4C613… |
| The buyer asks for 24,851 Wh, one more than the vintage has left | refused by the EVM contract: VintageExhausted; nothing moved |
BFE60C14… |
| A claim for the buyer's certificates signed with the producer's key | refused by the EVM contract: BadSignature; nothing moved |
8C005180… |
MentariV2: the buyer's key signs a retirement of 500 Wh against vintage 1/20786 |
accepted, recorded by the Native registry | E9ABBF77… |
MentariV2: the buyer asks for 24,351 Wh, one more than the vintage has left |
refused by the Native registry: “vintage 1/20786 has 24350 Wh left to retire, 24351 Wh asked”; the whole transaction reverted | 826F49A8… |
The deployer writes a retirement straight to mentari-registry |
refused by the registry: “only the controller (the MentariV2 contract) can write to the registry” | 31E20187… |
Press it yourself: Try it → "Retire with your post-quantum signature", or Try it → "Ask for one watt-hour too many" for the registry. The
page shows the exact text the demo account's key signed. Write-up: docs/v2-native-registry.md.
sequenceDiagram
participant U as Holder
participant M as Mentari (EVM)
participant B as Cross-VM bridge 0x…0901
participant R as qday-receipts (Native)
U->>M: retire(wh, memo)
M->>M: burn wh
M->>B: executeCrossVMCall(Native, receipts book, {"record":{"note":"MTR1 n=… wh=… by=0x… m=…"}})
B->>R: record(note)
R-->>B: receipt id
B-->>M: reply bytes
M->>M: check id is new, store Retirement{holder, wh, receiptId}
Note over U,R: Any failure on either side reverts the whole transaction
- Minting. A registrar adds a solar system (meter, producer, capacity) with an ML-DSA-87 signature. After that, a
daily reading signed by the meter's ML-DSA-87 key mints watt-hours to the producer.
attestrefuses a second reading for the same day, a reading for today or the future, and more watt-hours than the capacity allows in one day (capacity times a maximum of sun hours fixed when the contract is deployed). Signed messages include the chain id and the contract address, so a signature cannot be replayed elsewhere. - Moving.
transferonly sends to accounts whose ML-DSA-87 key is registered on chain with proof of possession (pqcKeyStatus). There is noapproveortransferFrom. - Retiring.
retireburns first, builds the receipt note from typed fields, calls the bridge, reads the receipt id from the reply and stores it. The EVM event names the Native receipt, and the Native note names the EVM retirement, so anyone can match them one to one. - Showing atomicity.
AtomicityProbeis a separate, clearly labelled demo contract. It writes a receipt and then reverts, asks the Native contract to refuse, and calls a Native contract that governance has not approved. Each case must leave both ledgers unchanged. - Reading. The QoreChain REST API has no CORS headers, so a small Node server serves the site and proxies a fixed list of read-only paths. It also sends the demo transactions from a rate-limited demo account.
More detail: docs/architecture.md. Each design decision has a record in
docs/decisions/, with how to undo it.
| Requirement (official wording) | Where it is met | Status |
|---|---|---|
| "Build an application where an EVM contract atomically calls an approved Native contract." | Mentari.retire calls the bridge with a record message for qday-receipts, which is on the testnet allowlist (governance proposal 40, code id 865) |
Case A on testnet, block 10609362: receipts 7 → 8 (evidence/testnet.json) |
| "A working EVM-to-Native call to an approved Native contract" | Case A: one retirement that adds one receipt whose sender is the contract's qor1… address |
Recorded: EVM tx 0x08e96e38…, receipt 8 |
| "with atomic execution shown on testnet" | Cases B, C, D through AtomicityProbe: the receipt count is the same before and after each |
Recorded on testnet, blocks 10609364, 10609366, 10609368: receipts 8 → 8 each time |
| Public repository, licence, README | This repository, Apache-2.0, this file | Done |
| Testnet addresses | Receipts book qor1xjayq5ev55tkzpml9klxwyshr7gdrha0nurha9jhm0f0gdckksgs3gltw8; Mentari qor17h9jcczg5l8gckn6enrxaw80cvu59fzg2335fw; AtomicityProbe qor1wsud7p2lpktwdwsmntywwv62r0jkzv8ymglm0l (config/app.json) |
Done |
| "An AI_USAGE.md file documenting the workflow, the generated work and the human contribution" | AI_USAGE.md |
Done |
This is what the code uses, and where.
| Kit or feature | Version or address | Where |
|---|---|---|
@qorechain/sdk |
0.14.0 (pinned) | scripts/src/accounts.ts: generateMnemonic and deriveUnifiedAccount for the test accounts; scripts/src/native-entry.ts: crossvm.crossVmCall for case H |
MsgCrossVMCall from an account, hybrid-signed, no EVM window |
/qorechain.crossvm.v1.MsgCrossVMCall |
case H: Mentari.retire called from the Native lane (docs/findings.md); every "Retire now" on the site (server/src/native.ts) |
| Cross-VM bridge precompile | 0x0000000000000000000000000000000000000901 |
contracts/src/lib/CrossVm.sol |
pqcVerify precompile (ML-DSA-87) |
0x0000000000000000000000000000000000000a01 |
contracts/src/lib/Pqc.sol |
pqcKeyStatus precompile |
0x0000000000000000000000000000000000000a02 |
contracts/src/lib/Pqc.sol |
qday-receipts Native contract |
code id 865 | the target of every retirement |
@qorechain/qorex-rainbowkit |
0.1.0 (pinned) | web/src/wallet/setup.ts: QoreX as the wallet on the Try it page |
@qorechain/qorex-types |
0.1.0 (pinned) | web/src/wallet/useWalletActions.ts: qorexSignAndBroadcast, so the wallet path retires through the Native lane |
@qorechain/wallet-adapter |
0.6.0 (pinned) | web/src/wallet/useWalletActions.ts: validateQorexRequest checks every request before QoreX sees it; web/src/wallet/errors.ts: isQorexRejection. No Keplr or Leap path, and why: decision 0048 |
@qorechain/qorex-wallet-mock |
0.1.0 (pinned, tests and pnpm wallet-run) |
web/e2e/wallet.e2e.ts: QoreX in the browser tests; scripts/wallet-run.ts: the same path on the testnet |
@qorechain/pqc |
0.2.3 (pinned) | web/src/data/pqCheck.ts: mldsa87.verify re-checks the meters' ML-DSA-87 signatures in your browser on the Verify page; web/src/components/ForgeDemo.tsx: mldsa87.keygen and sign make the forger's key in "Forge a meter reading" |
@qorechain/qore-cli |
0.1.1 (pinned) | scripts/pq-status.ts (pnpm pq-status, the last step of pnpm demo): qore pq status <hash> on every Native press in live.json, which must report the hybrid tier with one PQC layer and a verified signature |
@qorechain/mcp |
0.1.1 (pinned) | scripts/mcp-check.ts (pnpm mcp-check): QoreChain's MCP server, started in process and read by an MCP client, must give the same counters as a direct eth_call and a hybrid-signed status for the newest press; docs/mcp.md shows how to add it to an AI assistant and what to ask |
@qorechain/qoreseal |
0.1.0 (pinned) | scripts/seal.ts (pnpm seal): each site's details sealed with ML-KEM-1024 to the registrar's registered key; web/src/data/seal.ts: Verify checks the envelopes and opens them in the browser (sealed site details) |
KEM key registry, MsgRegisterKEMKey |
/qorechain.pqc.v1.MsgRegisterKEMKey, read at /qorechain/pqc/v1/kem/{address} |
the registrar's ML-KEM-1024 key, registered at block 11146882 (sealed site details) |
@qorechain/evm |
0.14.0 (pinned) | web/src/data/forge.ts: precompiles.pqcVerify asks the chain whether the forger's signature is valid in "Forge a meter reading"; scripts/src/rpc.ts: qorechainTestnet gives every script's EVM client the chain's id, name, currency and explorer |
@qorechain/qorescan |
0.1.0 (pinned, dev) | scripts/cbom.sh (pnpm cbom): the CycloneDX CBOM in docs/cbom/ of the contracts, the site's TLS and the PQC keys of all 9 Mentari accounts; CI runs it on every push as a step that cannot fail the build |
@qorechain/qoresign |
0.2.0 (pinned) | scripts/src/v2-sign.ts: signMessage signs every Mentari v2 retirement and transfer claim in QoreSign's message format, and messagePqSignBytes must equal the contract's own bytes before anything is sent (v2) |
asset-kit QoreChainHybridHolderGuard |
0x1b2c6188fab4fb6f9cb7b115b4e917eeb07f1745, ownership renounced |
contracts/vendor/asset-kit/, unmodified from qorechain/qorechain-asset-kit: Mentari v2 asks it who may hold certificates |
On the project page these two features show as Declared. The fest FAQ says they cannot be verified automatically, so jurors check them in the repo. This is where to look:
| Feature | Precompile | The call | What depends on it |
|---|---|---|---|
| Solidity PQC signature check | pqcVerify, 0x…0a01 |
Pqc.requireSignature |
registerSystem and attest: a reading without a valid ML-DSA-87 signature mints nothing |
| Solidity PQC key status | pqcKeyStatus, 0x…0a02 |
Pqc._status |
_requireQuantumReady: certificates move only to accounts with a registered, proven ML-DSA-87 key |
The deployed contract holds both addresses: eth_getCode for 0xf5cb2c6048a7ce8c5a7accc66eb8efc33942a448 contains
PUSH2 0x0a01 and PUSH2 0x0a02.
You need Node.js 22, pnpm 12.9.1 and git. The test script installs a pinned Foundry if forge is missing.
git clone --recurse-submodules https://github.com/aimanmalib/mentari.git
cd mentari
pnpm install --frozen-lockfile
pnpm exec playwright install chromium webkit
bash scripts/gerbang-ujian.sh # what CI runs: forge build, test, fmt and coverage, vitest, web build, browser tests, secret scanThe site on your machine. It reads the testnet; building with VITE_MENTARI_DATA=sample uses the local fixture instead:
pnpm build
pnpm start # http://localhost:8080Only the contract tests:
cd contracts && forge testCounted on 2 December 2026 from the public CI run 46933771867 on commit 9623984: 160 Foundry tests, 14 Rust tests for mentari-registry, 829 vitest tests and 30 Playwright tests, with line coverage of contracts/src at 99 %. The CI log prints one vitest total and the scripts count; the server and site counts come from local runs of the same commit and add up to that total. CI runs the same steps on every push; bash scripts/gerbang-ujian.sh runs them locally. Earlier counts (115, 694 and 16 on 1 December; 728 and 22 for release 1.2.0) are in CHANGELOG.md.
| Suite | Result | What it covers |
|---|---|---|
Foundry, contracts/test/ |
160 passed, 0 failed | unit tests, fuzz tests (512 runs each) and invariant suites for v1 and v2, the regression tests for both QCAI audit runs (contracts/test/audit/), and v2's exact signed text; line coverage of contracts/src 99 % |
Rust, native/ |
14 passed | mentari-registry: a vintage cannot be retired past what its meter attested, and only the bound contract may write |
vitest, server/test/ |
263 passed | the /lcd allowlist, client IP behind Cloudflare, demo rate limits and budget, the off switch, fallbacks, the wallet grant, the live demo sender on a local node, the hybrid-signed Native route for every button, Pay and retire with its payee's balance, the classical-key drill, the v2 buttons, the daily meter run, the explorer redirects and the honest demo status |
vitest, web/test/ |
327 passed | the "both ledgers agree" check, the ML-DSA-87 re-check in the browser against real testnet signatures and a one-byte change, the forged reading, the "No EVM window is open" panel, Pay and retire, the home page story, the link preview tags, the slide counts match this table, the AI_USAGE.md counts, the slide PDF is the one printed from the slide source, both languages have the same keys, the bounded event search, the stale phrases guard, the README numbers and links |
vitest, scripts/test/ |
239 passed | account derivation, the wallet messages the site encodes, funding, key registration and EVM windows on the Native lane, the cases A to K and their re-check, the nine EVM windows in pnpm verify, the sealed site details, the v2 proofs, the health, funds and self-test watches with the meter check, the deploy freeze |
Playwright, web/e2e/ |
30 passed | the home page and Retire now, the wallet path with the QoreX wallet mock, the classical-key drill, the forged reading, Pay and retire with its twin, the EVM window panel and the v2 sections: 15 cases in Chromium and in WebKit as an iPhone 13 |
The four invariants hold after every random call:
- Minted minus retired equals supply.
- The number of retirements equals the number of receipts the bridge accepted from the contract.
- Each retirement's receipt id is unique and increasing.
- No balance sits on an address without a post-quantum key.
Each one was checked by breaking Mentari.sol on purpose; each break turns its invariant red
(docs/TESTING.md). The fuzz tests check that no memo can put ", \ or a control character into the
JSON note, and that the note never passes 140 characters.
| Action | Post-quantum signature | Checked by |
|---|---|---|
| Register a system, mint a daily reading | Registrar's or meter's ML-DSA-87 signature | Mentari itself, with pqcVerify |
Retire now, the failure buttons, grant, the daily meter call |
Hybrid (secp256k1 + ML-DSA-87), sent from the Native lane with no EVM window | The chain |
| Any EVM transaction signed with secp256k1 alone | None | The chain refuses it unless the account has an open, scoped EVM window |
| Seal a site's owner and address | ML-KEM-1024 to the registrar's registered key (QoreSeal); the anchor memo is hybrid-signed | Anyone, with pnpm verify or on Verify; only the registrar can open it |
| A bank send, a window, or a new post-quantum key for an account that has one | Hybrid, with the account's registered ML-DSA-87 key | The chain refuses the secp256k1 signature alone (case K) |
retire and transfer act for msg.sender; they take no post-quantum signature of their own. So the contract comment
"not from msg.sender" is true for minting and registration, not for those two. The chain closes the gap: in case I,
a retire signed with the buyer's classical key alone was refused ("has no open EVM authorisation window"), nonce 6
before and after. The same retire from the Native lane then went through
(97A5C807…CEA38).
The explorer, on Testnet, labels it like this:
The early EVM lane transactions (cases A to D, the deploys) show "not quantum-safe". Details and the untested case (a
classical key inside an open window): docs/threat-model.md.
That gap stays closed only while no account holds an open window. None does: after setup no Mentari account keeps a
window, so a classical key someone finds has no window to use. Verify
reads all nine accounts' windows from the chain live (/qorechain/pqc/v1/evm_window/{address}), and pnpm verify checks
the same nine (decision 0050).
Case I tried one action. Case K plays Q-Day for one account: someone has recovered its secp256k1 key, not its
ML-DSA-87 key, and tries what that key might sign. The holder, qor196zjpnyv5t8d4rf2t0ngg7ydqckp380fa9vrs3, is an
account no recurring job uses, with a registered ML-DSA-87 key, 1.2 QOR and 1,000 Wh of certificates. On 28 November
2026 pnpm classic-k signed each attempt below with its secp256k1 key alone
(decision 0043).
| Action | What it asks for | The chain's answer | Code |
|---|---|---|---|
bank-send |
MsgSend of 1,000 uqor out of the account |
"has a registered PQC key and must include the hybrid signature extension" | pqc 20 |
evm-retire |
Mentari.retire(500, "Case K") as an EVM transaction |
"has no open EVM authorisation window; open one with MsgOpenEVMWindow, signed on the Cosmos lane with the account's post-quantum key" | refused by the node |
evm-transfer |
Mentari.transfer of 100 Wh |
the same | refused by the node |
evm-window-open |
MsgOpenEVMWindow with no targets, so that the two calls above would pass |
"must include the hybrid signature extension" | pqc 20 |
pq-key-replace |
A new ML-DSA-87 key over the registered one, with a valid proof of possession for the new key | "PQC key maintenance from a keyed account needs the hybrid signature" | pqc 234 |
All five stopped before any block, so no fee was paid. Before and after are the same: sequence 1, EVM nonce 1,
1,200,000 uqor, the same key, 1,000 Wh, 28 retirements, 74 receipts (on 28 November). pnpm verify checks it again with no keys: none
of the five hashes is in a block, and today the holder still has the key it registered, the same sequence and nonce,
no window, and no less uqor or certificates. The chain's full words are in testnet.json.
What it means: once an account has an ML-DSA-87 key, its secp256k1 key alone moves nothing, opens no window and
cannot put the attacker's own post-quantum key in place. It does not change what the table above says about retire
and transfer: an account with an open window can still send them with its classical key until the window ends,
within its scope. On an account with no key yet, a classical key can register one; every Mentari account has one.
Two buttons on Try it let you play the attacker against the live testnet.
Steal it with the classical key. The server holds one key of the case K account: its secp256k1 key, which is what
a quantum attacker could recover from the public key. Its ML-DSA-87 key is not on the server (the key file may hold
one field only). Each press runs the five case K attempts again with that key alone and shows the chain's own words
for each, and the account before and after. Measured on 2 December 2026 through the public site: all five refused
before any block, the account unchanged, in about 7 seconds. An accepted attempt would be shown as accepted
(decision 0044, POST /api/demo/steal).
Forge a meter reading. Your browser makes a new ML-DSA-87 key, signs the contract's own attestMessage for the
newest accepted reading's system and day, claiming the most that system may report, and asks the chain's pqcVerify
precompile about it: valid, for the forger's key. Then it runs Mentari.attest with that signature as an eth_call,
with no wallet and no transaction. The contract refuses: BadSignature(<that system's meter>). Every past day is
already attested, so the call runs one block before the real reading, when the day was still open and only the
signature check was left (decision 0045).
The steal button counts against the same 5 presses an hour as the other buttons. The forgery runs in your browser and reads the public RPC, so it has no server limit.
A real certificate registry knows each generating site's location and owner: under the I-REC Standard, issuers register the production devices and their owners, and a certificate says where the electricity was produced (source). An owner's name and a home rooftop's address are personal data, so Mentari keeps them off the chain and out of the clear (decision 0046):
- The registrar published an ML-KEM-1024 key in QoreChain's KEM key registry with one hybrid-signed
MsgRegisterKEMKey(D9D48440…). pnpm sealreads that key back from the chain and seals each system's owner and address to it with@qorechain/qoreseal. The envelopes are inevidence/seal/; the details themselves never enter git. Each envelope is bound to this chain, this contract and its site, so it cannot be passed off as another site's.- One hybrid-signed Native transaction from the registrar anchors them: its memo is the SHA-256 of the envelope list
(
578D3B2B…, block 11146885).
On Verify your browser reads the registrar's key and the anchor from the
chain, hashes each envelope and checks it is addressed to that key. "Open the sample envelope" decrypts a sample sealed
to the registrar and to a key published in config/seal.json on purpose. The real envelopes open
only with the registrar's QoreSeal seed (pnpm seal-seed), and only in the browser. pnpm verify runs the same
checks. Capacity, readings and meter keys stay public, so anyone can still check a certificate. The site details are
invented, because the meters are simulated.
- A leaked classical key. Minting needs the meter's ML-DSA-87 signature, checked on chain. A classical key alone mints nothing, and the chain refuses its EVM transactions while the account has no open window (case I). With it alone, an account that has an ML-DSA-87 key cannot send uqor, open a window or replace that key (case K).
- Receivers without a post-quantum key. An account with no registered key can be claimed by whoever breaks its
classical key first. So
transferrefuses such accounts. - JSON injection through the memo. The memo is limited to 40 characters from
[A-Za-z0-9 .:/#-]and the note is built from typed fields, so a memo cannot change the message sent to the Native contract. - A failed or silent bridge. An empty or unreadable reply, or a receipt id that is not new, reverts the retirement.
- Abuse of the demo button. One request at a time, 5 per IP an hour, 150 a day, a balance floor of 120 QOR, and an off switch, all in
config/limits.json.
Full version with sources: docs/threat-model.md.
- The meter is simulated. Readings come from a seeded model of sun hours. The signatures, the contracts and the chain are real; the solar panels are not.
- Testnet only. This is a demo on the Diana testnet. It is not a recognised certificate scheme, and the certificates have no value.
- The Native side records, it does not enforce, in v1 and in
MentariV2Receipts.qday-receiptsis the shared workshop book; Mentari's receipts are the ones its contracts sent. Mentari's own enforcing contract went live on 2 December at 21:15 UTC, hours before the close, so it has run only briefly. v1retireandtransferact formsg.sender(the chain keeps a classical key alone out: cases I and K); v2 takes the holder's ML-DSA-87 signature instead. - The wallet path ran once with the real QoreX extension, by script, not by a person's hands. "Retire from your own
wallet" hands QoreX one
MsgCrossVMCallintoMentari.retire; QoreX signs it with the hybrid ML-DSA-87 signature and sends it on the Native lane. On 2 December 2026 the QoreX 0.4.6 extension from the Chrome Web Store, in Playwright Chromium with a new test wallet, connected on the public site, registered its ML-DSA-87 key on its own, and signed the retire:39F0487E…A533, block 11,147,525, code 0,PQCHybridSignature; retirements 37 → 38 and receipts 122 → 123 (Verify n=38,evidence/qorex-real.json). QoreX's testnet switch is hidden: tap its version label 7 times, then "Switch to testnet (diana)". Earlier runs used the wallet mock (pnpm wallet-run,evidence/wallet-native.json). QoreX keeps separate Native and EVM accounts, and this path uses the Native one (ADR 0042). "Retire now" needs no wallet. - No professional audit. The contracts have tests, fuzzing and invariants, and the QCAI audit answered finding by
finding in
docs/AUDIT.md; no human firm audited them.
I built Mentari with AI coding agents (Claude Code). Almost all of the code, tests, documents and images in this
repository were generated by them, inside a pipeline I built and under rules I set, and checked by automated gates and a separate
reviewer agent before each commit was accepted. AI_USAGE.md describes the workflow, the generated work
and my contribution.
- The QoreChain workshop examples in qorechain/build-before-qday
(Apache-2.0):
workshop-2/01-qday-vaultfor thepqcVerifyandpqcKeyStatuspattern, andworkshop-3/02-cross-vmfor the bridge call and the receipts book. See NOTICE. @qorechain/sdk, Foundry and forge-std, Vite, React, wagmi, RainbowKit, vitest, Playwright, TypeScript and tsx. Versions are pinned inpackage.json,pnpm-lock.yamland.gitmodules.- Fonts: Bricolage Grotesque, Instrument Sans
and IBM Plex Mono, all under the SIL Open Font License 1.1, served from Fontsource
packages on the site and from
deck/fonts/(licence files included) in the slides. - The music in the demo video is by Sascha Ende, ende.app (CC BY 4.0). The narration is an AI clone of my own voice (decision 0032).
See CONTRIBUTING.md, the Code of Conduct and SECURITY.md. Changes are listed in CHANGELOG.md.
Apache-2.0. Credits for adapted patterns and third-party packages are in NOTICE.
I built this project. I run Sasa Teguh, a studio in Malaysia that builds websites found on Google and in AI answers, and sets up systems like this one for businesses.



