HiveJS: get info and vote for witness - Informationen erhalten und für Witness voten #16

avatar
(Edited)

DE (EN below)

In meinem letzten Beitrag habe ich gezeigt, wie man mit HiveJS HivePower delegiert.
In diesem Beitrag zeige ich wie man Witnesse abruft und wie man für einen Wittness ein Vote abgibt.

Wittness nach Votes abrufen

In der Dokumentation finden wir diverse Möglichkeiten, um Witnesse abzurufen. Eine davon ist die Witnesse nach den Votes, die sie erhalten abzurufen.

Dies erfolgt über die Funktion hive.api.getWitnessesByVote, die 2 Parameter erwartet.

  • from Witnessname ab dem die Ausgabe erfolgen soll
  • limit Anzahl der Witnesses die ausgegeben werden soll.

Um die Top 100 auszugeben, gibt man einen leeren String und 100 an.

für einen Witness Voten


Mit der Funktion hive.broadcast.accountWitnessVote kann ein Vote für einen Witness abgegeben werden.

  • wif private Aktiv-Key des Voters
  • account Nutzername des Voters
  • witness Witnessname für den gevotet wird
  • approve true order false um eine Stimme abzugeben bzw. wieder zu entziehen.

Witness proxy

Mit der Funktion hive.broadcast.accountWitnessProxy kann ein Witness proxy gesetzt werden, sodass man automatisch die gleichen Witnesses votet wie der gesetzte Proxy.

  • wif private Aktiv-Key des Nutzers
  • account Nutzername des Nutzers, der dem Proxy folgen soll
  • proxy Nutzername, dessen Votes man folgt.

Witness Votes eines Nutzers

Möchte man wissen, für welche Witnesse ein Nutzer ein Vote abgegeben hat, nutzt man die Funktion hive.api.getAccounts. Die Witnesses sind über Witness_votes abrufbar.

Diesmal gibt es kein Beispielcode von mir, da es doch sehr simpel ist.

Wer Fragen hat, kann gern ein Kommentar da lassen. Am besten @mein-senf-dazu erwähnen, damit ich es mitbekomme.

EN

In my last post, I showed how to delegate HivePower using HiveJS.
In this post I show how to retrieve Witnesse and how to cast a vote for a Wittness.

Retrieve Wittness by Votes

In the documentation we can find various ways to retrieve Witnesse. One of them is to retrieve wittnesses according to the votes they receive.

This is done using the hive.api.getWitnessesByVote function, which expects 2 parameters.

  • from witness name from which the output should be done.
  • limit number of witnesses to be output.

To output the top 100, specify an empty string and 100.

for one witness vote


The hive.broadcast.accountWitnessVote function can be used to cast a vote for a Witness.

  • wif private active key of the voter.
    account username of the voter
    witness Witnessname for which a vote is made
  • approve true or false to cast or withdraw a vote.

Witness proxy

With the function hive.broadcast.accountWitnessProxy a witness proxy can be set, so that you automatically vote the same witnesses as the set proxy.

  • wif private active key of the user
  • account username of the user who should follow the proxy
  • proxy username whose votes to follow.

Witness votes of a user

If one wants to know for which witnesses a user has cast a vote, one uses the function hive.api.getAccounts. The witnesses can be retrieved via Witness_votes.

This time there is no example code from me, because it is very simple.

If you have any questions, feel free to leave a comment. It's best to mention @mein-senf-dazu, so I get it.

Translated with www.DeepL.com/Translator (free version)



0
0
0.000
5 comments
avatar

Congratulations @hive-coding! You have completed the following achievement on the Hive blockchain And have been rewarded with New badge(s)

You received more than 1250 upvotes.
Your next target is to reach 1500 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

Check out our last posts:

HiveBuzz World Cup Contest - Recap of 3rd Place match
The Hive Gamification Proposal Renewal
Support the HiveBuzz project. Vote for our proposal!
0
0
0.000
avatar

I kind of miss using Hive libraries to do stuff and HiveJS is one of the first things I used. Glad to see that it's still alive :)

0
0
0.000
avatar

Thanks for learning from this post

0
0
0.000