Send memos in batches with python

in #steem7 years ago (edited)

I have opened a logo request task for tagbot recently. Lots of people responded with their work. I could only pick 1 contribution for the winner, so, I also wanted to send a small tip and thanks to all designers via steem transfers.

Doing the same thing 15-16 times was not efficient so I wrote this script. That also let me bundle transfers into one transaction. Do you know that you can actually send lots of memos in a single transfer transaction? (I believe the limit was 256 operations per tx but I am too lazy to check it, at the moment.)

Note: from, memo, and amount properties are hard-coded but you get the idea.

thanks.py


from steem import Steem
from steem.transactionbuilder import TransactionBuilder
from steembase import operations
designers = ['account1', 'account2']
def send_in_batch(to_list):
    s = Steem(
        nodes=["https://rpc.buildteam.io"],
        keys=["active_wif"]
    )
    payouts = []
    for to in to_list:
        payouts.append(operations.Transfer(**{
            "from": "emrebeyler",
            "to": to,
            "amount": "0.5 SBD",
            "memo": "Thanks for the design contribution on tagbot.",
        }))
    tb = TransactionBuilder(steemd_instance=s)
    tb.appendOps(payouts)
    tb.appendSigner("emrebeyler", "active")
    tb.sign()
    tb.broadcast()
send_in_batch(designers)
Sort:  

Done voting as a witness. Good luck

Very cool feature! I bet it is much more efficient for Steemit then sending each one separately! Thank you for sharing this work with everyone.

thanks. it's more efficient and fast if you need to do multiple transfers.

Well done, thanks for the tip !

We recommended this post here, here, here, here and here.

We are Discover Steem, if you like our work consider giving us an upvote. :) If you don't wish to receive recommendations under your posts, reply with STOP.

Thanks for the info.I guess it was known by a very few people.
I too have tried something to help the newbies,you can also checked that.