create account

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

View this thread on: hive.blogpeakd.comecency.com
· @hive-coding · (edited)
$2.43
HiveJS: get info and vote for witness - Informationen erhalten und für Witness voten #16
## DE (EN below)
In meinem letzten [Beitrag](https://ecency.com/hive-169321/@hive-coding/hivejs-how-to-delegtae-hivepower) 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](https://gitlab.syncad.com/hive/hive-js/tree/master/doc#witnesses) finden wir diverse Möglichkeiten, um Witnesse abzurufen. Eine davon ist die Witnesse nach den Votes, die sie erhalten abzurufen.

![](https://images.ecency.com/DQmPc1pQinUkacxzSQmpP8ckHkwdJi18U7SnvvswQwJoUj8/grafik.png)

Dies erfolgt über die Funktion [hive.api.getWitnessesByVote](https://gitlab.syncad.com/hive/hive-js/tree/master/doc#get-witnesses-by-vote), 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
![](https://images.ecency.com/DQmQrPrtNpTaPu1PMEVzvNsKqBTRJTj3uqxn67TtyVA5BLV/grafik.png)
Mit der Funktion [hive.broadcast.accountWitnessVote](https://gitlab.syncad.com/hive/hive-js/tree/master/doc#account-witness-vote) 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 
![](https://images.ecency.com/DQmamfpttSGbNYpRVx1PkZBw2tZVLJ9E6quy4Yu8uaMijN5/grafik.png)

Mit der Funktion [hive.broadcast.accountWitnessProxy](https://gitlab.syncad.com/hive/hive-js/tree/master/doc#account-witness-proxy) 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
![](https://images.ecency.com/DQma3w58d4nR9Yyxx2BGqfqfeUM2Ebeq34DwxjBXUu7JjMi/grafik.png)

Möchte man wissen, für welche Witnesse ein Nutzer ein Vote abgegeben hat, nutzt man die Funktion [hive.api.getAccounts](https://gitlab.syncad.com/hive/hive-js/tree/master/doc#get-accounts). 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](https://ecency.com/hive-169321/@hive-coding/hivejs-how-to-delegate-hivepower), 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](https://gitlab.syncad.com/hive/hive-js/tree/master/doc#witnesses) we can find various ways to retrieve Witnesse. One of them is to retrieve wittnesses according to the votes they receive.

![](https://images.ecency.com/DQmPc1pQinUkacxzSQmpP8ckHkwdJi18U7SnvvswQwJoUj8/grafik.png)

This is done using the [hive.api.getWitnessesByVote](https://gitlab.syncad.com/hive/hive-js/tree/master/doc#get-witnesses-by-vote) 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
![](https://images.ecency.com/DQmQrPrtNpTaPu1PMEVzvNsKqBTRJTj3uqxn67TtyVA5BLV/grafik.png)
The [hive.broadcast.accountWitnessVote](https://gitlab.syncad.com/hive/hive-js/tree/master/doc#account-witness-vote) 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 
![](https://images.ecency.com/DQmamfpttSGbNYpRVx1PkZBw2tZVLJ9E6quy4Yu8uaMijN5/grafik.png)

With the function [hive.broadcast.accountWitnessProxy](https://gitlab.syncad.com/hive/hive-js/tree/master/doc#account-witness-proxy) 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
![](https://images.ecency.com/DQma3w58d4nR9Yyxx2BGqfqfeUM2Ebeq34DwxjBXUu7JjMi/grafik.png)

If one wants to know for which witnesses a user has cast a vote, one uses the function [hive.api.getAccounts](https://gitlab.syncad.com/hive/hive-js/tree/master/doc#get-accounts). 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)
👍  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , and 102 others
👎  
properties (23)
authorhive-coding
permlinkhivejs-get-info-and-vote
categoryhive-169321
json_metadata"{"links":["https://ecency.com/hive-169321/@hive-coding/hivejs-how-to-delegtae-hivepower","https://gitlab.syncad.com/hive/hive-js/tree/master/doc#witnesses","https://gitlab.syncad.com/hive/hive-js/tree/master/doc#get-witnesses-by-vote","https://gitlab.syncad.com/hive/hive-js/tree/master/doc#account-witness-vote","https://gitlab.syncad.com/hive/hive-js/tree/master/doc#account-witness-proxy","https://gitlab.syncad.com/hive/hive-js/tree/master/doc#get-accounts","https://ecency.com/hive-169321/@hive-coding/hivejs-how-to-delegate-hivepower","https://gitlab.syncad.com/hive/hive-js/tree/master/doc#witnesses","https://gitlab.syncad.com/hive/hive-js/tree/master/doc#get-witnesses-by-vote","https://gitlab.syncad.com/hive/hive-js/tree/master/doc#account-witness-vote"],"image":["https://images.ecency.com/DQmPc1pQinUkacxzSQmpP8ckHkwdJi18U7SnvvswQwJoUj8/grafik.png","https://images.ecency.com/DQmQrPrtNpTaPu1PMEVzvNsKqBTRJTj3uqxn67TtyVA5BLV/grafik.png","https://images.ecency.com/DQmamfpttSGbNYpRVx1PkZBw2tZVLJ9E6quy4Yu8uaMijN5/grafik.png","https://images.ecency.com/DQma3w58d4nR9Yyxx2BGqfqfeUM2Ebeq34DwxjBXUu7JjMi/grafik.png"],"users":["mein-senf-dazu","mein-senf-dazu"],"tags":["hive-169321","hive","coding","deutsch","hive-engine","hivejs","hive-coding","pob","hive-js","dev"],"description":"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","app":"ecency/3.0.30-vision","format":"markdown+html"}"
created2022-12-18 07:30:24
last_update2022-12-18 07:37:36
depth0
children5
last_payout2022-12-25 07:30:24
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value2.434 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length4,981
author_reputation8,653,483,468,469
root_title"HiveJS: get info and vote for witness - Informationen erhalten und für Witness voten #16"
beneficiaries
0.
accountmein-senf-dazu
weight10,000
max_accepted_payout1,000,000.000 HBD
percent_hbd0
post_id119,198,401
net_rshares12,339,313,219,868
author_curate_reward""
vote details (167)
@hivebuzz ·
Congratulations @hive-coding! You have completed the following achievement on the Hive blockchain And have been rewarded with New badge(s)

<table><tr><td><img src="https://images.hive.blog/60x70/http://hivebuzz.me/@hive-coding/upvoted.png?202212180842"></td><td>You received more than 1250 upvotes.<br>Your next target is to reach 1500 upvotes.</td></tr>
</table>

<sub>_You can view your badges on [your board](https://hivebuzz.me/@hive-coding) and compare yourself to others in the [Ranking](https://hivebuzz.me/ranking)_</sub>
<sub>_If you no longer want to receive notifications, reply to this comment with the word_ `STOP`</sub>



**Check out our last posts:**
<table><tr><td><a href="/hive-102201/@hivebuzz/wc2022-recap-final-day1"><img src="https://images.hive.blog/64x128/https://i.imgur.com/uNPMgnd.png"></a></td><td><a href="/hive-102201/@hivebuzz/wc2022-recap-final-day1">HiveBuzz World Cup Contest - Recap of 3rd Place match</a></td></tr><tr><td><a href="/hive-139531/@hivebuzz/proposal-2324"><img src="https://images.hive.blog/64x128/https://i.imgur.com/RNIZ1N6.png"></a></td><td><a href="/hive-139531/@hivebuzz/proposal-2324">The Hive Gamification Proposal Renewal</a></td></tr></table>

###### Support the HiveBuzz project. [Vote](https://hivesigner.com/sign/update_proposal_votes?proposal_ids=%5B%22248%22%5D&approve=true) for [our proposal](https://peakd.com/me/proposals/248)!
properties (22)
authorhivebuzz
permlinknotify-hive-coding-20221218t085337
categoryhive-169321
json_metadata{"image":["http://hivebuzz.me/notify.t6.png"]}
created2022-12-18 08:53:36
last_update2022-12-18 08:53:36
depth1
children0
last_payout2022-12-25 08:53:36
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length1,396
author_reputation369,446,705,072,593
root_title"HiveJS: get info and vote for witness - Informationen erhalten und für Witness voten #16"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id119,199,580
net_rshares0
@lilacse ·
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 :) 
properties (22)
authorlilacse
permlinkre-hive-coding-20221220t19552786z
categoryhive-169321
json_metadata{"tags":["hive-169321","hive","coding","deutsch","hive-engine","hivejs","hive-coding","pob","hive-js","dev"],"app":"ecency/3.0.35-mobile","format":"markdown+html"}
created2022-12-20 11:55:03
last_update2022-12-20 11:55:03
depth1
children0
last_payout2022-12-27 11:55:03
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length131
author_reputation19,250,085,524,596
root_title"HiveJS: get info and vote for witness - Informationen erhalten und für Witness voten #16"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id119,250,008
net_rshares0
@pizzabot ·
<center>🍕 PIZZA !
 @hive-coding! The Hive.Pizza team manually upvoted your post.

<sub>Please <a href="https://vote.hive.uno/@pizza.witness">vote for pizza.witness</a>!</sub></center>
properties (22)
authorpizzabot
permlinkre-hivejs-get-info-and-vote-20221218t174258z
categoryhive-169321
json_metadata"{"app": "beem/0.24.19"}"
created2022-12-18 17:42:57
last_update2022-12-18 17:42:57
depth1
children0
last_payout2022-12-25 17:42:57
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length183
author_reputation7,698,943,017,949
root_title"HiveJS: get info and vote for witness - Informationen erhalten und für Witness voten #16"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id119,208,412
net_rshares0
@poshtoken ·
https://twitter.com/1386214711138660352/status/1604401298593529857
<sub> The rewards earned on this comment will go directly to the people( @mein-senf-dazu ) sharing the post on Twitter as long as they are registered with @poshtoken. Sign up at https://hiveposh.com.</sub>
properties (22)
authorposhtoken
permlinkre-hive-coding-hivejs-get-info-and-vote-1246
categoryhive-169321
json_metadata"{"app":"Poshtoken 0.0.1","payoutToUser":["mein-senf-dazu"]}"
created2022-12-18 09:04:00
last_update2022-12-18 09:04:00
depth1
children0
last_payout2022-12-25 09:04:00
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length273
author_reputation5,763,144,369,229,736
root_title"HiveJS: get info and vote for witness - Informationen erhalten und für Witness voten #16"
beneficiaries
0.
accountreward.app
weight10,000
max_accepted_payout1,000,000.000 HBD
percent_hbd0
post_id119,199,715
net_rshares0
@roky ·
Thanks for learning from this post
properties (22)
authorroky
permlinkre-hive-coding-20221220t21159537z
categoryhive-169321
json_metadata{"tags":["hive-169321","hive","coding","deutsch","hive-engine","hivejs","hive-coding","pob","hive-js","dev"],"app":"ecency/3.0.35-mobile","format":"markdown+html"}
created2022-12-20 15:02:00
last_update2022-12-20 15:02:00
depth1
children0
last_payout2022-12-27 15:02:00
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length34
author_reputation43,116,356,586,137
root_title"HiveJS: get info and vote for witness - Informationen erhalten und für Witness voten #16"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id119,253,573
net_rshares0