What Changed In The Transfer RPC Request?

in #hf242 months ago (edited)


I use steem-js in my scripts for working with Hive, Steem and Blurt.

const chain=require("steem");

Switching The Blockchains

I switch the blockchains by setting different options. Before HF24, chain_id was the same as this from Steem and rebranded_api was not set.

if (name=='steem') {
    chain.api.setOptions({ url: 'https://api.steemit.com' });
    chain.config.set('alternative_api_endpoints', ['https://api.steemit.com', 'https://api.steemit.com']);
} else if (name=='hive') {
    chain.api.setOptions({ url: 'https://api.hive.blog' });
    chain.config.set('alternative_api_endpoints', ['https://api.openhive.network', 'https://rpc.esteem.app']);
    chain.config.set('rebranded_api', true)
    //chain.broadcast.updateOperations() doesn't exist in steem-js nor in blurtjs and not needed anymore with hivejs
} else if (name=='blurt') {
    chain.api.setOptions({ url: 'https://rpc.blurt.buzz', useAppbaseApi: true });
    chain.config.set('alternative_api_endpoints', ['https://rpc.blurt.buzz', 'https://rpc.blurt.buzz']);

The Free Hive Voting Service

Following The Community Fork, @mahdiyari released hive-js. I tried to extend my voting service to Hive using his library.

// not working
const steem=require("steem");
const hive=require("@hiveio/hive-js");

That was not working. The operations were done in the wrong blockchains when using both libraries simultaneously. Only one instance is possible.

I resolved the case importing only @hiveio/hive-js or steem, switching blockchains and making synchronous calls.

Hard Fork #24

Using these settings and updating the operations, according to How to prepare your applications for HF24, @quicktrades works well in the Hive and Steem internal markets. My other scripts work on Blurt and Steem. With Hive, the scripts worked well before HF24.

What Works


What Doesn't Work

vote works

...but not if the script worked before with Blurt or Steem.
My voting service has not been working with Hive anymore since HF24 for this cause, but it works well with Blurt and Steem. The voting service is popular on Blurt only. See @droida/do-you-vote-on-blurt-are-you-loosing-money.

transfer doesn't work

const active="a secret not to disclose";
chain.broadcast.transfer(active, "droida", "freebot", "0.001 HIVE", "", function(err, result) {
    console.log(err, result);

Error message is RPCError: missing required active authority:Missing Active Authority droida

claim_account doesn't work

const op=['claim_account',{
    creator: creator,
    fee: '0.000 HIVE',
    json_metadata: JSON.stringify({}),
    extensions: [],
    extensions: [],
    operations: [ op ]
    }, [active], (err, result) => {
        console.log(err, result);

Error message is OperationalError [RPCError]: missing required active authority:Missing Active Authority droida

What Changed In The transfer RPC Requests?

...and in claim_account?

I can transfer on Hive only if I import @hiveio/hive-js but using the Hive library makes getAccountHistory fail now.

chain.api.getAccountHistory("droida", -1, 1, function(err, result) {
    console.log(err, result);

The error message:

(node:5730) UnhandledPromiseRejectionWarning: TypeError: callback is not a function
    at /hive/node_modules/@hiveio/hive-js/lib/api/transports/http.js:148:11
    at process._tickCallback (internal/process/next_tick.js:68:7)
(node:5730) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:5730) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Broken By HF24

HF24 made a mess. It sucks, I would like to call it Hard Fuck 24. It obliges developers to rewrite what was working (I have many scripts accepting the blockchain name as a parameter).
That takes energy, nerves, time and money (time is money). It makes me willing to focus on Blurt only, now that @quicktrades works.

Thanks For Your Help


The solution is probably a small common change for all the operations that fail now that shouldn't because those operations haven't changed (shouldn't).

The resolution will wait because of the missing time to investigate.
I have a full-time job and little time to invest in personal projects or to learn some javascript coding (I wrote my first instruction 37 years ago :p ). I have too few will to search for the modifications in the source code.

Discord is faster and more probative, but I can't reward answers there.



Instead of blaming hf24 and hive, learn some simple javascript coding. Use different variable names for each library and things should work well. For further help reach out to hivedevs discord server. We love to help developers.

Edit: Yes, the account history change was a mess and shouldn't have been done like that but docs are updated already for that on hive-js. https://gitlab.syncad.com/hive/hive-js/-/tree/master/doc

Thanks. I was using different variable names already.

// not working
const steem=require("steem");
const hive=require("@hiveio/hive-js");

Hey @droida, here is a little bit of BEER from @eii for you. Enjoy it!

Learn how to earn FREE BEER each day by staking your BEER.

Congratulations @droida! You have completed the following achievement on the Hive blockchain and have been rewarded with new badge(s) :

You distributed more than 16000 upvotes. Your next target is to reach 17000 upvotes.

You can view your badges on your board and compare yourself to others in the Ranking
If you no longer want to receive notifications, reply to this comment with the word STOP