Hive-js & Hive-tx migration to Hive - Breaking changes for browsers!

in HiveDevs10 months ago



Hive-js is the official javascript library for Hive. All the apps previously using Steem-js should use Hive-js instead.


npm install @hiveio/hive-js --save

Browser usage:

<script src=""></script>

New config option:

hive.config.set('alternative_api_endpoints', ['', '']);

Breaking changes (Only on browsers):
The only breaking change is the variable name on the browsers. You must use hive instead of steem in the browsers to access Hive-js library.

Example usage:

hive.api.getAccounts(['mahdiyari', 'hiveio'], function(err, result) {
    console.log(err, result);

Deprecated method:
hive.formatter.vestToSteem() is deprecated and will be removed in the future releases. Use hive.formatter.vestToHive() instead.

var hivePower = hive.formatter.vestToHive(vestingShares, totalVestingShares, totalVestingFundHive);

Source code and full documentation:
Npm package:


Lightweight and complete JavaScript library for using Hive blockchain in Javascript environments such as Web or NodeJS.

Previously introduced as Steem-tx and now fully migrated to Hive.

Source code and full documentation:
Npm package:

Contribution is more than welcome in all repositories on
Development is in the hands of the community.


Thanks for doing this important work.

 10 months ago 

I like the new alternative_api_endpoints, does it failover to the next endpoint when one errors?

Yes. The expected behavior is a failover to the next endpoint.

Nice! I don't have to re-invent the wheel swapping nodes in my code anymore.

Thanks for developing and sharing this "toy", @mahdiyari!
Bookmarked and reblogged!
!tip & hugs! 🤗
@tipu curate

hive.config.set('alternative_api_endpoints', ['', '']);


For just clarification: alternative_api_endpoints is added by someone else. I just documented it.

How much time do we have to make the transition?

Hive-js is the official library (for now) and will get updated regularly. You can use whatever works for you.
I think after next hf, steem libraries will not work on Hive.

ok, great... I still have some time then...
Thx for the quick reply! 👍

Thanks for the work!

Of course ;P

Are there types for typescript with hive-js?

I might not understand what's your mean. But hive-js should work with typescript too.

import * as hive from 'hive-js'

kools, I started off on dsteem and it worked with typescript. For clarity I was tryina ensure that hive-js had types to work with typescript. Do you know if dsteem will be ported over and which is the recommend lib for deving for hive?

A few people worked on dhive and I think you can try it:

Hive-js is not ideal for broadcasting massive transactions and is slow in signing but is more userfriendly and has more methods. On the other hand, dhive is faster in signing transactions.

If you want something light without any extra method, hive-tx might be your choice. And is fast enough.

Note the typo:

I20200506-13:22:30.477(2)? Alternate endpoitns:  [ '', '' ]
I20200506-13:22:30.524(2)? Error Failover Threshold:  3

'endpoitns' should be replaced by 'endpoints' :)

Anyone else having issues with old data being pulled? Seems hive.api.getAccounts is pulling old hive information, not the most recent update. I've tried multiple browsers and even a second computer to verify, example page is the console.log history on I'm noticing has 2 different versions of json metadata, the text in red is incorrect, but I see a posting json metadata on top that is showing updated information.... Assistance is more then welcomed. has more information, apparently it's a artifact from pre-hf21... Could this be updated to use posting_json_metadata with a json_metadata fallback? Or something?

posting_json_metadata requires only posting key to update but json_metadata requires active key.

What about to view it? My project site I'd like to display posting, but not sure what to call

database_api.find_accounts returns posting_json_metadata

hive.api.callAsync('database_api.find_accounts', { accounts: ['mahdiyari'] })
  .then((res) => console.log(res))

or'database_api.find_accounts', { accounts: ['mahdiyari'] }, (err, res) => {
  console.log(err, res)

Beautiful, going to try that shortly. Appreciate the help.

Worked great, thank you again.