Chao
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
      • Invitee
    • Publish Note

      Publish Note

      Everyone on the web can find and read all notes of this public team.
      Once published, notes can be searched and viewed by anyone online.
      See published notes
      Please check the box to agree to the Community Guidelines.
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Versions and GitHub Sync Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
Invitee
Publish Note

Publish Note

Everyone on the web can find and read all notes of this public team.
Once published, notes can be searched and viewed by anyone online.
See published notes
Please check the box to agree to the Community Guidelines.
Engagement control
Commenting
Permission
Disabled Forbidden Owners Signed-in users Everyone
Enable
Permission
  • Forbidden
  • Owners
  • Signed-in users
  • Everyone
Suggest edit
Permission
Disabled Forbidden Owners Signed-in users Everyone
Enable
Permission
  • Forbidden
  • Owners
  • Signed-in users
Emoji Reply
Enable
Import from Dropbox Google Drive Gist Clipboard
   owned this note    owned this note      
Published Linked with GitHub
Subscribed
  • Any changes
    Be notified of any changes
  • Mention me
    Be notified of mention me
  • Unsubscribe
Subscribe
# Coordinator Service for MACI I have finished the feature for MACI coordinator service. Two PR have been merged: [v1.0](https://github.com/appliedzkp/maci/pull/327) and [v0.10](https://github.com/appliedzkp/maci/pull/338). ## Overal structure There are two roles in the cordinator service: admin (i.e. maci coordinator) and user (i.e. normal user). The responsibility for admin is to maintain the code updated and the backend services for normal users. The user just need sends http request to the backend server to interact with the MACI service such as signup and publish messages. The coordinator service has been wrapped into two docker instances: one for the backend server to accept user request; one for mongodb service to store all necessary informations of the current state such as smart contract addresses, zero knowledge proof keys etc. ![](https://i.imgur.com/ND645nU.png) There are two modes: development mode and production mode. For developers and cordinator, it's convenient for them to be able to quickly change the code and test the results. Hence the backend docker instance mounts the code repo to the developer's local repo. For production mode, all the code repos will be included into the docker instance instead of mount to local repo. ## Project Setup The project can be setup in two different ways. One for developing purpose, which the codes are linked to the developers' local machine, so it is easy to modify the codes and test the results. The other is for production purpose, where the codes are stored in docker image, so there will be no code changes when starting the docker services. ### development environment #### setup ```bash= ######################## ### dependency setup ### ######################## # needed for both v0.10.x and v1.0.x versions sudo apt-get install build-essential libgmp-dev && \ libsodium-dev nasm git nlohmann-json3-dev g++ jq ######################## ### maci v1.0.x setup### ######################## # reference: https://appliedzkp.github.io/maci/installation.html # install rapicsnark for v1.0.0 git clone https://github.com/iden3/rapidsnark.git && \ cd rapidsnark && \ git checkout 1c13721de4a316b0b254c310ccec9341f5e2208e npm install && \ git submodule init && \ git submodule update && \ npx task createFieldSources && \ npx task buildProver # install maci for v1.0 git clone https://github.com/appliedzkp/maci.git && \ cd maci && git checkout v1\ npm i && npm run bootstrap && npm run build cd contracts && npm run compileSol # zkey setup for v1.0 npx zkey-manager compile -c zkeys.config.yml npx zkey-manager downloadPtau -c zkeys.config.yml npx zkey-manager genZkeys -c zkeys.config.yml # setup docker environment docker build -t maci-node:v0.5 - < LightDockerfile cd docker ./setup.sh ######################### ### maci v0.10.x setup### ######################### # install rust if haven't done it before curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh # install zkutil cargo install zkutil --version 0.3.2 # install maci for v0.10.x git clone https://github.com/appliedzkp/maci.git maci_v0_10 cd maci_v0_10 && npm i && npm run bootstrap && npm run build cd circuits && ./scripts/buildBatchUpdateStateTreeSnark.sh && \ ./scripts/buildQuadVoteTallySnark.sh cd ../contracts && npm run compileSol #################### ### docker setup ### #################### # step 1: install docker # reference: https://docs.docker.com/engine/install/ubuntu/ # step 2: run docker as non-root user # https://docs.docker.com/engine/install/linux-postinstall/ # step 3: install docker-compose # https://docs.docker.com/compose/install/ # pull and update docker image # make sure the image name (maci-node:v0.5) match the name in docker-compose.yml cd maci/docker docker build -t maci-node:v0.5 - < LightDockerfile # change host.docker.internal to docker network ip (for Linux machine) ./setup.sh ``` #### development and test ```bash= ### Setup for developer # (1) docker/docker-compose.yml: manually replace ETH_PROVIDER from 127.0.0.1 to docker network ip # (2) server/docker.sh: manually replace SCRIPT location to local maci repo location. # This local maci location should match in docker-compose.yml. # In my case, it's # SCRIPT='node /root/dev-maci/server/index.js' ### In one terminal # if for v1.0 cd contracts && npm run hardhat # if for v0.10 cd contracts && npm run ganache ### In second terminal cd server && ./docker.sh -u # whenever modified the code, just restart the docker instance by Ctrl+c and restart the service ./docker.sh -r ### In third terminal # if for v1.0 cd server && ./test.sh # if for v0.10 cd server && ./test_v0_10.sh ### turnoff docker after finish cd server && ./docker.sh -d ``` ### production environment #### setup ```bash= git clone https://github.com/appliedzkp/maci.git git checkout v1 #### setup zkeys if you haven't download it in local machine # (1) in this case, remove the zkey mapping in docker/docker-compose.yml # (2) login into docker cd maci/server && ./docker.sh -u # then Ctrl-C ./docker.sh -l # (3) generate zkey inside docker instance cd ~/maci/cli && ./gen_zkey.sh ``` #### test ```bash= ### In one terminal cd server && ./docker.sh -u ## In second terminal cd server && ./docker.sh -l # now in docker # if for v1.0 cd /root/maci/contracts && npm run hardhat # if for v0.10 cd /root/maci_v0_10/contracts && npm run ganache ### In third terminal, admin role cd server && ./docker.sh -l # now in docker cd /root/maci/server # run any commands for admin, e.g. # if for v1.0 ./admin.sh deploy ./admin.sh store # if for v0.10 ./admin_v0_10.sh deploy ./admin_v0_10.sh store ### In fourth terminal, user role # in local machine, not inside docker cd server # run any commands for user, e.g. # if for v1.0 ./user.sh signup -p $pk -x $maci # if for v0.10 ./user_v0_10.sh signup -p $pk -x $maci ``` ###### tags: `public`

Import from clipboard

Paste your webpage below. It will be converted to Markdown.

Advanced permission required

Your current role can only read. Ask the system administrator to acquire write and comment permission.

This team is disabled

Sorry, this team is disabled. You can't edit this note.

This note is locked

Sorry, only owner can edit this note.

Reach the limit

Sorry, you've reached the max length this note can be.
Please reduce the content or divide it to more notes, thank you!

Import from Gist

Import from Snippet

or

Export to Snippet

Are you sure?

Do you really want to delete this note?
All users will lose their connection.

Create a note from template

Create a note from template

Oops...
This template is not available.
Upgrade
All
  • All
  • Team
No template found.

Create custom template

Upgrade

Delete template

Do you really want to delete this template?
Turn this template into a regular note and keep its content, versions, and comments.

This page need refresh

You have an incompatible client version.
Refresh to update.
New version available!
See releases notes here
Refresh to enjoy new features.
Your user state has changed.
Refresh to load new user state.

Sign in

Forgot password

or

By clicking below, you agree to our terms of service.

Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
Wallet ( )
Connect another wallet

New to HackMD? Sign up

Help

  • English
  • 中文
  • Français
  • Deutsch
  • 日本語
  • Español
  • Català
  • Ελληνικά
  • Português
  • italiano
  • Türkçe
  • Русский
  • Nederlands
  • hrvatski jezik
  • język polski
  • Українська
  • हिन्दी
  • svenska
  • Esperanto
  • dansk

Documents

Help & Tutorial

How to use Book mode

How to use Slide mode

API Docs

Edit in VSCode

Install browser extension

Get in Touch

Feedback

Discord

Send us email

Resources

Releases

Pricing

Blog

Policy

Terms

Privacy

Cheatsheet

Syntax Example Reference
# Header Header 基本排版
- Unordered List
  • Unordered List
1. Ordered List
  1. Ordered List
- [ ] Todo List
  • Todo List
> Blockquote
Blockquote
**Bold font** Bold font
*Italics font* Italics font
~~Strikethrough~~ Strikethrough
19^th^ 19th
H~2~O H2O
++Inserted text++ Inserted text
==Marked text== Marked text
[link text](https:// "title") Link
![image alt](https:// "title") Image
`Code` Code 在筆記中貼入程式碼
```javascript
var i = 0;
```
var i = 0;
:smile: :smile: Emoji list
{%youtube youtube_id %} Externals
$L^aT_eX$ LaTeX
:::info
This is a alert area.
:::

This is a alert area.

Versions and GitHub Sync
Get Full History Access

  • Edit version name
  • Delete

revision author avatar     named on  

More Less

No updates to save
Compare
    Choose a version
    No search result
    Version not found
Sign in to link this note to GitHub
Learn more
This note is not linked with GitHub
 

Feedback

Submission failed, please try again

Thanks for your support.

On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

Please give us some advice and help us improve HackMD.

 

Thanks for your feedback

Remove version name

Do you want to remove this version name and description?

Transfer ownership

Transfer to
    Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

      Link with GitHub

      Please authorize HackMD on GitHub
      • Please sign in to GitHub and install the HackMD app on your GitHub repo.
      • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
      Learn more  Sign in to GitHub

      Push the note to GitHub Push to GitHub Pull a file from GitHub

        Authorize again
       

      Choose which file to push to

      Select repo
      Refresh Authorize more repos
      Select branch
      Select file
      Select branch
      Choose version(s) to push
      • Save a new version and push
      • Choose from existing versions
      Include title and tags
      Available push count

      Pull from GitHub

       
      File from GitHub
      File from HackMD

      GitHub Link Settings

      File linked

      Linked by
      File path
      Last synced branch
      Available push count

      Danger Zone

      Unlink
      You will no longer receive notification when GitHub file changes after unlink.

      Syncing

      Push failed

      Push successfully