How to Run aMACI Operator Service on vota-sf
Testnet
Requirements
Hardware requirements
- CPU: 8 cores
- Memory: 16 GB
- Disk: 100 GB
Software requirements
- Node.js (opens in a new tab) version: >= 20
dorad
version: 0.4.0
Create an aMACI operator account
Make sure you have backed up the MNEMONIC of this account which is the only method to recover your wallet. Also, it will be used when initiating aMACI operator service.
This account will be used later to register as an aMACI operator.
export ACCOUNT_NAME=maci-operator
dorad keys add $ACCOUNT_NAME
Register an aMACI operator on vota-sf
Stake 20 DORA to register as aMACI operator with your aMACI operator account:
dorad tx wasm execute dora17p9rzwnnfxcjp32un9ug7yhhzgtkhvl9jfksztgw5uh69wac2pgsnah3h8 '{"register": {} }' \
--from maci-operator \
--amount "20000000000000000000peaka" \
--chain-id "vota-sf" \
--gas-prices 100000000000peaka \
--gas auto \
--gas-adjustment 1.5 \
--node https://vota-sf-rpc.dorafactory.org:443 \
-y
Query whether your aMACI operator has been created successfully
dorad query wasm contract-state smart dora17p9rzwnnfxcjp32un9ug7yhhzgtkhvl9jfksztgw5uh69wac2pgsnah3h8 '{ "is_maci_operator": { "address": <your_account_address> } }' --node https://vota-sf-rpc.dorafactory.org:443
If terminal shows true
, it means the aMACI operator creation is successful.
data: true
Build aMACI operator service
git clone https://github.com/DoraFactory/maci-operator && cd maci-operator
npm install
npm run build
Initiate aMACI operator service
Before configuring environment variables, please make sure you have navigated
to the /maci-operator
directory.
Create your own environment variables file
cp .env.template .env
Generate your coordinator public and private key
Please back up the generated public and private keys.
node dist/gen-key.js
Next, enter the public key into our coordinator public key collection form (opens in a new tab). For example, the format of the public key:
X: 16429304017412205675820866000313944904446810339972042319485432996531286181952
Y: 5572999208344294573488778747734990567557173306854827005273539480127951622273
Config your MNEMONIC and coordinator private key
- 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.
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=A-MACI-operator-service
After=network-online.target
[Service]
User=<USER>
WorkingDirectory=<PATH_TO_maci-operator>
EnvironmentFile=<PATH_TO_maci-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 A-MACI operator service).<PATH_TO_maci-operator>
: Enter the path to themaci-operator
directory, which is likely/home/ubuntu/maci-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 it started successfully, you will see many similar logs like this:
[DO]: inspect
[TASK inspect] find rounds count: 0/0
[DO]: inspect
[TASK inspect] find rounds count: 0/0
[DO]: inspect
What is the aMACI operator service doing?
- The aMACI operator service periodically checks aMACI rounds that need to be processed on the
vota-sf
testnet. - The aMACI operator service logs processed aMACI round information and other data in the
/maci-operator/work
directory.