Setting up a Validator in the Celo baklava testnet with faucet funds — optimized sequence from Anyblock experience

Prerequisites

Hardware requirements

Software requirements

  • nvm v0.37.2
  • node v10.23.0 LTS
  • npm 6.14.8
  • docker 5:20.10.2~3–0~ubuntu-focal
  • celocli 0.0.60
npm install -g @celo/celocli --unsafe-perm
apt-get install libsecret-1-0

Accounts node (“local machine”) setup

# On the Accounts machine
export CELO_IMAGE=us.gcr.io/celo-org/geth:baklava
# On the Accounts machine
docker pull $CELO_IMAGE
# On the Accounts machine
mkdir celo-accounts-node
cd celo-accounts-node
# On the Accounts machine
pwgen -c -n 24 2
# On the Accounts machine
docker run -v $PWD:/root/.celo --rm -it $CELO_IMAGE account new
export CELO_VALIDATOR_GROUP_ADDRESS=<YOUR_CELO_VALIDATOR_GROUP_ADDRESS>
export CELO_VALIDATOR_ADDRESS=<YOUR_CELO_VALIDATOR_ADDRESS>
# On the Accounts machine
docker run --name celo-accounts -it --restart always -p 127.0.0.1:8545:8545 -v $PWD:/root/.celo $CELO_IMAGE --verbosity 3 --syncmode full --rpc --rpcaddr 0.0.0.0 --rpcapi eth,net,web3,debug,admin,personal --baklava --light.serve 0 --datadir /root/.celo

Validator node setup

# On the Validator machine
mkdir celo-validator-node
cd celo-validator-node
# On the Validator machine
pwgen -c -n 24 > .password
# On the Validator machine
export CELO_VALIDATOR_SIGNER_ADDRESS=<YOUR_CELO_VALIDATOR_SIGNER_ADDRESS>

(Validator) Proxy node setup

# On the Proxy machine
export CELO_VALIDATOR_SIGNER_ADDRESS=<YOUR_CELO_VALIDATOR_SIGNER_ADDRESS>
# On the Proxy machine
mkdir celo-proxy-node
cd celo-proxy-node
# On the Proxy machine
docker run --name celo-proxy-password -it --rm -v $PWD:/root/.celo $CELO_IMAGE account new --password /root/.celo/.password
# On the Proxy machine
export PROXY_ADDRESS=<YOUR_PROXY_ADDRESS>
# On the Proxy machine
docker run --name celo-proxy -it --restart unless-stopped -p 30303:30303 -p 30303:30303/udp -p 30503:30503 -p 30503:30503/udp -v $PWD:/root/.celo $CELO_IMAGE --verbosity 3 --nousb --syncmode full --proxy.proxy --proxy.proxiedvalidatoraddress $CELO_VALIDATOR_SIGNER_ADDRESS --proxy.internalendpoint :30503 --etherbase $PROXY_ADDRESS --unlock $PROXY_ADDRESS --password /root/.celo/.password --allow-insecure-unlock --baklava --datadir /root/.celo --celostats=<YOUR_VALIDATOR_NAME>@baklava-celostats-server.celo-testnet.org
# On any of your machines with fully configured celocli and a completed Validator setup
celocli validator:status
# On the Proxy machine
docker exec celo-proxy geth --exec "admin.nodeInfo['enode'].split('//')[1].split('@')[0]" attach | tr -d '"'
# On the Proxy machine
dig +short myip.opendns.com @resolver1.opendns.com
# On the Accounts machine
export PROXY_EXTERNAL_IP=<YOUR_PROXY_EXTERNAL_IP>
# On the Accounts machine
nc -vz $PROXY_EXTERNAL_IP 30303
# On the Accounts machine
nc -vz $PROXY_EXTERNAL_IP 30503

Completion of Validator node setup

# On the Validator machine
export CELO_VALIDATOR_GROUP_ADDRESS=<YOUR_CELO_VALIDATOR_GROUP_ADDRESS>
export CELO_VALIDATOR_ADDRESS=<YOUR_CELO_VALIDATOR_ADDRESS>
export PROXY_ENODE=<YOUR_PROXY_ENODE>
export PROXY_EXTERNAL_IP=<YOUR_PROXY_EXTERNAL_IP>
export PROXY_INTERNAL_IP=<YOUR_PROXY_INTERNAL_IP>
# On the Validator machine
docker run --name celo-validator -it --restart unless-stopped -p 30303:30303 -p 30303:30303/udp -v $PWD:/root/.celo $CELO_IMAGE --verbosity 3 --syncmode full --mine --istanbul.blockperiod=5 --istanbul.requesttimeout=3000 --etherbase $CELO_VALIDATOR_SIGNER_ADDRESS --nodiscover --nousb --proxy.proxied --proxy.proxyenodeurlpairs=enode://$PROXY_ENODE@$PROXY_INTERNAL_IP:30503\;enode://$PROXY_ENODE@$PROXY_EXTERNAL_IP:30303 --unlock=$CELO_VALIDATOR_SIGNER_ADDRESS --password /root/.celo/.password --celostats=<YOUR_VALIDATOR_NAME>=@baklava-celostats-server.celo-testnet.org --baklava --datadir /root/.celo

Registration of Accounts as Validator

# On the Validator machine
docker run -v $PWD:/root/.celo --rm -it $CELO_IMAGE --password /root/.celo/.password account proof-of-possession $CELO_VALIDATOR_SIGNER_ADDRESS $CELO_VALIDATOR_ADDRESS
# On the Validator machine
docker run -v $PWD:/root/.celo --rm -it $CELO_IMAGE --password /root/.celo/.password account proof-of-possession $CELO_VALIDATOR_SIGNER_ADDRESS $CELO_VALIDATOR_ADDRESS --bls
# On the Accounts machine
export CELO_VALIDATOR_SIGNER_ADDRESS=<YOUR_CELO_VALIDATOR_SIGNER_ADDRESS>
export CELO_VALIDATOR_SIGNER_SIGNATURE=<YOUR_CELO_VALIDATOR_SIGNER_SIGNATURE>
export CELO_VALIDATOR_SIGNER_PUBLIC_KEY=<YOUR_CELO_VALIDATOR_SIGNER_PUBLIC_KEY>
export CELO_VALIDATOR_SIGNER_BLS_SIGNATURE=<YOUR_CELO_VALIDATOR_SIGNER_BLS_SIGNATURE>
export CELO_VALIDATOR_SIGNER_BLS_PUBLIC_KEY=<YOUR_CELO_VALIDATOR_SIGNER_BLS_PUBLIC_KEY>
# On the Accounts machine
docker stop celo-accounts -t 60
# On the Accounts machine
docker rm celo-accounts
# On the Accounts machine
docker run --name celo-accounts -it --restart always -p 127.0.0.1:8545:8545 -v $PWD:/root/.celo $CELO_IMAGE --verbosity 3 --syncmode full --rpc --rpcaddr 0.0.0.0 --rpcapi eth,net,web3,debug,admin,personal --baklava --light.serve 0 --datadir /root/.celo --allow-insecure-unlock
# On the Accounts machine
celocli account:unlock $CELO_VALIDATOR_GROUP_ADDRESS
# On the Accounts machine
celocli account:unlock $CELO_VALIDATOR_ADDRESS
# On the Accounts machine
celocli account:register --from $CELO_VALIDATOR_GROUP_ADDRESS --name <YOUR_VALIDATOR_GROUP_NAME>
# On the Accounts machine
celocli account:register --from $CELO_VALIDATOR_ADDRESS --name <YOUR_VALIDATOR_NAME>
# On the Accounts machine
celocli account:set-name --account <YOUR_VALIDATOR_OR_VALIDATOR_GROUP_ADDRESS> --name <YOUR_VALIDATOR_OR_VALIDATOR_GROUP_NAME>
# On the Accounts machine
celocli lockedgold:lock --from $CELO_VALIDATOR_GROUP_ADDRESS --value 10000e18
# On the Accounts machine
celocli lockedgold:lock --from $CELO_VALIDATOR_ADDRESS --value 10000e18
# On the Accounts machine
celocli lockedgold:show $CELO_VALIDATOR_GROUP_ADDRESS
# On the Accounts machine
celocli lockedgold:show $CELO_VALIDATOR_ADDRESS
# On the Accounts machine
celocli validatorgroup:register --from $CELO_VALIDATOR_GROUP_ADDRESS --commission 0.1
# On the Accounts machine
celocli account:authorize --from $CELO_VALIDATOR_ADDRESS --role validator --signature $CELO_VALIDATOR_SIGNER_SIGNATURE --signer $CELO_VALIDATOR_SIGNER_ADDRESS
# On the Accounts machine
celocli validator:register --from $CELO_VALIDATOR_ADDRESS --ecdsaKey $CELO_VALIDATOR_SIGNER_PUBLIC_KEY --blsKey $CELO_VALIDATOR_SIGNER_BLS_PUBLIC_KEY --blsSignature $CELO_VALIDATOR_SIGNER_BLS_SIGNATURE
# On the Accounts machine
celocli validator:affiliate $CELO_VALIDATOR_GROUP_ADDRESS --from $CELO_VALIDATOR_ADDRESS
# On the Accounts machine
celocli validatorgroup:member --accept $CELO_VALIDATOR_ADDRESS --from $CELO_VALIDATOR_GROUP_ADDRESS
# On the Accounts machine
celocli validator:show $CELO_VALIDATOR_ADDRESS
celocli validatorgroup:show $CELO_VALIDATOR_GROUP_ADDRESS

Vote in Election

# On the Accounts machine
export CELO_VALIDATOR_GROUP_VOTE_SIGNER_ADDRESS=<YOUR_VALIDATOR_GROUP_VOTE_SIGNER_ADDRESS>
export CELO_VALIDATOR_VOTE_SIGNER_ADDRESS=<YOUR_VALIDATOR_VOTE_SIGNER_ADDRESS>
# On the Accounts machine
docker run -v $PWD:/root/.celo --rm -it $CELO_IMAGE --nousb account proof-of-possession $CELO_VALIDATOR_GROUP_VOTE_SIGNER_ADDRESS $CELO_VALIDATOR_GROUP_ADDRESS
# On the Accounts machine
docker run -v $PWD:/root/.celo --rm -it $CELO_IMAGE --nousb account proof-of-possession $CELO_VALIDATOR_VOTE_SIGNER_ADDRESS $CELO_VALIDATOR_ADDRESS
# On the Accounts machine
export CELO_VALIDATOR_GROUP_VOTE_SIGNER_SIGNATURE=<YOUR_VALIDATOR_GROUP_VOTE_SIGNER_SIGNATURE>
export CELO_VALIDATOR_GROUP_VOTE_SIGNER_PUBLIC_KEY=<YOUR_VALIDATOR_GROUP_VOTE_SIGNER_PUBLIC_KEY>
export CELO_VALIDATOR_VOTE_SIGNER_SIGNATURE=<YOUR_VALIDATOR_VOTE_SIGNER_SIGNATURE>
export CELO_VALIDATOR_VOTE_SIGNER_PUBLIC_KEY=<YOUR_VALIDATOR_VOTE_SIGNER_PUBLIC_KEY>
# On the Accounts machine
celocli account:authorize --from $CELO_VALIDATOR_GROUP_ADDRESS --role vote --signature $CELO_VALIDATOR_GROUP_VOTE_SIGNER_SIGNATURE --signer $CELO_VALIDATOR_GROUP_VOTE_SIGNER_ADDRESS
# On the Accounts machine
celocli account:authorize --from $CELO_VALIDATOR_ADDRESS --role vote --signature $CELO_VALIDATOR_VOTE_SIGNER_SIGNATURE --signer $CELO_VALIDATOR_VOTE_SIGNER_ADDRESS
# On the Accounts machine
celocli transfer:celo --from $CELO_VALIDATOR_GROUP_ADDRESS --to $CELO_VALIDATOR_GROUP_VOTE_SIGNER_ADDRESS --value 1e18
# On the Accounts machine
celocli transfer:celo --from $CELO_VALIDATOR_ADDRESS --to $CELO_VALIDATOR_VOTE_SIGNER_ADDRESS --value 1e18
# On the Accounts machine
celocli account:unlock $CELO_VALIDATOR_GROUP_VOTE_SIGNER_ADDRESS
# On the Accounts machine
celocli account:unlock $CELO_VALIDATOR_GROUP_VOTE_SIGNER_ADDRESS
# On the Accounts machine
celocli election:vote --from $CELO_VALIDATOR_GROUP_VOTE_SIGNER_ADDRESS --for $CELO_VALIDATOR_GROUP_ADDRESS --value 10000e18
# On the Accounts machine
celocli election:vote --from $CELO_VALIDATOR_VOTE_SIGNER_ADDRESS --for $CELO_VALIDATOR_GROUP_ADDRESS --value 10000e18
# On the Accounts machine
celocli election:activate --from $CELO_VALIDATOR_GROUP_ADDRESS --wait && celocli election:activate --from $CELO_VALIDATOR_ADDRESS --wait
# On the Accounts machine
celocli election:show $CELO_VALIDATOR_GROUP_ADDRESS --group
celocli election:show $CELO_VALIDATOR_GROUP_ADDRESS --voter
celocli election:show $CELO_VALIDATOR_ADDRESS --voter
# On the Accounts machine
celocli lockedgold:show $CELO_VALIDATOR_GROUP_ADDRESS
celocli lockedgold:show $CELO_VALIDATOR_ADDRESS
# On the Accounts machine
celocli validator:status --validator $CELO_VALIDATOR_ADDRESS
celocli election:list

Attestation node setup

# On the Attestation machine
mkdir celo-attestations-node
cd celo-attestations-node
# On the Attestation machine
export CELO_ATTESTATION_SIGNER_ADDRESS=<YOUR_CELO_ATTESTATION_SIGNER_ADDRESS>
# On the Attestation machine
docker run -v $PWD:/root/.celo --rm -it $CELO_IMAGE --nousb account proof-of-possession $CELO_ATTESTATION_SIGNER_ADDRESS $CELO_VALIDATOR_ADDRESS
# On the Accounts machine
export CELO_ATTESTATION_SIGNER_ADDRESS=<YOUR_CELO_ATTESTATION_SIGNER_ADDRESS>
export CELO_ATTESTATION_SIGNER_SIGNATURE=<YOUR_CELO_ATTESTATION_SIGNER_SIGNATURE>
# On the Accounts machine
celocli account:authorize --from $CELO_VALIDATOR_ADDRESS --role attestation --signature $CELO_ATTESTATION_SIGNER_SIGNATURE --signer $CELO_ATTESTATION_SIGNER_ADDRESS
# On the Attestation machine
echo <YOUR_CELO_ATTESTATION_SIGNER_PASSWORD> > .password
# On the Attestation machine
docker run --name celo-attestations -it --restart always -p 127.0.0.1:8545:8545 -v $PWD:/root/.celo $CELO_IMAGE --verbosity 3 --syncmode full --rpc --rpcaddr 0.0.0.0 --rpcapi eth,net,web3,debug,admin --unlock $CELO_ATTESTATION_SIGNER_ADDRESS --password /root/.celo/.password --allow-insecure-unlock --baklava
# On the Attestation machine
cp -r ./keystore baklava
# On the Attestation machine
apt install postgresql
# On the Attestation machine
su - postgres
createuser --superuser <YOUR_POSTGRES_USER>
createdb -O <YOUR_POSTGRES_USER> attestation-service
psql -c "ALTER USER <YOUR_POSTGRES_USER> PASSWORD '<YOUR_POSTGRES_PASSWORD>';"
# On the Attestation machine
export DATABASE_URL="postgres://<YOUR_POSTGRES_USER>:<YOUR_POSTGRES_PASSWORD>@localhost:5432/attestation-service"
# On the Attestation machine
export CONFIG=/root/celo-attestations-node/config
# On the Attestation machine
curl https://raw.githubusercontent.com/celo-org/celo-monorepo/master/packages/attestation-service/config/.env.development > $CONFIG
Required options:
DATABASE_URL=postgres://<YOUR_POSTGRES_USER>:<YOUR_POSTGRES_PASSWORD>@localhost:5432/attestation-service
CELO_PROVIDER=http://localhost:8545
CELO_VALIDATOR_ADDRESS=<YOUR_VALIDATOR_ADDRESS>
CELO_ATTESTATION_SIGNER_ADDRESS=<YOUR_ATTESTATION_SIGNER_ADDRESS>
SMS_PROVIDERS=twilio,nexmo
Nexmo configuration options:
NEXMO_KEY=<YOUR_NEXMO_KEY>
NEXMO_SECRET=<YOUR_NEXMO_SECRET>
Twilio configuration options:
TWILIO_ACCOUNT_SID=<YOUR_TWILIO_ACCOUNT_SID>
TWILIO_MESSAGING_SERVICE_SID=<YOUR_TWILIO_MESSAGING_SERVICE_SID>
TWILIO_AUTH_TOKEN=<YOUR_TWILIO_AUTH_TOKEN>
# On the Accounts machine
export CELO_ATTESTATION_SERVICE_URL=<YOUR_ATTESTATION_SERVICE_URL>
# On the Accounts machine
celocli account:claim-attestation-service-url ./metadata.json --url $CELO_ATTESTATION_SERVICE_URL --from $CELO_VALIDATOR_VOTE_SIGNER_ADDRESS
# On the Accounts machine
celocli account:create-metadata ./metadata.json --from $CELO_VALIDATOR_ADDRESS
# On the Accounts machine
celocli account:create-metadata ./group-metadata.json --from $CELO_VALIDATOR_GROUP_ADDRESS
# On the Accounts machine
celocli account:claim-account ./group-metadata.json --address $CELO_VALIDATOR_ADDRESS --from $CELO_VALIDATOR_GROUP_ADDRESS
# On the Accounts machine
celocli account:claim-account ./metadata.json --address $CELO_VALIDATOR_GROUP_ADDRESS --from $CELO_VALIDATOR_ADDRESS
# On the Accounts machine
celocli account:register-metadata --url --from $CELO_VALIDATOR_ADDRESS
# On the Accounts machine
celocli account:register-metadata --url --from $CELO_VALIDATOR_GROUP_ADDRESS
# On the Accounts machine
celocli account:get-metadata $CELO_VALIDATOR_ADDRESS
# On the Attestation machine
export TAG=attestation-service-baklava
# On the Attestation machine
docker run --name celo-attestation-service -it --restart always --entrypoint /bin/bash --network host --env-file $CONFIG -e PORT=80 -p 80:80 us.gcr.io/celo-testnet/celo-monorepo:$TAG -c " cd /celo-monorepo/packages/attestation-service && yarn run db:migrate && yarn start "
# On the Accounts machine
celocli identity:test-attestation-service --from $CELO_VALIDATOR_ADDRESS --phoneNumber --message conCELOations!!!

Final words

Freddy Zwanzger — Co-Founder of Anyblock

Interested or questions?

--

--

Anyblock Analytics is a German blockchain solution provider. We offer consulting, tools and data to integrate business processes with blockchain.

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store