corvuszk 0.0.0-stage → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +202 -0
- package/README.md +205 -2
- package/SECURITY-NOTICE.md +14 -0
- package/SECURITY.md +36 -0
- package/WHAT-YOU-GET.md +86 -0
- package/contracts/age_over.compact +16 -0
- package/contracts/balance_above.compact +15 -0
- package/contracts/condition.compact +21 -0
- package/contracts/eligibility.compact +143 -0
- package/contracts/eligibility_v2.compact +155 -0
- package/demo/hosted-server.mjs +252 -0
- package/demo/index.html +11 -0
- package/demo/offline.mjs +17 -0
- package/demo/server.mjs +20 -0
- package/dist/crypto-condition.d.ts +13 -0
- package/dist/crypto-condition.js +105 -0
- package/dist/index.d.ts +364 -0
- package/dist/index.js +659 -0
- package/dist/intent.d.ts +44 -0
- package/dist/intent.js +128 -0
- package/dist/midnight-config.d.ts +12 -0
- package/dist/midnight-config.js +18 -0
- package/dist/registry.d.ts +38 -0
- package/dist/registry.js +92 -0
- package/dist/strict-release.d.ts +36 -0
- package/dist/strict-release.js +186 -0
- package/docs/CNAME +1 -0
- package/docs/alternatives-and-costs.md +43 -0
- package/docs/buildathon/demo-script.md +34 -0
- package/docs/buildathon/pitch-deck.md +67 -0
- package/docs/buildathon/wave3-progress.md +34 -0
- package/docs/demo/demo.css +66 -0
- package/docs/demo/demo.js +157 -0
- package/docs/demo/index.html +144 -0
- package/docs/getting-started.md +85 -0
- package/docs/index.html +174 -0
- package/docs/live-eligibility.md +53 -0
- package/docs/live-run-receipts.json +63 -0
- package/docs/live-run.md +50 -0
- package/docs/media/corvuszk-demo-poster.jpg +0 -0
- package/docs/media/corvuszk-demo.mp4 +0 -0
- package/docs/on-chain-submit.md +82 -0
- package/docs/proof-server.md +28 -0
- package/docs/security-model.md +80 -0
- package/docs/site/index.html +12 -0
- package/docs/styles.css +129 -0
- package/docs/templates.md +46 -0
- package/docs/xrpl-escrow-flow.md +39 -0
- package/examples/eligibility-release.mjs +104 -0
- package/examples/escrow-offline.mjs +49 -0
- package/midnight/deploy-mainnet.mjs +318 -0
- package/midnight/deploy.mjs +66 -0
- package/midnight/deployments.preprod.json +171 -0
- package/midnight/e2e-escrow.mjs +29 -0
- package/midnight/eligibility.mjs +507 -0
- package/midnight/ensure-pipeline.sh +25 -0
- package/midnight/gen-wallets.mjs +19 -0
- package/midnight/live-eligibility.mjs +232 -0
- package/midnight/managed/age_over/compiler/contract-info.json +83 -0
- package/midnight/managed/age_over/compiler/contract-manifest.json +59 -0
- package/midnight/managed/age_over/contract/index.d.ts +46 -0
- package/midnight/managed/age_over/contract/index.js +488 -0
- package/midnight/managed/age_over/contract/index.js.map +8 -0
- package/midnight/managed/age_over/keys/prove.verifier +0 -0
- package/midnight/managed/age_over/zkir/prove.bzkir +0 -0
- package/midnight/managed/age_over/zkir/prove.zkir +43 -0
- package/midnight/managed/balance_above/compiler/contract-info.json +73 -0
- package/midnight/managed/balance_above/compiler/contract-manifest.json +59 -0
- package/midnight/managed/balance_above/contract/index.d.ts +44 -0
- package/midnight/managed/balance_above/contract/index.js +428 -0
- package/midnight/managed/balance_above/contract/index.js.map +8 -0
- package/midnight/managed/balance_above/keys/prove.verifier +0 -0
- package/midnight/managed/balance_above/zkir/prove.bzkir +0 -0
- package/midnight/managed/balance_above/zkir/prove.zkir +37 -0
- package/midnight/managed/condition/compiler/contract-info.json +72 -0
- package/midnight/managed/condition/compiler/contract-manifest.json +59 -0
- package/midnight/managed/condition/contract/index.d.ts +44 -0
- package/midnight/managed/condition/contract/index.js +422 -0
- package/midnight/managed/condition/contract/index.js.map +8 -0
- package/midnight/managed/condition/keys/attest.verifier +0 -0
- package/midnight/managed/condition/zkir/attest.bzkir +0 -0
- package/midnight/managed/condition/zkir/attest.zkir +37 -0
- package/midnight/managed/eligibility/compiler/contract-info.json +205 -0
- package/midnight/managed/eligibility/compiler/contract-manifest.json +79 -0
- package/midnight/managed/eligibility/contract/index.d.ts +66 -0
- package/midnight/managed/eligibility/contract/index.js +1232 -0
- package/midnight/managed/eligibility/contract/index.js.map +8 -0
- package/midnight/managed/eligibility/keys/prove.verifier +0 -0
- package/midnight/managed/eligibility/keys/reveal.verifier +0 -0
- package/midnight/managed/eligibility/zkir/prove.bzkir +0 -0
- package/midnight/managed/eligibility/zkir/prove.zkir +175 -0
- package/midnight/managed/eligibility/zkir/reveal.bzkir +0 -0
- package/midnight/managed/eligibility/zkir/reveal.zkir +42 -0
- package/midnight/managed/eligibility_v2/compiler/contract-info.json +225 -0
- package/midnight/managed/eligibility_v2/compiler/contract-manifest.json +79 -0
- package/midnight/managed/eligibility_v2/contract/index.d.ts +69 -0
- package/midnight/managed/eligibility_v2/contract/index.js +1397 -0
- package/midnight/managed/eligibility_v2/contract/index.js.map +8 -0
- package/midnight/managed/eligibility_v2/keys/prove.verifier +0 -0
- package/midnight/managed/eligibility_v2/keys/reveal.verifier +0 -0
- package/midnight/managed/eligibility_v2/zkir/prove.bzkir +0 -0
- package/midnight/managed/eligibility_v2/zkir/prove.zkir +210 -0
- package/midnight/managed/eligibility_v2/zkir/reveal.bzkir +0 -0
- package/midnight/managed/eligibility_v2/zkir/reveal.zkir +42 -0
- package/midnight/night-balance.mjs +2 -0
- package/midnight/preflight.mjs +16 -0
- package/midnight/providers.mjs +33 -0
- package/midnight/rt-compat.mjs +12 -0
- package/midnight/sdk-bridge.mjs +593 -0
- package/midnight/simulate.mjs +58 -0
- package/midnight/status.mjs +8 -0
- package/midnight/submit-onchain.mjs +105 -0
- package/midnight/tsconfig.json +12 -0
- package/midnight/wallet.mjs +3 -0
- package/midnight/wallet9.mjs +251 -0
- package/midnight/witnesses.ts +168 -0
- package/package.json +84 -4
- package/scripts/compile-contracts.sh +21 -0
- package/src/crypto-condition.ts +96 -0
- package/src/index.ts +934 -0
- package/src/intent.ts +147 -0
- package/src/midnight-config.ts +17 -0
- package/src/registry.ts +93 -0
- package/src/strict-release.ts +199 -0
- package/tsconfig.json +1 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,3 +1,206 @@
|
|
|
1
|
-
#
|
|
1
|
+
# CorvusZK
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://github.com/CorvusZK-1/CorvusZK/actions/workflows/ci.yml)
|
|
4
|
+
[](LICENSE)
|
|
5
|
+

|
|
6
|
+

|
|
7
|
+

|
|
8
|
+

|
|
9
|
+
|
|
10
|
+
**Prove a private fact on Midnight, then release a native XRPL escrow.** CorvusZK is an open-source TypeScript SDK plus four Compact contracts that let an XRPL app hold payment in a standard XRPL escrow until a zero-knowledge check passes on Midnight: "this holder has a valid credential", "age over N", "balance above X", or "condition met". The private inputs never leave the holder's machine. CorvusZK never holds funds or keys.
|
|
11
|
+
|
|
12
|
+
*Built on [Midnight](https://midnight.network) (Compact, Midnight.js, proof server) and the [XRP Ledger](https://xrpl.org). Midnight Buildathon Wave 3 entry.* All four contracts are live on Midnight mainnet (13 Nov 2026). The full eligibility + XRPL escrow release path (prove, reveal, and EscrowFinish) has been proven on Midnight Preprod + XRPL testnet. Unaudited. Not for real value. Not affiliated with the Midnight Foundation, Ripple, or the XRPL Foundation.
|
|
13
|
+
|
|
14
|
+
> **Security notice (26 Nov 2026):** The eligibility contract already deployed on Midnight mainnet (13 Nov 2026) uses the insecure demo issuer and must not be used with real value. Anyone who holds one demo credential can recover the issuer's signing key. There is no known real-value use. Details: [SECURITY-NOTICE.md](SECURITY-NOTICE.md).
|
|
15
|
+
|
|
16
|
+
## Judge quick-start (5 minutes)
|
|
17
|
+
|
|
18
|
+
1. **See it run (1 min, nothing to install).** [corvuszk.com/demo](https://corvuszk.com/demo/) steps through the live run of 12 Nov 2026 (ledger 9): XRPL escrow locked → eligibility contract deployed on Midnight Preprod → private `prove` → `reveal` → XRPL escrow released. Every step links to the public explorer. A [72-second video](https://corvuszk.com/) is on the homepage. The demo page is a replay of that recorded run, not a live wallet connection.
|
|
19
|
+
2. **Run the contracts locally (3 min, Node 22.18+ or 24, no wallet, no tokens).**
|
|
20
|
+
```bash
|
|
21
|
+
git clone https://github.com/CorvusZK-1/CorvusZK && cd CorvusZK
|
|
22
|
+
npm ci && (cd midnight && npm ci)
|
|
23
|
+
npm run test:offline # SDK units + eligibility circuit + simulator tests for all 4 contracts
|
|
24
|
+
npm run test:lifecycle # payment lifecycle: create, fund, prove, release, refund, timeout (offline)
|
|
25
|
+
npm run simulate # runs the compiled Compact circuits: pass and refuse cases
|
|
26
|
+
npm run example:eligibility # mock credential → prove → refusal before reveal → fulfillment from revealed state
|
|
27
|
+
```
|
|
28
|
+
3. **Recompile the contracts (1 min).** With the [Compact toolchain](https://docs.midnight.network/) installed: `compact update 0.36.0 && npm run compile:check`. It compiles all four contracts and checks the output matches the committed `midnight/managed/` artifacts byte for byte. [CI](https://github.com/CorvusZK-1/CorvusZK/actions/workflows/ci.yml) does the same on every push.
|
|
29
|
+
4. **Check the chain evidence.** The [deployed contracts table](#deployed-contracts) links every address and proof transaction.
|
|
30
|
+
5. **Read the limits.** [Security model](#security-model): what XRPL does and does not enforce, and who must be trusted.
|
|
31
|
+
|
|
32
|
+
### Where things are
|
|
33
|
+
|
|
34
|
+
| Path | What it is |
|
|
35
|
+
|---|---|
|
|
36
|
+
| [`contracts/`](contracts/) | The four Compact contracts: `eligibility`, `condition`, `age_over`, `balance_above` |
|
|
37
|
+
| [`midnight/witnesses.ts`](midnight/witnesses.ts) | Typed witness implementations (private inputs) for all four contracts, checked against the compiler's generated types |
|
|
38
|
+
| [`midnight/managed/`](midnight/managed/) | Compiler output: TypeScript contract API, ZKIR circuits, proving and verifying keys (the large proving keys are in the repo only, not the npm package) |
|
|
39
|
+
| [`midnight/eligibility.mjs`](midnight/eligibility.mjs) | Mock issuer, Schnorr credential, XRPL preimage binding, `fulfillmentFromRevealedLedger` |
|
|
40
|
+
| [`midnight/sdk-bridge.mjs`](midnight/sdk-bridge.mjs), [`providers.mjs`](midnight/providers.mjs), [`wallet9.mjs`](midnight/wallet9.mjs) | Midnight.js provider stack: wallet, proof server, indexer, deploy, `callTx`, ledger reads |
|
|
41
|
+
| [`midnight/live-eligibility.mjs`](midnight/live-eligibility.mjs) | The end-to-end script behind the 12 Nov run (`npm run live:eligibility`) |
|
|
42
|
+
| [`src/`](src/) | The TypeScript SDK (`MidnightBackend`, `LocalSimulationBackend`, XRPL escrow helpers) |
|
|
43
|
+
| [`test/`](test/) | `templates.test.mjs` (contract simulator tests), `eligibility.test.mjs`, `unit.test.mjs`, `xrpl.integration.test.mjs` (live XRPL testnet) |
|
|
44
|
+
| [`docs/demo/`](docs/demo/) | The corvuszk.com/demo page |
|
|
45
|
+
|
|
46
|
+
## Deployed contracts
|
|
47
|
+
|
|
48
|
+
Preprod records are on **Midnight Preprod, ledger 9** (testnet, free test tokens). Mainnet records are on **Midnight mainnet, ledger 9** (unaudited, not for real value). Machine-readable copies: [`midnight/deployments.preprod.json`](midnight/deployments.preprod.json), [`midnight/deployments.mainnet.json`](midnight/deployments.mainnet.json). Receipts: [11 Nov](receipts/ledger9-preprod-2026-11-11.md), [12 Nov](receipts/ledger9-preprod-2026-11-12.md).
|
|
49
|
+
|
|
50
|
+
| Network | Contract | Address | Proof transaction | Date (PT) |
|
|
51
|
+
|---|---|---|---|---|
|
|
52
|
+
| Preprod | `eligibility` (one instance per escrow; this is the 12 Nov run's instance) | [`b8a7935e586c31800fc0b424c4f7e83d274c62d8dab3b63b77708d569ba0c1f2`](https://preprod.midnightexplorer.com/contracts/b8a7935e586c31800fc0b424c4f7e83d274c62d8dab3b63b77708d569ba0c1f2) | [`prove`](https://preprod.midnightexplorer.com/transactions/88a89d1df54979f400b991cf4b7e152dccacd18950cef3539af7d7f1611a3859) · [`reveal`](https://preprod.midnightexplorer.com/transactions/0cb52d18a22d6c2dccc588f7668c732efa96eb18316e4425363a71a7e382d586) | 12 Nov 2026 |
|
|
53
|
+
| Preprod | `age_over` | [`838bb8f23e4413da672fdae86d29c7918da2dab8ab6e32ff9c824357127ea16f`](https://preprod.midnightexplorer.com/contracts/838bb8f23e4413da672fdae86d29c7918da2dab8ab6e32ff9c824357127ea16f) | [`prove` (11 Nov)](https://preprod.midnightexplorer.com/transactions/fb86e2539597ce7934c10cfc528ea890c4ed2513af25756e2b27218ba59ada89) · [`prove` (12 Nov)](https://preprod.midnightexplorer.com/transactions/cdd140eefcb38622f05de9091fd75d39331ff1143d46893aa61bfdaa91b9e455) | 11 Nov 2026 |
|
|
54
|
+
| Preprod | `balance_above` | [`7eab336024024dfec2787023d0ee5af56818d9199425bb76f1b756570f04284b`](https://preprod.midnightexplorer.com/contracts/7eab336024024dfec2787023d0ee5af56818d9199425bb76f1b756570f04284b) | [`prove`](https://preprod.midnightexplorer.com/transactions/e14168707c2f48a3edd0a5f7bdaaa0aef1cf51c13da456763da1f22b28fabd4f) | 11 Nov 2026 |
|
|
55
|
+
| Preprod | `condition` | [`b6f78efb34e84b8809267764f0f62eaab5f375c845cc57a64a63b700dde04df3`](https://preprod.midnightexplorer.com/contracts/b6f78efb34e84b8809267764f0f62eaab5f375c845cc57a64a63b700dde04df3) | [`attest`](https://preprod.midnightexplorer.com/transactions/c974a56ea2e257d09701d55c9d82cc6a9dcb7231d565a6324dd0c5b6e343847f) | 11 Nov 2026 |
|
|
56
|
+
| **Mainnet** | `condition` | [`18c57f073a57731fe6b9dac69f3604ebc7a4d0a6710ac99970d804a1ae6b470a`](https://www.midnightexplorer.com/contracts/18c57f073a57731fe6b9dac69f3604ebc7a4d0a6710ac99970d804a1ae6b470a) | [`attest`](https://www.midnightexplorer.com/transactions/53d53013bad4e36eda2531177ada92fb925b8cb86732b0de1d85def75ab633c4) | 13 Nov 2026 |
|
|
57
|
+
| **Mainnet** | `age_over` | [`7ac8e54d2fa8bf577bf3b6caa9e5f68de332e04264cf9f2a2a33f5fa6f785dfc`](https://www.midnightexplorer.com/contracts/7ac8e54d2fa8bf577bf3b6caa9e5f68de332e04264cf9f2a2a33f5fa6f785dfc) | [`prove`](https://www.midnightexplorer.com/transactions/83228532a1386132a1a8c8ea532b1f38d4283dd6d2ea4b437fdbf0da066e0bc0) | 13 Nov 2026 |
|
|
58
|
+
| **Mainnet** | `balance_above` | [`8e58143e993fad1400a409192199dd4eb742acfedec4f96e17199039049b05e0`](https://www.midnightexplorer.com/contracts/8e58143e993fad1400a409192199dd4eb742acfedec4f96e17199039049b05e0) | [`prove`](https://www.midnightexplorer.com/transactions/44e9e0c63348d309d68d8edac164a0f9b744326ccd4e42e49c887df6585c790f) | 13 Nov 2026 |
|
|
59
|
+
| **Mainnet** | `eligibility` (insecure demo issuer; must not be used with real value; no real XRPL escrow, no `reveal`) | [`8990d6387c095310a91d83ef47f2d3019023f6077a4f50526faf4b23aa148ad3`](https://www.midnightexplorer.com/contracts/8990d6387c095310a91d83ef47f2d3019023f6077a4f50526faf4b23aa148ad3) | [`prove`](https://www.midnightexplorer.com/transactions/222476605d263d66a7856888d1cc8dcba26315d5c7677c5b73cd248fbed0a776) | 13 Nov 2026 |
|
|
60
|
+
|
|
61
|
+
XRPL testnet side of the 12 Nov run: [`EscrowCreate`](https://testnet.xrpl.org/transactions/593F1F56ED7AD8FB7C4C4DF7D78EF2DE41AC3DE085DC476BC30B348F350FAB41) (20 test XRP) and [`EscrowFinish`](https://testnet.xrpl.org/transactions/194F5D8FD89AFF3E95ACC7A140D2ED2AB6129EA7E6A73A2C7A2A0BAE6634354C) (`tesSUCCESS`), about 88 seconds apart. Older ledger 8 records (3–6 Nov 2026) are kept under `ledger8History` in the deployments file and in [docs/live-run.md](docs/live-run.md).
|
|
62
|
+
|
|
63
|
+
## Architecture
|
|
64
|
+
|
|
65
|
+
```mermaid
|
|
66
|
+
flowchart LR
|
|
67
|
+
subgraph XRPL["XRP Ledger (testnet)"]
|
|
68
|
+
E1["EscrowCreate<br/>condition = SHA-256(preimage)<br/>XRP locked, fixed destination"]
|
|
69
|
+
E2["EscrowFinish<br/>XRPL checks the preimage"]
|
|
70
|
+
end
|
|
71
|
+
subgraph Holder["Holder's machine (private)"]
|
|
72
|
+
W["Witnesses: holder secret,<br/>credential expiry, issuer signature"]
|
|
73
|
+
PS["Local proof server"]
|
|
74
|
+
end
|
|
75
|
+
subgraph Midnight["Midnight (Preprod)"]
|
|
76
|
+
C["eligibility contract<br/>public: issuer key, escrow binding,<br/>preimage commitment"]
|
|
77
|
+
P["prove(): verify credential in-circuit,<br/>record proven + one-time nullifier"]
|
|
78
|
+
R["reveal(): only after prove(),<br/>publish the release preimage"]
|
|
79
|
+
end
|
|
80
|
+
Payer["Payer wallet"] --> E1
|
|
81
|
+
Policy["Payer-side policy party<br/>samples the preimage (default)"] -->|"commitment only"| C
|
|
82
|
+
Policy -->|"condition only"| Payer
|
|
83
|
+
W --> PS -->|"proof transaction, no private data"| P
|
|
84
|
+
C --> P --> R
|
|
85
|
+
R -->|"indexer read"| SDK["CorvusZK SDK<br/>fulfillmentFromRevealedLedger"]
|
|
86
|
+
SDK --> E2
|
|
87
|
+
E1 -.->|"same condition"| E2
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
By default the payer-side policy party samples the preimage. It can finish without Midnight, which pays the fixed destination early, or withhold, in which case the payer is refunded after `CancelAfter`. XRPL does not read Midnight: the link is the crypto-condition. This is a trusted-party release: the payer side holds the unlock code by default, and if it is never used the deal refunds to the payer after `CancelAfter`. Details: [Security model](#security-model).
|
|
91
|
+
|
|
92
|
+
### Private vs public state (Midnight's two ledgers)
|
|
93
|
+
|
|
94
|
+
Midnight splits each contract into private state, kept on the user's machine and fed to circuits as witnesses, and public ledger state on chain. Only values a circuit explicitly `disclose()`s become public.
|
|
95
|
+
|
|
96
|
+
| Contract | Private (witness, stays on the holder's machine) | Public (on the Midnight ledger) |
|
|
97
|
+
|---|---|---|
|
|
98
|
+
| `eligibility` | holder secret, credential expiry, issuer Schnorr signature (nonce point, scalar), release preimage until `reveal` | issuer public key, credential type, as-of date, XRPL owner / sequence / destination, preimage commitment, `proven`, nullifier, preimage after `reveal` |
|
|
99
|
+
| `age_over` | birth year, salt | minimum age, as-of year, birth-year commitment, `proven` |
|
|
100
|
+
| `balance_above` | balance, salt | threshold, balance commitment, `proven` |
|
|
101
|
+
| `condition` | attester secret, "delivered" flag | attester commitment, escrow id, `released` |
|
|
102
|
+
| XRPL escrow | — | amount, payer, destination, condition, finish time (XRPL fields are always public) |
|
|
103
|
+
|
|
104
|
+
## Status (honest)
|
|
105
|
+
|
|
106
|
+
| Part | State |
|
|
107
|
+
|---|---|
|
|
108
|
+
| Compact contracts (4) | Compile with Compact 0.36.0 (language 0.28.0, compact-runtime 0.21.0, ledger 9). CI recompiles them and checks the committed artifacts match. |
|
|
109
|
+
| Eligibility + XRPL escrow release | **Ran live on Preprod ledger 9 on 12 Nov 2026** (receipts above). First ran on ledger 8 on 6 Nov 2026. The issuer is a labeled **mock**, not a regulated KYC provider and not an XRPL Credential (XLS-70) object. |
|
|
110
|
+
| `condition`, `age_over`, `balance_above` | Deployed on Preprod ledger 9 on 11 Nov 2026, one proof call each (indexer status SUCCESS). `age_over` proved again on 12 Nov. Deployed on Midnight mainnet on 13 Nov 2026, one proof call each. |
|
|
111
|
+
| Tests | Offline suites (SDK units, eligibility circuit, simulator tests for all four contracts) run in CI. The live XRPL testnet escrow test runs as a separate best-effort CI job because it depends on the public faucet. CI does not run live Midnight transactions (that needs a funded wallet and a proof server). |
|
|
112
|
+
| `MidnightBackend` (SDK) | Runs the compiled circuits locally (`local-circuits`), attaches Preprod addresses (`preprod`), posts a Preprod `callTx` (`submitOnChain`), and deploys / calls / reads eligibility instances. |
|
|
113
|
+
| `LocalSimulationBackend` | Ed25519-signed attestation for learning the API offline. **Not zero-knowledge.** |
|
|
114
|
+
| Midnight mainnet | **Live for all four contracts** on 13 Nov 2026. `condition`, `age_over`, and `balance_above` each have one proof call. Addresses and explorer links are in the table above and in [`midnight/deployments.mainnet.json`](midnight/deployments.mainnet.json). An `eligibility` instance was deployed later the same day with one `prove` call (placeholder XRPL accounts, no real escrow, no `reveal`). **That mainnet eligibility contract uses the insecure demo issuer and must not be used with real value.** See [SECURITY-NOTICE.md](SECURITY-NOTICE.md). Unaudited. |
|
|
115
|
+
| Frontend | [corvuszk.com/demo](https://corvuszk.com/demo/) replays the 12 Nov run with explorer links and live XRPL lookups. A wallet-connected live page is not built yet. |
|
|
116
|
+
| Users / revenue | None yet. |
|
|
117
|
+
|
|
118
|
+
## Security model
|
|
119
|
+
|
|
120
|
+
Short version. The full write-up, with tables for each check and replay case, is in [docs/security-model.md](docs/security-model.md).
|
|
121
|
+
|
|
122
|
+
- **How the chains connect.** The XRPL escrow condition is SHA-256 of a 32-byte preimage. The eligibility contract stores a commitment to that preimage (not the preimage), plus the escrow's owner, sequence and destination. `prove()` checks the mock issuer's Schnorr signature in-circuit and records a one-time nullifier bound to that escrow. `reveal()` only works after `prove()` and only for the committed preimage. The SDK then rebuilds the XRPL fulfillment from the revealed ledger state.
|
|
123
|
+
- **What XRPL enforces.** Only the crypto-condition, the fixed destination and the time bounds. XRPL does not verify the Midnight proof. CorvusZK runs in **trusted policy party** mode: the party that sampled the preimage (by default the payer-side policy party) can finish without Midnight, which pays the fixed destination early, or withhold, in which case the payer is refunded after `CancelAfter`. It must be trusted to release only after the proof. In plain terms, this is a trusted-party release: the payer side holds the unlock code by default, and the deal refunds to the payer on timeout.
|
|
124
|
+
- **Replay.** A second `prove()` or `reveal()` on the same contract fails. The nullifier changes with owner, sequence, destination or preimage commitment. There is no cross-contract nullifier registry.
|
|
125
|
+
- **Privacy limits.** XRPL amount, accounts and timing stay public. After `reveal()`, the preimage is public.
|
|
126
|
+
- **Other limits.** The demo issuer's signature is not secure (see [SECURITY-NOTICE.md](SECURITY-NOTICE.md)). Unaudited. Not for real value. The eligibility + XRPL escrow path has been proven on testnet only.
|
|
127
|
+
|
|
128
|
+
## Who it is for
|
|
129
|
+
|
|
130
|
+
TypeScript builders shipping small XRPL apps that need a private yes/no before releasing escrowed XRP: age-gated goods, proof-of-funds style checks, "condition met" attestations, without becoming a custodial wallet. Why Midnight: XRPL escrows have no private checks today. XRPL's own Confidential Transfers are a separate feature that does not work with escrows and was not enabled on mainnet as of 27 Nov 2026 ([xrpl.org](https://xrpl.org/), re-check before relying on it). Midnight's Compact contracts add private checks without moving the money off XRPL. To run the Midnight half, an XRPL builder must hold some NIGHT so a wallet can generate DUST, which pays Midnight fees. Per IO, Midnight mainnet is in a federated phase as of 23 Nov 2026 (re-check). Comparisons with XRPL Credentials, Xahau Hooks, Boundless Smart Escrows and other Midnight projects, plus fee notes, are in [docs/alternatives-and-costs.md](docs/alternatives-and-costs.md).
|
|
131
|
+
|
|
132
|
+
Docs: [security notice](SECURITY-NOTICE.md) · [getting started](docs/getting-started.md) · [what's included](WHAT-YOU-GET.md) · [the proof templates](docs/templates.md) · [XRPL escrow flow](docs/xrpl-escrow-flow.md) · [live eligibility run how-to](docs/live-eligibility.md) · [on-chain submit](docs/on-chain-submit.md) · [proof server](docs/proof-server.md) · [SECURITY.md](SECURITY.md) · [CHANGELOG](CHANGELOG.md)
|
|
133
|
+
|
|
134
|
+
## Use it in your app
|
|
135
|
+
|
|
136
|
+
Requires Node 20+ for the SDK (Node 22.12+ for the `midnight/` runtime, Node 24 in CI).
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
npm install && npm run build
|
|
140
|
+
npm run demo:offline # no network: the 3 claims, passing and refused cases
|
|
141
|
+
npm run example:offline # same idea as a copy-pasteable examples/ script
|
|
142
|
+
npm test # all tests, including 1 live XRPL testnet escrow test
|
|
143
|
+
npm run demo # local web demo at http://localhost:8787 using free XRPL testnet faucet wallets
|
|
144
|
+
npm run demo:hosted # same testnet demo for a host like Render (PORT, /healthz, rate limits)
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### Which backend to use
|
|
148
|
+
| Backend | What it is | Use when |
|
|
149
|
+
|---|---|---|
|
|
150
|
+
| `LocalSimulationBackend` | Ed25519-signed attestation. **Not ZK.** | Learning the escrow API offline / in unit tests |
|
|
151
|
+
| `MidnightBackend` | Real Compact circuits via `midnight/sdk-bridge.mjs`; `submitOnChain` for Preprod callTx | Circuit prove/verify locally, or post a new on-chain attest/prove when wallet + proof server + DUST are ready |
|
|
152
|
+
|
|
153
|
+
Use it in your app (simulation backend):
|
|
154
|
+
```ts
|
|
155
|
+
import * as xrpl from 'xrpl';
|
|
156
|
+
import { LocalSimulationBackend, createCryptoCondition, createEscrow, proveAgeOver, verifyAndReleaseEscrow, XRPL_TESTNET_WSS } from 'corvuszk';
|
|
157
|
+
const client = new xrpl.Client(XRPL_TESTNET_WSS); await client.connect();
|
|
158
|
+
const cond = createCryptoCondition(); // payer keeps cond.fulfillment
|
|
159
|
+
const esc = await createEscrow(client, payer, { destination: payee.address, amountXrp: '20', condition: cond.condition });
|
|
160
|
+
const backend = new LocalSimulationBackend();
|
|
161
|
+
const proof = await proveAgeOver(backend, 1990, 18, 2026, salt);
|
|
162
|
+
await verifyAndReleaseEscrow(client, payee, { backend, proof, owner: esc.owner, offerSequence: esc.offerSequence, ...cond });
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
Real Compact circuits via `MidnightBackend` (local circuits; no redeploy):
|
|
166
|
+
```ts
|
|
167
|
+
import { MidnightBackend, proveAgeOver, proveBalanceAbove, proveCondition } from 'corvuszk';
|
|
168
|
+
// Token from env only — never hard-code or log it.
|
|
169
|
+
const backend = new MidnightBackend({
|
|
170
|
+
blockfrostProjectId: process.env.BLOCKFROST_MIDNIGHT_PREPROD,
|
|
171
|
+
mode: 'local-circuits', // or 'preprod' to attach deployments.preprod.json addresses
|
|
172
|
+
});
|
|
173
|
+
// Needs: cd midnight && npm ci (Compact runtime + managed circuits)
|
|
174
|
+
const age = await proveAgeOver(backend, 1990, 18, 2026, 'dev-salt');
|
|
175
|
+
const bal = await proveBalanceAbove(backend, 5000, 1000, 'dev-salt');
|
|
176
|
+
const ok = await backend.verify(age); // true when the circuit accepted the witness
|
|
177
|
+
|
|
178
|
+
// Optional: post a new on-chain callTx (needs proof server + synced wallet with DUST)
|
|
179
|
+
// const { txHash, proof } = await backend.submitOnChain({
|
|
180
|
+
// claim: age.claim,
|
|
181
|
+
// witness: { kind: 'ageOver', birthYear: 1990, salt: 'dev-salt' },
|
|
182
|
+
// syncTimeoutMs: 90_000,
|
|
183
|
+
// });
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
Docs for chain submit: [on-chain submit](docs/on-chain-submit.md) · [proof server runbook](docs/proof-server.md)
|
|
187
|
+
|
|
188
|
+
### API
|
|
189
|
+
- `proveCondition(backend, secret, salt, commitment)`, `proveBalanceAbove(backend, balance, threshold, salt)`, `proveAgeOver(backend, birthYear, minAge, asOfYear, salt)` return a `Proof`, or throw if the predicate is false. Helpers pass private witnesses into `MidnightBackend` without putting them on `Proof.claim`.
|
|
190
|
+
- `createCryptoCondition()` returns a PREIMAGE-SHA-256 `{condition, fulfillment}`.
|
|
191
|
+
- `createEscrow(client, payerWallet, {destination, amountXrp, condition, cancelAfterSec})`
|
|
192
|
+
- `verifyAndReleaseEscrow(client, submitter, {backend, proof, owner, offerSequence, condition, fulfillment})` verifies the proof first, then submits EscrowFinish.
|
|
193
|
+
- `commit(value, salt)` creates a hiding commitment. The simulation uses SHA-256; the Compact templates use `persistentHash`. `MidnightBackend` rewrites `Proof.claim.commitment` to the Compact commitment.
|
|
194
|
+
- `MidnightBackend.submitOnChain({ claim, witness, contractAddress?, syncTimeoutMs? })` submits a Preprod `callTx` and returns `{ txId, txHash, blockHeight, contractAddress, proof }`. Callers pass witnesses; the SDK persists nothing. Fails fast if Blockfrost, proof server, sync, or DUST are missing.
|
|
195
|
+
|
|
196
|
+
### To enable real Midnight Preprod proofs
|
|
197
|
+
1. Create a free Blockfrost account and a "Midnight Preprod" project. Its token starts with `nightpreprod`. Export it as `BLOCKFROST_MIDNIGHT_PREPROD` (never commit or log it).
|
|
198
|
+
2. `cd midnight && npm ci` so `MidnightBackend` can load `sdk-bridge.mjs` and the managed circuits.
|
|
199
|
+
3. For **local circuit proofs** (SDK default): nothing else — `new MidnightBackend({ blockfrostProjectId: process.env.BLOCKFROST_MIDNIGHT_PREPROD })` then `proveAgeOver` / etc.
|
|
200
|
+
4. For **on-chain submit** against contracts already in `midnight/deployments.preprod.json`: start the proof server (see [docs/proof-server.md](docs/proof-server.md)), ensure the deployer wallet has DUST, then `backend.submitOnChain(...)` or `cd midnight && node submit-onchain.mjs --template age_over`. For a **fresh deploy**, use `midnight/deploy.mjs` / `ensure-pipeline.sh` (longer; registers DUST if needed). Faucet: https://midnight-tmnight-preprod.nethermind.dev/
|
|
201
|
+
|
|
202
|
+
## Licence
|
|
203
|
+
Apache-2.0. Dependencies: xrpl.js (ISC; its only runtime dependency tree), Compact/Midnight.js (Apache-2.0, optional under `midnight/`). Not affiliated with Ripple, the XRPL Foundation or the Midnight Foundation.
|
|
204
|
+
|
|
205
|
+
## Buildathon Wave 3 materials
|
|
206
|
+
Pitch deck, demo script, and what was built during Wave 3: [docs/buildathon/](docs/buildathon/).
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Security notice: CorvusZK demo credential signature is not secure
|
|
2
|
+
|
|
3
|
+
**Date:** 26 November 2026 (America/Los_Angeles)
|
|
4
|
+
**Contact:** cory.raven1@gmail.com
|
|
5
|
+
|
|
6
|
+
The eligibility demo in CorvusZK (`contracts/eligibility.compact` and the "mock issuer" in `midnight/eligibility.mjs`) uses a custom signature scheme written for demonstration. An engineering review found that anyone who receives **one** credential from that demo issuer can work out the issuer's private signing key and then create valid-looking credentials for anyone.
|
|
7
|
+
|
|
8
|
+
- **Who is affected:** anyone who has used the CorvusZK eligibility demo issuer, or copied that signature code, to decide who may receive funds. The issuer has always been labelled a mock, and the project is marked "Unaudited. Not for real value." There is no known real-value use. Do not use it for anything that matters.
|
|
9
|
+
- **Mainnet deployment:** the eligibility contract already deployed on Midnight mainnet (13 November 2026) uses this insecure demo issuer and must not be used with real value.
|
|
10
|
+
- **What is not affected:** the XRPL escrow itself (funds still go only to the fixed destination or back to the payer after `CancelAfter`), and the other three contract templates (`condition`, `age_over`, and `balance_above`), which do not use this signature.
|
|
11
|
+
- **What we are doing:** the demo issuer is now clearly marked insecure and test-only in code, the SDK refuses mainnet release while it is in use, and we plan to replace it with a standard, well-reviewed signature primitive from Midnight's standard library, after outside review.
|
|
12
|
+
- **What you should do:** treat any credential from the demo issuer as untrusted. Do not deploy the eligibility contract with real value.
|
|
13
|
+
|
|
14
|
+
Questions: [cory.raven1@gmail.com](mailto:cory.raven1@gmail.com). To report a new vulnerability, use this repository's [Security Advisories](https://github.com/CorvusZK-1/CorvusZK/security/advisories/new).
|
package/SECURITY.md
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Security notes for CorvusZK
|
|
2
|
+
|
|
3
|
+
## Security notice (26 Nov 2026)
|
|
4
|
+
|
|
5
|
+
The eligibility demo issuer's signature is **not secure**. Anyone who holds one demo credential can recover the issuer's signing key. The eligibility contract already deployed on Midnight mainnet (13 Nov 2026) uses that insecure demo issuer and must not be used with real value. There is no known real-value use. Full notice: [SECURITY-NOTICE.md](SECURITY-NOTICE.md). Contact: cory.raven1@gmail.com.
|
|
6
|
+
|
|
7
|
+
## Non-custodial by design
|
|
8
|
+
|
|
9
|
+
- CorvusZK never holds user funds. XRP locked for a deal sits in a **native XRPL escrow** created by the payer’s own wallet, with a fixed destination.
|
|
10
|
+
- The SDK never stores private keys, seed phrases, or crypto-condition fulfillments. Callers pass them in; nothing is persisted by the library.
|
|
11
|
+
- Private witnesses (birth year, balance, secrets) are passed into prove helpers and must not be placed on `Proof.claim`.
|
|
12
|
+
|
|
13
|
+
## Secrets that must never be committed
|
|
14
|
+
|
|
15
|
+
Do not put any of the following in git, release zips, landing pages, or screenshots:
|
|
16
|
+
|
|
17
|
+
- `.wallets*.json`, `.wallet-state*`, `.contract-secrets*`, `.keys*`, `.xrpl-e2e-keys*`
|
|
18
|
+
- Blockfrost / indexer project IDs or API tokens (use env vars such as `BLOCKFROST_MIDNIGHT_PREPROD`)
|
|
19
|
+
- `midnight/midnight-level-db/`, proof-server logs with credentials
|
|
20
|
+
- `.env` files
|
|
21
|
+
|
|
22
|
+
See `.gitignore`. If a secret is ever committed, rotate it immediately.
|
|
23
|
+
|
|
24
|
+
## Honest limits
|
|
25
|
+
|
|
26
|
+
- The four Compact contracts are live on **Midnight mainnet** (13 Nov 2026). Unaudited. Not for real value. The full eligibility + XRPL escrow release path (prove, reveal, and EscrowFinish) has been proven on Midnight Preprod + XRPL testnet only. The mainnet `eligibility` contract uses the insecure demo issuer and must not be used with real value (no real XRPL escrow, no `reveal`). See [SECURITY-NOTICE.md](SECURITY-NOTICE.md).
|
|
27
|
+
- `LocalSimulationBackend` is **not** zero-knowledge; it is a signed local attestation for development.
|
|
28
|
+
- Compact `persistentHash` commitments and simulation SHA-256 commitments are not interchangeable.
|
|
29
|
+
- `contracts/eligibility.compact` checks a **mock** in-process credential signature and records a one-time nullifier bound to escrow owner, offer sequence, destination, and preimage commitment. That signature is not secure (see [SECURITY-NOTICE.md](SECURITY-NOTICE.md)). It is not a regulated KYC credential, and not an XRPL Credential (XLS-70) ledger object. A fresh instance is deployed per escrow on Preprod by `npm run live:eligibility` (last run 12 Nov 2026). See the README security model.
|
|
30
|
+
- The party who samples the XRPL preimage can still submit `EscrowFinish` without a Midnight proof. XRPL does not verify Compact proofs.
|
|
31
|
+
- `age_over` and `balance_above` still prove a committed number. They do not authenticate an issuer.
|
|
32
|
+
- There is no cross-contract nullifier registry. One-time use is the `proven` and `preimageRevealed` flags on that contract instance.
|
|
33
|
+
|
|
34
|
+
## Reporting
|
|
35
|
+
|
|
36
|
+
If you find a vulnerability in CorvusZK, report it privately through this repository's [Security Advisories](https://github.com/CorvusZK-1/CorvusZK/security/advisories/new) (Security → Report a vulnerability). Do not open a public issue that includes secrets or exploit payloads against live wallets.
|
package/WHAT-YOU-GET.md
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# What's included (CorvusZK)
|
|
2
|
+
|
|
3
|
+
Honest inventory of this toolkit as of **13 Nov 2026** (four Compact contracts live on Midnight mainnet; ledger 9 code upgrade was 11 Nov 2026; v1.0.1 packaging was 5 Nov 2026). Unaudited. Not for real value. The full eligibility + XRPL escrow release path has been proven on Midnight Preprod + XRPL testnet only. Apache-2.0. Not affiliated with Ripple, the XRPL Foundation, or the Midnight Foundation.
|
|
4
|
+
|
|
5
|
+
## Included
|
|
6
|
+
|
|
7
|
+
| Item | Notes |
|
|
8
|
+
|---|---|
|
|
9
|
+
| TypeScript SDK (`src/`, builds to `dist/`) | Non-custodial. Never holds funds, keys, or fulfillments. |
|
|
10
|
+
| Four Compact contracts | `condition`, `balance_above`, `age_over`, and `eligibility` under `contracts/` |
|
|
11
|
+
| Eligibility template | `contracts/eligibility.compact`: mock Schnorr issuer, one-time nullifier bound to XRPL owner, offer sequence, destination, and preimage commitment. Run live on Preprod ledger 9 with an XRPL testnet escrow release on 12 Nov 2026 ([receipts/ledger9-preprod-2026-11-12.md](receipts/ledger9-preprod-2026-11-12.md)); first live run on ledger 8, 6 Nov 2026 ([docs/live-run.md](docs/live-run.md)). |
|
|
12
|
+
| Compiled circuit artifacts | `midnight/managed/` contract code, ZKIR, compiler info and the small verifier keys are in the npm package. The proving keys (about 200 MB) and `midnight/package.json` are **not**; get them from the GitHub repository (clone it, then `npm ci && (cd midnight && npm ci)`) for `npm run simulate` and real proving. |
|
|
13
|
+
| Live Midnight Preprod contracts (ledger 9, deployed 11–12 Nov 2026) | Addresses and tx hashes in `midnight/deployments.preprod.json` and the links below; ledger 8 history (3 Nov) under `ledger8History` |
|
|
14
|
+
| Live Midnight **mainnet** contracts (13 Nov 2026) | All four contracts. Addresses and proof transactions in `midnight/deployments.mainnet.json` and the README deployed-contracts table. Unaudited. Not for real value. The mainnet `eligibility` instance is a demonstration only (mock issuer, no real XRPL escrow, no `reveal`). |
|
|
15
|
+
| **On-chain submit from the SDK** | `MidnightBackend.submitOnChain` → `midnight/sdk-bridge.mjs` `submitCallTx` (bounded wallet sync; no redeploy) |
|
|
16
|
+
| XRPL escrow helpers | Create crypto-condition escrow; finish only after a proof verifies |
|
|
17
|
+
| Docs | `docs/getting-started.md`, `docs/templates.md`, `docs/xrpl-escrow-flow.md`, `docs/on-chain-submit.md`, `docs/proof-server.md`, `SECURITY.md`, this file, `README.md` |
|
|
18
|
+
| Offline example | `examples/escrow-offline.mjs` (`npm run example:offline`) |
|
|
19
|
+
| Offline demo | `npm run demo:offline` — no network, no money |
|
|
20
|
+
| Optional web demo | `npm run demo` — uses free XRPL testnet faucet |
|
|
21
|
+
| Midnight scripts | Deploy / attest / e2e / `submit-onchain.mjs` under `midnight/` for Preprod |
|
|
22
|
+
|
|
23
|
+
### Ledger 9 status
|
|
24
|
+
|
|
25
|
+
**Live on Midnight Preprod ledger 9 since 11 Nov 2026 (about 6:47–6:55 PM PT).** Code upgraded the same day to Wallet SDK 2.0.0, Midnight.js 5.0.0, Compact 0.36.0 and proof server 9.0.0. The throwaway test wallet's free test NIGHT was re-registered for DUST, the three templates were redeployed, and one ZK proof call was submitted to each; the Preprod indexer reports all three calls as SUCCESS. On **12 Nov 2026** (2:55 AM PT) the eligibility template and the XRPL escrow release were also run live on ledger 9 ([receipts](receipts/ledger9-preprod-2026-11-12.md)). The older ledger 8 records (3–6 Nov 2026) are kept under `ledger8History` in `midnight/deployments.preprod.json`.
|
|
26
|
+
|
|
27
|
+
**Live on Midnight mainnet since 13 Nov 2026.** All four contracts have a mainnet address and at least one proof or attest call. Unaudited. Not for real value. The mainnet `eligibility` instance did not run `reveal` and is not bound to a real XRPL escrow. Addresses: [`midnight/deployments.mainnet.json`](midnight/deployments.mainnet.json) and the README deployed-contracts table.
|
|
28
|
+
|
|
29
|
+
- `condition` contract: https://preprod.midnightexplorer.com/contracts/b6f78efb34e84b8809267764f0f62eaab5f375c845cc57a64a63b700dde04df3
|
|
30
|
+
- deploy tx: https://preprod.midnightexplorer.com/transactions/1c24472691745fea4b864140613a44be6f588fcda8ab6d1f20e6ae73873f437c
|
|
31
|
+
- `attest` (ZK proof) tx: https://preprod.midnightexplorer.com/transactions/c974a56ea2e257d09701d55c9d82cc6a9dcb7231d565a6324dd0c5b6e343847f
|
|
32
|
+
- `age_over` contract: https://preprod.midnightexplorer.com/contracts/838bb8f23e4413da672fdae86d29c7918da2dab8ab6e32ff9c824357127ea16f
|
|
33
|
+
- deploy tx: https://preprod.midnightexplorer.com/transactions/94a06463280aa11934e4659903d28e0e54afaf830ba728489b932890d99dfa82
|
|
34
|
+
- `prove` (ZK proof) tx: https://preprod.midnightexplorer.com/transactions/fb86e2539597ce7934c10cfc528ea890c4ed2513af25756e2b27218ba59ada89
|
|
35
|
+
- `balance_above` contract: https://preprod.midnightexplorer.com/contracts/7eab336024024dfec2787023d0ee5af56818d9199425bb76f1b756570f04284b
|
|
36
|
+
- deploy tx: https://preprod.midnightexplorer.com/transactions/1aab88403471888ef9ab5ab499ca3b3f07fa9e06eb4817f3ba09a12ed60cde80
|
|
37
|
+
- `prove` (ZK proof) tx: https://preprod.midnightexplorer.com/transactions/e14168707c2f48a3edd0a5f7bdaaa0aef1cf51c13da456763da1f22b28fabd4f
|
|
38
|
+
|
|
39
|
+
### Explorer links from the ledger 8 run (3–6 Nov 2026, before the 9 Nov network upgrade)
|
|
40
|
+
|
|
41
|
+
- Condition contract: https://preprod.midnightexplorer.com/contracts/45563d2ede4887717968e51405bc4d9993dd7082959c59cda72755c500cd52f5
|
|
42
|
+
- Attest (ZK) tx: https://preprod.midnightexplorer.com/transactions/311bfb859032f9fa5c1391eaf7055ff5e3956d418fbbdfd9fcd0e564dee17eda
|
|
43
|
+
- XRPL escrow released after that proof: https://testnet.xrpl.org/transactions/A289E64FA9FCB6F6CBD70AD6F86F2D3556B0444726A3425087423DF3315D40AE
|
|
44
|
+
|
|
45
|
+
## Not included
|
|
46
|
+
|
|
47
|
+
| Item | Status |
|
|
48
|
+
|---|---|
|
|
49
|
+
| Midnight **mainnet** SDK `submitOnChain` | Not shipped. Contracts are deployed on mainnet (see above); the SDK `submitOnChain` path is Preprod only. Unaudited. Not for real value. |
|
|
50
|
+
| Hosted proof relay / monitoring SaaS | Not built. Self-host the proof server (see `docs/proof-server.md`). |
|
|
51
|
+
| Registered domain | **corvuszk.com** registered (Porkbun, paid through 5 Nov 2027). Trademark not filed. |
|
|
52
|
+
| Wallet seeds, Blockfrost project IDs, or other secrets | Never ship in this package. Set `BLOCKFROST_MIDNIGHT_PREPROD` yourself. |
|
|
53
|
+
| Custodial service or money movement | Deliberately out of scope. XRP stays in the payer's own XRPL escrow. |
|
|
54
|
+
| Regulated KYC / XRPL Credential object | Not shipped. The eligibility example is a labeled mock. |
|
|
55
|
+
| XRPL-enforced Midnight proof | Not shipped. XRPL checks the crypto-condition preimage only. |
|
|
56
|
+
|
|
57
|
+
## Two backends (know the difference)
|
|
58
|
+
|
|
59
|
+
- **`LocalSimulationBackend`** — signed attestation for local/dev. **Not zero-knowledge.** Fine for learning the escrow flow.
|
|
60
|
+
- **`MidnightBackend`** — real Compact circuits (`mode: 'local-circuits'` by default). `mode: 'preprod'` attaches live contract addresses. **`submitOnChain`** posts a new Preprod `callTx` against the 11 Nov ledger 9 deployments when a proof server + funded synced wallet with DUST are available (fails fast otherwise; default sync cap 90s).
|
|
61
|
+
|
|
62
|
+
## Try it in 5 minutes (no money)
|
|
63
|
+
|
|
64
|
+
Requires Node 22.18+ for the local Compact circuits and tests (Node 24 in CI). The SDK alone can run on Node 20+.
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
npm install && npm run build
|
|
68
|
+
npm run demo:offline
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Optional next steps:
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
npm test # unit tests + one live XRPL testnet escrow test
|
|
75
|
+
cd midnight && npm ci && cd .. && npm run simulate # real Compact circuits locally
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
On-chain submit (needs your Blockfrost token, Docker proof server, funded Preprod wallet — see `docs/on-chain-submit.md`):
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
cd midnight && node submit-onchain.mjs --template age_over --dry-run
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Licence
|
|
85
|
+
|
|
86
|
+
Apache-2.0. See `README.md` for dependency licences.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
pragma language_version >= 0.16;
|
|
2
|
+
import CompactStandardLibrary;
|
|
3
|
+
// Prove age >= minAge without revealing birth year.
|
|
4
|
+
export ledger minAge: Uint<16>;
|
|
5
|
+
export ledger asOfYear: Uint<16>;
|
|
6
|
+
export ledger birthCommit: Bytes<32>;
|
|
7
|
+
export ledger proven: Boolean;
|
|
8
|
+
witness birthYear(): Uint<16>;
|
|
9
|
+
witness salt(): Bytes<32>;
|
|
10
|
+
constructor(m: Uint<16>, y: Uint<16>, c: Bytes<32>) { minAge = disclose(m); asOfYear = disclose(y); birthCommit = disclose(c); proven = false; }
|
|
11
|
+
export circuit prove(): [] {
|
|
12
|
+
const by = birthYear();
|
|
13
|
+
assert(persistentHash<Vector<2, Bytes<32>>>([salt(), by as Field as Bytes<32>]) == birthCommit, "commitment mismatch");
|
|
14
|
+
assert(by + minAge <= asOfYear, "under age");
|
|
15
|
+
proven = true;
|
|
16
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
pragma language_version >= 0.16;
|
|
2
|
+
import CompactStandardLibrary;
|
|
3
|
+
// Prove a private balance exceeds a public threshold, bound to a public commitment.
|
|
4
|
+
export ledger threshold: Uint<64>;
|
|
5
|
+
export ledger balanceCommit: Bytes<32>;
|
|
6
|
+
export ledger proven: Boolean;
|
|
7
|
+
witness balance(): Uint<64>;
|
|
8
|
+
witness salt(): Bytes<32>;
|
|
9
|
+
constructor(t: Uint<64>, c: Bytes<32>) { threshold = disclose(t); balanceCommit = disclose(c); proven = false; }
|
|
10
|
+
export circuit prove(): [] {
|
|
11
|
+
const b = balance();
|
|
12
|
+
assert(persistentHash<Vector<2, Bytes<32>>>([salt(), b as Field as Bytes<32>]) == balanceCommit, "commitment mismatch");
|
|
13
|
+
assert(b > threshold, "balance not above threshold");
|
|
14
|
+
proven = true;
|
|
15
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
pragma language_version >= 0.16;
|
|
2
|
+
import CompactStandardLibrary;
|
|
3
|
+
// Private delivery attestation gate for an XRPL escrow.
|
|
4
|
+
// attesterCommit = persistentHash(attesterSecret); escrowId binds to XRPL Owner+OfferSequence.
|
|
5
|
+
export ledger attesterCommit: Bytes<32>;
|
|
6
|
+
export ledger escrowId: Bytes<32>;
|
|
7
|
+
export ledger released: Boolean;
|
|
8
|
+
witness attesterSecret(): Bytes<32>;
|
|
9
|
+
witness deliveryOk(): Boolean;
|
|
10
|
+
constructor(commit: Bytes<32>, id: Bytes<32>) {
|
|
11
|
+
attesterCommit = disclose(commit);
|
|
12
|
+
escrowId = disclose(id);
|
|
13
|
+
released = false;
|
|
14
|
+
}
|
|
15
|
+
export circuit attest(): [] {
|
|
16
|
+
assert(!released, "already released");
|
|
17
|
+
const s = attesterSecret();
|
|
18
|
+
assert(persistentHash<Bytes<32>>(s) == attesterCommit, "not the attester");
|
|
19
|
+
assert(deliveryOk(), "condition not met");
|
|
20
|
+
released = true;
|
|
21
|
+
}
|