ProGrammer avatar

HiveJs Tutorials --Learning how to transfer HIVE/HBD thorugh HiveJs

pakgamer

Published: 15 Jun 2020 › Updated: 15 Jun 2020HiveJs Tutorials --Learning how to transfer HIVE/HBD thorugh HiveJs

HiveJs Tutorials --Learning how to transfer HIVE/HBD thorugh HiveJs

Hello Everyone

As you know we have started learning Hivejs. In the previous posts, we did a few things like voting on someone's post using hive.js. In this post, we are going to learn how to transfer some HIVE/HBD using the Hivejs Liberty. If you you are new to these tutorials I will suggest reading the previous posts about the Hive in order to understand how things work here. If you know the JavaScript already then I am pretty sure that understand the Hibvejs will not be a big problem for you. If you don't know the Javascript we also have the Javascript tutorials for beginners. So without wasting time let's start.
image.png

We are going to use this API. This piece of code will help us transfer our funds.

hive.broadcast.transfer(wif, from, to, amount, memo, function(err, result) {
  console.log(err, result);
});

image.png

It takes some parameters. Like the first one is the password(Active key as it is a transfer). The second one is from like who is sending the coins. The 3rd one of "to" who is going to receive the coins. The fourth one if ammout+ The symbol( you will learn the pattern in the post) and the last one is memo. The memo is like a message with the coins It is optional which means we can transfer without a memo.

image.png

When you fill it. It should look something like this. Just For sake of example, I am sending a small amount to probithive. Ok let's run it.

image.png

If everything went right you should see something like this.

null {
  id: 'b6585c255cda88a27e5d37c4028de21282d33407',
  block_num: 44320137,
  trx_num: 1,
  expired: false,
  ref_block_num: 17774,
  ref_block_prefix: 332704036,
  expiration: '2020-06-15T18:22:06',
  operations: [ [ 'transfer', [Object] ] ],
  extensions: [],
  signatures: [
    '1f2c07a04e392c579950cb2f627ce74a8ecd7f6baf6b6536f4502d982d2deb989c0886832c8d92b1b77c33e4da61f992c0a1d2b073fa7551c5ab4acf614a97cf79'
  ]
}

image.png

As you can see the transaction is completed. If you want to transfer HBD just replace the HIVE with HBD other things are same.

I think this much is enough for today. Now if you like the post please upvote and comment if you want to give me some advise
ntitled-1.png

Leave HiveJs Tutorials --Learning how to transfer HIVE/HBD thorugh HiveJs to:

Written by

Loves Coding, Gaming, Photography and LIFE

Read more #programming posts


Best Posts From ProGrammer

We have not curated any of pakgamer's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.

More Posts From ProGrammer