It's a bit of a cheat, BUT if you can format the text file the way bitcoin-cli wants it and start it with the bitcoin-cli command all you have to do then is run the file.
bitcoin-cli sendmany "" "{\"12345678ZZStgN5qWduEHyGrsSw72WEiTZ\":0.01,\"12345678ZZStgN5qWduEHyGrsSw72WEiTZ\":0.02}"
The other option is to send them as individual transactions:
bitcoin-cli sendtoaddress "12345678ZZStgN5qWduEHyGrsSw72WEiT" 0.001
bitcoin-cli sendtoaddress "12345678ZZStgN5qWduEHyGrsSw72WEiT" 0.002
bitcoin-cli sendtoaddress "12345678ZZStgN5qWduEHyGrsSw72WEiT" 0.003
It's a bit easier as you are not needing the \ and { and everything else.
just start each line with bitcoin-cli sendtoaddress and add the address and the amount and run it.
-Dave
I'm taking another approach but your's is also an option as I might need to add different amounts to each address and also the change address!
But I'm already half way done to the first version. Then, to change to other format will be easier!
To send individual transactions will make more fees and if I can o it with a single transaction, fees will be less, right? The idea is also to be able to set several outputs into a single transaction to save in fees!
Fees are based on the size of the transaction (data size not
BTC) which is usually based on the number of inputs, but many individual ones will most likely be more expensive to send.
I have used the method quoted above to do things for myself just because it is human readable.
I did all the processing in a DB, then dumped what I needed to text and ran a bitcoin-cli command against it.
It was a bit more programming work on my part, but I could look at a text file to see what happened instead of going through SQL logs trying to figure out what happened.
As you start to do more things the text file approach does become more labor YMMV.
And the obligatory, test it against testnet coins 1st or some alt-coin that costs almost nothing. So long as it's based off one of the newer core releases it should be fine. But if you mess something up your didn't loose real money.
-Dave