@orbinum/circuits 0.3.0

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 ADDED
@@ -0,0 +1,17 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ Copyright 2026 Orbinum Team
6
+
7
+ Licensed under the Apache License, Version 2.0 (the "License");
8
+ you may not use this file except in compliance with the License.
9
+ You may obtain a copy of the License at
10
+
11
+ http://www.apache.org/licenses/LICENSE-2.0
12
+
13
+ Unless required by applicable law or agreed to in writing, software
14
+ distributed under the License is distributed on an "AS IS" BASIS,
15
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ See the License for the specific language governing permissions and
17
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,130 @@
1
+ # @orbinum/circuits
2
+
3
+ Zero-Knowledge circuits for Orbinum privacy blockchain. This package contains compiled circuit artifacts for proof generation and verification.
4
+
5
+ [![npm version](https://img.shields.io/npm/v/@orbinum/circuits.svg)](https://www.npmjs.com/package/@orbinum/circuits)
6
+ [![License](https://img.shields.io/badge/license-GPL--3.0-blue)](https://github.com/orbinum/circuits/blob/main/LICENSE)
7
+
8
+ ## 🚀 Installation
9
+
10
+ ```bash
11
+ npm install @orbinum/circuits
12
+ ```
13
+
14
+ ## 📦 Package Contents
15
+
16
+ This package includes **12 files** for 3 circuits (disclosure, transfer, unshield):
17
+
18
+ ### For Each Circuit (disclosure, transfer, unshield):
19
+
20
+ 1. **`{circuit}.wasm`** - Witness calculator (3 files)
21
+ 2. **`{circuit}_pk.zkey`** - Proving key for snarkjs (3 files)
22
+ 3. **`{circuit}_pk.ark`** - Proving key for arkworks/Rust (3 files)
23
+ 4. **`verification_key_{circuit}.json`** - Verification key for on-chain verification (3 files)
24
+
25
+ ## 🔧 Usage
26
+
27
+ ### With snarkjs (JavaScript/TypeScript)
28
+
29
+ ```typescript
30
+ import { join } from "path";
31
+ import { readFileSync } from "fs";
32
+
33
+ // Get circuit artifacts
34
+ const circuitsPath = require.resolve("@orbinum/circuits/package.json").replace("package.json", "");
35
+
36
+ // Load WASM witness calculator
37
+ const wasmPath = join(circuitsPath, "transfer.wasm");
38
+ const wasmBuffer = readFileSync(wasmPath);
39
+
40
+ // Load proving key (.zkey)
41
+ const zkeyPath = join(circuitsPath, "transfer_pk.zkey");
42
+ const zkeyBuffer = readFileSync(zkeyPath);
43
+
44
+ // Use with snarkjs for proof generation
45
+ // ... snarkjs proof generation code ...
46
+ ```
47
+
48
+ ### With arkworks (Rust)
49
+
50
+ ```rust
51
+ use std::fs::File;
52
+ use ark_circom::read_zkey;
53
+
54
+ // Load proving key (.ark format)
55
+ let mut ark_file = File::open("transfer_pk.ark")?;
56
+ let proving_key = read_proving_key(&mut ark_file)?;
57
+
58
+ // Use for proof generation
59
+ // ... arkworks proof generation code ...
60
+ ```
61
+
62
+ ### Verification Keys (On-chain)
63
+
64
+ ```typescript
65
+ import verificationKey from "@orbinum/circuits/verification_key_transfer.json";
66
+
67
+ // Use for on-chain verification in Substrate runtime
68
+ // The JSON contains the verification key in a format ready for the runtime
69
+ ```
70
+
71
+ ## 📋 Available Circuits
72
+
73
+ ### 1. **Disclosure** (`disclosure_*`)
74
+
75
+ Selective disclosure circuit for privacy-preserving attribute revelation.
76
+
77
+ ### 2. **Transfer** (`transfer_*`)
78
+
79
+ Private token transfer circuit with 2 inputs and 2 outputs.
80
+
81
+ ### 3. **Unshield** (`unshield_*`)
82
+
83
+ Withdrawal circuit from private pool to public account.
84
+
85
+ ## 🔗 Related Packages
86
+
87
+ - [@orbinum/proof-generator](https://www.npmjs.com/package/@orbinum/proof-generator) - High-level proof orchestrator
88
+ - [@orbinum/groth16-proofs](https://www.npmjs.com/package/@orbinum/groth16-proofs) - Arkworks WASM proof generator
89
+
90
+ ## 💡 Usage Example with @orbinum/proof-generator
91
+
92
+ ```typescript
93
+ import { generateProof, CircuitType } from "@orbinum/proof-generator";
94
+
95
+ // Proof generator automatically loads circuits from @orbinum/circuits
96
+ const result = await generateProof(CircuitType.Transfer, witnessInputs, numPublicSignals);
97
+
98
+ console.log("Proof:", result.proof);
99
+ console.log("Public signals:", result.publicSignals);
100
+ ```
101
+
102
+ ## 📄 File Sizes
103
+
104
+ - **WASM files**: ~1-2 MB each (witness calculators)
105
+ - **`.zkey` files**: ~7-9 MB each (snarkjs proving keys)
106
+ - **`.ark` files**: ~7-9 MB each (arkworks proving keys)
107
+ - **Verification keys**: ~3-4 KB each (JSON)
108
+
109
+ **Total package size**: ~50-60 MB
110
+
111
+ ## 🔒 Security Notice
112
+
113
+ ⚠️ **Important**: These circuit artifacts are for **testing and development only**.
114
+
115
+ For production deployment, a **multi-party trusted setup ceremony** is required to generate secure proving/verification keys.
116
+
117
+ ## 📖 Circuit Specifications
118
+
119
+ For detailed circuit specifications, constraints, and integration guides:
120
+
121
+ - [Circuit Documentation](https://github.com/orbinum/circuits/tree/main/docs)
122
+ - [Integration Guide](https://github.com/orbinum/circuits/blob/main/docs/INTEGRATION.md)
123
+
124
+ ## 🐛 Issues
125
+
126
+ Report issues at: https://github.com/orbinum/circuits/issues
127
+
128
+ ## 📄 License
129
+
130
+ GPL-3.0 - See [LICENSE](https://github.com/orbinum/circuits/blob/main/LICENSE)
Binary file
Binary file
Binary file
package/index.d.ts ADDED
@@ -0,0 +1,24 @@
1
+ /**
2
+ * @orbinum/circuits - Circuit artifacts index
3
+ *
4
+ * Helper functions to load circuit artifacts
5
+ */
6
+
7
+ export interface CircuitPaths {
8
+ wasm: string;
9
+ zkey: string;
10
+ ark: string;
11
+ verificationKey: string;
12
+ }
13
+
14
+ /**
15
+ * Get paths to all files for a specific circuit
16
+ */
17
+ export function getCircuitPaths(circuit: "disclosure" | "transfer" | "unshield"): CircuitPaths;
18
+
19
+ /**
20
+ * Available circuits
21
+ */
22
+ export type CircuitType = "disclosure" | "transfer" | "unshield";
23
+
24
+ export const CIRCUITS: CircuitType[];
package/index.js ADDED
@@ -0,0 +1,34 @@
1
+ /**
2
+ * @orbinum/circuits - Circuit artifacts index
3
+ *
4
+ * Helper functions to load circuit artifacts
5
+ */
6
+
7
+ const { join } = require("path");
8
+
9
+ const CIRCUITS = ["disclosure", "transfer", "unshield"];
10
+
11
+ /**
12
+ * Get paths to all files for a specific circuit
13
+ * @param {string} circuit - Circuit name: 'disclosure', 'transfer', or 'unshield'
14
+ * @returns {Object} Paths to circuit files
15
+ */
16
+ function getCircuitPaths(circuit) {
17
+ if (!CIRCUITS.includes(circuit)) {
18
+ throw new Error(`Invalid circuit: ${circuit}. Must be one of: ${CIRCUITS.join(", ")}`);
19
+ }
20
+
21
+ const basePath = __dirname;
22
+
23
+ return {
24
+ wasm: join(basePath, `${circuit}.wasm`),
25
+ zkey: join(basePath, `${circuit}_pk.zkey`),
26
+ ark: join(basePath, `${circuit}_pk.ark`),
27
+ verificationKey: join(basePath, `verification_key_${circuit}.json`),
28
+ };
29
+ }
30
+
31
+ module.exports = {
32
+ getCircuitPaths,
33
+ CIRCUITS,
34
+ };
package/package.json ADDED
@@ -0,0 +1,38 @@
1
+ {
2
+ "name": "@orbinum/circuits",
3
+ "version": "0.3.0",
4
+ "description": "Zero-Knowledge circuits for Orbinum privacy blockchain",
5
+ "main": "index.js",
6
+ "types": "index.d.ts",
7
+ "files": [
8
+ "*.wasm",
9
+ "*.zkey",
10
+ "*.ark",
11
+ "*.json",
12
+ "index.js",
13
+ "index.d.ts",
14
+ "LICENSE"
15
+ ],
16
+ "keywords": [
17
+ "zk-snark",
18
+ "groth16",
19
+ "circom",
20
+ "circuits",
21
+ "privacy",
22
+ "orbinum",
23
+ "zero-knowledge"
24
+ ],
25
+ "author": "Orbinum",
26
+ "license": "GPL-3.0",
27
+ "repository": {
28
+ "type": "git",
29
+ "url": "https://github.com/orbinum/circuits"
30
+ },
31
+ "homepage": "https://github.com/orbinum/circuits",
32
+ "publishConfig": {
33
+ "access": "public"
34
+ },
35
+ "engines": {
36
+ "node": ">=18.0.0"
37
+ }
38
+ }
package/transfer.wasm ADDED
Binary file
Binary file
Binary file
package/unshield.wasm ADDED
Binary file
Binary file
Binary file
@@ -0,0 +1,109 @@
1
+ {
2
+ "protocol": "groth16",
3
+ "curve": "bn128",
4
+ "nPublic": 4,
5
+ "vk_alpha_1": [
6
+ "20491192805390485299153009773594534940189261866228447918068658471970481763042",
7
+ "9383485363053290200918347156157836566562967994039712273449902621266178545958",
8
+ "1"
9
+ ],
10
+ "vk_beta_2": [
11
+ [
12
+ "6375614351688725206403948262868962793625744043794305715222011528459656738731",
13
+ "4252822878758300859123897981450591353533073413197771768651442665752259397132"
14
+ ],
15
+ [
16
+ "10505242626370262277552901082094356697409835680220590971873171140371331206856",
17
+ "21847035105528745403288232691147584728191162732299865338377159692350059136679"
18
+ ],
19
+ [
20
+ "1",
21
+ "0"
22
+ ]
23
+ ],
24
+ "vk_gamma_2": [
25
+ [
26
+ "10857046999023057135944570762232829481370756359578518086990519993285655852781",
27
+ "11559732032986387107991004021392285783925812861821192530917403151452391805634"
28
+ ],
29
+ [
30
+ "8495653923123431417604973247489272438418190587263600148770280649306958101930",
31
+ "4082367875863433681332203403145435568316851327593401208105741076214120093531"
32
+ ],
33
+ [
34
+ "1",
35
+ "0"
36
+ ]
37
+ ],
38
+ "vk_delta_2": [
39
+ [
40
+ "17181498531159263629882165870813697779346883078645466145783271498545766806464",
41
+ "4103758893379416054048842959380474068052324667650307530147789116301376054674"
42
+ ],
43
+ [
44
+ "17240782462632988568877834665875325743663801812824474063393589053354835026260",
45
+ "10727175232410694244198044736795714331219651403982597624913437252546529983481"
46
+ ],
47
+ [
48
+ "1",
49
+ "0"
50
+ ]
51
+ ],
52
+ "vk_alphabeta_12": [
53
+ [
54
+ [
55
+ "2029413683389138792403550203267699914886160938906632433982220835551125967885",
56
+ "21072700047562757817161031222997517981543347628379360635925549008442030252106"
57
+ ],
58
+ [
59
+ "5940354580057074848093997050200682056184807770593307860589430076672439820312",
60
+ "12156638873931618554171829126792193045421052652279363021382169897324752428276"
61
+ ],
62
+ [
63
+ "7898200236362823042373859371574133993780991612861777490112507062703164551277",
64
+ "7074218545237549455313236346927434013100842096812539264420499035217050630853"
65
+ ]
66
+ ],
67
+ [
68
+ [
69
+ "7077479683546002997211712695946002074877511277312570035766170199895071832130",
70
+ "10093483419865920389913245021038182291233451549023025229112148274109565435465"
71
+ ],
72
+ [
73
+ "4595479056700221319381530156280926371456704509942304414423590385166031118820",
74
+ "19831328484489333784475432780421641293929726139240675179672856274388269393268"
75
+ ],
76
+ [
77
+ "11934129596455521040620786944827826205713621633706285934057045369193958244500",
78
+ "8037395052364110730298837004334506829870972346962140206007064471173334027475"
79
+ ]
80
+ ]
81
+ ],
82
+ "IC": [
83
+ [
84
+ "15964950830910202244217667436665733776997447861553802623999698138484110595957",
85
+ "1040079402286714073647109609323335894210500907477000571792043915719024030224",
86
+ "1"
87
+ ],
88
+ [
89
+ "3340210474460277437662732981813692576850795858372732555286041366326257354427",
90
+ "9836565355755721050636876037692518662635375900213403984966267475206475658524",
91
+ "1"
92
+ ],
93
+ [
94
+ "12060419398997673887064863238328225795227850230778535632787590613985993920427",
95
+ "5881790740170267272776729282842338197965403298580720322757247992346504212644",
96
+ "1"
97
+ ],
98
+ [
99
+ "14940581636929495647429694768793509851524492245737760358779578356534185051021",
100
+ "8199470560675183315870564454703278914683812654862355184904152407412888877972",
101
+ "1"
102
+ ],
103
+ [
104
+ "10409564891268817626963180756840234046972055191382429263672757341041082599476",
105
+ "20153095266914888386311759097574228223575358889458887322529392137999194059340",
106
+ "1"
107
+ ]
108
+ ]
109
+ }
@@ -0,0 +1,114 @@
1
+ {
2
+ "protocol": "groth16",
3
+ "curve": "bn128",
4
+ "nPublic": 5,
5
+ "vk_alpha_1": [
6
+ "20491192805390485299153009773594534940189261866228447918068658471970481763042",
7
+ "9383485363053290200918347156157836566562967994039712273449902621266178545958",
8
+ "1"
9
+ ],
10
+ "vk_beta_2": [
11
+ [
12
+ "6375614351688725206403948262868962793625744043794305715222011528459656738731",
13
+ "4252822878758300859123897981450591353533073413197771768651442665752259397132"
14
+ ],
15
+ [
16
+ "10505242626370262277552901082094356697409835680220590971873171140371331206856",
17
+ "21847035105528745403288232691147584728191162732299865338377159692350059136679"
18
+ ],
19
+ [
20
+ "1",
21
+ "0"
22
+ ]
23
+ ],
24
+ "vk_gamma_2": [
25
+ [
26
+ "10857046999023057135944570762232829481370756359578518086990519993285655852781",
27
+ "11559732032986387107991004021392285783925812861821192530917403151452391805634"
28
+ ],
29
+ [
30
+ "8495653923123431417604973247489272438418190587263600148770280649306958101930",
31
+ "4082367875863433681332203403145435568316851327593401208105741076214120093531"
32
+ ],
33
+ [
34
+ "1",
35
+ "0"
36
+ ]
37
+ ],
38
+ "vk_delta_2": [
39
+ [
40
+ "13240232876868386494108652779817474952316318952810878973254412692911558867632",
41
+ "16347590663521732394025581272898538630471281498601579993469941176971924600386"
42
+ ],
43
+ [
44
+ "13557005240656553772818805810517429799550918083210432911140321093840076700542",
45
+ "14700656657294163774759001919282652049154398781032001485800913171547479111289"
46
+ ],
47
+ [
48
+ "1",
49
+ "0"
50
+ ]
51
+ ],
52
+ "vk_alphabeta_12": [
53
+ [
54
+ [
55
+ "2029413683389138792403550203267699914886160938906632433982220835551125967885",
56
+ "21072700047562757817161031222997517981543347628379360635925549008442030252106"
57
+ ],
58
+ [
59
+ "5940354580057074848093997050200682056184807770593307860589430076672439820312",
60
+ "12156638873931618554171829126792193045421052652279363021382169897324752428276"
61
+ ],
62
+ [
63
+ "7898200236362823042373859371574133993780991612861777490112507062703164551277",
64
+ "7074218545237549455313236346927434013100842096812539264420499035217050630853"
65
+ ]
66
+ ],
67
+ [
68
+ [
69
+ "7077479683546002997211712695946002074877511277312570035766170199895071832130",
70
+ "10093483419865920389913245021038182291233451549023025229112148274109565435465"
71
+ ],
72
+ [
73
+ "4595479056700221319381530156280926371456704509942304414423590385166031118820",
74
+ "19831328484489333784475432780421641293929726139240675179672856274388269393268"
75
+ ],
76
+ [
77
+ "11934129596455521040620786944827826205713621633706285934057045369193958244500",
78
+ "8037395052364110730298837004334506829870972346962140206007064471173334027475"
79
+ ]
80
+ ]
81
+ ],
82
+ "IC": [
83
+ [
84
+ "12521353044701549515327655017850372472462274389676752451261564850795277210784",
85
+ "17537427920533725255683527309076964578961889733887641292864968986005206833227",
86
+ "1"
87
+ ],
88
+ [
89
+ "9054540875357326821742569992875343778082451382872166255139682380736118336965",
90
+ "19145371190592659949158552383366523068893276589381638814741619309597554902109",
91
+ "1"
92
+ ],
93
+ [
94
+ "4742393298120554619433281305566496971436669707311583698440427823952632276050",
95
+ "3877416000326877112020382111726729873163167304724326109191809999398145068082",
96
+ "1"
97
+ ],
98
+ [
99
+ "13596656322317975043597922138537730020108978263529423575433634179437267442285",
100
+ "9742436487435369435567344764161265311134349467077942742196530523569923539419",
101
+ "1"
102
+ ],
103
+ [
104
+ "10688916237036738808967339930842102783882829011167399097753073924876231581798",
105
+ "15541123047651505099565506020079072290645702361358638026159150320227489549290",
106
+ "1"
107
+ ],
108
+ [
109
+ "10594341809050651078348790198511832237136162370751007990030736876706319494726",
110
+ "8811599578125639162916289173502210672259754599803755307954551465982761005752",
111
+ "1"
112
+ ]
113
+ ]
114
+ }
@@ -0,0 +1,114 @@
1
+ {
2
+ "protocol": "groth16",
3
+ "curve": "bn128",
4
+ "nPublic": 5,
5
+ "vk_alpha_1": [
6
+ "20491192805390485299153009773594534940189261866228447918068658471970481763042",
7
+ "9383485363053290200918347156157836566562967994039712273449902621266178545958",
8
+ "1"
9
+ ],
10
+ "vk_beta_2": [
11
+ [
12
+ "6375614351688725206403948262868962793625744043794305715222011528459656738731",
13
+ "4252822878758300859123897981450591353533073413197771768651442665752259397132"
14
+ ],
15
+ [
16
+ "10505242626370262277552901082094356697409835680220590971873171140371331206856",
17
+ "21847035105528745403288232691147584728191162732299865338377159692350059136679"
18
+ ],
19
+ [
20
+ "1",
21
+ "0"
22
+ ]
23
+ ],
24
+ "vk_gamma_2": [
25
+ [
26
+ "10857046999023057135944570762232829481370756359578518086990519993285655852781",
27
+ "11559732032986387107991004021392285783925812861821192530917403151452391805634"
28
+ ],
29
+ [
30
+ "8495653923123431417604973247489272438418190587263600148770280649306958101930",
31
+ "4082367875863433681332203403145435568316851327593401208105741076214120093531"
32
+ ],
33
+ [
34
+ "1",
35
+ "0"
36
+ ]
37
+ ],
38
+ "vk_delta_2": [
39
+ [
40
+ "1545032554073779649356239631893752244649696827187815861670397162826183754931",
41
+ "20314999785314503565623024867913636156801164997066449897860768907774370581592"
42
+ ],
43
+ [
44
+ "9043720973115289314904265089531027469020347117089218856801223721531103662056",
45
+ "1731759157587106468048280763944125674612517726686059643642432234957314643786"
46
+ ],
47
+ [
48
+ "1",
49
+ "0"
50
+ ]
51
+ ],
52
+ "vk_alphabeta_12": [
53
+ [
54
+ [
55
+ "2029413683389138792403550203267699914886160938906632433982220835551125967885",
56
+ "21072700047562757817161031222997517981543347628379360635925549008442030252106"
57
+ ],
58
+ [
59
+ "5940354580057074848093997050200682056184807770593307860589430076672439820312",
60
+ "12156638873931618554171829126792193045421052652279363021382169897324752428276"
61
+ ],
62
+ [
63
+ "7898200236362823042373859371574133993780991612861777490112507062703164551277",
64
+ "7074218545237549455313236346927434013100842096812539264420499035217050630853"
65
+ ]
66
+ ],
67
+ [
68
+ [
69
+ "7077479683546002997211712695946002074877511277312570035766170199895071832130",
70
+ "10093483419865920389913245021038182291233451549023025229112148274109565435465"
71
+ ],
72
+ [
73
+ "4595479056700221319381530156280926371456704509942304414423590385166031118820",
74
+ "19831328484489333784475432780421641293929726139240675179672856274388269393268"
75
+ ],
76
+ [
77
+ "11934129596455521040620786944827826205713621633706285934057045369193958244500",
78
+ "8037395052364110730298837004334506829870972346962140206007064471173334027475"
79
+ ]
80
+ ]
81
+ ],
82
+ "IC": [
83
+ [
84
+ "4759917404823790432407520088534459023356590579383652181465364916912449624695",
85
+ "3832863574771841234331076301811290460934931101437953774708549890327258738564",
86
+ "1"
87
+ ],
88
+ [
89
+ "5336337706419091211868472399687230066131810167568242892809804587865519165344",
90
+ "11353185051357039508206677538186633821853103335512576778299092029039610062882",
91
+ "1"
92
+ ],
93
+ [
94
+ "15084681146036149779834232651527344012418671089935933939397885561760086121969",
95
+ "10673952063622217067979641197117245279252423258914282179285754313970092562596",
96
+ "1"
97
+ ],
98
+ [
99
+ "21039779822942533132271658631716796333199025786313218659510617689739394153598",
100
+ "11163282276070815586063767846812914624591347999168289386275553753092237495248",
101
+ "1"
102
+ ],
103
+ [
104
+ "3095712311814508041135867864726006035419219310141511809667041762596327080341",
105
+ "17159247848061658623919878194408282495395946967527260450426770075448330620486",
106
+ "1"
107
+ ],
108
+ [
109
+ "4168950959496505617599330781731644101559373119770356275626759863667568305184",
110
+ "5644689731760572677103844719463014317690882565098456772580613601327065049357",
111
+ "1"
112
+ ]
113
+ ]
114
+ }