Skip to content

Commit

Permalink
docs(coordinator): add readme docs for coordinator
Browse files Browse the repository at this point in the history
  • Loading branch information
0xmad committed May 14, 2024
1 parent 18de273 commit 38e7bbe
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 15 deletions.
3 changes: 0 additions & 3 deletions coordinator/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ COORDINATOR_RAPIDSNARK_EXE=
# Location of zkey, wasm files
COORDINATOR_ZKEY_PATH="./zkeys"

# Coordinator mnemonic phrase
COORDINATOR_MNEMONIC=

# Coordinator RPC url
COORDINATOR_RPC_URL=http://localhost:8545

Expand Down
12 changes: 12 additions & 0 deletions coordinator/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Coordinator service

## Instructions

1. Add `.env` file (see `.env.example`).
2. Generate RSA key pair with `pnpm run generate-keypair`.
3. Download zkey files using `pnpm run download-zkeys:{type}` (only test type is available for now).
4. Make sure you copied RSA public key to your application. This will be needed for encrypting `Authorization` header and coordinator private key for proof generation.
5. Run `pnpm run start` to run the service.
6. All API calls must be called with `Authorization` header, where the value is encrypted with RSA public key, you generated before. Header value contains message signature and message digest created by `COORDINATOR_ADDRESS`. Format is `publicEncrypt({signature}:{digest})`.
Make sure you set `COORDINATOR_ADDRESS` env variable and sign any message with this address from your application (see [AccountSignatureGuard](./ts/auth/AccountSignatureGuard.service.ts)).
7. Proofs can be generated with `POST v1/proof/generate` API method (see [dto spec](./ts/proof/dto.ts) and [controller](./ts/app.controller.ts)).
11 changes: 0 additions & 11 deletions coordinator/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,15 @@ dotenv.config();

const parentDir = __dirname.includes("build") ? ".." : "";

const accounts = process.env.COORDINATOR_MNEMONIC
? {
mnemonic: process.env.COORDINATOR_MNEMONIC,
path: "m/44'/60'/0'/0",
initialIndex: 0,
count: 20,
}
: undefined; // use default accounts for tests

const config: HardhatUserConfig = {
defaultNetwork: "localhost",
networks: {
localhost: {
url: process.env.COORDINATOR_RPC_URL,
loggingEnabled: false,
accounts,
},
hardhat: {
loggingEnabled: false,
accounts,
},
},
paths: {
Expand Down
1 change: 0 additions & 1 deletion coordinator/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
],
"scripts": {
"hardhat": "hardhat node",
"prebuild": "pnpm run generate-keypair",
"build": "nest build",
"start": "nest start",
"start:dev": "nest start --watch",
Expand Down

0 comments on commit 38e7bbe

Please sign in to comment.