Fast and secure EOS Block Producer voting with cleos in Docker

in #eos6 years ago (edited)

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.

Sort:  

Excellent @tiktuk! Thanks for this. I hadn’t been pulling the latest docker image and that will tighten up my coding. Thanks! Gunnar

pow pow skier! What's up bud

Hey Buddy! Great to connect with u again. Here’s an EOS airdrop for you and your followers! https://t.me/EOS_airdropbot/?id=3187761

PM me on telegram sometime, I’d like to introduce our gals to each other. :)

Yes, always pull the most recent image before deploys. You don't want to miss any security updates.

Nice update tiktuk. This actually isn't as hard as it looks.

Were you at the Tulip Conf in SF?
Cheers

I was at some of it. An extremely busy work week meant I couldn't see everything.

Congratulations @tiktuk! You received a personal award!

Happy Birthday! - You are on the Steem blockchain for 2 years!

You can view your badges on your Steem Board and compare to others on the Steem Ranking

Vote for @Steemitboard as a witness to get one more award and increased upvotes!

Coin Marketplace

STEEM 0.27
TRX 0.13
JST 0.031
BTC 62177.56
ETH 2918.14
USDT 1.00
SBD 3.66