LightHive - A light Python client for HIVE blockchain

Words
111
Reading
1 min
Listen
Play
6y


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@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=["",])

op = Operation('account_witness_vote', {
        '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=[""]
)

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!

Vote for my witness


If you didn't vote for my witness already, consider casting a witness vote.

LightHive - A light Python client for HIVE blockchain | Ecency