How to transfer SBD or STEEM to multiple accounts? (Batch transfer with steem-python) / 如何向多个账户批量转账

in #steemdev7 years ago

Manual transfer

Some of my friends held some very interesting activities on steemit. Such as 谷哥点名 by @jubi, and 七夕征文大赛by @rivalhw. The activities are very successful, plenty of people did participate and many people won the prize.

But, How to pay bonuses is a bit of a hassle, organizers need to log on to the website and transfer bonuses to each winner.

If there are a large number of winners, We need to do the same thing over and over again.

Batch transfer

Fortunately, we can implement batch transfers using program.
Just installed the official python library for STEEM as I mentioned in my previous article

But, We need Active private key this time, follow the same steps in my previous article but select Active private key, and then import it to our local wallet.

A simplest script maybe like this:

#!/usr/bin/env python
import sys
from steem import Steem

from_account = 'oflyhigh'
to_accounts = ['oflyhigh.test', 'jubi', 'deanliu']
amount = 0.001
asset = 'SBD'
message = 'Test transfer!'

def main(argv=None):
        steem=Steem()
        for to_account in to_accounts:
                steem.transfer(to_account, amount=amount, asset=asset, memo=message, account=from_account)

if __name__ == "__main__":
        sys.exit(main())

Now, we can transfer 0.001 SBD to multiple accounts ( @oflyhigh.test, @jubi, @deanliu) by executing the script. A message Test transfer! was added at the same time.

Now, let me check my wallet:

We made it successfully!

For encrypted messaging

steem-python also supports message encryption.

To issue a encrypted message, just plus # prefix for your message.
For example,
message = '#Test transfer!'

And you must import memo private key to your local wallet, otherwise you will get the following error message like this one:
steembase.exceptions.MissingKeyError: Memo key for oflyhigh missing!

There's a small issue of steem-python for encrypted memo

We get two '#' in the memo, which should be one, but it doesn't matter.

中文

我的一些朋友在STEEMIT举办了很多有意思的活动,比如 @jubi谷哥点名@rivalhw七夕征文大赛等等。这些活动非常成功,吸引了很多朋友参加并且很多朋友赢得了奖励。

但是,如何发放奖励是很麻烦的事情,组织者要登陆网站给每个获奖者一笔一笔的转账。如果获奖者很多,那么我们就要一次又一次的做相同的事情。

幸运的是,我们可以用程序实现批量转账并附加备注信息,代码参见英文部分。

程序同时支持备注消息加密,在消息前边加个#号就可以了。但是steem-python有点小BUG,转账后的消息里多了一个#号,但是这没啥大影响。

Sort:  

If you'd like it to be super fast and efficient, you can pack multiple op's in a single tx.
http://steem.readthedocs.io/en/latest/examples.html#batching-operations

guide me also

Thank you for your comment.

I had already introduced Batching Operations in my another article:
https://steemit.com/cn/@oflyhigh/operation-transaction
This method is really efficient, but it may be too technical to explain😀

BTW: I'm very glad that you brought SteemData SBDS back, It's really very useful. 👍

Thanks. I check this.

Is there perhaps a website/tool for this? I don't understand this whole python stuff

It seems as easy as pie....thanks for your tips....now i know more...

It would be great a web interface is developed so that non-coder people can send STEEM or SBD to multiple people. Thanks for the efforts though.

awesome

Good information. i resteem your post.

thanks for the info.. really helpful

helpfull, only i have registered sucsesfully multiple account

Good post..
May sometimes you might to send me a present to show your kindness 😄😉

Coin Marketplace

STEEM 0.20
TRX 0.14
JST 0.030
BTC 64870.15
ETH 3489.66
USDT 1.00
SBD 2.54