Send memos in batches with python

Words
117
Reading
1 min
Listen
Play
9y

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)
Send memos in batches with python | Ecency