You are viewing a single comment's thread from:

RE: LeoThread 2024-04-20 22:32

in LeoFinance6 months ago

I am digging into writing data into the Hive blockchain using Beem and Python. Check the links in the comments for some cool resources.

Sort:  

Such a nice initiative. I hope you can do something good.

Thanks!

Do you know how to write to json directly?

You mean that Custom JSON operation?

yes. i am facing some trouble with it

Without detail, it's hard to say what's wrong but this you can create a buy order for $LEO.

import json from lighthive.client import Client from lighthive.datastructures import Operation accountname = '' active_key = '' symbol = 'leo' amount = 1 price = 0.01 lighthiveClient = Client(keys=[active_key]) payLoad = [{"contractName":"market","contractAction":"buy","contractPayload":{"symbol":symbol.upper(),"quantity":str(amount),"price":str(price)}}] jsonData = { 'required_auths': [accountname] ,'required_posting_auths': [] ,'id':'ssc-mainnet-hive' ,'json': json.dumps(payLoad) } op = Operation(type='custom_json', value=jsonData) r = lighthiveClient.broadcast_sync(op)

thanks, let me try and tame it.

i am using Beem, and probably stuck at the part where i need to put in the wif. i am working based on this: https://ecency.com/hive-167922/@geekgirl/using-hive-blockchain-custom-json-operation-with-python-and-beem

I've been doing the same lately and it's indeed cool. I've also been using AI to help me understand the concepts and create/improve on the code, which has worked really well so far. Thanks for the resources!

Thank you for sharing. It'd be a great help.