├── .gitignore
├── LICENSE.txt
├── README.md
├── flureeConfig.json
├── package-lock.json
├── package.json
├── public
├── favicon.ico
├── index.html
├── logo192.png
├── logo512.png
├── manifest.json
├── queries.gif
├── robots.txt
├── vscode.gif
└── zero-knowledge.gif
├── resources
├── add_auth.json
├── alt-auth-keys.csv
├── example_queries.js
├── schema.json
└── seed.json
└── src
├── App.css
├── App.js
├── App.test.js
├── circuits
├── InRange.circom
├── InRange.json
├── input.json
├── proof.json
├── proving_key.json
├── public.json
├── verification_key.json
└── witness.json
├── flureeFetch.js
├── index.css
├── index.js
├── logo.svg
├── screens
├── GenProof.js
└── Verify.js
└── serviceWorker.js
/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.js
7 |
8 | # testing
9 | /coverage
10 |
11 | # production
12 | /build
13 |
14 | # misc
15 | .DS_Store
16 | .env.local
17 | .env.development.local
18 | .env.test.local
19 | .env.production.local
20 |
21 | npm-debug.log*
22 | yarn-debug.log*
23 | yarn-error.log*
24 |
25 | flureeResponse.txt
--------------------------------------------------------------------------------
/LICENSE.txt:
--------------------------------------------------------------------------------
1 | Copyright 2020 Fluree, PBC
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4 |
5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6 |
7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ## Legal Fishing
2 |
3 | This Github repo demonstrates how one could set up a Fluree ledger to use zero-knowledge proofs.
4 |
5 | In this example, Fluree is deployed as a backend data management platform in managing trusted data. The use-case is a simple example of:
6 |
7 | 1. the establishment of a dynamic zone where fishing is allowed
8 | 2. the ability for boats to input catch locations without disclosing where the catch was precisely made
9 | 3. the ability for a third party to validate that the fish was caught in an allowed zone, without disclosing their catch location
10 |
11 | Please check out the accompanying [blog post](https://flur.ee/2020/02/05/using-zero-knowledge-proofs-with-fluree/) and [video](https://youtu.be/LlBBaorIzgs) !
12 |
13 | Features demonstrated: zero knowledge proofs, data immutability, and traceability.
14 |
15 | 
16 |
17 | ### Get Started
18 |
19 | 1. `Start Fluree`
20 |
21 | Download and unzip this [Fluree packet](https://fluree-examples.s3.amazonaws.com/fluree-zero-knowledge-packet.zip). The packet contains Fluree, version 0.13.0, as well as a prepopulated database with the schema, seed data, and several example proofs (`resources/schema.json` and `resources/seed.json` have the schema and seed transaction, respectively).
22 |
23 | Navigate to the folder where you downloaded the packet, and run `./fluree_start.sh`. If you have Java 8+ installed, this should launch Fluree, and a Admin Console will be available for you to explore at `http://localhost:8080`. `resources/example_queries.js` has example queries you can test out directly in the Admin Console.
24 |
25 | 2. `Start the App`
26 |
27 | ```
28 | git clone https://github.com/fluree/legal-fishing.git
29 | ```
30 |
31 | ```
32 | cd legal-fishing
33 | ```
34 |
35 | ```
36 | npm install
37 | ```
38 |
39 | ```
40 | npm start
41 | ```
42 |
43 | ### How Does it Work
44 |
45 | Zero-knowledge proofs allow you to prove that your secret information fits certain parameters without sharing your secret information. We used Iden3's [circom](https://github.com/iden3/circomlib) to create the circuit used in this app, and Iden3's [snarkjs] to handle proof generation and verification.
46 |
47 | Please check out the accompanying [blog post](https://flur.ee/2020/02/05/using-zero-knowledge-proofs-with-fluree/) for more information about the zero knowledge proofs used in this example.
48 |
49 | #### Query to Get Circuit
50 |
51 | This app uses a single circuit, which we use to generate all the proofs. We store the circuit, proving key, and verification key in the `snarkConfig` collection under the `id` `legalFishing`. We use the below query to fetch the circuit and proving key.
52 |
53 | ```
54 | { "selectOne": ["?circuit", "?provingKey"],
55 | "where": [
56 | ["?snark", "snarkConfig/id", "legalFishing"],
57 | ["?snark", "snarkConfig/circuit", "?circuit"],
58 | ["?snark", "snarkConfig/provingKey", "?provingKey"]]
59 | }
60 | ```
61 |
62 | #### Transaction to Submit Proof
63 |
64 | The below transaction is used to create a new proof, and link that proof to the `snarkConfig`, which is storing the relevant circuit and keys.
65 |
66 | ```
67 | [{
68 | "_id": ["snarkConfig/id", "legalFishing"],
69 | "proofs": ["proof$1"]
70 | },
71 | {
72 | "_id": "proof$1",
73 | "proof": "PROOF HERE",
74 | "instant": "#(now)",
75 | "publicSignals": "PUBLIC SIGNALS HERE"
76 | }]
77 | ```
78 |
79 | #### Query to Get All Proofs Connected to the legalFishing Circuit
80 |
81 | The below query gets all the proofs that are connected to the legalFishing circuit.
82 |
83 | ```
84 | {
85 | "select": ["?proof", "?proofBody", "?publicSignals", "?verificationKey", "?instant"],
86 | "where": [
87 | ["?proof", "proof/proof", "?proofBody"],
88 | ["?proof", "proof/publicSignals", "?publicSignals"],
89 | ["?proof", "proof/instant", "?instant"],
90 | ["?config", "snarkConfig/id", "legalFishing"],
91 | ["?config", "snarkConfig/verificationKey", "?verificationKey"]
92 | ]
93 | }
94 | ```
95 |
96 | There are other example queries that you can try out in `/resources/example_queries.js`.
97 |
98 | 
99 |
100 | #### Visual Studio Code
101 | If you are using Visual Studio Code to view this repo, you can issue the example queries using the extension.
102 |
103 | 1. Download the `Fluree: Beta extension`. In the top menu bar, select `View` > `Extensions`. Then search `Fluree: Beta` and click install.
104 | 2. Open the Command Palette by going to `View` > `Command Palette`, and issue `Fluree: Set Config`.
105 | 3. Highlight any query in `resources/example_queries.js`, using the Command Palette, issue, `Fluree: Query`, and the results of the query will appear in a `flureeResponse.txt` file. Note: every time you issue a query or transaction, this file gets overwritten.
106 |
107 | 
108 |
109 | ### Resources
110 |
111 | To see more example projects, visit our [example repo](https://github.com/fluree/examples).
112 |
113 | This example also has an accompanying [blog post](https://flur.ee/2020/02/05/using-zero-knowledge-proofs-with-fluree/) and [video](https://youtu.be/LlBBaorIzgs).
114 |
115 |
116 | Check out our entire [documentation](https://docs.flur.ee/) or jump directly to the section on [full-text search](https://docs.flur.ee/docs/database-setup/database-settings#language).
117 |
118 | You can also engage with us via email, `support@flur.ee`.
119 |
120 | Or by [Slack](https://launchpass.com/flureedb).
121 |
122 |
123 |
--------------------------------------------------------------------------------
/flureeConfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "ip": "http://localhost:8080",
3 | "network": "legal",
4 | "db": "fishing"
5 | }
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "legal-fishing",
3 | "version": "0.1.0",
4 | "private": true,
5 | "dependencies": {
6 | "@testing-library/jest-dom": "^4.2.4",
7 | "@testing-library/react": "^9.4.0",
8 | "@testing-library/user-event": "^7.2.1",
9 | "circomlib": "0.0.20",
10 | "interactjs": "^1.7.3",
11 | "isomorphic-fetch": "^2.2.1",
12 | "react": "^16.12.0",
13 | "react-bootstrap": "^1.0.0-beta.16",
14 | "react-dom": "^16.12.0",
15 | "react-scripts": "3.3.0",
16 | "snarkjs": "^0.1.20"
17 | },
18 | "scripts": {
19 | "start": "react-scripts start",
20 | "build": "react-scripts build",
21 | "test": "react-scripts test",
22 | "eject": "react-scripts eject"
23 | },
24 | "eslintConfig": {
25 | "extends": "react-app"
26 | },
27 | "browserslist": {
28 | "production": [
29 | ">0.2%",
30 | "not dead",
31 | "not op_mini all"
32 | ],
33 | "development": [
34 | "last 1 chrome version",
35 | "last 1 firefox version",
36 | "last 1 safari version"
37 | ]
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fluree/example-zero-knowledge/e7a2d7c5dae1533d53fbcbe1c424f163bb14b9bd/public/favicon.ico
--------------------------------------------------------------------------------
/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
12 |
13 |
17 |
18 |
24 |
33 | React App
34 |
35 |
36 | You need to enable JavaScript to run this app.
37 |
38 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/public/logo192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fluree/example-zero-knowledge/e7a2d7c5dae1533d53fbcbe1c424f163bb14b9bd/public/logo192.png
--------------------------------------------------------------------------------
/public/logo512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fluree/example-zero-knowledge/e7a2d7c5dae1533d53fbcbe1c424f163bb14b9bd/public/logo512.png
--------------------------------------------------------------------------------
/public/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "short_name": "React App",
3 | "name": "Create React App Sample",
4 | "icons": [
5 | {
6 | "src": "favicon.ico",
7 | "sizes": "64x64 32x32 24x24 16x16",
8 | "type": "image/x-icon"
9 | },
10 | {
11 | "src": "logo192.png",
12 | "type": "image/png",
13 | "sizes": "192x192"
14 | },
15 | {
16 | "src": "logo512.png",
17 | "type": "image/png",
18 | "sizes": "512x512"
19 | }
20 | ],
21 | "start_url": ".",
22 | "display": "standalone",
23 | "theme_color": "#000000",
24 | "background_color": "#ffffff"
25 | }
26 |
--------------------------------------------------------------------------------
/public/queries.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fluree/example-zero-knowledge/e7a2d7c5dae1533d53fbcbe1c424f163bb14b9bd/public/queries.gif
--------------------------------------------------------------------------------
/public/robots.txt:
--------------------------------------------------------------------------------
1 | # https://www.robotstxt.org/robotstxt.html
2 | User-agent: *
3 |
--------------------------------------------------------------------------------
/public/vscode.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fluree/example-zero-knowledge/e7a2d7c5dae1533d53fbcbe1c424f163bb14b9bd/public/vscode.gif
--------------------------------------------------------------------------------
/public/zero-knowledge.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fluree/example-zero-knowledge/e7a2d7c5dae1533d53fbcbe1c424f163bb14b9bd/public/zero-knowledge.gif
--------------------------------------------------------------------------------
/resources/add_auth.json:
--------------------------------------------------------------------------------
1 | [
2 | {
3 | "_id": "_auth",
4 | "id": "Tf44rUrCADcT4uDDAXUttcB2dgFiNsmcEjm",
5 | "roles": [
6 | [
7 | "_role/id",
8 | "root"
9 | ]
10 | ]
11 | }
12 | ]
--------------------------------------------------------------------------------
/resources/alt-auth-keys.csv:
--------------------------------------------------------------------------------
1 | Public Key,Private Key,Auth Id
2 | 0263e7a6ef71a2d508da1ab9e9e4646ff54dbaeca39ed9fb8a8dd447e06161f8de,1ccca82da13fbe246175446cc86aaeddc61df31753ba83eb5e2a615ce2fa9c81,Tf44rUrCADcT4uDDAXUttcB2dgFiNsmcEjm
--------------------------------------------------------------------------------
/resources/example_queries.js:
--------------------------------------------------------------------------------
1 | // 1. Query to get circuit
2 | // This query first finds the `snarkConfig` with id, `legalFishing`,
3 | // and then follows that relationship to get the config's circuit and proving key.
4 |
5 | const getCircuit =
6 | { "selectOne": ["?circuit", "?provingKey"],
7 | "where": [
8 | ["?snark", "snarkConfig/id", "legalFishing"],
9 | ["?snark", "snarkConfig/circuit", "?circuit"],
10 | ["?snark", "snarkConfig/provingKey", "?provingKey"]]
11 | }
12 |
13 | // 2. Get proofs submitted by `Tf44rUrCADcT4uDDAXUttcB2dgFiNsmcEjm`
14 | // Must be submitted to the /history endpoint (in the UI select "History" in the central drop-down)
15 |
16 | const history =
17 | {
18 | "history": [null, "proof/proof"],
19 | "auth": ["Tf44rUrCADcT4uDDAXUttcB2dgFiNsmcEjm"],
20 | "pretty-print": true
21 | }
22 |
23 | // 3. Proofs in One Location
24 | // Select all proofs with the same legal fishing
25 |
26 | const same_location =
27 | {
28 | "select": { "?proof": ["*"] },
29 | "where": [
30 | ["?proof", "proof/publicSignals", "[\"1\",\"16\",\"42\",\"0\",\"41\"]"]
31 | ]
32 | }
--------------------------------------------------------------------------------
/resources/schema.json:
--------------------------------------------------------------------------------
1 | [{
2 | "_id": "_collection",
3 | "name": "snarkConfig"
4 | },
5 | {
6 | "_id": "_collection",
7 | "name": "proof"
8 | },
9 | {
10 | "_id": "_predicate",
11 | "name": "snarkConfig/id",
12 | "type": "string",
13 | "unique": true
14 | },
15 | {
16 | "_id": "_predicate",
17 | "name": "snarkConfig/circuit",
18 | "type": "json"
19 | },
20 | {
21 | "_id": "_predicate",
22 | "name": "snarkConfig/verificationKey",
23 | "type": "json"
24 | },
25 | {
26 | "_id": "_predicate",
27 | "name": "snarkConfig/provingKey",
28 | "type": "json"
29 | },
30 | {
31 | "_id": "_predicate",
32 | "name": "snarkConfig/proofs",
33 | "type": "ref",
34 | "restrictCollection": "proof",
35 | "multi": true
36 | },
37 | {
38 | "_id": "_predicate",
39 | "name": "proof/id",
40 | "type": "string",
41 | "unique": true
42 | },
43 | {
44 | "_id": "_predicate",
45 | "name": "proof/proof",
46 | "type": "json"
47 | },
48 | {
49 | "_id": "_predicate",
50 | "name": "proof/publicSignals",
51 | "type": "json",
52 | "index": true
53 | },
54 | {
55 | "_id": "_predicate",
56 | "name": "proof/instant",
57 | "type": "instant"
58 | }]
--------------------------------------------------------------------------------
/src/App.css:
--------------------------------------------------------------------------------
1 | .App {
2 | text-align: center;
3 | }
4 |
5 | .App-logo {
6 | height: 40vmin;
7 | pointer-events: none;
8 | }
9 |
10 | @media (prefers-reduced-motion: no-preference) {
11 | .App-logo {
12 | animation: App-logo-spin infinite 20s linear;
13 | }
14 | }
15 |
16 | .App-header {
17 | background-color: #282c34;
18 | min-height: 100vh;
19 | display: flex;
20 | flex-direction: column;
21 | align-items: center;
22 | justify-content: center;
23 | font-size: calc(10px + 2vmin);
24 | color: white;
25 | }
26 |
27 | .App-link {
28 | color: #61dafb;
29 | }
30 |
31 | @keyframes App-logo-spin {
32 | from {
33 | transform: rotate(0deg);
34 | }
35 | to {
36 | transform: rotate(360deg);
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/src/App.js:
--------------------------------------------------------------------------------
1 | import React, { Component } from 'react';
2 | import './App.css';
3 | import { Row, Col, Alert, Button, ButtonGroup } from 'react-bootstrap';
4 |
5 | import GenProof from './screens/GenProof';
6 | import Verify from './screens/Verify';
7 |
8 | class Main extends Component {
9 | state = {
10 | view: "genProof"
11 | }
12 |
13 | render(){
14 | return(
15 |
16 |
17 |
18 | Fishing Secrets Demo
19 |
20 |
21 |
22 |
23 | Explore:
24 |
25 | this.setState({ view: "genProof"})}
26 | disabled={this.state.view === "genProof"}>Generate Proof
27 | this.setState({ view: "verify"})}
28 | disabled={this.state.view === "verify"}>Verify Proofs
29 |
30 |
31 |
32 |
33 |
34 |
35 | Make sure the database `legal/fishing` is running on `http://localhost:8080`, and that this database contains both the schema and the necessary items in snarkConfig (see the `seed` folder).
36 |
37 |
38 |
39 | {
40 | this.state.view === "genProof" &&
41 | }
42 | {
43 | this.state.view === "verify" &&
44 | }
45 |
46 | )
47 | }
48 |
49 | }
50 |
51 | export default Main;
52 |
--------------------------------------------------------------------------------
/src/App.test.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { render } from '@testing-library/react';
3 | import App from './App';
4 |
5 | test('renders learn react link', () => {
6 | const { getByText } = render( );
7 | const linkElement = getByText(/learn react/i);
8 | expect(linkElement).toBeInTheDocument();
9 | });
10 |
--------------------------------------------------------------------------------
/src/circuits/InRange.circom:
--------------------------------------------------------------------------------
1 | include "../../node_modules/circomlib/circuits/comparators.circom";
2 | include "../../node_modules/circomlib/circuits/bitify.circom";
3 |
4 | template InAuthorizedRange(){
5 |
6 | // Public inputs are the latitude and longitude ranges for an authorized fishing area.
7 | signal input latitudeRange[2]; // Ranging from 0 to 180. i.e. (20, 21)
8 | signal input longitudeRange[2]; // Ranging from 0 to 360 i.e. (76, 172)
9 |
10 | // The private input is the location where the fish was caught.
11 | // This is in the form (latitude, longitude)
12 | signal private input fishingLocation[2];
13 | signal output out; // 0 or 1
14 |
15 | // Max num bits would be 9. 2^9 = 512, which is greater than max longitude range, 360.
16 |
17 | // The fishing latitude has to be greater than or equal to
18 | // the min latitude of the authorized area
19 | component gt1 = GreaterEqThan(9);
20 | gt1.in[0] <== fishingLocation[0];
21 | gt1.in[1] <== latitudeRange[0];
22 | gt1.out === 1;
23 |
24 | out <-- gt1.out;
25 |
26 |
27 | // The fishing latitude has to be less than or equal to
28 | // the max latitude of the authorized area
29 | component lt1 = LessEqThan(9);
30 | lt1.in[0] <== fishingLocation[0];
31 | lt1.in[1] <== latitudeRange[1];
32 | lt1.out === 1;
33 |
34 | // The fishing longitude has to be greater than or equal to
35 | // the min longitude of the authorized area
36 | component gt2 = GreaterEqThan(9);
37 | gt2.in[0] <== fishingLocation[1];
38 | gt2.in[1] <== longitudeRange[0];
39 | gt2.out === 1;
40 |
41 | // The fishing longitude has to be less than or equal to
42 | // the max longitude of the authorized area
43 | component lt2 = LessEqThan(9);
44 | lt2.in[0] <== fishingLocation[1];
45 | lt2.in[1] <== longitudeRange[1];
46 | lt2.out === 1;
47 |
48 | out <-- (gt1.out + gt2.out + lt1.out + lt2.out) * 1/4;
49 | out === 1;
50 | }
51 |
52 | component main = InAuthorizedRange();
--------------------------------------------------------------------------------
/src/circuits/InRange.json:
--------------------------------------------------------------------------------
1 | {
2 | "mainCode": "{\n {\n {\n {\n {\n }\n }\n }\n {\n }\n }\n}\n",
3 | "signalName2Idx": {
4 | "one": 0,
5 | "main.latitudeRange[0]": 2,
6 | "main.latitudeRange[1]": 3,
7 | "main.longitudeRange[0]": 4,
8 | "main.longitudeRange[1]": 5,
9 | "main.fishingLocation[0]": 6,
10 | "main.fishingLocation[1]": 7,
11 | "main.out": 1,
12 | "main.gt1.in[0]": 6,
13 | "main.gt1.in[1]": 2,
14 | "main.gt1.out": 1,
15 | "main.gt1.lt.in[0]": 2,
16 | "main.gt1.lt.in[1]": 25,
17 | "main.gt1.lt.out": 1,
18 | "main.gt1.lt.n2b.in": 26,
19 | "main.gt1.lt.n2b.out[0]": 27,
20 | "main.gt1.lt.n2b.out[1]": 8,
21 | "main.gt1.lt.n2b.out[2]": 9,
22 | "main.gt1.lt.n2b.out[3]": 10,
23 | "main.gt1.lt.n2b.out[4]": 11,
24 | "main.gt1.lt.n2b.out[5]": 12,
25 | "main.gt1.lt.n2b.out[6]": 13,
26 | "main.gt1.lt.n2b.out[7]": 14,
27 | "main.gt1.lt.n2b.out[8]": 15,
28 | "main.gt1.lt.n2b.out[9]": 28,
29 | "main.gt1.lt.n2b.out[10]": 16,
30 | "main.gt1.lt.n2b.out[11]": 17,
31 | "main.gt1.lt.n2b.out[12]": 18,
32 | "main.gt1.lt.n2b.out[13]": 19,
33 | "main.gt1.lt.n2b.out[14]": 20,
34 | "main.gt1.lt.n2b.out[15]": 21,
35 | "main.gt1.lt.n2b.out[16]": 22,
36 | "main.gt1.lt.n2b.out[17]": 23,
37 | "main.gt1.lt.n2b.out[18]": 24
38 | },
39 | "components": [
40 | {
41 | "name": "main",
42 | "params": {},
43 | "template": "InAuthorizedRange",
44 | "inputSignals": 6
45 | },
46 | {
47 | "name": "main.gt1",
48 | "params": {
49 | "n": "9"
50 | },
51 | "template": "GreaterEqThan",
52 | "inputSignals": 2
53 | },
54 | {
55 | "name": "main.gt1.lt",
56 | "params": {
57 | "n": "9"
58 | },
59 | "template": "LessThan",
60 | "inputSignals": 2
61 | },
62 | {
63 | "name": "main.gt1.lt.n2b",
64 | "params": {
65 | "n": "19"
66 | },
67 | "template": "Num2Bits",
68 | "inputSignals": 1
69 | }
70 | ],
71 | "componentName2Idx": {
72 | "main": 0,
73 | "main.gt1": 1,
74 | "main.gt1.lt": 2,
75 | "main.gt1.lt.n2b": 3
76 | },
77 | "signals": [
78 | {
79 | "names": [
80 | "one"
81 | ],
82 | "triggerComponents": []
83 | },
84 | {
85 | "names": [
86 | "main.out",
87 | "main.gt1.out",
88 | "main.gt1.lt.out"
89 | ],
90 | "triggerComponents": []
91 | },
92 | {
93 | "names": [
94 | "main.latitudeRange[0]",
95 | "main.gt1.in[1]",
96 | "main.gt1.lt.in[0]"
97 | ],
98 | "triggerComponents": [
99 | 0,
100 | 1,
101 | 2
102 | ]
103 | },
104 | {
105 | "names": [
106 | "main.latitudeRange[1]"
107 | ],
108 | "triggerComponents": [
109 | 0
110 | ]
111 | },
112 | {
113 | "names": [
114 | "main.longitudeRange[0]"
115 | ],
116 | "triggerComponents": [
117 | 0
118 | ]
119 | },
120 | {
121 | "names": [
122 | "main.longitudeRange[1]"
123 | ],
124 | "triggerComponents": [
125 | 0
126 | ]
127 | },
128 | {
129 | "names": [
130 | "main.fishingLocation[0]",
131 | "main.gt1.in[0]"
132 | ],
133 | "triggerComponents": [
134 | 0,
135 | 1
136 | ]
137 | },
138 | {
139 | "names": [
140 | "main.fishingLocation[1]"
141 | ],
142 | "triggerComponents": [
143 | 0
144 | ]
145 | },
146 | {
147 | "names": [
148 | "main.gt1.lt.n2b.out[1]"
149 | ],
150 | "triggerComponents": []
151 | },
152 | {
153 | "names": [
154 | "main.gt1.lt.n2b.out[2]"
155 | ],
156 | "triggerComponents": []
157 | },
158 | {
159 | "names": [
160 | "main.gt1.lt.n2b.out[3]"
161 | ],
162 | "triggerComponents": []
163 | },
164 | {
165 | "names": [
166 | "main.gt1.lt.n2b.out[4]"
167 | ],
168 | "triggerComponents": []
169 | },
170 | {
171 | "names": [
172 | "main.gt1.lt.n2b.out[5]"
173 | ],
174 | "triggerComponents": []
175 | },
176 | {
177 | "names": [
178 | "main.gt1.lt.n2b.out[6]"
179 | ],
180 | "triggerComponents": []
181 | },
182 | {
183 | "names": [
184 | "main.gt1.lt.n2b.out[7]"
185 | ],
186 | "triggerComponents": []
187 | },
188 | {
189 | "names": [
190 | "main.gt1.lt.n2b.out[8]"
191 | ],
192 | "triggerComponents": []
193 | },
194 | {
195 | "names": [
196 | "main.gt1.lt.n2b.out[10]"
197 | ],
198 | "triggerComponents": []
199 | },
200 | {
201 | "names": [
202 | "main.gt1.lt.n2b.out[11]"
203 | ],
204 | "triggerComponents": []
205 | },
206 | {
207 | "names": [
208 | "main.gt1.lt.n2b.out[12]"
209 | ],
210 | "triggerComponents": []
211 | },
212 | {
213 | "names": [
214 | "main.gt1.lt.n2b.out[13]"
215 | ],
216 | "triggerComponents": []
217 | },
218 | {
219 | "names": [
220 | "main.gt1.lt.n2b.out[14]"
221 | ],
222 | "triggerComponents": []
223 | },
224 | {
225 | "names": [
226 | "main.gt1.lt.n2b.out[15]"
227 | ],
228 | "triggerComponents": []
229 | },
230 | {
231 | "names": [
232 | "main.gt1.lt.n2b.out[16]"
233 | ],
234 | "triggerComponents": []
235 | },
236 | {
237 | "names": [
238 | "main.gt1.lt.n2b.out[17]"
239 | ],
240 | "triggerComponents": []
241 | },
242 | {
243 | "names": [
244 | "main.gt1.lt.n2b.out[18]"
245 | ],
246 | "triggerComponents": []
247 | },
248 | {
249 | "names": [
250 | "main.gt1.lt.in[1]"
251 | ],
252 | "triggerComponents": [
253 | 2
254 | ]
255 | },
256 | {
257 | "names": [
258 | "main.gt1.lt.n2b.in"
259 | ],
260 | "triggerComponents": [
261 | 3
262 | ]
263 | },
264 | {
265 | "names": [
266 | "main.gt1.lt.n2b.out[0]"
267 | ],
268 | "triggerComponents": []
269 | },
270 | {
271 | "names": [
272 | "main.gt1.lt.n2b.out[9]"
273 | ],
274 | "triggerComponents": []
275 | }
276 | ],
277 | "constraints": [
278 | [
279 | {
280 | "0": "21888242871839275222246405745257275088548364400416034343698204186575808495616",
281 | "1": "512",
282 | "2": "1",
283 | "6": "21888242871839275222246405745257275088548364400416034343698204186575808495616",
284 | "8": "21888242871839275222246405745257275088548364400416034343698204186575808495615",
285 | "9": "21888242871839275222246405745257275088548364400416034343698204186575808495613",
286 | "10": "21888242871839275222246405745257275088548364400416034343698204186575808495609",
287 | "11": "21888242871839275222246405745257275088548364400416034343698204186575808495601",
288 | "12": "21888242871839275222246405745257275088548364400416034343698204186575808495585",
289 | "13": "21888242871839275222246405745257275088548364400416034343698204186575808495553",
290 | "14": "21888242871839275222246405745257275088548364400416034343698204186575808495489",
291 | "15": "21888242871839275222246405745257275088548364400416034343698204186575808495361",
292 | "16": "21888242871839275222246405745257275088548364400416034343698204186575808494593",
293 | "17": "21888242871839275222246405745257275088548364400416034343698204186575808493569",
294 | "18": "21888242871839275222246405745257275088548364400416034343698204186575808491521",
295 | "19": "21888242871839275222246405745257275088548364400416034343698204186575808487425",
296 | "20": "21888242871839275222246405745257275088548364400416034343698204186575808479233",
297 | "21": "21888242871839275222246405745257275088548364400416034343698204186575808462849",
298 | "22": "21888242871839275222246405745257275088548364400416034343698204186575808430081",
299 | "23": "21888242871839275222246405745257275088548364400416034343698204186575808364545",
300 | "24": "21888242871839275222246405745257275088548364400416034343698204186575808233473"
301 | },
302 | {
303 | "0": "21888242871839275222246405745257275088548364400416034343698204186575808495615",
304 | "1": "512",
305 | "2": "1",
306 | "6": "21888242871839275222246405745257275088548364400416034343698204186575808495616",
307 | "8": "21888242871839275222246405745257275088548364400416034343698204186575808495615",
308 | "9": "21888242871839275222246405745257275088548364400416034343698204186575808495613",
309 | "10": "21888242871839275222246405745257275088548364400416034343698204186575808495609",
310 | "11": "21888242871839275222246405745257275088548364400416034343698204186575808495601",
311 | "12": "21888242871839275222246405745257275088548364400416034343698204186575808495585",
312 | "13": "21888242871839275222246405745257275088548364400416034343698204186575808495553",
313 | "14": "21888242871839275222246405745257275088548364400416034343698204186575808495489",
314 | "15": "21888242871839275222246405745257275088548364400416034343698204186575808495361",
315 | "16": "21888242871839275222246405745257275088548364400416034343698204186575808494593",
316 | "17": "21888242871839275222246405745257275088548364400416034343698204186575808493569",
317 | "18": "21888242871839275222246405745257275088548364400416034343698204186575808491521",
318 | "19": "21888242871839275222246405745257275088548364400416034343698204186575808487425",
319 | "20": "21888242871839275222246405745257275088548364400416034343698204186575808479233",
320 | "21": "21888242871839275222246405745257275088548364400416034343698204186575808462849",
321 | "22": "21888242871839275222246405745257275088548364400416034343698204186575808430081",
322 | "23": "21888242871839275222246405745257275088548364400416034343698204186575808364545",
323 | "24": "21888242871839275222246405745257275088548364400416034343698204186575808233473"
324 | },
325 | {}
326 | ],
327 | [
328 | {
329 | "8": "1"
330 | },
331 | {
332 | "0": "21888242871839275222246405745257275088548364400416034343698204186575808495616",
333 | "8": "1"
334 | },
335 | {}
336 | ],
337 | [
338 | {
339 | "9": "1"
340 | },
341 | {
342 | "0": "21888242871839275222246405745257275088548364400416034343698204186575808495616",
343 | "9": "1"
344 | },
345 | {}
346 | ],
347 | [
348 | {
349 | "10": "1"
350 | },
351 | {
352 | "0": "21888242871839275222246405745257275088548364400416034343698204186575808495616",
353 | "10": "1"
354 | },
355 | {}
356 | ],
357 | [
358 | {
359 | "11": "1"
360 | },
361 | {
362 | "0": "21888242871839275222246405745257275088548364400416034343698204186575808495616",
363 | "11": "1"
364 | },
365 | {}
366 | ],
367 | [
368 | {
369 | "12": "1"
370 | },
371 | {
372 | "0": "21888242871839275222246405745257275088548364400416034343698204186575808495616",
373 | "12": "1"
374 | },
375 | {}
376 | ],
377 | [
378 | {
379 | "13": "1"
380 | },
381 | {
382 | "0": "21888242871839275222246405745257275088548364400416034343698204186575808495616",
383 | "13": "1"
384 | },
385 | {}
386 | ],
387 | [
388 | {
389 | "14": "1"
390 | },
391 | {
392 | "0": "21888242871839275222246405745257275088548364400416034343698204186575808495616",
393 | "14": "1"
394 | },
395 | {}
396 | ],
397 | [
398 | {
399 | "15": "1"
400 | },
401 | {
402 | "0": "21888242871839275222246405745257275088548364400416034343698204186575808495616",
403 | "15": "1"
404 | },
405 | {}
406 | ],
407 | [
408 | {
409 | "0": "1",
410 | "1": "21888242871839275222246405745257275088548364400416034343698204186575808495616"
411 | },
412 | {
413 | "1": "21888242871839275222246405745257275088548364400416034343698204186575808495616"
414 | },
415 | {}
416 | ],
417 | [
418 | {
419 | "16": "1"
420 | },
421 | {
422 | "0": "21888242871839275222246405745257275088548364400416034343698204186575808495616",
423 | "16": "1"
424 | },
425 | {}
426 | ],
427 | [
428 | {
429 | "17": "1"
430 | },
431 | {
432 | "0": "21888242871839275222246405745257275088548364400416034343698204186575808495616",
433 | "17": "1"
434 | },
435 | {}
436 | ],
437 | [
438 | {
439 | "18": "1"
440 | },
441 | {
442 | "0": "21888242871839275222246405745257275088548364400416034343698204186575808495616",
443 | "18": "1"
444 | },
445 | {}
446 | ],
447 | [
448 | {
449 | "19": "1"
450 | },
451 | {
452 | "0": "21888242871839275222246405745257275088548364400416034343698204186575808495616",
453 | "19": "1"
454 | },
455 | {}
456 | ],
457 | [
458 | {
459 | "20": "1"
460 | },
461 | {
462 | "0": "21888242871839275222246405745257275088548364400416034343698204186575808495616",
463 | "20": "1"
464 | },
465 | {}
466 | ],
467 | [
468 | {
469 | "21": "1"
470 | },
471 | {
472 | "0": "21888242871839275222246405745257275088548364400416034343698204186575808495616",
473 | "21": "1"
474 | },
475 | {}
476 | ],
477 | [
478 | {
479 | "22": "1"
480 | },
481 | {
482 | "0": "21888242871839275222246405745257275088548364400416034343698204186575808495616",
483 | "22": "1"
484 | },
485 | {}
486 | ],
487 | [
488 | {
489 | "23": "1"
490 | },
491 | {
492 | "0": "21888242871839275222246405745257275088548364400416034343698204186575808495616",
493 | "23": "1"
494 | },
495 | {}
496 | ],
497 | [
498 | {
499 | "24": "1"
500 | },
501 | {
502 | "0": "21888242871839275222246405745257275088548364400416034343698204186575808495616",
503 | "24": "1"
504 | },
505 | {}
506 | ],
507 | [
508 | {},
509 | {},
510 | {
511 | "0": "1",
512 | "1": "21888242871839275222246405745257275088548364400416034343698204186575808495616"
513 | }
514 | ]
515 | ],
516 | "templates": {
517 | "CompConstant": "function(ctx) {\n ctx.setVar(\"sum\", [], \"0\");\n ctx.setVar(\"b\", [], \"340282366920938463463374607431768211455\");\n ctx.setVar(\"a\", [], \"1\");\n ctx.setVar(\"e\", [], \"1\");\n for (ctx.setVar(\"i\", [], \"0\");bigInt(bigInt(ctx.getVar(\"i\",[])).lt(bigInt(\"127\")) ? 1 : 0).neq(bigInt(0));(ctx.setVar(\"i\", [], bigInt(ctx.getVar(\"i\",[])).add(bigInt(\"1\")).mod(__P__))).add(__P__).sub(bigInt(1)).mod(__P__)) { \n {\n ctx.setVar(\"clsb\", [], bigInt(bigInt(bigInt(ctx.getVar(\"i\",[])).mul(bigInt(\"2\")).mod(__P__)).greater(bigInt(256)) ? 0 : bigInt(ctx.getVar(\"ct\",[])).shr(bigInt(bigInt(ctx.getVar(\"i\",[])).mul(bigInt(\"2\")).mod(__P__))).and(__MASK__)).and(bigInt(\"1\")).and(__MASK__));\n ctx.setVar(\"cmsb\", [], bigInt(bigInt(bigInt(bigInt(ctx.getVar(\"i\",[])).mul(bigInt(\"2\")).mod(__P__)).add(bigInt(\"1\")).mod(__P__)).greater(bigInt(256)) ? 0 : bigInt(ctx.getVar(\"ct\",[])).shr(bigInt(bigInt(bigInt(ctx.getVar(\"i\",[])).mul(bigInt(\"2\")).mod(__P__)).add(bigInt(\"1\")).mod(__P__))).and(__MASK__)).and(bigInt(\"1\")).and(__MASK__));\n ctx.setVar(\"slsb\", [], ctx.getSignal(\"in\", [bigInt(ctx.getVar(\"i\",[])).mul(bigInt(\"2\")).mod(__P__)]));\n ctx.setVar(\"smsb\", [], ctx.getSignal(\"in\", [bigInt(bigInt(ctx.getVar(\"i\",[])).mul(bigInt(\"2\")).mod(__P__)).add(bigInt(\"1\")).mod(__P__)]));\n if (bigInt(bigInt((bigInt(ctx.getVar(\"cmsb\",[])).eq(bigInt(\"0\")) ? 1 : 0)).and(bigInt((bigInt(ctx.getVar(\"clsb\",[])).eq(bigInt(\"0\")) ? 1 : 0))).and(__MASK__)).neq(bigInt(0))) {\n {\n ctx.setSignal(\"parts\", [ctx.getVar(\"i\",[])], bigInt(bigInt(bigInt(bigInt(__P__.sub(bigInt(ctx.getVar(\"b\",[]))).mod(__P__)).mul(bigInt(ctx.getVar(\"smsb\",[]))).mod(__P__)).mul(bigInt(ctx.getVar(\"slsb\",[]))).mod(__P__)).add(bigInt(bigInt(ctx.getVar(\"b\",[])).mul(bigInt(ctx.getVar(\"smsb\",[]))).mod(__P__))).mod(__P__)).add(bigInt(bigInt(ctx.getVar(\"b\",[])).mul(bigInt(ctx.getVar(\"slsb\",[]))).mod(__P__))).mod(__P__));\n }\n\n } else {\n if (bigInt(bigInt((bigInt(ctx.getVar(\"cmsb\",[])).eq(bigInt(\"0\")) ? 1 : 0)).and(bigInt((bigInt(ctx.getVar(\"clsb\",[])).eq(bigInt(\"1\")) ? 1 : 0))).and(__MASK__)).neq(bigInt(0))) {\n {\n ctx.setSignal(\"parts\", [ctx.getVar(\"i\",[])], bigInt(bigInt(bigInt(bigInt(bigInt(bigInt(ctx.getVar(\"a\",[])).mul(bigInt(ctx.getVar(\"smsb\",[]))).mod(__P__)).mul(bigInt(ctx.getVar(\"slsb\",[]))).mod(__P__)).add(__P__).sub(bigInt(bigInt(ctx.getVar(\"a\",[])).mul(bigInt(ctx.getVar(\"slsb\",[]))).mod(__P__))).mod(__P__)).add(bigInt(bigInt(ctx.getVar(\"b\",[])).mul(bigInt(ctx.getVar(\"smsb\",[]))).mod(__P__))).mod(__P__)).add(__P__).sub(bigInt(bigInt(ctx.getVar(\"a\",[])).mul(bigInt(ctx.getVar(\"smsb\",[]))).mod(__P__))).mod(__P__)).add(bigInt(ctx.getVar(\"a\",[]))).mod(__P__));\n }\n\n } else {\n if (bigInt(bigInt((bigInt(ctx.getVar(\"cmsb\",[])).eq(bigInt(\"1\")) ? 1 : 0)).and(bigInt((bigInt(ctx.getVar(\"clsb\",[])).eq(bigInt(\"0\")) ? 1 : 0))).and(__MASK__)).neq(bigInt(0))) {\n {\n ctx.setSignal(\"parts\", [ctx.getVar(\"i\",[])], bigInt(bigInt(bigInt(bigInt(ctx.getVar(\"b\",[])).mul(bigInt(ctx.getVar(\"smsb\",[]))).mod(__P__)).mul(bigInt(ctx.getVar(\"slsb\",[]))).mod(__P__)).add(__P__).sub(bigInt(bigInt(ctx.getVar(\"a\",[])).mul(bigInt(ctx.getVar(\"smsb\",[]))).mod(__P__))).mod(__P__)).add(bigInt(ctx.getVar(\"a\",[]))).mod(__P__));\n }\n\n } else {\n {\n ctx.setSignal(\"parts\", [ctx.getVar(\"i\",[])], bigInt(bigInt(bigInt(__P__.sub(bigInt(ctx.getVar(\"a\",[]))).mod(__P__)).mul(bigInt(ctx.getVar(\"smsb\",[]))).mod(__P__)).mul(bigInt(ctx.getVar(\"slsb\",[]))).mod(__P__)).add(bigInt(ctx.getVar(\"a\",[]))).mod(__P__));\n }\n\n }\n\n }\n\n }\n ctx.setVar(\"sum\", [], bigInt(ctx.getVar(\"sum\",[])).add(bigInt(ctx.getSignal(\"parts\", [ctx.getVar(\"i\",[])]))).mod(__P__));\n ctx.setVar(\"b\", [], bigInt(ctx.getVar(\"b\",[])).add(__P__).sub(bigInt(ctx.getVar(\"e\",[]))).mod(__P__));\n ctx.setVar(\"a\", [], bigInt(ctx.getVar(\"a\",[])).add(bigInt(ctx.getVar(\"e\",[]))).mod(__P__));\n ctx.setVar(\"e\", [], bigInt(ctx.getVar(\"e\",[])).mul(bigInt(\"2\")).mod(__P__));\n }\n\n }\n ctx.setSignal(\"sout\", [], ctx.getVar(\"sum\",[]));\n ctx.setPin(\"num2bits\", [], \"in\", [], ctx.getSignal(\"sout\", []));\n ctx.setSignal(\"out\", [], ctx.getPin(\"num2bits\", [], \"out\", [\"127\"]));\n}\n",
518 | "AliasCheck": "function(ctx) {\n for (ctx.setVar(\"i\", [], \"0\");bigInt(bigInt(ctx.getVar(\"i\",[])).lt(bigInt(\"254\")) ? 1 : 0).neq(bigInt(0));(ctx.setVar(\"i\", [], bigInt(ctx.getVar(\"i\",[])).add(bigInt(\"1\")).mod(__P__))).add(__P__).sub(bigInt(1)).mod(__P__)) { \n ctx.setPin(\"compConstant\", [], \"in\", [ctx.getVar(\"i\",[])], ctx.getSignal(\"in\", [ctx.getVar(\"i\",[])]))\n }\n ctx.assert(ctx.getPin(\"compConstant\", [], \"out\", []), \"0\", \"undefined:31:4\");\n}\n",
519 | "Num2Bits": "function(ctx) {\n ctx.setVar(\"lc1\", [], \"0\");\n for (ctx.setVar(\"i\", [], \"0\");bigInt(bigInt(ctx.getVar(\"i\",[])).lt(bigInt(ctx.getVar(\"n\",[]))) ? 1 : 0).neq(bigInt(0));(ctx.setVar(\"i\", [], bigInt(ctx.getVar(\"i\",[])).add(bigInt(\"1\")).mod(__P__))).add(__P__).sub(bigInt(1)).mod(__P__)) { \n {\n ctx.setSignal(\"out\", [ctx.getVar(\"i\",[])], bigInt(bigInt(ctx.getVar(\"i\",[])).greater(bigInt(256)) ? 0 : bigInt(ctx.getSignal(\"in\", [])).shr(bigInt(ctx.getVar(\"i\",[]))).and(__MASK__)).and(bigInt(\"1\")).and(__MASK__));\n ctx.assert(bigInt(ctx.getSignal(\"out\", [ctx.getVar(\"i\",[])])).mul(bigInt(bigInt(ctx.getSignal(\"out\", [ctx.getVar(\"i\",[])])).add(__P__).sub(bigInt(\"1\")).mod(__P__))).mod(__P__), \"0\", \"/Users/plogian/fluree/legal-fishing/node_modules/circomlib/circuits/bitify.circom:31:8\");\n ctx.setVar(\"lc1\", [], bigInt(ctx.getVar(\"lc1\",[])).add(bigInt(bigInt(ctx.getSignal(\"out\", [ctx.getVar(\"i\",[])])).mul(bigInt(bigInt(\"2\").modPow(bigInt(ctx.getVar(\"i\",[])), __P__))).mod(__P__))).mod(__P__));\n }\n\n }\n ctx.assert(ctx.getVar(\"lc1\",[]), ctx.getSignal(\"in\", []), \"/Users/plogian/fluree/legal-fishing/node_modules/circomlib/circuits/bitify.circom:35:4\");\n}\n",
520 | "Num2Bits_strict": "function(ctx) {\n ctx.setPin(\"n2b\", [], \"in\", [], ctx.getSignal(\"in\", []));\n for (ctx.setVar(\"i\", [], \"0\");bigInt(bigInt(ctx.getVar(\"i\",[])).lt(bigInt(\"254\")) ? 1 : 0).neq(bigInt(0));(ctx.setVar(\"i\", [], bigInt(ctx.getVar(\"i\",[])).add(bigInt(\"1\")).mod(__P__))).add(__P__).sub(bigInt(1)).mod(__P__)) { \n {\n ctx.setSignal(\"out\", [ctx.getVar(\"i\",[])], ctx.getPin(\"n2b\", [], \"out\", [ctx.getVar(\"i\",[])]));\n ctx.setPin(\"aliasCheck\", [], \"in\", [ctx.getVar(\"i\",[])], ctx.getPin(\"n2b\", [], \"out\", [ctx.getVar(\"i\",[])]));\n }\n\n }\n}\n",
521 | "Bits2Num": "function(ctx) {\n ctx.setVar(\"lc1\", [], \"0\");\n for (ctx.setVar(\"i\", [], \"0\");bigInt(bigInt(ctx.getVar(\"i\",[])).lt(bigInt(ctx.getVar(\"n\",[]))) ? 1 : 0).neq(bigInt(0));(ctx.setVar(\"i\", [], bigInt(ctx.getVar(\"i\",[])).add(bigInt(\"1\")).mod(__P__))).add(__P__).sub(bigInt(1)).mod(__P__)) { \n {\n ctx.setVar(\"lc1\", [], bigInt(ctx.getVar(\"lc1\",[])).add(bigInt(bigInt(ctx.getSignal(\"in\", [ctx.getVar(\"i\",[])])).mul(bigInt(bigInt(\"2\").modPow(bigInt(ctx.getVar(\"i\",[])), __P__))).mod(__P__))).mod(__P__));\n }\n\n }\n ctx.setSignal(\"out\", [], ctx.getVar(\"lc1\",[]));\n}\n",
522 | "Bits2Num_strict": "function(ctx) {\n for (ctx.setVar(\"i\", [], \"0\");bigInt(bigInt(ctx.getVar(\"i\",[])).lt(bigInt(\"254\")) ? 1 : 0).neq(bigInt(0));(ctx.setVar(\"i\", [], bigInt(ctx.getVar(\"i\",[])).add(bigInt(\"1\")).mod(__P__))).add(__P__).sub(bigInt(1)).mod(__P__)) { \n {\n ctx.setPin(\"b2n\", [], \"in\", [ctx.getVar(\"i\",[])], ctx.getSignal(\"in\", [ctx.getVar(\"i\",[])]));\n ctx.setPin(\"aliasCheck\", [], \"in\", [ctx.getVar(\"i\",[])], ctx.getSignal(\"in\", [ctx.getVar(\"i\",[])]));\n }\n\n }\n ctx.setSignal(\"out\", [], ctx.getPin(\"b2n\", [], \"out\", []));\n}\n",
523 | "Num2BitsNeg": "function(ctx) {\n ctx.setVar(\"lc1\", [], \"0\");\n ctx.setVar(\"neg\", [], bigInt((bigInt(ctx.getVar(\"n\",[])).eq(bigInt(\"0\")) ? 1 : 0)).neq(bigInt(0)) ? (\"0\") : (bigInt(bigInt(\"2\").modPow(bigInt(ctx.getVar(\"n\",[])), __P__)).add(__P__).sub(bigInt(ctx.getSignal(\"in\", []))).mod(__P__)));\n for (ctx.setVar(\"i\", [], \"0\");bigInt(bigInt(ctx.getVar(\"i\",[])).lt(bigInt(ctx.getVar(\"n\",[]))) ? 1 : 0).neq(bigInt(0));(ctx.setVar(\"i\", [], bigInt(ctx.getVar(\"i\",[])).add(bigInt(\"1\")).mod(__P__))).add(__P__).sub(bigInt(1)).mod(__P__)) { \n {\n ctx.setSignal(\"out\", [ctx.getVar(\"i\",[])], bigInt(bigInt(ctx.getVar(\"i\",[])).greater(bigInt(256)) ? 0 : bigInt(ctx.getVar(\"neg\",[])).shr(bigInt(ctx.getVar(\"i\",[]))).and(__MASK__)).and(bigInt(\"1\")).and(__MASK__));\n ctx.assert(bigInt(ctx.getSignal(\"out\", [ctx.getVar(\"i\",[])])).mul(bigInt(bigInt(ctx.getSignal(\"out\", [ctx.getVar(\"i\",[])])).add(__P__).sub(bigInt(\"1\")).mod(__P__))).mod(__P__), \"0\", \"undefined:92:8\");\n ctx.setVar(\"lc1\", [], bigInt(ctx.getVar(\"lc1\",[])).add(bigInt(bigInt(ctx.getSignal(\"out\", [ctx.getVar(\"i\",[])])).mul(bigInt(bigInt(\"2\").modPow(bigInt(ctx.getVar(\"i\",[])), __P__))).mod(__P__))).mod(__P__));\n }\n\n }\n ctx.setPin(\"isZero\", [], \"in\", [], ctx.getSignal(\"in\", []));\n ctx.assert(bigInt(ctx.getVar(\"lc1\",[])).add(bigInt(bigInt(ctx.getPin(\"isZero\", [], \"out\", [])).mul(bigInt(bigInt(\"2\").modPow(bigInt(ctx.getVar(\"n\",[])), __P__))).mod(__P__))).mod(__P__), bigInt(bigInt(\"2\").modPow(bigInt(ctx.getVar(\"n\",[])), __P__)).add(__P__).sub(bigInt(ctx.getSignal(\"in\", []))).mod(__P__), \"undefined:100:4\");\n}\n",
524 | "BinSum": "function(ctx) {\n ctx.setVar(\"nout\", [], ctx.callFunction(\"nbits\", [bigInt(bigInt(bigInt(\"2\").modPow(bigInt(ctx.getVar(\"n\",[])), __P__)).add(__P__).sub(bigInt(\"1\")).mod(__P__)).mul(bigInt(ctx.getVar(\"ops\",[]))).mod(__P__)]));\n ctx.setVar(\"lin\", [], \"0\");\n ctx.setVar(\"lout\", [], \"0\");\n for (ctx.setVar(\"k\", [], \"0\");bigInt(bigInt(ctx.getVar(\"k\",[])).lt(bigInt(ctx.getVar(\"n\",[]))) ? 1 : 0).neq(bigInt(0));(ctx.setVar(\"k\", [], bigInt(ctx.getVar(\"k\",[])).add(bigInt(\"1\")).mod(__P__))).add(__P__).sub(bigInt(1)).mod(__P__)) { \n {\n for (ctx.setVar(\"j\", [], \"0\");bigInt(bigInt(ctx.getVar(\"j\",[])).lt(bigInt(ctx.getVar(\"ops\",[]))) ? 1 : 0).neq(bigInt(0));(ctx.setVar(\"j\", [], bigInt(ctx.getVar(\"j\",[])).add(bigInt(\"1\")).mod(__P__))).add(__P__).sub(bigInt(1)).mod(__P__)) { \n {\n ctx.setVar(\"lin\", [], bigInt(ctx.getVar(\"lin\",[])).add(bigInt(bigInt(ctx.getSignal(\"in\", [ctx.getVar(\"j\",[]),ctx.getVar(\"k\",[])])).mul(bigInt(bigInt(\"2\").modPow(bigInt(ctx.getVar(\"k\",[])), __P__))).mod(__P__))).mod(__P__));\n }\n\n }\n }\n\n }\n for (ctx.setVar(\"k\", [], \"0\");bigInt(bigInt(ctx.getVar(\"k\",[])).lt(bigInt(ctx.getVar(\"nout\",[]))) ? 1 : 0).neq(bigInt(0));(ctx.setVar(\"k\", [], bigInt(ctx.getVar(\"k\",[])).add(bigInt(\"1\")).mod(__P__))).add(__P__).sub(bigInt(1)).mod(__P__)) { \n {\n ctx.setSignal(\"out\", [ctx.getVar(\"k\",[])], bigInt(bigInt(ctx.getVar(\"k\",[])).greater(bigInt(256)) ? 0 : bigInt(ctx.getVar(\"lin\",[])).shr(bigInt(ctx.getVar(\"k\",[]))).and(__MASK__)).and(bigInt(\"1\")).and(__MASK__));\n ctx.assert(bigInt(ctx.getSignal(\"out\", [ctx.getVar(\"k\",[])])).mul(bigInt(bigInt(ctx.getSignal(\"out\", [ctx.getVar(\"k\",[])])).add(__P__).sub(bigInt(\"1\")).mod(__P__))).mod(__P__), \"0\", \"undefined:85:8\");\n ctx.setVar(\"lout\", [], bigInt(ctx.getVar(\"lout\",[])).add(bigInt(bigInt(ctx.getSignal(\"out\", [ctx.getVar(\"k\",[])])).mul(bigInt(bigInt(\"2\").modPow(bigInt(ctx.getVar(\"k\",[])), __P__))).mod(__P__))).mod(__P__));\n }\n\n }\n ctx.assert(ctx.getVar(\"lin\",[]), ctx.getVar(\"lout\",[]), \"undefined:92:4\");\n}\n",
525 | "IsZero": "function(ctx) {\n ctx.setSignal(\"inv\", [], bigInt((bigInt(ctx.getSignal(\"in\", [])).eq(bigInt(\"0\")) ? 0 : 1)).neq(bigInt(0)) ? (bigInt(\"1\").mul( bigInt(ctx.getSignal(\"in\", [])).inverse(__P__) ).mod(__P__)) : (\"0\"));\n ctx.setSignal(\"out\", [], bigInt(bigInt(__P__.sub(bigInt(ctx.getSignal(\"in\", []))).mod(__P__)).mul(bigInt(ctx.getSignal(\"inv\", []))).mod(__P__)).add(bigInt(\"1\")).mod(__P__));\n ctx.assert(bigInt(ctx.getSignal(\"in\", [])).mul(bigInt(ctx.getSignal(\"out\", []))).mod(__P__), \"0\", \"undefined:32:4\");\n}\n",
526 | "IsEqual": "function(ctx) {\n ctx.setPin(\"isz\", [], \"in\", [], bigInt(ctx.getSignal(\"in\", [\"1\"])).add(__P__).sub(bigInt(ctx.getSignal(\"in\", [\"0\"]))).mod(__P__));\n ctx.setSignal(\"out\", [], ctx.getPin(\"isz\", [], \"out\", []));\n}\n",
527 | "ForceEqualIfEnabled": "function(ctx) {\n ctx.setPin(\"isz\", [], \"in\", [], bigInt(ctx.getSignal(\"in\", [\"1\"])).add(__P__).sub(bigInt(ctx.getSignal(\"in\", [\"0\"]))).mod(__P__));\n ctx.assert(bigInt(bigInt(\"1\").add(__P__).sub(bigInt(ctx.getPin(\"isz\", [], \"out\", []))).mod(__P__)).mul(bigInt(ctx.getSignal(\"enabled\", []))).mod(__P__), \"0\", \"undefined:55:4\");\n}\n",
528 | "LessThan": "function(ctx) {\n ctx.setPin(\"n2b\", [], \"in\", [], bigInt(bigInt(ctx.getSignal(\"in\", [\"0\"])).add(bigInt(bigInt(ctx.getVar(\"n\",[])).greater(bigInt(256)) ? 0 : bigInt(\"1\").shl(bigInt(ctx.getVar(\"n\",[]))).and(__MASK__))).mod(__P__)).add(__P__).sub(bigInt(ctx.getSignal(\"in\", [\"1\"]))).mod(__P__));\n ctx.setSignal(\"out\", [], bigInt(\"1\").add(__P__).sub(bigInt(ctx.getPin(\"n2b\", [], \"out\", [ctx.getVar(\"n\",[])]))).mod(__P__));\n}\n",
529 | "LessEqThan": "function(ctx) {\n ctx.setPin(\"lt\", [], \"in\", [\"0\"], ctx.getSignal(\"in\", [\"0\"]));\n ctx.setPin(\"lt\", [], \"in\", [\"1\"], bigInt(ctx.getSignal(\"in\", [\"1\"])).add(bigInt(\"1\")).mod(__P__));\n ctx.setSignal(\"out\", [], ctx.getPin(\"lt\", [], \"out\", []));\n}\n",
530 | "GreaterThan": "function(ctx) {\n ctx.setPin(\"lt\", [], \"in\", [\"0\"], ctx.getSignal(\"in\", [\"1\"]));\n ctx.setPin(\"lt\", [], \"in\", [\"1\"], ctx.getSignal(\"in\", [\"0\"]));\n ctx.setSignal(\"out\", [], ctx.getPin(\"lt\", [], \"out\", []));\n}\n",
531 | "GreaterEqThan": "function(ctx) {\n ctx.setPin(\"lt\", [], \"in\", [\"0\"], ctx.getSignal(\"in\", [\"1\"]));\n ctx.setPin(\"lt\", [], \"in\", [\"1\"], bigInt(ctx.getSignal(\"in\", [\"0\"])).add(bigInt(\"1\")).mod(__P__));\n ctx.setSignal(\"out\", [], ctx.getPin(\"lt\", [], \"out\", []));\n}\n",
532 | "InAuthorizedRange": "function(ctx) {\n ctx.setPin(\"gt1\", [], \"in\", [\"0\"], ctx.getSignal(\"fishingLocation\", [\"0\"]));\n ctx.setPin(\"gt1\", [], \"in\", [\"1\"], ctx.getSignal(\"latitudeRange\", [\"0\"]));\n ctx.assert(ctx.getPin(\"gt1\", [], \"out\", []), \"1\", \"/Users/plogian/fluree/legal-fishing/src/circuits/InRange.circom:22:4\");\n ctx.setSignal(\"out\", [], ctx.getPin(\"gt1\", [], \"out\", []));\n}\n"
533 | },
534 | "functions": {
535 | "nbits": {
536 | "params": [
537 | "a"
538 | ],
539 | "func": "function(ctx) {\n ctx.setVar(\"n\", [], \"1\");\n ctx.setVar(\"r\", [], \"0\");\n while (bigInt(bigInt(bigInt(ctx.getVar(\"n\",[])).add(__P__).sub(bigInt(\"1\")).mod(__P__)).lt(bigInt(ctx.getVar(\"a\",[]))) ? 1 : 0).neq(bigInt(0))) {\n {\n (ctx.setVar(\"r\", [], bigInt(ctx.getVar(\"r\",[])).add(bigInt(\"1\")).mod(__P__))).add(__P__).sub(bigInt(1)).mod(__P__);\n ctx.setVar(\"n\", [], bigInt(ctx.getVar(\"n\",[])).mul(bigInt(\"2\")).mod(__P__));\n }\n\n }\n return ctx.getVar(\"r\",[]);;\n}\n"
540 | }
541 | },
542 | "nPrvInputs": 2,
543 | "nPubInputs": 4,
544 | "nInputs": 6,
545 | "nOutputs": 1,
546 | "nVars": 25,
547 | "nConstants": 4,
548 | "nSignals": 29
549 | }
--------------------------------------------------------------------------------
/src/circuits/input.json:
--------------------------------------------------------------------------------
1 | {
2 | "latitudeRange": [ 20, 21],
3 | "longitudeRange": [ 176, 190],
4 | "fishingLocation": [ 20, 180]
5 | }
--------------------------------------------------------------------------------
/src/circuits/proof.json:
--------------------------------------------------------------------------------
1 | {
2 | "pi_a": [
3 | "16790370973080887512107481436562447412770484065236171718020872246275560463159",
4 | "12753156541058233761815991957703788909166087942597642910431261905444094377766",
5 | "1"
6 | ],
7 | "pi_ap": [
8 | "7859631110369683032607384851495137480176967480541310305022039452839465863844",
9 | "6895149279746011821244067132957627340833171010264610550156307926808045319649",
10 | "1"
11 | ],
12 | "pi_b": [
13 | [
14 | "20640338264396243571033484634714909230600455719418158166466015654503786114801",
15 | "7754455583378654136415070359169622013982169718730232857991728118263048393236"
16 | ],
17 | [
18 | "17827290809450720797327912247619342379054628726049707378185479889010310385830",
19 | "2978936912554201298462925829413016970991341315442412977302714746045811343824"
20 | ],
21 | [
22 | "1",
23 | "0"
24 | ]
25 | ],
26 | "pi_bp": [
27 | "7556880602245254700521432783689070002857684355417944898467678345907204821532",
28 | "4935918555618397237075160981499737132785876184024632348992280135862435481728",
29 | "1"
30 | ],
31 | "pi_c": [
32 | "3282813082545079978744339509798069738323514107626273448281425659185522106922",
33 | "13532191693667802705382995653731799982111403681339766722594465430646676697942",
34 | "1"
35 | ],
36 | "pi_cp": [
37 | "20034357703651709379074452830514921288107931933515338482184837741922438754679",
38 | "14543358875512936439316879641249493524637928263333069608505831510348385690705",
39 | "1"
40 | ],
41 | "pi_kp": [
42 | "13981162705159244191065876150772352657843840777590798984375524005048560236160",
43 | "12236064164843870256213532225349983102347922375967489441685442214343329524755",
44 | "1"
45 | ],
46 | "pi_h": [
47 | "20656626118287641532693218962704621374545179368367000460191359430182043017953",
48 | "21537873267043090315114139433237221817578567103423058667549072119128972889885",
49 | "1"
50 | ],
51 | "protocol": "original"
52 | }
--------------------------------------------------------------------------------
/src/circuits/proving_key.json:
--------------------------------------------------------------------------------
1 | {
2 | "protocol": "original",
3 | "nVars": 25,
4 | "nPublic": 5,
5 | "domainBits": 5,
6 | "domainSize": 32,
7 | "polsA": [
8 | {
9 | "0": "21888242871839275222246405745257275088548364400416034343698204186575808495616",
10 | "9": "1",
11 | "20": "1"
12 | },
13 | {
14 | "0": "512",
15 | "9": "21888242871839275222246405745257275088548364400416034343698204186575808495616",
16 | "21": "1"
17 | },
18 | {
19 | "0": "1",
20 | "22": "1"
21 | },
22 | {
23 | "23": "1"
24 | },
25 | {
26 | "24": "1"
27 | },
28 | {
29 | "25": "1"
30 | },
31 | {
32 | "0": "21888242871839275222246405745257275088548364400416034343698204186575808495616"
33 | },
34 | {},
35 | {
36 | "0": "21888242871839275222246405745257275088548364400416034343698204186575808495615",
37 | "1": "1"
38 | },
39 | {
40 | "0": "21888242871839275222246405745257275088548364400416034343698204186575808495613",
41 | "2": "1"
42 | },
43 | {
44 | "0": "21888242871839275222246405745257275088548364400416034343698204186575808495609",
45 | "3": "1"
46 | },
47 | {
48 | "0": "21888242871839275222246405745257275088548364400416034343698204186575808495601",
49 | "4": "1"
50 | },
51 | {
52 | "0": "21888242871839275222246405745257275088548364400416034343698204186575808495585",
53 | "5": "1"
54 | },
55 | {
56 | "0": "21888242871839275222246405745257275088548364400416034343698204186575808495553",
57 | "6": "1"
58 | },
59 | {
60 | "0": "21888242871839275222246405745257275088548364400416034343698204186575808495489",
61 | "7": "1"
62 | },
63 | {
64 | "0": "21888242871839275222246405745257275088548364400416034343698204186575808495361",
65 | "8": "1"
66 | },
67 | {
68 | "0": "21888242871839275222246405745257275088548364400416034343698204186575808494593",
69 | "10": "1"
70 | },
71 | {
72 | "0": "21888242871839275222246405745257275088548364400416034343698204186575808493569",
73 | "11": "1"
74 | },
75 | {
76 | "0": "21888242871839275222246405745257275088548364400416034343698204186575808491521",
77 | "12": "1"
78 | },
79 | {
80 | "0": "21888242871839275222246405745257275088548364400416034343698204186575808487425",
81 | "13": "1"
82 | },
83 | {
84 | "0": "21888242871839275222246405745257275088548364400416034343698204186575808479233",
85 | "14": "1"
86 | },
87 | {
88 | "0": "21888242871839275222246405745257275088548364400416034343698204186575808462849",
89 | "15": "1"
90 | },
91 | {
92 | "0": "21888242871839275222246405745257275088548364400416034343698204186575808430081",
93 | "16": "1"
94 | },
95 | {
96 | "0": "21888242871839275222246405745257275088548364400416034343698204186575808364545",
97 | "17": "1"
98 | },
99 | {
100 | "0": "21888242871839275222246405745257275088548364400416034343698204186575808233473",
101 | "18": "1"
102 | }
103 | ],
104 | "polsB": [
105 | {
106 | "0": "21888242871839275222246405745257275088548364400416034343698204186575808495615",
107 | "1": "21888242871839275222246405745257275088548364400416034343698204186575808495616",
108 | "2": "21888242871839275222246405745257275088548364400416034343698204186575808495616",
109 | "3": "21888242871839275222246405745257275088548364400416034343698204186575808495616",
110 | "4": "21888242871839275222246405745257275088548364400416034343698204186575808495616",
111 | "5": "21888242871839275222246405745257275088548364400416034343698204186575808495616",
112 | "6": "21888242871839275222246405745257275088548364400416034343698204186575808495616",
113 | "7": "21888242871839275222246405745257275088548364400416034343698204186575808495616",
114 | "8": "21888242871839275222246405745257275088548364400416034343698204186575808495616",
115 | "10": "21888242871839275222246405745257275088548364400416034343698204186575808495616",
116 | "11": "21888242871839275222246405745257275088548364400416034343698204186575808495616",
117 | "12": "21888242871839275222246405745257275088548364400416034343698204186575808495616",
118 | "13": "21888242871839275222246405745257275088548364400416034343698204186575808495616",
119 | "14": "21888242871839275222246405745257275088548364400416034343698204186575808495616",
120 | "15": "21888242871839275222246405745257275088548364400416034343698204186575808495616",
121 | "16": "21888242871839275222246405745257275088548364400416034343698204186575808495616",
122 | "17": "21888242871839275222246405745257275088548364400416034343698204186575808495616",
123 | "18": "21888242871839275222246405745257275088548364400416034343698204186575808495616"
124 | },
125 | {
126 | "0": "512",
127 | "9": "21888242871839275222246405745257275088548364400416034343698204186575808495616"
128 | },
129 | {
130 | "0": "1"
131 | },
132 | {},
133 | {},
134 | {},
135 | {
136 | "0": "21888242871839275222246405745257275088548364400416034343698204186575808495616"
137 | },
138 | {},
139 | {
140 | "0": "21888242871839275222246405745257275088548364400416034343698204186575808495615",
141 | "1": "1"
142 | },
143 | {
144 | "0": "21888242871839275222246405745257275088548364400416034343698204186575808495613",
145 | "2": "1"
146 | },
147 | {
148 | "0": "21888242871839275222246405745257275088548364400416034343698204186575808495609",
149 | "3": "1"
150 | },
151 | {
152 | "0": "21888242871839275222246405745257275088548364400416034343698204186575808495601",
153 | "4": "1"
154 | },
155 | {
156 | "0": "21888242871839275222246405745257275088548364400416034343698204186575808495585",
157 | "5": "1"
158 | },
159 | {
160 | "0": "21888242871839275222246405745257275088548364400416034343698204186575808495553",
161 | "6": "1"
162 | },
163 | {
164 | "0": "21888242871839275222246405745257275088548364400416034343698204186575808495489",
165 | "7": "1"
166 | },
167 | {
168 | "0": "21888242871839275222246405745257275088548364400416034343698204186575808495361",
169 | "8": "1"
170 | },
171 | {
172 | "0": "21888242871839275222246405745257275088548364400416034343698204186575808494593",
173 | "10": "1"
174 | },
175 | {
176 | "0": "21888242871839275222246405745257275088548364400416034343698204186575808493569",
177 | "11": "1"
178 | },
179 | {
180 | "0": "21888242871839275222246405745257275088548364400416034343698204186575808491521",
181 | "12": "1"
182 | },
183 | {
184 | "0": "21888242871839275222246405745257275088548364400416034343698204186575808487425",
185 | "13": "1"
186 | },
187 | {
188 | "0": "21888242871839275222246405745257275088548364400416034343698204186575808479233",
189 | "14": "1"
190 | },
191 | {
192 | "0": "21888242871839275222246405745257275088548364400416034343698204186575808462849",
193 | "15": "1"
194 | },
195 | {
196 | "0": "21888242871839275222246405745257275088548364400416034343698204186575808430081",
197 | "16": "1"
198 | },
199 | {
200 | "0": "21888242871839275222246405745257275088548364400416034343698204186575808364545",
201 | "17": "1"
202 | },
203 | {
204 | "0": "21888242871839275222246405745257275088548364400416034343698204186575808233473",
205 | "18": "1"
206 | }
207 | ],
208 | "polsC": [
209 | {
210 | "19": "1"
211 | },
212 | {
213 | "19": "21888242871839275222246405745257275088548364400416034343698204186575808495616"
214 | },
215 | {},
216 | {},
217 | {},
218 | {},
219 | {},
220 | {},
221 | {},
222 | {},
223 | {},
224 | {},
225 | {},
226 | {},
227 | {},
228 | {},
229 | {},
230 | {},
231 | {},
232 | {},
233 | {},
234 | {},
235 | {},
236 | {},
237 | {}
238 | ],
239 | "A": [
240 | [
241 | "6543047960617981073886972622273531443599165233117160290361185486138300537104",
242 | "11401518062075154897134708833711425469699755817872313530069388841257420979753",
243 | "1"
244 | ],
245 | [
246 | "12423292224312996997512845630020420315990228971663481703212606385309249082280",
247 | "187089888143708956044704479516625605650361368074653359027313199214731198602",
248 | "1"
249 | ],
250 | [
251 | "15559281875656469775112083667694773353079958871450130703727936158716951882348",
252 | "20065076019533905015729566796015049488941428584293297605747899784452650283898",
253 | "1"
254 | ],
255 | [
256 | "20261789557823626180607484517793205410285129320710435474895836844642684402649",
257 | "16901113082181097881247026511513777847242291314946367386342738851983118837093",
258 | "1"
259 | ],
260 | [
261 | "5674982760698123096493230714707448218617707887801376223785790289766735490058",
262 | "9829810340385346851491932447599218985694501821638335649223680628973158602826",
263 | "1"
264 | ],
265 | [
266 | "6442006813067603843261861427177653620020623608637667570096236683755749868136",
267 | "4428755654903388966273772554589239071575460289725402645961530198843343674775",
268 | "1"
269 | ],
270 | [
271 | "10904084214728257669745677274063271309712237689005591558247337343469746644550",
272 | "76895898683632662688243041936647474072350113237083268781108107454187232446",
273 | "1"
274 | ],
275 | [
276 | "0",
277 | "1",
278 | "0"
279 | ],
280 | [
281 | "19483956084407209250894636051318804027379438671765713927799854583960591421927",
282 | "5464457605105328707831918451994816238993943729130248395321642668262360155890",
283 | "1"
284 | ],
285 | [
286 | "2429738501047556760930680024233086290631589714239229930068917227255019115262",
287 | "12061876565348263211281919743221934313072898468552691330269471181847594468472",
288 | "1"
289 | ],
290 | [
291 | "14598920263750093342672752434980549311332211511337520048122683125447994968174",
292 | "3129075194129626122741860250964854947365024869545823601590207203919825315354",
293 | "1"
294 | ],
295 | [
296 | "2663272945605975320695260284161269234851607518235877530241482387677770022297",
297 | "4964849786463288485604041466743289393582154826360290122119344572726122410388",
298 | "1"
299 | ],
300 | [
301 | "17347298481813785627467031910417927924179919962797207667478114518066840493763",
302 | "10380642318630646868599447967844386807699096512446720732730970542526518347845",
303 | "1"
304 | ],
305 | [
306 | "18942420557931095879787525490204243856517888073007172625471541867877023300838",
307 | "7312299512141350665621583015786324620847584787871874663605362822697909194984",
308 | "1"
309 | ],
310 | [
311 | "18035301180587023102978711148092299161899757899411757614637031281249760018907",
312 | "8218289026719102851023847886700790231616010911306825045362310281504959036330",
313 | "1"
314 | ],
315 | [
316 | "13801941386096423102901795345834257833388500597514435183006337595409964192637",
317 | "20400391213159206410417834202132839578062470029327848836729560946561162869176",
318 | "1"
319 | ],
320 | [
321 | "15232908478236280840502360374106512595522141307021432683054055887071992960952",
322 | "7221818959625408737312957883595069040440974897359823540686747571759809654949",
323 | "1"
324 | ],
325 | [
326 | "17442487599569699160724406383377687785472007720189767135740461602132130335945",
327 | "15077237937194767771632650776795439446011330434382661226909679203826418061727",
328 | "1"
329 | ],
330 | [
331 | "17035073900974008536115161411184613800638282476371999545439753436972535600453",
332 | "18842046767868093363394532326445916038927686212414446382751064266438534802087",
333 | "1"
334 | ],
335 | [
336 | "3232745785293263291084033876204932517098924850875532069597950016107895994322",
337 | "9011877334754525760140876321719139337474533262266825905904458742403648169485",
338 | "1"
339 | ],
340 | [
341 | "6287127477848045186893001492886248390977813295583196358248433957771568882539",
342 | "620826557894817084811273239574805524385740058431950886383904776779099454306",
343 | "1"
344 | ],
345 | [
346 | "13501603683408262014901110098123344498791608109414155754265785587072632455692",
347 | "589869079033136659529815860714904881562539201591711396990018488189860977711",
348 | "1"
349 | ],
350 | [
351 | "17725955847842683451065590432573616713509174017124301815720951300404180860761",
352 | "17275158417763730158531051417184541787068609424070319381041802884000772249877",
353 | "1"
354 | ],
355 | [
356 | "1206959706889536920708359086405258143903631112084792001580625110248521713427",
357 | "15192670286273390669630202203214069925351740081512973431031961037917180339665",
358 | "1"
359 | ],
360 | [
361 | "5972411641564975870136286597714637937191472251683422911256832700891248967068",
362 | "21119747676008009209495725909686906039929262561678203823956190805859397125551",
363 | "1"
364 | ],
365 | [
366 | "8383602102837997866681276117220569464391336286657022166085332838075612360659",
367 | "17420001887903153603140909723894855058397959497660087778164556423917736551164",
368 | "1"
369 | ]
370 | ],
371 | "B": [
372 | [
373 | [
374 | "16016570529889898382437039948900880138270703517165523587904438571106012319867",
375 | "18252145205768987373586981665106863347834150671959534840962890257790030509733"
376 | ],
377 | [
378 | "11584440189441651102979355139220013722154452950822205861692538407299082356235",
379 | "8978757811803064417211056118913988653675977087874601738962200567592851955645"
380 | ],
381 | [
382 | "1",
383 | "0"
384 | ]
385 | ],
386 | [
387 | [
388 | "6882249423754321791289889211423528860492269602363114560129385598631792006500",
389 | "9116254266493557753535397883738762501954704249685754625853394195032363182390"
390 | ],
391 | [
392 | "18235165733717810724027099435332132775605997831217721607826826434904337443530",
393 | "3598001082101678657239591453782386880812614780474861744285550905957180387131"
394 | ],
395 | [
396 | "1",
397 | "0"
398 | ]
399 | ],
400 | [
401 | [
402 | "94326043124494510955084047656855159240837122863131633553741953252359585933",
403 | "2594688928658614494663356055444926338362708734500121167667967915174532393687"
404 | ],
405 | [
406 | "11220065982639733781649638886088833162505824525385888627321660911401253050661",
407 | "8062159942175167173416473399515918892588800434916223666724408148092064696573"
408 | ],
409 | [
410 | "1",
411 | "0"
412 | ]
413 | ],
414 | [
415 | [
416 | "0",
417 | "0"
418 | ],
419 | [
420 | "1",
421 | "0"
422 | ],
423 | [
424 | "0",
425 | "0"
426 | ]
427 | ],
428 | [
429 | [
430 | "0",
431 | "0"
432 | ],
433 | [
434 | "1",
435 | "0"
436 | ],
437 | [
438 | "0",
439 | "0"
440 | ]
441 | ],
442 | [
443 | [
444 | "0",
445 | "0"
446 | ],
447 | [
448 | "1",
449 | "0"
450 | ],
451 | [
452 | "0",
453 | "0"
454 | ]
455 | ],
456 | [
457 | [
458 | "94326043124494510955084047656855159240837122863131633553741953252359585933",
459 | "2594688928658614494663356055444926338362708734500121167667967915174532393687"
460 | ],
461 | [
462 | "10668176889199541440596766859168441926190486631911935035367376983243973157922",
463 | "13826082929664108048829932345741356196107510722381599995964629746553161512010"
464 | ],
465 | [
466 | "1",
467 | "0"
468 | ]
469 | ],
470 | [
471 | [
472 | "0",
473 | "0"
474 | ],
475 | [
476 | "1",
477 | "0"
478 | ],
479 | [
480 | "0",
481 | "0"
482 | ]
483 | ],
484 | [
485 | [
486 | "12778028168863661170288716696789031509545378745542417466756619401470746606144",
487 | "6367728770777982542698536884405459819396120909056949415381184181528584417254"
488 | ],
489 | [
490 | "3145640014752307555100858108031878472491926866396335004455922796939446676837",
491 | "7272604550292426582619791505274307285681841686536015762842015306651189865827"
492 | ],
493 | [
494 | "1",
495 | "0"
496 | ]
497 | ],
498 | [
499 | [
500 | "9214060136295626482954293706431243243604574332743418381766155119199750401700",
501 | "1612818010430478760077705501373809261285866032994932649970902621769708892444"
502 | ],
503 | [
504 | "13843081708980814784259483597177992777135926734919849308731126737782168218033",
505 | "12868965839761902883254340420136452023502815682402878032028820978517748938928"
506 | ],
507 | [
508 | "1",
509 | "0"
510 | ]
511 | ],
512 | [
513 | [
514 | "8990892484747654917816661504075697022757263313134870609669650812314668946501",
515 | "5012430869171861038725050842263231367720026380440571073761097353024809511915"
516 | ],
517 | [
518 | "363562226423856681128002070443280040523316898689555621881053743123334823779",
519 | "21392608698504028068351257397946514888592428854818646057085914904796952306231"
520 | ],
521 | [
522 | "1",
523 | "0"
524 | ]
525 | ],
526 | [
527 | [
528 | "18841233641161504729167254266660439489050528338250548517864759913376505381887",
529 | "2770988663425742921295261379109073167897364258997280974236224237418540445264"
530 | ],
531 | [
532 | "10684137098802710966870692110780646954359897088774128229716995924352636025126",
533 | "16662615645276316573571587624359274608855145218653753301628426022222240744263"
534 | ],
535 | [
536 | "1",
537 | "0"
538 | ]
539 | ],
540 | [
541 | [
542 | "714732131432116733289477413190453673727799202744259889154451435532173655347",
543 | "19749339372227642751640327463963116293113649937969783265219294049665430071618"
544 | ],
545 | [
546 | "20884623868685676745685865000876366777530894891039070244569666395403712923717",
547 | "16379026355736426881003429952132536155458459577367450048815719919521404435830"
548 | ],
549 | [
550 | "1",
551 | "0"
552 | ]
553 | ],
554 | [
555 | [
556 | "9129938589043170021195468018407133702029063803181331074224668539409770227498",
557 | "14181639762744220373297771121436465284720830697301826648113457948897374541751"
558 | ],
559 | [
560 | "6009947464738334215227655891741934369371896156307738735040658477980658387548",
561 | "21061381607459045297225300902515580213029892471133547246416347455772855524101"
562 | ],
563 | [
564 | "1",
565 | "0"
566 | ]
567 | ],
568 | [
569 | [
570 | "18742826873027088150301310651348208557846464025745226959618264528837828627928",
571 | "20378183758688286203656876269181191277294659244551370609723064671020651449646"
572 | ],
573 | [
574 | "8797966374850803584651665182615580716119730699912488535158373831405894273486",
575 | "13176119933914340893446064543166934671762274261480812079120126319931685010693"
576 | ],
577 | [
578 | "1",
579 | "0"
580 | ]
581 | ],
582 | [
583 | [
584 | "9407388829179744005198092898250459538345105659316309394482094381583553861236",
585 | "19605374957997772177955052254140453109831005196243150221275383114431062641712"
586 | ],
587 | [
588 | "12469558311371981290996846057685658033419000713576920180516011412222785956151",
589 | "16631505839681802028186412062242533109288009678348893876932689665046912743576"
590 | ],
591 | [
592 | "1",
593 | "0"
594 | ]
595 | ],
596 | [
597 | [
598 | "16404737595350573832068721045901307806151936965663764102328988269255211002698",
599 | "21880970296256301837166320319246507852874551522506868585367914560740628982598"
600 | ],
601 | [
602 | "311329434776250536149459904170860512826157891770592015298657635155005225764",
603 | "15411946013602568099200545297618012812857200401626244723927804385481618086760"
604 | ],
605 | [
606 | "1",
607 | "0"
608 | ]
609 | ],
610 | [
611 | [
612 | "7439199907420747155077325149002590391490619500336072236559363738534485420000",
613 | "9984232565598003528299319786342414188086209297960578588380208361133690511285"
614 | ],
615 | [
616 | "5687083751118541891106114445173252148739209401108315719198199683585567790433",
617 | "14134428264736662728091320397028566978654250081679242045926561060563547119722"
618 | ],
619 | [
620 | "1",
621 | "0"
622 | ]
623 | ],
624 | [
625 | [
626 | "20978470284498890729466973753001708720197955148935696463182153113605802666595",
627 | "705880839695209339197356387795709561687172503354199057764682907780956851286"
628 | ],
629 | [
630 | "9995475673914166464771963788429420559296802530266402126000243042458940766741",
631 | "6888750851176541338476093018478046718852091338329888721998273395995352501946"
632 | ],
633 | [
634 | "1",
635 | "0"
636 | ]
637 | ],
638 | [
639 | [
640 | "8492993606141346307628685181277354869125021706524952161549603983653886662574",
641 | "12346114867342884469346604025903619027382635545892131911322194671581351919269"
642 | ],
643 | [
644 | "8498831606149302767667265111141747221109442530124598175089297689302441015174",
645 | "8844994918204162696785176894047720261663152258374165472777121491997598298802"
646 | ],
647 | [
648 | "1",
649 | "0"
650 | ]
651 | ],
652 | [
653 | [
654 | "2782156317039437434698805794831556928298045688478580766281012487537360774316",
655 | "10262215109919063483235651863323102623645379008697986629159869662537043059799"
656 | ],
657 | [
658 | "13835188950414400520108900499930295137839070911506313779970926623453567982365",
659 | "11609082100024105324501037390716819051464322192640787130870905549105189863750"
660 | ],
661 | [
662 | "1",
663 | "0"
664 | ]
665 | ],
666 | [
667 | [
668 | "1604309721966586456298785286977815852713250342021460132760436741440645666141",
669 | "18401930953783194119712699924795224046685041070376058052848642010016788399700"
670 | ],
671 | [
672 | "21329538816248211384253445541375552677563923732028040563325733708225862369743",
673 | "9735251769723199268607958726510137921144989173716131002686021992999450483154"
674 | ],
675 | [
676 | "1",
677 | "0"
678 | ]
679 | ],
680 | [
681 | [
682 | "21856312087879390977228727978882994656076507122578643256407498020855844000185",
683 | "18573077473506936018425890286734785486765105043488937399391600395655908030998"
684 | ],
685 | [
686 | "20527819081389844512570411531981289850937804858264179315467074941947130944734",
687 | "12929715881544394147104860357542684498820343174984434369788410731319188965281"
688 | ],
689 | [
690 | "1",
691 | "0"
692 | ]
693 | ],
694 | [
695 | [
696 | "15851076427094152419396272007889903156476905295824587212765243111929208420247",
697 | "12607791620408029719739338719682285380399825007121150661323311423843693090490"
698 | ],
699 | [
700 | "7046376003474365739080688180057985854626142584185987530566447999369693921339",
701 | "8219810221944883249000310439280771216404758949341360464549328740433119008378"
702 | ],
703 | [
704 | "1",
705 | "0"
706 | ]
707 | ],
708 | [
709 | [
710 | "8765078383993771933799617112642815428222317217094152414871582501908741714199",
711 | "16180516975487352629100541527446539634987392540969226187756305451367746911991"
712 | ],
713 | [
714 | "16191413714473890410225397929639796157415798543433687383706935681635802064320",
715 | "12782941945899073088596333326054352665753613323996308417042609334652460846287"
716 | ],
717 | [
718 | "1",
719 | "0"
720 | ]
721 | ],
722 | [
723 | [
724 | "15538191628613860553441981361496308307693840371839338612437579606084165401830",
725 | "13596632491114136473391840402871273619758749134174709383425742722690664387477"
726 | ],
727 | [
728 | "17049710803492456467938571858680084287550432210067982032851633421514377777824",
729 | "13404672073504257420329885331674837484782208645396924657194213832305731279759"
730 | ],
731 | [
732 | "1",
733 | "0"
734 | ]
735 | ]
736 | ],
737 | "C": [
738 | [
739 | "8060381645591980374345154626016825684378762355464088764787012227405144602465",
740 | "586464802800265969351620651710163330527433516056140556351441674610506814662",
741 | "1"
742 | ],
743 | [
744 | "8060381645591980374345154626016825684378762355464088764787012227405144602465",
745 | "21301778069039009252894785093547111758168877641241683106337596220034719393921",
746 | "1"
747 | ],
748 | [
749 | "0",
750 | "1",
751 | "0"
752 | ],
753 | [
754 | "0",
755 | "1",
756 | "0"
757 | ],
758 | [
759 | "0",
760 | "1",
761 | "0"
762 | ],
763 | [
764 | "0",
765 | "1",
766 | "0"
767 | ],
768 | [
769 | "0",
770 | "1",
771 | "0"
772 | ],
773 | [
774 | "0",
775 | "1",
776 | "0"
777 | ],
778 | [
779 | "0",
780 | "1",
781 | "0"
782 | ],
783 | [
784 | "0",
785 | "1",
786 | "0"
787 | ],
788 | [
789 | "0",
790 | "1",
791 | "0"
792 | ],
793 | [
794 | "0",
795 | "1",
796 | "0"
797 | ],
798 | [
799 | "0",
800 | "1",
801 | "0"
802 | ],
803 | [
804 | "0",
805 | "1",
806 | "0"
807 | ],
808 | [
809 | "0",
810 | "1",
811 | "0"
812 | ],
813 | [
814 | "0",
815 | "1",
816 | "0"
817 | ],
818 | [
819 | "0",
820 | "1",
821 | "0"
822 | ],
823 | [
824 | "0",
825 | "1",
826 | "0"
827 | ],
828 | [
829 | "0",
830 | "1",
831 | "0"
832 | ],
833 | [
834 | "0",
835 | "1",
836 | "0"
837 | ],
838 | [
839 | "0",
840 | "1",
841 | "0"
842 | ],
843 | [
844 | "0",
845 | "1",
846 | "0"
847 | ],
848 | [
849 | "0",
850 | "1",
851 | "0"
852 | ],
853 | [
854 | "0",
855 | "1",
856 | "0"
857 | ],
858 | [
859 | "0",
860 | "1",
861 | "0"
862 | ],
863 | [
864 | "4537704129717176167230203936832078099760087961801901663842064591587494021983",
865 | "16301959603505356481924089561596932127669947905394585724703419231579607456595",
866 | "1"
867 | ]
868 | ],
869 | "Ap": [
870 | null,
871 | null,
872 | null,
873 | null,
874 | null,
875 | null,
876 | [
877 | "3886756557600000107069460923531693692666830782847105049659616289600205709995",
878 | "6620901386694347928865700755515697132588152235383097612492437259862005779385",
879 | "1"
880 | ],
881 | [
882 | "0",
883 | "1",
884 | "0"
885 | ],
886 | [
887 | "9977589322706635191193883454120081696438068691922371370060681574969136405142",
888 | "16019297180892864994466824506684722537784428812940390212249668056215502300621",
889 | "1"
890 | ],
891 | [
892 | "21246974093562376313095290381866251290768301422102186426598029683816209132645",
893 | "15327234930171804921027414072238879372754431555343196948792947353415204629771",
894 | "1"
895 | ],
896 | [
897 | "1353215017360646007611918250097852583461083238007250049569942419873943186451",
898 | "2770414259016995806347069850654180843905473617876496583942772959161195087714",
899 | "1"
900 | ],
901 | [
902 | "12587000239473100870351248298710371888266333502229052426782082300572222677991",
903 | "4930609616544731969014778079541063118357457210561171635447189559563517131653",
904 | "1"
905 | ],
906 | [
907 | "8472462183205369947931682529251942436831680363411685374674790404325974334276",
908 | "16670382512938041702276231109316980657183997430825907324579417901192047164518",
909 | "1"
910 | ],
911 | [
912 | "1359664906167217490746335218772941187771515446639068052418580539431934303133",
913 | "13058111851555890601732530898514534064504075356168399198766533178990177743388",
914 | "1"
915 | ],
916 | [
917 | "14904386450775559777543482146209199010036631420795506376392027394696036906608",
918 | "1840726345420299305632051076213448752984315711308551877523842518887455723998",
919 | "1"
920 | ],
921 | [
922 | "11335149661765261751472940267810013853364835256886365463724684387942713918142",
923 | "14557763711711834809112835969020465517844533936324271185374305368851015683289",
924 | "1"
925 | ],
926 | [
927 | "4776736041291708149895824473990365228534827660862625726615194307798655672376",
928 | "12496604262170318689926770624742597839043903237739296193674897190800444237765",
929 | "1"
930 | ],
931 | [
932 | "6670213162756782709693389192981044112252383021727290468760806663270945959982",
933 | "863878488528731211904779000650965272337350017965486385500223532909008265011",
934 | "1"
935 | ],
936 | [
937 | "7226603570255202700884089568638173518520236028123383761617666234797536017935",
938 | "13907936627604876908112428618204161872014836478561146407997610247452865430613",
939 | "1"
940 | ],
941 | [
942 | "2869437020516973891635613445334363312985085979527411217051753560726760692351",
943 | "18488069584917626845475609670797995653021257128653377467422228537284777481293",
944 | "1"
945 | ],
946 | [
947 | "8592707821433349709890364878418021690044039687580059592612526668884142491596",
948 | "14943380027834430358837952323611612703683473672459053111642356782408674312195",
949 | "1"
950 | ],
951 | [
952 | "18732494165532110259822475203828688999394601520476401038720893687663038036026",
953 | "14826608923412482422314631747959616613856069370454892968985567227866170907686",
954 | "1"
955 | ],
956 | [
957 | "20836555392639686968211106816954120268384207775641558300676164063979204621931",
958 | "195911462687928746101607865157405233951412184147538506803976093189713103424",
959 | "1"
960 | ],
961 | [
962 | "9539331093423010885916592701060660162782705168880799770484292421233583002908",
963 | "1328588185035985093140655667067477021423702690809851097075871113591405389277",
964 | "1"
965 | ],
966 | [
967 | "4038498483372318946242062441041728122261279855172934102477046916500115412470",
968 | "11583003304133979420502859403010298892710361305613171931475968926683861440242",
969 | "1"
970 | ],
971 | [
972 | "7115089724501069206818204271566724262449886369327129423400450136945818272387",
973 | "4177163085630152079669657126729538460782127343484565721185989396449102429712",
974 | "1"
975 | ]
976 | ],
977 | "Bp": [
978 | [
979 | "5774299665019726817152985119499044301020554422551066811605108455783516025196",
980 | "9452724182267464604305026467946661871732488294172730963154340883144425965619",
981 | "1"
982 | ],
983 | [
984 | "12711109388117224690566981454746756329300189780338352631086934400134375987836",
985 | "4827351810775041909520444260159715066223004907966068926606115576142890936009",
986 | "1"
987 | ],
988 | [
989 | "15851018027226893098552970619452665317852976909599073107168387642893729588126",
990 | "12907211384981666199407395562129805752481097298551159510011189353334316433070",
991 | "1"
992 | ],
993 | [
994 | "0",
995 | "1",
996 | "0"
997 | ],
998 | [
999 | "0",
1000 | "1",
1001 | "0"
1002 | ],
1003 | [
1004 | "0",
1005 | "1",
1006 | "0"
1007 | ],
1008 | [
1009 | "15851018027226893098552970619452665317852976909599073107168387642893729588126",
1010 | "8981031486857609022839010183127469336215213858746664152677848541310909775513",
1011 | "1"
1012 | ],
1013 | [
1014 | "0",
1015 | "1",
1016 | "0"
1017 | ],
1018 | [
1019 | "19473973521775920138447331094540380666079304457886981961345365957926854874527",
1020 | "19297439733763321860785895835037213125573340458514505873019361968231946661445",
1021 | "1"
1022 | ],
1023 | [
1024 | "161775137058920048518889205732077706146993302236007482863058101547860172844",
1025 | "19746879225080239145835935259364650062556668896787109064844380709818771120766",
1026 | "1"
1027 | ],
1028 | [
1029 | "794675759688422384425569200665770676417270674814482358372626320035371127143",
1030 | "15779285092287546491801696225435701293912722605565943596091052191866029078210",
1031 | "1"
1032 | ],
1033 | [
1034 | "1604061747817777308884650462922662576078663682445269731143764577897571553698",
1035 | "20683683406053704557761515955558354086745446956563633593413762332419586046472",
1036 | "1"
1037 | ],
1038 | [
1039 | "18200445982379720169766069906642344594712827271959454749623412242983544376642",
1040 | "7828290371341020462892990667625324701440631045356193837467943163993721474459",
1041 | "1"
1042 | ],
1043 | [
1044 | "802567450942430866031760824839082033338748410180163186905987063733876902290",
1045 | "14487390782998926862404355549842454482983617370058255306125136433419522619059",
1046 | "1"
1047 | ],
1048 | [
1049 | "13331348174850958976098957961212710952683158897173651587992906632525826105477",
1050 | "16374680510526151651620352303558443067590535829600507875115595658653983518387",
1051 | "1"
1052 | ],
1053 | [
1054 | "19761968086878888967735915821219031572285079439039152407923470600235255511979",
1055 | "21473994736814706548893279373362156296487534382243762870948558704604219100617",
1056 | "1"
1057 | ],
1058 | [
1059 | "10885252122135127788254372839042755096843024483624096865901388814565365940206",
1060 | "7322050965645990002883101141014388892010895885115875504360586270503546240576",
1061 | "1"
1062 | ],
1063 | [
1064 | "21099880335830031187365696535106601369592188076797392676644476890053849344162",
1065 | "20132367211768416033310946652495576716845227389993624830252413611985763266443",
1066 | "1"
1067 | ],
1068 | [
1069 | "14996716904867189149514755830032100809188801347237582215259340064276061514771",
1070 | "6020464070393049490489909403275882738779340957244134683327081655593477964208",
1071 | "1"
1072 | ],
1073 | [
1074 | "9422307479523295794855083200715033157981186721204274663278451452046997106125",
1075 | "4213074932628138870006830024869463841392043636305091936927658274184816591370",
1076 | "1"
1077 | ],
1078 | [
1079 | "1734531837197748932576529457762345830222881283860945572852838403820312270936",
1080 | "12204597539387931946818209143290025335101760900178093536641410758238452995993",
1081 | "1"
1082 | ],
1083 | [
1084 | "5886879344562613354097941523219695509736577282804708725704068248474213309405",
1085 | "9149263980815728781813489455927934353391917932506982113915682226619134240525",
1086 | "1"
1087 | ],
1088 | [
1089 | "15395602664292123621029917613443828810661944922803502885673905817325140224936",
1090 | "4107563566282548441286125997312836102196249349019661457788643526994129995677",
1091 | "1"
1092 | ],
1093 | [
1094 | "1592527737740054222248512515783529348945593866984131705127355367839130911415",
1095 | "1300175395525359310312578438283529714560469594344290564992111146338375335492",
1096 | "1"
1097 | ],
1098 | [
1099 | "8618192830267242968135875652808437606906171119926616189039802597062658959313",
1100 | "829220077213535903430466624346126125043576388004889185133374978018228458334",
1101 | "1"
1102 | ],
1103 | [
1104 | "15954135884810581006751661322487190579849172932555805998302646164066383148860",
1105 | "9761057326531840152651912845235060899044870468547825143101981513072166814169",
1106 | "1"
1107 | ]
1108 | ],
1109 | "Cp": [
1110 | [
1111 | "20558561223741951614752026280957690580322614995878462913955327000312480275581",
1112 | "19861613314329988892344948430680313811096446327686574193298698013742278220241",
1113 | "1"
1114 | ],
1115 | [
1116 | "20558561223741951614752026280957690580322614995878462913955327000312480275581",
1117 | "2026629557509286329901457314576961277599864829611249469390339880902947988342",
1118 | "1"
1119 | ],
1120 | [
1121 | "0",
1122 | "1",
1123 | "0"
1124 | ],
1125 | [
1126 | "0",
1127 | "1",
1128 | "0"
1129 | ],
1130 | [
1131 | "0",
1132 | "1",
1133 | "0"
1134 | ],
1135 | [
1136 | "0",
1137 | "1",
1138 | "0"
1139 | ],
1140 | [
1141 | "0",
1142 | "1",
1143 | "0"
1144 | ],
1145 | [
1146 | "0",
1147 | "1",
1148 | "0"
1149 | ],
1150 | [
1151 | "0",
1152 | "1",
1153 | "0"
1154 | ],
1155 | [
1156 | "0",
1157 | "1",
1158 | "0"
1159 | ],
1160 | [
1161 | "0",
1162 | "1",
1163 | "0"
1164 | ],
1165 | [
1166 | "0",
1167 | "1",
1168 | "0"
1169 | ],
1170 | [
1171 | "0",
1172 | "1",
1173 | "0"
1174 | ],
1175 | [
1176 | "0",
1177 | "1",
1178 | "0"
1179 | ],
1180 | [
1181 | "0",
1182 | "1",
1183 | "0"
1184 | ],
1185 | [
1186 | "0",
1187 | "1",
1188 | "0"
1189 | ],
1190 | [
1191 | "0",
1192 | "1",
1193 | "0"
1194 | ],
1195 | [
1196 | "0",
1197 | "1",
1198 | "0"
1199 | ],
1200 | [
1201 | "0",
1202 | "1",
1203 | "0"
1204 | ],
1205 | [
1206 | "0",
1207 | "1",
1208 | "0"
1209 | ],
1210 | [
1211 | "0",
1212 | "1",
1213 | "0"
1214 | ],
1215 | [
1216 | "0",
1217 | "1",
1218 | "0"
1219 | ],
1220 | [
1221 | "0",
1222 | "1",
1223 | "0"
1224 | ],
1225 | [
1226 | "0",
1227 | "1",
1228 | "0"
1229 | ],
1230 | [
1231 | "0",
1232 | "1",
1233 | "0"
1234 | ],
1235 | [
1236 | "10407944599373320545265745633732533010463921350108098309610029238419149318025",
1237 | "4485831140775575313556224060821963288296191258875386545144710423048456008548",
1238 | "1"
1239 | ]
1240 | ],
1241 | "Kp": [
1242 | [
1243 | "13312015003545589510465350657864418148263207415439766134763725918024265021721",
1244 | "19740668539275842053538940016131079536449129147177875215748611069276788457694",
1245 | "1"
1246 | ],
1247 | [
1248 | "6213445691690753529851247028784939990351765552458669811400693177631254237100",
1249 | "13565626207008669451330067554607636590892755882921049323607190351305755331706",
1250 | "1"
1251 | ],
1252 | [
1253 | "7649366582516909575926610323791878146159931959536505489303166248844439029491",
1254 | "11617016716055734454113939961950124789041332145101440987215054462437878852982",
1255 | "1"
1256 | ],
1257 | [
1258 | "6724819599396108444225511642631695334813646643370598399379571208096109284960",
1259 | "4440203762367695623077937214063024136828309989317872384806727418758690652890",
1260 | "1"
1261 | ],
1262 | [
1263 | "18849548352002653967687240764937736898430329851569956706476975378399621130925",
1264 | "5109192155275209426896379420726353378208161070110468107889632641315681218239",
1265 | "1"
1266 | ],
1267 | [
1268 | "11133417356320009614242536230807387182336948505415381065345958875917638088501",
1269 | "11544483702513803923434856387548563720243246947633884580326316579790607577798",
1270 | "1"
1271 | ],
1272 | [
1273 | "14467248902663088669176951082644684056735314847979777141716783366315450734105",
1274 | "505676923257679245830873878288258191292662957686005066273427733284560485817",
1275 | "1"
1276 | ],
1277 | [
1278 | "0",
1279 | "1",
1280 | "0"
1281 | ],
1282 | [
1283 | "8900394682725152686568560245177451144737451295147912757300085488882319299714",
1284 | "8757380940835015603965850841347919407296310235061227100701697030909336705700",
1285 | "1"
1286 | ],
1287 | [
1288 | "6112072002540843260384476480356085679804732749716601010841371965875789049945",
1289 | "1453072723812951128958688005026332080478725800011617496949729771425076973211",
1290 | "1"
1291 | ],
1292 | [
1293 | "8560317704476329799559731685662389924640951439599282365535114282931516867984",
1294 | "14900154112736061155743260967213104430591790702625419971869860848891333854965",
1295 | "1"
1296 | ],
1297 | [
1298 | "6545946406298929904911693890738148223562799926637262537416718436509224896690",
1299 | "4922664283735736386624293691616414340643483345572876041079279555366706314429",
1300 | "1"
1301 | ],
1302 | [
1303 | "20048136237917237495159686999559774198066816626431729939073243948407545363414",
1304 | "20098306464247212817566678246532045143752330122404190156422132920979895724774",
1305 | "1"
1306 | ],
1307 | [
1308 | "16109604018157859096828043335090744582467334598206988333051600226281898184345",
1309 | "15570517824697344928308866747216483733368037120295668342912302044545344410163",
1310 | "1"
1311 | ],
1312 | [
1313 | "11756087884644395415825187527309468394628036645886222776674361071729290819878",
1314 | "14631741571822707453667630254763364768190058763170065827873529632822167318937",
1315 | "1"
1316 | ],
1317 | [
1318 | "7316774350312531404335744455534334383806380042295647624580374095141739805306",
1319 | "1590419063308273242643993231384750688610941843484825334583501196824642355770",
1320 | "1"
1321 | ],
1322 | [
1323 | "18955949798449595257161424632819845327407953963171247324964084588722626892301",
1324 | "10737812887781274923921737255004641019576873630905069770272054479277706269788",
1325 | "1"
1326 | ],
1327 | [
1328 | "6961333628813147675924340247394036972086344157931295661418513433741017404601",
1329 | "17653888726175802719629786032097365373968886726379375427846244909741912118424",
1330 | "1"
1331 | ],
1332 | [
1333 | "1018535583356048442807768955556385194418061534948180194683373631870578400544",
1334 | "9064665724250541774085630644880739929042693562637044628997490942270874677280",
1335 | "1"
1336 | ],
1337 | [
1338 | "12554970867396980064822467654697667942277501340200436400808562786689059447443",
1339 | "10429439371699894028449529291036083495731815333874660498851352245277754282821",
1340 | "1"
1341 | ],
1342 | [
1343 | "4546277384805838350322597953485937041948574638130035615446352239368069164522",
1344 | "1542314495864256352660120625776382926978422553313136029851716396415373423548",
1345 | "1"
1346 | ],
1347 | [
1348 | "8715119600545011804429649362576947291831810220393113325620832101974934530310",
1349 | "8586440834159873331614832300564455332123455605659499902464644449918221082109",
1350 | "1"
1351 | ],
1352 | [
1353 | "6155994564928023901776050627762018636945289444929365149250673299612272002663",
1354 | "11738248773696016021327448407575530267835095534417883159484205431723228090254",
1355 | "1"
1356 | ],
1357 | [
1358 | "5577072348023550734041888162555366658540010581181001242441989949391730962624",
1359 | "20301638733148910067007859121816913306440970937882100343175945118581154729325",
1360 | "1"
1361 | ],
1362 | [
1363 | "21061988563459462473482686600983702547657760041416238954727629792100197334251",
1364 | "11260503229578559998229553356097010669074628065601962524876680373961787894428",
1365 | "1"
1366 | ],
1367 | [
1368 | "7461158690407165856769180349123920366199231985125546917613607712108825552921",
1369 | "7384625401549614825532622092315086855984957745574978524469541879019056458574",
1370 | "1"
1371 | ],
1372 | [
1373 | "2310965471619461204970299437056087331496532140914424260110294664658660638111",
1374 | "19429225581349514202207171541966905373832708258854680766504807304142304022224",
1375 | "1"
1376 | ],
1377 | [
1378 | "19972335184928988797792227188368466189299572784933258594753226932397433021215",
1379 | "8208288760450960653549041912072355959480820757113633140095819096232715364710",
1380 | "1"
1381 | ]
1382 | ],
1383 | "hExps": [
1384 | [
1385 | "1",
1386 | "2",
1387 | "1"
1388 | ],
1389 | [
1390 | "20081616802159139321403425610240076983357824686356740526481309193185986674849",
1391 | "19411451482072224401471062914565168463297377929206310828921103098124262576032",
1392 | "1"
1393 | ],
1394 | [
1395 | "14737520861074909466960585970112714854901877795961882381834478752512034917732",
1396 | "1947335742605858860204565939564033477015750905305515362650684856898261983834",
1397 | "1"
1398 | ],
1399 | [
1400 | "5831345080344219382955155611547343522565381437373018087828677287602656890452",
1401 | "15863559323069249984994564539267353904102597362593004482189455609146669565159",
1402 | "1"
1403 | ],
1404 | [
1405 | "19361424684545868190329566638443237092340611747140541349237782529651249993533",
1406 | "9804102629718103095573388044051493576283726608318689506234211578062882286672",
1407 | "1"
1408 | ],
1409 | [
1410 | "945514683415093777186756558876104469918688457158034966033117021236660177612",
1411 | "8410193818940071939523599888080541014651780043247232839357190599679702353292",
1412 | "1"
1413 | ],
1414 | [
1415 | "17255682795586202911061581150757745503872037693196757736622095481701730105325",
1416 | "2906029634393435571203459375487453072080781477025558255730262209016343348178",
1417 | "1"
1418 | ],
1419 | [
1420 | "19789717942282633509089869215439807492690074480288901353737455334743854947491",
1421 | "12344617055070827962441705497890259062308256930792593733066248158490447583053",
1422 | "1"
1423 | ],
1424 | [
1425 | "1171158411441659257294401893077272727534286680834896931516215957540773793277",
1426 | "10960509389208142968603944853175391914876081442475107424195888800522563860795",
1427 | "1"
1428 | ],
1429 | [
1430 | "21332667634243702181243715036430561192874096784510714797515288235958179383005",
1431 | "21177981939575291851426837022665558056923046174201535043773368125769390789396",
1432 | "1"
1433 | ],
1434 | [
1435 | "1319922442842511242907887502843733963763517490480212548274875313430578212203",
1436 | "12507680695805629261719478051365233459433756670329981835680318032466884599142",
1437 | "1"
1438 | ],
1439 | [
1440 | "15079121774988139432418487717579787399460026836162642052874675941864797034469",
1441 | "18607900823228158321183185082690200235649294504635837983077280467063899276511",
1442 | "1"
1443 | ],
1444 | [
1445 | "10203144595537328948091219257584452642903866982498474114993649654088347578562",
1446 | "5046872536710705287539228571386757407360232635946396567699039397284029048650",
1447 | "1"
1448 | ],
1449 | [
1450 | "706683124260819089904645933961654224428767380694317120957278941458157751528",
1451 | "18962287569236930317498986030962236516755356504337758374255199805763796473206",
1452 | "1"
1453 | ],
1454 | [
1455 | "9945642512365721738779393903020836049582821997955970557520548244685360375161",
1456 | "19969522302727764123964275395588749350396639996658858963319269230386372408654",
1457 | "1"
1458 | ],
1459 | [
1460 | "15823191981544052846123298914717137890510124842621038416152155390203064093400",
1461 | "7063499086725069284737837011804583656431017284275317532557201265124960659252",
1462 | "1"
1463 | ],
1464 | [
1465 | "21808017996986871114322545388979980867540615107141437601325103550773525583924",
1466 | "5286028924649017251927971685753844554627851917838760533311689505537504221141",
1467 | "1"
1468 | ],
1469 | [
1470 | "15417633829394923540700796197911040990157586854735734326875921135034674588247",
1471 | "3080920150340269359638855777713720411249344397975865763894720442547832074049",
1472 | "1"
1473 | ],
1474 | [
1475 | "21759899226216675939804383398087269195302062526711622473655404111676889618844",
1476 | "17919319544215595111702551581122978432452593275849138862053043734774923561682",
1477 | "1"
1478 | ],
1479 | [
1480 | "7645603874245912224126572862640547526793800042539844368970992228476502532800",
1481 | "2541357840541564942959598750314461480543389555627592053971214158356895737966",
1482 | "1"
1483 | ],
1484 | [
1485 | "10493482649289743691609853637332116327725499858362360665032085600634296510748",
1486 | "6522129257762582242770745245921423402999806815845173484162642936683187276950",
1487 | "1"
1488 | ],
1489 | [
1490 | "9502070604158611512117620456323831855475448452096130264768031739038715142834",
1491 | "10596798210836519506902108330626713779436279727631040690538823890104111139137",
1492 | "1"
1493 | ],
1494 | [
1495 | "2875386340691242981363935234135799470103098850918328347072413993209360346354",
1496 | "2654067529204300312460136494867297100191046510308411326175480950465959137511",
1497 | "1"
1498 | ],
1499 | [
1500 | "19353817829487034782083133935517769039607738866867020890967544267498748373700",
1501 | "9287738392795162449179817071753682054785774446297549074105928912173595921407",
1502 | "1"
1503 | ],
1504 | [
1505 | "17420785355026671406609095940317233160200122740770783317467953234736878322169",
1506 | "3188920781758603307545367046786791483414863627031382552138546088748214992729",
1507 | "1"
1508 | ],
1509 | [
1510 | "12580371702289280955988782735408951475328832860859088521137954093694277976778",
1511 | "1600916694067017907624420038102406999871804043337927250981597558282363377916",
1512 | "1"
1513 | ],
1514 | [
1515 | "7118561842687459739364491786729683758241744081844471708203872594324180594575",
1516 | "4707247990388051777644218063137967079771477014083626733055090912476491210181",
1517 | "1"
1518 | ],
1519 | [
1520 | "14088867829149139302676451427526294002510856823429957074047538437102867658947",
1521 | "12433084256978702992856208627329163545184174826335604233298361665624342649574",
1522 | "1"
1523 | ],
1524 | [
1525 | "17211037888038257251622198590588728879903976740420607111006619427072324291567",
1526 | "7205365137372230676664811640597153521498966736444010306663618143655802764705",
1527 | "1"
1528 | ],
1529 | [
1530 | "8251885185220658713494819585701589040251573049216720868185948987874312292178",
1531 | "18474641297305815441464993878466311382139995499973224639291421545292610636239",
1532 | "1"
1533 | ],
1534 | [
1535 | "5912505295956092221270561263544853481661215565890838525221858600166170303226",
1536 | "4995158880013306914896414635508425520114446833607831263120544451300656463597",
1537 | "1"
1538 | ],
1539 | [
1540 | "18564444036834292310823038821244013882000446748086786708831536322123147120674",
1541 | "12469108345412252422503105834290096369871653821706882181146946227132629257729",
1542 | "1"
1543 | ],
1544 | [
1545 | "9458267093756231049263103633499383843111930102043241494662095868749585426643",
1546 | "9743449581334614574876531260977068290006976556501064070721223899368844083871",
1547 | "1"
1548 | ]
1549 | ]
1550 | }
--------------------------------------------------------------------------------
/src/circuits/public.json:
--------------------------------------------------------------------------------
1 | [
2 | "1",
3 | "20",
4 | "21",
5 | "176",
6 | "190"
7 | ]
--------------------------------------------------------------------------------
/src/circuits/verification_key.json:
--------------------------------------------------------------------------------
1 | {
2 | "protocol": "original",
3 | "nPublic": 5,
4 | "IC": [
5 | [
6 | "6543047960617981073886972622273531443599165233117160290361185486138300537104",
7 | "11401518062075154897134708833711425469699755817872313530069388841257420979753",
8 | "1"
9 | ],
10 | [
11 | "12423292224312996997512845630020420315990228971663481703212606385309249082280",
12 | "187089888143708956044704479516625605650361368074653359027313199214731198602",
13 | "1"
14 | ],
15 | [
16 | "15559281875656469775112083667694773353079958871450130703727936158716951882348",
17 | "20065076019533905015729566796015049488941428584293297605747899784452650283898",
18 | "1"
19 | ],
20 | [
21 | "20261789557823626180607484517793205410285129320710435474895836844642684402649",
22 | "16901113082181097881247026511513777847242291314946367386342738851983118837093",
23 | "1"
24 | ],
25 | [
26 | "5674982760698123096493230714707448218617707887801376223785790289766735490058",
27 | "9829810340385346851491932447599218985694501821638335649223680628973158602826",
28 | "1"
29 | ],
30 | [
31 | "6442006813067603843261861427177653620020623608637667570096236683755749868136",
32 | "4428755654903388966273772554589239071575460289725402645961530198843343674775",
33 | "1"
34 | ]
35 | ],
36 | "vk_a": [
37 | [
38 | "7507530419937091112618588185609998550183530449344017483439850782149926494316",
39 | "3916055617633402976821235482135583924634394777189986656901571184400017340970"
40 | ],
41 | [
42 | "16080473567499510913833483081585486143027140163460350874088484770205459844211",
43 | "10385751091386982416220236128355688480818426663075956323060020266306776020535"
44 | ],
45 | [
46 | "1",
47 | "0"
48 | ]
49 | ],
50 | "vk_b": [
51 | "10642580688161510864242501591556878539613502802216436379235511296624202505315",
52 | "17285742527316315894026342704662574965959075326400072900678241548664748402413",
53 | "1"
54 | ],
55 | "vk_c": [
56 | [
57 | "7955947139417046542210988339809518833763557922771447362247396884408975659491",
58 | "21439204110566816531102745945002240733167276321694953674715824866926999810380"
59 | ],
60 | [
61 | "15211038904433488518158233090602415366546290794441992503171769852763975485389",
62 | "15778953255202812593750787111297554824916289712212890755125196447817095005478"
63 | ],
64 | [
65 | "1",
66 | "0"
67 | ]
68 | ],
69 | "vk_gb_1": [
70 | "3083943963279409975782164969692036742073413813752728085239114420072690007163",
71 | "4994890749632235338487226772081079940865215613903354234293159701603064037190",
72 | "1"
73 | ],
74 | "vk_gb_2": [
75 | [
76 | "9022591396625529884302813807762358823850924918269376678222808217168173990391",
77 | "19105118657252435745448545851125386649068081086950123791947277863284365520883"
78 | ],
79 | [
80 | "17640989426428601670428731669621054309406223929004106633318629001067253669253",
81 | "15528402431255932041112539166964941648319859480199738488413687513894013600258"
82 | ],
83 | [
84 | "1",
85 | "0"
86 | ]
87 | ],
88 | "vk_g": [
89 | [
90 | "13449895439610470699022235444641935143600734584362351745086583373986831189078",
91 | "322717155486149614169696325512265962965080699911753248319368534225500317811"
92 | ],
93 | [
94 | "16656313015618280257941408852837600594156261582075961672446775965378544647349",
95 | "15931240696989497129688205533791150787038844090993894810899716001026837644696"
96 | ],
97 | [
98 | "1",
99 | "0"
100 | ]
101 | ],
102 | "vk_z": [
103 | [
104 | "2971887128365170362463376905782799202126445399192290462182284786064114584011",
105 | "17470468529471227134208755796666094578936954274764915689996882124509173710940"
106 | ],
107 | [
108 | "1346980230047161650841985497737977445024743476330537594099039683564610955381",
109 | "20619931140962397100156717246136580800125451067502960977815731308356123739438"
110 | ],
111 | [
112 | "1",
113 | "0"
114 | ]
115 | ]
116 | }
--------------------------------------------------------------------------------
/src/circuits/witness.json:
--------------------------------------------------------------------------------
1 | [
2 | "1",
3 | "1",
4 | "20",
5 | "21",
6 | "176",
7 | "190",
8 | "20",
9 | "180",
10 | "1",
11 | "1",
12 | "1",
13 | "1",
14 | "1",
15 | "1",
16 | "1",
17 | "1",
18 | "0",
19 | "0",
20 | "0",
21 | "0",
22 | "0",
23 | "0",
24 | "0",
25 | "0",
26 | "0"
27 | ]
--------------------------------------------------------------------------------
/src/flureeFetch.js:
--------------------------------------------------------------------------------
1 | import fetch from 'isomorphic-fetch';
2 |
3 | function gateway(ip) {
4 | let hosted = process.env.REACT_APP_ENVIRONMENT === "hosted";
5 | let production = process.env.NODE_ENV === "production";
6 |
7 | if (hosted && production) {
8 | return "https://db.flur.ee";
9 | }
10 | else if (hosted) {
11 | return "http://localhost:8080"
12 | } else if (!hosted){
13 | return ip;
14 | }
15 | }
16 |
17 | function parseJSON(response) {
18 | return response.json().then(function (json) {
19 | const newResponse = Object.assign(response, { json });
20 |
21 | if (response.status < 300) {
22 | return newResponse;
23 | } else {
24 | throw newResponse;
25 | }
26 | });
27 | }
28 |
29 | function fullEndpoint(endpoint, network, db, body, ip) {
30 | const hosted = process.env.REACT_APP_ENVIRONMENT === "hosted";
31 | const endpointInfix = hosted ? "api" : "fdb";
32 |
33 | const locatedEndpoint = [
34 | "query",
35 | "multi-query",
36 | "block",
37 | "history",
38 | "transact",
39 | "graphql",
40 | "sparql",
41 | "command",
42 | "snapshot"
43 | ].includes(endpoint);
44 |
45 | const startURI = gateway(ip);
46 |
47 | if (locatedEndpoint) {
48 | if (endpoint === "snapshot") {
49 | return `${startURI}/${endpointInfix}/${body["db/id"]}/${endpoint}`;
50 | } else {
51 | return `${startURI}/${endpointInfix}/${
52 | hosted ? "db/" : ""
53 | }${network}/${db}/${endpoint}`;
54 | }
55 | }
56 |
57 | const prefixedEndpoints = [
58 | "dbs",
59 | "action",
60 | "new-db",
61 | "accounts",
62 | "signin",
63 | "health",
64 | "sub",
65 | "new-pw",
66 | "reset-pw",
67 | "activate-account",
68 | "delete-db"
69 | ].includes(endpoint);
70 |
71 | if (prefixedEndpoints) {
72 | return `${startURI}/${endpointInfix}/${endpoint}`;
73 | }
74 |
75 | if (endpoint === "logs") {
76 | return `${startURI}/${endpointInfix}/fdb/${endpoint}/${network}`;
77 | }
78 |
79 | throw {
80 | status: 400,
81 | message: "Invalid endpoint"
82 | };
83 | }
84 |
85 | const flureeFetch = opts => {
86 | // Opts include: ip, body, auth, network, db, endpoint
87 | const { ip, body, auth, network, db, endpoint, headers, noRedirect } = opts;
88 |
89 | const fullUri = fullEndpoint(endpoint, network, db, body, ip);
90 |
91 | const finalHeaders = headers
92 | ? headers
93 | : {
94 | "Content-Type": "application/json",
95 | "Request-Timeout": 20000,
96 | Authorization: `Bearer ${auth}`
97 | };
98 |
99 | const fetchOpts = {
100 | method: "POST",
101 | headers: finalHeaders,
102 | body: JSON.stringify(body)
103 | };
104 |
105 | return fetch(fullUri, fetchOpts)
106 | .then(parseJSON)
107 | .catch(error => {
108 | if (!noRedirect && (error.status === 401 || error.status === 403)) {
109 | localStorage.removeItem("token");
110 | // main token expired, need to log back in.
111 | if (this.props) {
112 | this.props.logout();
113 | } else {
114 | window.location = "/";
115 | }
116 | } else {
117 | if (error.json) {
118 | return error.json;
119 | }
120 |
121 | return error;
122 | }
123 | });
124 | };
125 |
126 | export { flureeFetch };
127 |
--------------------------------------------------------------------------------
/src/index.css:
--------------------------------------------------------------------------------
1 | body {
2 | margin: 0;
3 | font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
4 | 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
5 | sans-serif;
6 | -webkit-font-smoothing: antialiased;
7 | -moz-osx-font-smoothing: grayscale;
8 | }
9 |
10 | code {
11 | font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
12 | monospace;
13 | }
14 |
15 | .mt20 {
16 | margin-top: 20px;
17 | }
18 |
19 | .resize-drag {
20 | background-color: rgb(11, 61, 87);
21 | color: white;
22 | font-size: 20px;
23 | font-family: sans-serif;
24 | border-radius: 8px;
25 | padding: 20px;
26 | margin: 30px 80px;
27 | touch-action: none;
28 |
29 | width: 120px;
30 |
31 | /* This makes things *much* easier */
32 | box-sizing: border-box;
33 | }
34 |
35 | .resize-container {
36 | width: 500px;
37 | height: 240px;
38 | background-color: #29e;
39 | margin-left: 50px;
40 | }
41 |
42 | .x-axis {
43 | padding-left: 5px;
44 | width: 500px;
45 | padding-bottom: 5px;
46 | }
47 |
48 | @media (max-width: 550px) {
49 | .resize-container {
50 | margin-left: 0px;
51 | }
52 | .x-axis {
53 | margin-left: 0px;
54 | }
55 | }
--------------------------------------------------------------------------------
/src/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom';
3 | import './index.css';
4 | import App from './App';
5 | import * as serviceWorker from './serviceWorker';
6 |
7 | ReactDOM.render( , document.getElementById('root'));
8 |
9 | // If you want your app to work offline and load faster, you can change
10 | // unregister() to register() below. Note this comes with some pitfalls.
11 | // Learn more about service workers: https://bit.ly/CRA-PWA
12 | serviceWorker.unregister();
13 |
--------------------------------------------------------------------------------
/src/logo.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/src/screens/GenProof.js:
--------------------------------------------------------------------------------
1 | import React, { Component } from 'react';
2 | import { Row, Col, Form, Alert, Button } from 'react-bootstrap';
3 | import interact from 'interactjs';
4 | import zkSnark from 'snarkjs';
5 |
6 | import {flureeFetch} from '../flureeFetch'
7 |
8 | class AuthorizedZone extends Component {
9 | componentDidMount(){
10 | interact('.resize-drag')
11 | .draggable({
12 | onmove: (event) => {
13 | const target = event.target;
14 |
15 | const dataX = target.getAttribute('data-x');
16 | const dataY = target.getAttribute('data-y');
17 | const initialX = parseInt(dataX) || 0;
18 | const initialY = parseInt(dataY) || 0;
19 |
20 | const deltaX = event.dx;
21 | const deltaY = event.dy;
22 |
23 | const newX = initialX + deltaX;
24 | const newY = initialY + deltaY;
25 |
26 | target
27 | .style
28 | .transform = `translate(${newX}px, ${newY}px)`;
29 |
30 | target.setAttribute('data-x', newX);
31 | target.setAttribute('data-y', newY);
32 |
33 | let topLeftX = parseInt(( newX + 80 ) / 5);
34 | if(topLeftX > 100) {
35 | topLeftX = 100
36 | } else if (topLeftX < 0 ){
37 | topLeftX = 0
38 | };
39 |
40 | let topLeftY = parseInt( (newY + 59) / 2.4);
41 | if(topLeftY > 100) {
42 | topLeftY = 100
43 | } else if (topLeftY < 0 ){
44 | topLeftY = 0
45 | };
46 |
47 | this.props.setCoords(topLeftX, topLeftY)
48 | },
49 | restrict: {
50 | restriction: 'parent',
51 | },
52 | modifiers: [
53 | interact.modifiers.restrictRect({
54 | restriction: 'parent'
55 | })
56 | ]
57 | })
58 | .resizable({
59 | // resize from all edges and corners
60 | edges: { left: true, right: true, bottom: true, top: true },
61 | modifiers: [
62 | // keep the edges inside the parent
63 | interact.modifiers.restrictEdges({
64 | outer: 'parent'
65 | }),
66 |
67 | // minimum size
68 | interact.modifiers.restrictSize({
69 | min: { width: 50, height: 50 }
70 | })
71 | ],
72 | inertia: true
73 | })
74 | .on('resizemove', (event) => {
75 | var target = event.target
76 | var x = (parseInt(target.getAttribute('data-x')) || 0)
77 | var y = (parseInt(target.getAttribute('data-y')) || 0)
78 |
79 | // update the element's style
80 | target.style.width = event.rect.width + 'px'
81 | target.style.height = event.rect.height + 'px'
82 |
83 | // translate when resizing from top or left edges
84 | x += event.deltaRect.left
85 | y += event.deltaRect.top
86 |
87 | target.style.webkitTransform = target.style.transform =
88 | 'translate(' + x + 'px,' + y + 'px)'
89 |
90 | target.setAttribute('data-x', x)
91 | target.setAttribute('data-y', y)
92 |
93 | let width = parseInt(event.rect.width/5);
94 | let height = parseInt(event.rect.height/2.4);
95 |
96 | let topLeftX = parseInt((( x + 80 ) / 5));
97 | if(topLeftX > 100) {
98 | topLeftX = 100
99 | } else if (topLeftX < 0 ){
100 | topLeftX = 0
101 | };
102 |
103 | let topLeftY = parseInt( (y + 59) / 2.4);
104 | if(topLeftY > 100) {
105 | topLeftY = 100
106 | } else if (topLeftY < 0 ){
107 | topLeftY = 0
108 | };
109 |
110 | this.props.setCoords(topLeftX, topLeftY)
111 | this.props.setDimensions(width, height)
112 | })
113 | }
114 |
115 | render() {
116 | return(
117 |
118 |
119 | 1. Create an authorized fishing zone by dragging and resizing the dark blue box below.
120 |
121 |
122 |
123 |
124 | 0
125 | _
126 | 100
127 |
128 |
131 |
Legal Zone
132 |
133 |
134 |
135 | )
136 | }}
137 |
138 | function FishingLocation(props) {
139 | return(
140 |
141 |
142 |
143 | 2. Put in your (secret) fishing location.
144 |
145 |
146 | We do not share your fishing location with anyone!
147 | We use your fishing location to generate a proof that you fished in a legal zone, but the coordinates are not recorded anywhere.
148 |
149 | X:
151 |
152 | Y:
153 |
154 |
155 |
156 |
157 | )
158 | }
159 |
160 | class GenerateProof extends Component {
161 | state = {}
162 |
163 | generateProof = () => {
164 | let maxLong = this.props.topLeftX + this.props.width > 100 ? 100 : this.props.topLeftX + this.props.width;
165 | let maxLat = this.props.topLeftY + this.props.height > 100 ? 100 : this.props.topLeftY + this.props.height;
166 |
167 | flureeFetch({
168 | "ip": "http://localhost:8080",
169 | "network": "legal",
170 | "db": "fishing",
171 | "endpoint": "query",
172 | "body": { "selectOne": ["?circuit", "?provingKey"],
173 | "where": [
174 | ["?snark", "snarkConfig/id", "legalFishing"],
175 | ["?snark", "snarkConfig/circuit", "?circuit"],
176 | ["?snark", "snarkConfig/provingKey", "?provingKey"]]}})
177 | .then(res => {
178 | const body = res.json;
179 | const circuit = JSON.parse(body[0])
180 | const cir = new zkSnark.Circuit(circuit);
181 |
182 | const input = {
183 | "latitudeRange": [ this.props.topLeftX, maxLong],
184 | "longitudeRange": [ this.props.topLeftY, maxLat],
185 | "fishingLocation": [ this.props.xcoord, this.props.ycoord]
186 | }
187 |
188 | const witness = cir.calculateWitness(input);
189 | const provingKey = JSON.parse(body[1]);
190 | const vk_proof = zkSnark.unstringifyBigInts(provingKey);
191 |
192 | let {proof, publicSignals} = zkSnark.original.genProof(vk_proof, witness);
193 | proof = zkSnark.stringifyBigInts(proof);
194 | publicSignals = zkSnark.stringifyBigInts(publicSignals);
195 |
196 | this.setState({ proof: proof, publicSignals: publicSignals})})
197 | };
198 |
199 |
200 | submitProof = () => {
201 | const { proof, publicSignals } = this.state;
202 |
203 | const txn = [{
204 | "_id": ["snarkConfig/id", "legalFishing"],
205 | "proofs": ["proof$1"]
206 | },
207 | {
208 | "_id": "proof$1",
209 | "proof": proof,
210 | "instant": "#(now)",
211 | "publicSignals": publicSignals
212 | }]
213 |
214 | flureeFetch({
215 | "ip": "http://localhost:8080",
216 | "network": "legal",
217 | "db": "fishing",
218 | "endpoint": "transact",
219 | "body": txn })
220 | .then(res => {
221 | if(res.json.status === 200 ){
222 | this.setState({ success: true})
223 | } else {
224 | this.setState({ error: res.json })
225 | }
226 | })
227 | .catch(err => this.setState({ error: JSON.stringify(err.message)}))
228 | }
229 |
230 | render(){
231 | return (
232 |
233 |
234 |
235 | 3. Generate the proof - Generate Proof
236 |
237 |
238 |
239 |
240 | Proof: {JSON.stringify(this.state.proof, null, 2)}
241 |
242 |
243 |
244 | Public Signals: {JSON.stringify(this.state.publicSignals, null, 2) }
245 |
246 |
247 |
248 | 4. Submit proof -
249 |
250 |
Submit Proof
251 | {
252 | this.state.error &&
{this.state.error}
253 | }
254 | {
255 | this.state.success &&
256 |
257 | Proof successfully submitted! Go to the Verify Proofs page to see all submitted proofs.
258 |
259 | }
260 |
261 |
262 |
263 |
264 |
265 |
266 | )
267 | }
268 | }
269 |
270 | class GenProof extends Component {
271 | state = {
272 | xcoord: "",
273 | ycoord: "",
274 | width: 26,
275 | height: 41,
276 | topLeftX: 16,
277 | topLeftY: 0
278 | }
279 | coordinateToInt(coord){
280 | if(isNaN(coord)){
281 | coord = ""
282 | } else if (coord > 100) {
283 | coord = 100
284 | } else if (coord < 0) {
285 | coord = 0
286 | }
287 | return coord
288 | }
289 |
290 | setX = (e) => {
291 | const proposedx = parseInt(e.target.value);
292 | const x = this.coordinateToInt(proposedx)
293 | this.setState({ xcoord: x})
294 | }
295 |
296 | setY = (e) => {
297 | const proposedy = parseInt(e.target.value);
298 | const y = this.coordinateToInt(proposedy)
299 | this.setState({ ycoord: y})
300 | }
301 |
302 | setCoords = (x, y) => {
303 | this.setState({ topLeftX: x, topLeftY: y})
304 | }
305 |
306 | setDimensions = (width, height) => {
307 | this.setState({ width: width, height: height })
308 | }
309 |
310 | render() {
311 | let inRange = this.state.xcoord >= this.state.topLeftX && this.state.xcoord <= this.state.topLeftX + this.state.width
312 | && this.state.ycoord >= this.state.topLeftY && this.state.ycoord <= this.state.topLeftY + this.state.height;
313 |
314 | return (
315 |
316 |
317 |
318 |
319 |
320 |
321 |
322 |
Your Legal Fishing Zone:
323 |
Height: {this.state.height}
324 |
Width: {this.state.width}
325 |
Top Left Corner: ({this.state.topLeftX}, {this.state.topLeftY})
326 |
Bottom Right Corner: ({this.state.topLeftX + this.state.width > 100 ? 100 : this.state.topLeftX + this.state.width }, {this.state.topLeftY + this.state.height > 100 ? 100 : this.state.topLeftY + this.state.height})
327 |
328 |
329 |
330 |
331 |
332 |
333 |
334 | {
335 | inRange
336 | ?
337 |
338 | Congrats, your fishing location is within the legal zone.
339 |
340 | :
341 |
342 | Sorry, your fishing location is NOT within the legal zone.
343 |
344 | }
345 |
346 |
347 |
348 |
350 |
351 | )}
352 | }
353 |
354 | export default GenProof;
--------------------------------------------------------------------------------
/src/screens/Verify.js:
--------------------------------------------------------------------------------
1 | import React, { Component } from 'react';
2 | import { flureeFetch } from '../flureeFetch';
3 | import { Alert, Button, Table } from 'react-bootstrap';
4 | import zkSnark from 'snarkjs';
5 |
6 | function sleep(time) {
7 | return new Promise((resolve) => setTimeout(resolve, time));
8 | }
9 |
10 | class Proof extends Component {
11 | state = {
12 | loading: false
13 | }
14 |
15 | verify = () => {
16 | this.setState({ loading: true })
17 |
18 | sleep(10)
19 | .then(res => {
20 | let verificationKey = JSON.parse(this.props.proof[3]);
21 | verificationKey = zkSnark.unstringifyBigInts(verificationKey);
22 |
23 | let proof = JSON.parse(this.props.proof[1])
24 | proof = zkSnark.unstringifyBigInts(proof);
25 |
26 | let publicSignals = JSON.parse(this.props.proof[2]);
27 |
28 | if (zkSnark.original.isValid(verificationKey, proof, publicSignals)) {
29 | this.setState({ verified: true, loading: false })
30 | } else {
31 | this.setState({ notVerified: true, loading: false })
32 | }
33 | })
34 | }
35 |
36 |
37 | render(){
38 | const coords = JSON.parse(this.props.proof[2]);
39 | return(
40 |
41 | {JSON.stringify(this.props.proof[0])}
42 | ({coords[1]}, {coords[3]})
43 | ({coords[2]}, {coords[4]})
44 | {this.props.proof[4]}
45 |
46 | {
47 | this.state.verified
48 | ?
49 | Verified!
50 | :
51 |
52 | {this.state.loading ? "Verifying" : "Verify" }
53 | }
54 | {
55 | this.state.notVerified && Not Verified!
56 | }
57 |
58 |
59 | )
60 | }
61 | }
62 |
63 | class Verify extends Component {
64 | state = {
65 |
66 | }
67 |
68 | componentDidMount(){
69 | flureeFetch({
70 | "ip": "http://localhost:8080",
71 | "network": "legal",
72 | "db": "fishing",
73 | "endpoint": "query",
74 | "body": {
75 | "select": ["?proof", "?proofBody", "?publicSignals", "?verificationKey", "?instant"],
76 | "where": [
77 | ["?proof", "proof/proof", "?proofBody"],
78 | ["?proof", "proof/publicSignals", "?publicSignals"],
79 | ["?proof", "proof/instant", "?instant"],
80 | ["?config", "snarkConfig/id", "legalFishing"],
81 | ["?config", "snarkConfig/verificationKey", "?verificationKey"]
82 | ]
83 | }
84 | })
85 | .then(res => {
86 | const proofs = res.json;
87 | this.setState({ proofs: proofs})
88 | })
89 | .catch(err => this.setState({ error: JSON.stringify(err.message)}))
90 | }
91 |
92 | render(){
93 | return (
94 |
95 |
96 |
97 |
98 | _id
99 | Legal Zone: Top Left Corner
100 | Legal Zone: Bottom Right Corner
101 | Submitted
102 | Verify
103 |
104 |
105 |
106 | {
107 | this.state.proofs &&
108 | this.state.proofs.map(proof => )
109 | }
110 |
111 |
112 | {
113 | this.state.error &&
114 |
115 | {this.state.error}
116 |
117 | }
118 |
119 | )
120 | }
121 | }
122 |
123 | export default Verify;
--------------------------------------------------------------------------------
/src/serviceWorker.js:
--------------------------------------------------------------------------------
1 | // This optional code is used to register a service worker.
2 | // register() is not called by default.
3 |
4 | // This lets the app load faster on subsequent visits in production, and gives
5 | // it offline capabilities. However, it also means that developers (and users)
6 | // will only see deployed updates on subsequent visits to a page, after all the
7 | // existing tabs open on the page have been closed, since previously cached
8 | // resources are updated in the background.
9 |
10 | // To learn more about the benefits of this model and instructions on how to
11 | // opt-in, read https://bit.ly/CRA-PWA
12 |
13 | const isLocalhost = Boolean(
14 | window.location.hostname === 'localhost' ||
15 | // [::1] is the IPv6 localhost address.
16 | window.location.hostname === '[::1]' ||
17 | // 127.0.0.0/8 are considered localhost for IPv4.
18 | window.location.hostname.match(
19 | /^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/
20 | )
21 | );
22 |
23 | export function register(config) {
24 | if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) {
25 | // The URL constructor is available in all browsers that support SW.
26 | const publicUrl = new URL(process.env.PUBLIC_URL, window.location.href);
27 | if (publicUrl.origin !== window.location.origin) {
28 | // Our service worker won't work if PUBLIC_URL is on a different origin
29 | // from what our page is served on. This might happen if a CDN is used to
30 | // serve assets; see https://github.com/facebook/create-react-app/issues/2374
31 | return;
32 | }
33 |
34 | window.addEventListener('load', () => {
35 | const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`;
36 |
37 | if (isLocalhost) {
38 | // This is running on localhost. Let's check if a service worker still exists or not.
39 | checkValidServiceWorker(swUrl, config);
40 |
41 | // Add some additional logging to localhost, pointing developers to the
42 | // service worker/PWA documentation.
43 | navigator.serviceWorker.ready.then(() => {
44 | console.log(
45 | 'This web app is being served cache-first by a service ' +
46 | 'worker. To learn more, visit https://bit.ly/CRA-PWA'
47 | );
48 | });
49 | } else {
50 | // Is not localhost. Just register service worker
51 | registerValidSW(swUrl, config);
52 | }
53 | });
54 | }
55 | }
56 |
57 | function registerValidSW(swUrl, config) {
58 | navigator.serviceWorker
59 | .register(swUrl)
60 | .then(registration => {
61 | registration.onupdatefound = () => {
62 | const installingWorker = registration.installing;
63 | if (installingWorker == null) {
64 | return;
65 | }
66 | installingWorker.onstatechange = () => {
67 | if (installingWorker.state === 'installed') {
68 | if (navigator.serviceWorker.controller) {
69 | // At this point, the updated precached content has been fetched,
70 | // but the previous service worker will still serve the older
71 | // content until all client tabs are closed.
72 | console.log(
73 | 'New content is available and will be used when all ' +
74 | 'tabs for this page are closed. See https://bit.ly/CRA-PWA.'
75 | );
76 |
77 | // Execute callback
78 | if (config && config.onUpdate) {
79 | config.onUpdate(registration);
80 | }
81 | } else {
82 | // At this point, everything has been precached.
83 | // It's the perfect time to display a
84 | // "Content is cached for offline use." message.
85 | console.log('Content is cached for offline use.');
86 |
87 | // Execute callback
88 | if (config && config.onSuccess) {
89 | config.onSuccess(registration);
90 | }
91 | }
92 | }
93 | };
94 | };
95 | })
96 | .catch(error => {
97 | console.error('Error during service worker registration:', error);
98 | });
99 | }
100 |
101 | function checkValidServiceWorker(swUrl, config) {
102 | // Check if the service worker can be found. If it can't reload the page.
103 | fetch(swUrl, {
104 | headers: { 'Service-Worker': 'script' }
105 | })
106 | .then(response => {
107 | // Ensure service worker exists, and that we really are getting a JS file.
108 | const contentType = response.headers.get('content-type');
109 | if (
110 | response.status === 404 ||
111 | (contentType != null && contentType.indexOf('javascript') === -1)
112 | ) {
113 | // No service worker found. Probably a different app. Reload the page.
114 | navigator.serviceWorker.ready.then(registration => {
115 | registration.unregister().then(() => {
116 | window.location.reload();
117 | });
118 | });
119 | } else {
120 | // Service worker found. Proceed as normal.
121 | registerValidSW(swUrl, config);
122 | }
123 | })
124 | .catch(() => {
125 | console.log(
126 | 'No internet connection found. App is running in offline mode.'
127 | );
128 | });
129 | }
130 |
131 | export function unregister() {
132 | if ('serviceWorker' in navigator) {
133 | navigator.serviceWorker.ready.then(registration => {
134 | registration.unregister();
135 | });
136 | }
137 | }
138 |
--------------------------------------------------------------------------------