Fast and secure EOS Block Producer voting with cleos in Docker

Today I will be covering Voting for EOS Block Producers using cleos, the official command line tool for the EOS blockchain. This is the method I use and suggest for education purposes or anyone paranoid. This is not the "nice and easy GUI" method. There are great GUI tools available from the community such as Scatter, Liquid EOS, EOSCanda eosc or Greymass EOS Voter if you do not know how to use the command line or Docker.

There are two primary ways to run cleos on your computer: compile/build EOS or run the official image within Docker. If you are paranoid you should compile cleos yourself. I use Docker all day and must trust Docker Hub, so I trust it in this case too.

  1. Install Docker - There are many tutorials for all operating systems available across the Internet if you need help.
  2. Select an EOS API endpoint of a Block Producer you trust. Warning: Use "https://" secured API endpoints only.
  3. Decide which Block Producers, up to a total of 30, you wish to vote for. I used the EOSPortal BP List and EOS Go BP Explore, but there are many other options.
  4. Start a terminal and run the following commands adapted for your needs. UPPER_CASE text, without a $ prefix, represents values you must enter.

# Pull the latest EOS Docker image. Always load the most recent.
docker pull eosio/eos:latest

Run bash within a new container.

docker run --name eos-wallet -it eosio/eos:latest /bin/bash

Set your chosen EOS API endpoint as an environment variable.

export EOS_URL=https://eos-api-endpoint

Create a new wallet. This will start keosd in the background.

Displays WALLET_PASSWORD, store if you plan to use the wallet again.

Remember you can always import your private keys into another wallet.

cleos wallet create

Import your private key into the unlocked wallet.

Displays PUBLIC_KEY, copy it to your clipboard.

cleos wallet import PRIVATE_KEY

Find the account name(s) associated with your PUBLIC_KEY.

Copy the ACCOUNT_NAME to your clipboard.

cleos --url $EOS_URL get accounts PUBLIC_KEY

Get account details, EOS token balance, CPU/RAM usage and

current Block Producer Votes.

cleos --url $EOS_URL get account ACCOUNT_NAME

Get the first 50 Block Producers

cleos --url $EOS_URL system listproducers

Optionally page through the list with -L to see all Block Producers.

cleos --url $EOS_URL system listproducers -L LAST_BLOCK_PRODUCER_NAME

VOTE! Enter your account name and the names of up to 30 Block Producers.

cleos --url $EOS_URL system voteproducer prods ACCOUNT_NAME
BLOCK_PRODUCER1 BLOCK_PRODUCER2 BLOCK_PRODUCER3

Get account details again to confirm your votes.

cleos --url $EOS_URL get account ACCOUNT_NAME

See if your votes changed any standings.

cleos --url $EOS_URL system listproducers

Close the container

exit # CTRL-D

Additional commands you may need:

# Restart a stopped container and export the EOS_URL again
docker start -i eos-wallet
export EOS_URL=https://eos-api-endpoint

Unlock a wallet, enter WALLET_PASSWORD

cleos wallet unlock

I could automate this further with scripts or a custom Dockerfile. Let me know in the comments if there is anything else you would find helpful.

Edit 6/17/18: ca-certificates was removed from above directions, because it was added to the Dockerfile in eosio/eos@cb9df33a.

H2
H3
H4
3 columns
2 columns
1 column
Join the conversation now