Steem-python question

in #steem6 years ago (edited)

I am currently playing around with programming some steem-bots using steem-python and have a problem for that I build a rather complicated solution, while there is probably a better way to do it.

Gygv9V.jpeg

I want to find out who delegates to a given Account (and how much) and who follows that Account.

Also I have just started with steem-pyhton and not given much consideration to the existing alternatives. What are the advantages of libraries such as BEEM compared to steem-python?

I will put 2.5 SBD as a steem-bounty for the best answers.

Sort:  

I tried to do something similar to get delegation info of any account.

https://steemit.com/steem/@culgin/finding-out-who-delegated-to-me-with-python-is-there-an-easier-way

You will find that it takes a long time to generate delegation info.

Posted using Partiko Android

yes, that is similar to my current implementation where I brutally search the entire account transactions of the past .

I think that's necessary. I checked with @justyy, who runs the following site, https://helloacm.com/tools/steemit/delegatees/

They too need to run the API in the background and store the delegation information in a database to provide a faster way to check delegation info.

Posted using Partiko Android

Loading...

The number one advantage of using either been or asyncsteem instead of the official python library, no doubt is error handling. I would argue that for a new project choosing one of the alternatives is a no brainer and the question shouldn't be if you should use an alternative library, but what alternative library you should use.

The two main choices I believe are beem, a library with a close to complete python API that allows you to do all that the official lib does but without most of its issues, and asyncsteem, a library that doesn't implement signed operations, but that does implement its functionality in an asynchronous non blocking way, so it can be used with the Python Twisted framework, allowing for scalable networking implementation that don't require the old threadded can of worms approach, but use the non blocking asynchronous setup popularized in recent years by Node JS in the JavaScript world and different asio libs such as boost-asio in other languages .

So basically:

  • If you have a huge legacy code base, maybe keep using the legacy official library.
  • If you start from zero and need signed operations, use beem.
  • If you start from zero and need asynchronous non blocking operations, use asyncsteem.
  • If you need both signing and async, currently, don't use Python

I think for this usecase, using an asynchronous approach would have its merits especially if you want some kind of web interface and don't want to be using a database all the time.

You would want to keep something of an in memory cache, probably, spitting through the history of any account you find to be active that you haven't currently cached yet, so you don't need to do last second history exploration. Then you will want to update the cache on new transactions and timeouts that update delegation . If, for example through web interface, an non-cached account is queried, only non-hits will take long to answer.

You could probably do this with Been as well, but you will either need to use old school shared state concurrency (threads, locks, mutexes), or opt for using a database all the time for a data set that should easily fit in memory. With asyncsteem you could do it without threads, mutexes, locks or databases with just one single always running process . This is of cause assuming you need a web user interface. If these lookups are meant purely within the context of a pure STEEM only bot without any non-steem user interaction, then Beem would do just fine, and as you will want to use signed operations to interact with the world, Beem would actually be the best option.

Hope the above isn't too confusing.

thanks a lot, that was a great summary. I will probably write my next project using beem.

@frdem3dot0 has set 2.500 SBD bounty on this post!
logo_for-light-bg_1000.png

Bounties are a new way you can earn rewards irrespective of you Steem Power. Go here to learn how bounties work.

Earn the bounty by commenting what you think the bounty creator wants to know from you.

Find more bounties here and become a bounty hunter.

Happy Rewards Hunting!

Congratulations to the following winner(s) of the bounty!

  • @holger80 has earned 1.096 SBD. 1.069 SBD from the creator of the bounty and 0.027 SBD from the community!
    Find more bounties here and become a bounty hunter.
  • @culgin has earned 0.299 SBD. 0.214 SBD from the creator of the bounty and 0.086 SBD from the community!
    Find more bounties here and become a bounty hunter.
  • @pibara has earned 0.855 SBD. 0.855 SBD from the creator of the bounty and 0.000 SBD from the community!
    Find more bounties here and become a bounty hunter.

I think@brendanvanbreda may be able to help you with this one. Check it out man!

There is also the lightsteem python client, but I've heard rumors that it's a clone/rip-off of beem?

I haven't done much programming against steem, though I do have some ideas I've been considering to implement.

what kind of ideas do you have? I am mostly interested in advertisement. The current bidbots are not delivering for people that want to advertise and they are also not delivering for the community. In the end they only work because of steem-inflation and are not real advertisement products with a logical revenue stream.

Instead I am interested in trying other solutions to advertisement.

I already have some scripts for checking the average market rate for various crypto currencies and setting up market maker orders towards some few exchanges. I was making great profits running those scripts towards some bad Norwegian exchange with low turnover and stupid customers, eventually I was thrown out of that exchange, I don't think I'm earning much money on it as it is now (but I think it's still useful for converting crypto currencies for the lowest possible cost). I also doubt I would earn much money on using those scripts for buying SBD on the market and converting it back to steem, but at least I would be able to offer a service to the community (reduce the SBD debt) without paying too much for it.

I was also thinking about a bot that will just work the steem sbd markets. But it might be risky with HF20 incoming that may potentially break the low peg to $. The bot I have in mind would obviously use this to evaluate clear buying opportunities and that may be flawed.

Realistically the peg will hold well until the next major crash, so there may be some opportunity.

Speed Difference?

so far I find that the speed is mostly limited by the communication with the nodes.

Hi @frdem3dot0!

Your post was upvoted by @steem-ua, new Steem dApp, using UserAuthority for algorithmic post curation!
Your UA account score is currently 2.672 which ranks you at #13643 across all Steem accounts.
Your rank has dropped 28 places in the last three days (old rank 13615).

In our last Algorithmic Curation Round, consisting of 316 contributions, your post is ranked at #69.

Evaluation of your UA score:
  • Only a few people are following you, try to convince more people with good work.
  • The readers like your work!
  • Good user engagement!

Feel free to join our @steem-ua Discord server

Coin Marketplace

STEEM 0.17
TRX 0.16
JST 0.029
BTC 76538.15
ETH 2885.03
USDT 1.00
SBD 2.56