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

in #hive4 years ago (edited)

Here is how you can check you balance on https://hive.blog while the 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

Coin Marketplace

STEEM 0.31
TRX 0.12
JST 0.033
BTC 64341.19
ETH 3145.13
USDT 1.00
SBD 4.00