Docs
Run aMACI Operator Service

How to Run aMACI Operator Service on Dora Vota Mainnet (vota-ash)

The aMACI operator service is a unique feature offered by the Dora Factory Anonymous MACI protocol (aMACI). Running an aMACI operator means that you will run and tally an aMACI round for a community, and validate the round with zero-knowledge proofs.

The first batch of aMACI opearators will be Dora Vota mainnet validators. From the protocol’s frontend (opens in a new tab), users will be able to create aMACI rounds and select an aMACI operator.

Requirements

Hardware requirements

Basic configuration

  • CPU: 4 cores
  • Memory: 8 GB
  • Disk: 256 GB

Better configuration

  • CPU: 8 cores
  • Memory: 16 GB
  • Disk: 512 GB

Software requirements

Create an aMACI operator account

⚠️

We strongly recommend you create a new account which will be used later to register as an aMACI operator. It is prohibited to use the validator’s owner address as the aMACI operator address, because it may cause the aMACI operator to fail to process transactions.

export AMACI_OPERATOR=amaci-operator
dorad keys add $AMACI_OPERATOR

To initiate the operator, please prepare 1,000 DORA for your operator account to support the service, and monitor the balance of the account in a timely manner. Insufficient balance may affect the operation of the aMACI operator service.

⚠️

Please make sure you have backed up the MNEMONIC of this account which is the only method to recover it. Also, it will be used when initiating aMACI operator service.

Register an aMACI operator on vota-sf

Set up your operator with the owner address of your validator on the vota-ash network.

  • The owner address is the address starting with dora prefix used to create your validator. Taking the DoraFactory validator (opens in a new tab) as an example, its owner address is dora1gerunjnh6umehq6zm0gphrc87u37veuv8jqmq3. Please use your validator owner address here to set up your aMACI operator.
  • This is the address of the aMACI mainnet contract: dora1smg5qp5trjdkcekdjssqpjehdjf6n4cjss0clyvqcud3t3u3948s8rmgg4.
dorad tx wasm execute dora1smg5qp5trjdkcekdjssqpjehdjf6n4cjss0clyvqcud3t3u3948s8rmgg4 '{"set_maci_operator": { "operator": "<your_operator_address>" } }' \
--from "<your_validator_owner_address>" \
--amount "20000000000000000000peaka" \
--chain-id "vota-ash" \
--gas-prices 100000000000peaka \
--gas auto \
--gas-adjustment 1.5 \
--node https://vota-rpc.dorafactory.org:443 \
-y

Build aMACI operator

git clone https://github.com/DoraFactory/amaci-operator.git && cd amaci-operator
 
npm install
 
npm run build

Configure aMACI operator service

Configure environment variables

Please make sure you have navigated to the /amaci-operator directory.

Step 1: Create your own environment variables file

cp .env.template .env

Step 2: Generate your coordinator public and private key

⚠️

Please back up the generated public and private keys.

node dist/gen-key.js

For example, the format of the public key:

X: 16429304017412205675820866000313944904446810339972042319485432996531286181952
Y: 5572999208344294573488778747734990567557173306854827005273539480127951622273

Step 3: Configure your MNEMONIC and coordinator private key of aMACI operator

  • Enter the mnemonic of the previously generated aMACI operator account into the MNEMONIC field in your .env file.
  • Enter the coordinator private key generated in the previous step into the COORDINATOR_PRI_KEY field in your .env file.
  • Enter the rpc url(It ensures that you can use a stable and continuous RPC services, it is recommended that you use your validator RPC or stable full node RPC) into the RPC_ENDPOINT field in your .env file.

Set your aMACI operator information

Step 1: Set your operator identity by your operator address

We will use the Keybase ID as your operator identity here. The Keybase ID is a 16-digit string that is generated with a keybase.io (opens in a new tab) account. It’s a cryptographically secure method of verifying your identity across multiple online networks. The Keybase API allows us to retrieve your Keybase avatar and other public info.

dorad tx wasm execute  dora1smg5qp5trjdkcekdjssqpjehdjf6n4cjss0clyvqcud3t3u3948s8rmgg4 '{"set_maci_operator_identity": { "identity": "<your_identity_id>" } }' \
--from $AMACI_OPERATOR \
--chain-id "vota-ash" \
--gas-prices 100000000000peaka \
--gas auto \
--gas-adjustment 1.5 \
--node https://vota-rpc.dorafactory.org:443 \
-y

Step 2: Set your operator public key by your operator address

dorad tx wasm execute dora1smg5qp5trjdkcekdjssqpjehdjf6n4cjss0clyvqcud3t3u3948s8rmgg4 '{"set_maci_operator_pubkey": { "pubkey": { "x": "<your_pubkey_x>", "y": "<your_pubkey_y>"  }} }' \
--from $AMACI_OPERATOR \
--chain-id "vota-ash" \
--gas-prices 100000000000peaka \
--gas auto \
--gas-adjustment 1.5 \
--node https://vota-rpc.dorafactory.org:443 \
-y

Initiate aMACI operator service

npm run init

Setup aMACI operator service

Create the definition file

Create the definition file in /etc/systemd/system/amaci.service.

[Unit]
Description=aMACI-operator-service
After=network-online.target
 
[Service]
User=<USER>
WorkingDirectory=<PATH_TO_amaci-operator>
EnvironmentFile=<PATH_TO_amaci-operator>/.env
ExecStart=/usr/bin/node dist/index.js
RestartSec=10
Restart=on-failure
LimitNOFILE=655350
 
[Install]
WantedBy=multi-user.target
  • <USER>: Enter the user (likely your username or root, unless you created a user specifically for aMACI operator service).
  • <PATH_TO_amaci-operator>: Enter the path to the amaci-operator directory, which is likely /home/ubuntu/amaci-operator.

Run the program upon startup

After registering amaci as a system service, you can set the program to run upon startup.

systemctl daemon-reload
systemctl enable amaci

Start the service and check the log

sudo systemctl start amaci
sudo journalctl -u amaci -f --no-hostname -o cat

If the service started successfully, the log will output your aMACI operator’s information and download some necessary zkey files. Like this:

Started A-MACI-operator-service.
Init
Coordinator public key:
X: 11043362857411207101295473092701542792077153813505230615881421921648274746246
Y: 3431336307758495332528815819065155244352578928861293932308944643929528727389
Vota address:
dora1nddnr2fjcupt3eher59mrp0cmwn52e4c98y4k5
Start to download zkey:
download zkey: 2-1-1-5_v2
https://vota-zkey.s3.ap-southeast-1.amazonaws.com/amaci_2-1-1-5_v2_zkeys.tar.gz
download zkey: 4-2-2-25_v2
https://vota-zkey.s3.ap-southeast-1.amazonaws.com/amaci_4-2-2-25_v2_zkeys.tar.gz
[DO]: inspect
===========
["93"]
[
  '11043362857411207101295473092701542792077153813505230615881421921648274746246',
  '3431336307758495332528815819065155244352578928861293932308944643929528727389'
]
[]
===========
[TASK inspect] find rounds count: 0/0

What is the aMACI operator service doing?

  • The aMACI operator service periodically checks aMACI rounds that need to be processed on the vota-ash mainnet.
  • The aMACI operator service logs processed aMACI round information and other data in the /amaci-operator/work directory.