lighthive is a light python client to interact with the HIVE blockchain. It’s simple and stupid. It doesn’t interfere with the process between the developer and the HIVE node.
It's forked from the Lightsteem project. You can just install w/ the traditional PIP: (Requires Python3.6+)
$ (sudo) pip install lighthive
Examples
Get Dynamic Global Properties
props = client.get_dynamic_global_properties()
print(props)
Get Current Reserve Ratio
ratio = c('witness_api').get_reserve_ratio()
print(ratio)
Get @emrebeyler’s account history
history = c.get_account_history("emrebeyler", 1000, 10)
for op in history:
print(op)
Get top 100 witness list
witness_list = client.get_witnesses_by_vote(None, 100)
print(witness_list)
Broadcasting transactions
Account Witness Vote
from lighthive.client import Client
from lighthive.datastructures import Operation
c = Client(
keys=["<private_key>",])
op = Operation('account_witness_vote', {
'account': '<your_account>',
'witness': 'emrebeyler',
'approve': True,
})
c.broadcast(op)
Voting
This will vote with a %1. Percent / 100 = Weight. If you want to downvote, use negative weight.
from lighthive.client import Client
from lighthive.datastructures import Operation
client = Client(
keys=["<private_key>"]
)
op = Operation('vote', {
"voter": "emrebeyler",
"author": "emrebeyler",
"permlink": "re-hitenkmr-actifit-ios-app-development-contribution-20180816t105311829z",
"weight": 100,
})
client.broadcast(op)
More examples can be found at the documentation.
Enjoy!
Thanks for this! You used the variable "c" before defining in the first couple of examples. You may want to update that! or not lol. Thanks again.
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
Ha! good catch. Enjoy!
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
HIVE IS ALIVE!!!
JOIN US, YOU'LL HAVE EXACTLY THE SAME BALANCE AS YOU HAVE HERE ON STEEM WITHOUT THE CENTRALIZATION AND CENSORSHIP!!
https://hive.blog
https://twitter.com/innerhive
ALSO, FUCK YOU @JUSTINSUNSTEEMIT
r>
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
HIVE IS ALIVE!!!
JOIN US, YOU'LL HAVE EXACTLY THE SAME BALANCE AS YOU HAVE HERE ON STEEM WITHOUT THE CENTRALIZATION AND CENSORSHIP!!
https://hive.blog
https://twitter.com/innerhive
ALSO, FUCK YOU @JUSTINSUNSTEEMIT
r>
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
HIVE IS ALIVE!!!
JOIN US, YOU'LL HAVE EXACTLY THE SAME BALANCE AS YOU HAVE HERE ON STEEM WITHOUT THE CENTRALIZATION AND CENSORSHIP!!
https://hive.blog
https://twitter.com/innerhive
ALSO, FUCK YOU @JUSTINSUNSTEEMIT
<br
br>
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit
HIVE IS ALIVE!!!
JOIN US, YOU'LL HAVE EXACTLY THE SAME BALANCE AS YOU HAVE HERE ON STEEM WITHOUT THE CENTRALIZATION AND CENSORSHIP!!
https://hive.blog
https://twitter.com/innerhive
ALSO, FUCK YOU @JUSTINSUNSTEEMIT
r>
br>
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit