How to do mass payouts in my application to multiple addresses at once, or very quickly? Let's say it's pay day--I've accumulated a lot of bitcoins, and sent them all to a single address. I now want to pay a lot of addresses from this "pool" of coins, say anywhere between 100 and 10,000 addresses. What is the best way to do this in a way I can use with PHP, and with which client would be the best fit? I'm currently familiar with bitcoind and electrum.

The problems I see happening is:


If I make them one after another, I would have to wait for a confirmation between each each transaction.
If I somehow send them all in one transaction, I would need to a) mess with raw transactions, and b) possibly hit a limit on the transaction size.


Is it possible to do this without using raw transactions? And how do I check to see how many addresses I can send to at once without hitting the max transaction size? If I DO have to deal with raw transactions, is there any library in PHP that helps me build them easily?

Thank you.
In Electrum you can use the CSV import feature to make bulk payments. It can accept either a CSV file or CSV entered into a text box. The rough format is:

ADDRESS, 0.12345
ADDRESS, 0.12314


This feature has been merged into the 1.9 version that is not released yet, but you can use it already.

https://github.com/spesmilo/electrum/pull/282

Example:

1PkeTTctdh2CvhW3fQLs93PWP9qupWV68X, 5
3NujXLC3LxNsmk2wr69CLBuXGfhXeenUyu, 5
1CNAnSb7d1XCA4AXBH2gip3mi8dNTQxzeo, 1
1LSBFJ1An9orRMU6Bz3NS1y3jr1eH9AexE, 1
16qRyDVZVpptJb4HZzv5rWkjqtJWVRjDep, 1
1PkeTTctdh2CvhW3fQLs93PWP9qupWV68X, 5
1Nnad832Zyob64wGbju49CC5RFbACAfCNZ, 1
1J2gFYBnf8K2wHJDndgr3iN1nPoZumHXap, 5


The amount is in the unit your Electrum is configured. In my case, for example, it is in mBTC. Be careful with this!