Here is how you can programmatically cast your 30 witness votes on Steemit

in #steemit5 years ago (edited)



This simple tutorial allows you to cast your Steemit witness votes account in a bunch of seconds, simply pasting a script in any browser.

NOTES:

  • This script requires that you enter your account's active key in the script in order to make it work.

It is completely safe though! If you have a basic understanding of Javascript you can verify yourself that your keys are not sent or stored anywhere besides Steem API!

STEP 1


Open your favorite browser on ANY site (I strongly recommend using Brave browser for its security and speed!)
and open the DevTools (Ctrl + Shift + J on Linux/Windows and Cmd + Opt + J on Mac)

STEP 2


Open a new tab, navigate to https://cdn.jsdelivr.net/npm/steem/dist/steem.min.js (SteemJs)
and copy and paste (Ctrl + A and Ctrl + C) the steem.js minified code into the Browser Console (DevTools) that you opened in the first tab.

STEP 3


Copy and paste my script below in the Console.

Note: before pressing enter change the myAccount and privateActiveKey with your credentials and feel free to change the list of witnesses that you want to vote for.
The list of witnesses in my code snippet was taken from @enforcer64.
If you want to follow some else's choice of witnesses visit their steemd page (eg. @theycalledmedan -> https://steemd.com/@theycallmedan) and copy their list from the "@theycallmedan votes for:" section.

var myAccount = 'gaottantacinque';
var privateActiveKey = '5Kb************************************3Nrd';

var witnessesToVote =  [
  'anyx',
  'ats-witness',
  'ausbitbank',
  'blocktrades',
  'bobinson',
  'c-squared',
  'c0ff33a',
  'coingecko',
  'dragosroua',
  'drakos',
  'emrebeyler',
  'good-karma',
  'gtg',
  'guiltyparties',
  'isnochys',
  'klye',
  'netuoso',
  'nextgencrypto',
  'ocd-witness',
  'patrice',
  'pharesim',
  'qurator',
  'r0nd0n',
  'roelandp',
  'someguy123',
  'steempeak',
  'steempress',
  'stem.witness',
   // 'themarkymark', // sorry, not a fan
  'yabapmatt',
];

// Remove all votes
var getMyAccountWitnessVotes = () => new Promise((resolve) => {
  console.log(`Checking witnes votes for ${myAccount}`);
  steem.api.getAccounts([myAccount], (err, result) => {
    if (err) {
      throw new Error(`Unable to get witness votes for ${myAccount}`);
    }
    resolve(result[0].witness_votes);
  });
});

// Value: [1 = vote, 0 = unvote]
var voteForWitness = (witnessName, value) => new Promise((resolve) => {
  console.log(`${value ? 'Voting' : 'Unvoting'} for ${witnessName}..`);
  steem.broadcast.accountWitnessVote(
    privateActiveKey, myAccount, witnessName, value,
    (err, result) => {
      if (err) {
        throw new Error(`Unable to vote for ${witnessName}`);
      }
      resolve(result);
    });
});

var replaceAllWitnessVotes = async () => {
  const myOldVotesArr = await getMyAccountWitnessVotes();
  for (let id = 0; id < myOldVotesArr.length; id++) {
    const currentWitness = myOldVotesArr[id];
    const res = await voteForWitness(currentWitness, 0);
    console.log(currentWitness, 'unvoted.', res);
  }
  for (let id = 0; id < witnessesToVote.length; id++) {
    const newWitness = witnessesToVote[id];
    const res = await voteForWitness(newWitness, 1);
    console.log(newWitness, 'voted.', res);
  }
  console.log('All done.');
}
replaceAllWitnessVotes();

You prefer clicking buttons around? Visit https://steemitwallet.com/~witnesses.

No matter what you are more comfortable with, please cast your witness votes as this is a critical time for Steemit!

Sort:  

Good work.

!DERANGED
!COFFEEA
!shop
$trdo
!BEER

Congratulations @eii, you successfuly trended the post shared by @gaottantacinque!
@gaottantacinque will receive 0.05115150 TRDO & @eii will get 0.03410100 TRDO curation in 3 Days from Post Created Date!

"Call TRDO, Your Comment Worth Something!"

To view or trade TRDO go to steem-engine.com
Join TRDO Discord Channel or Join TRDO Web Site

[jokemode:on]
yaaay, so we've got 7 out of 50 characters of his key, bruteforce tiiiiiiimeeeeeeeeeee (~‾▿‾)~
[/jokemode:off]

Nice work. I was too lazy clicking through the witnesses and was trying to mash it up as well, you beat me to it :)

I changed those 7 too lol. But I must admit, it was late, I was tired and initially submitted the post with my full key in it. Luckily the UI warmed me so it did not go through. If it didn’t (other UIs don’t have this check in place) my bot @keys-defender would have notified me and saved my funds ;=}

Yep this script is useful if you have multiple accounts. Glad someone will use it =}


Questo post è stato condiviso e votato all'interno del discord del team curatori di discovery-it Entra nella nostra community! hive-193212
This post was shared and voted inside the discord by the curators team of discovery-it. Join our community! hive-193212


Congratulations @gaottantacinque, your post successfully recieved 0.0511515 TRDO from below listed TRENDO callers:

@eii earned : 0.034101 TRDO curation


To view or trade TRDO go to steem-engine.com
Join TRDO Discord Channel or Join TRDO Web Site

Coin Marketplace

STEEM 0.24
TRX 0.26
JST 0.041
BTC 98341.73
ETH 3487.68
USDT 1.00
SBD 3.37