[hive.blog] How to migrate your DAPPS to Hive - Script 1: WHERE IS MY HONEY?? {steemJS}

in #hive2 years ago (edited)

Here is how you can check you balance on https://hive.blog using steemJS, while the Hive wallet becomes available:

NOTE:
This script does not requires a pre-existing Steemit/Hive account or any private key so it's very safe to use.

If you're the paranoid type feel free to log out, use a different browser, use incognito, etc. This script does not require authentication.

STEP 1


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

STEP 2


Open https://cdn.jsdelivr.net/npm/steem/dist/steem.min.js (SteemJs) and copy & paste (Ctrl + A and Ctrl + C) the javascript code displayed on the page into the Browser Console (DevTools) that you opened in the first tab.

STEP 3

  • Copy & paste my script below in the Console
  • Change the value of targetAccount (first line of the script) with your account name
  • Press enter.
var targetAccount = 'gaottantacinque'

steem.api.setOptions({ url: 'https://api.hive.blog' });
steem.config.set('address_prefix','STM');
steem.config.set('chain_id','0000000000000000000000000000000000000000000000000000000000000000');

steem.api.getAccounts([targetAccount], (err, response) => {
  const { balance, savings_balance, sbd_balance } = response[0];
  console.log(err, JSON.stringify({
    balance, savings_balance, sbd_balance,
  }));
});

// OUTPUT:
// {"balance":"13.709 HIVE","savings_balance":"0.000 HIVE","sbd_balance":"1.136 HBD"}



Enjoy & HIVE ON!   =]

Sort:  

You prefer running this as a nodeJs script?


Here are the steps:

  • Download NodeJs on your machine
  • Create a new folder for your project via terminal - eg. mkdir hello-hive
  • Navigate into the newly created folder - eg. cd hello-hive
  • Initialize npm: npm init and (to keep it simple) keep pressing enter until you get back control of the terminal
  • Create a file named index.js, copy my code snippet above and add this 1 line at the top: const steem = require('steem');
  • Execute: npm install --save steem

You can now execute the script running: node index.js😎😎🎉😎

PS. You can now also see your balances on ex steempeak:
https://peakd.com/@gaottantacinque/transfers

Forte! Devo provare..
Un saluto, nicola

You post has been manually curated by BDvoter Team! To know more about us please visit our website or join our Discord.

Are you a Splinterlands player? If Yes, then checkout MonsterMarket.io. Get instant 3% cashback on every card purchase, and 2% cashback on every booster pack purchase on MonsterMarket.io. MonsterMarket has the highest revenue sharing in the space - 60% for cards and 40% for packs, no minimum spending is required. Join MonsterMarket Discord.

BDvoter Team

Thx! =]

I guess it is easier to go and check it here.

https://hiveblocks.com/@gaottantacinque

Yep, looks much easier lol. I heard that people could not access their wallet and I was in the middle of migrating my dapps so I figured this could help some. =]

This post has been voted on by the HiveSTEM curation team and voting trail. It is elligible for support from @curie and @minnowbooster.

If you appreciate the work we are doing, then consider supporting our witness @stem.witness. Additional witness support to the curie witness would be appreciated as well.

For additional information please join us on the SteemSTEM discord and to get to know the rest of the community!

Please consider using the stem.openhive.network app and including @steemstem as a beneficiary of this post. This could yield a stronger support.