Post
Topic
Board Bitcoin Technical Support
Re: Automatic payment script for client.
by
Sanquin
on 23/09/2014, 00:08:36 UTC
I think something like this should work.

I cant test it though as I have no bitcoind setup with funds.

But it should work like

Quote
python SendBTC.py ...

SendBTC.py - Python 2.7, You will need to install https://github.com/jgarzik/python-bitcoinrpc
Code:
from bitcoinrpc.authproxy import AuthServiceProxy
import argparse

parser = argparse.ArgumentParser(description='Send Multiple BTC Payments.')
parser.add_argument('BTCAddresses', metavar='N', nargs='+',
                   help='BTC Addresses')

args = parser.parse_args()
print " "

bitcoin = AuthServiceProxy("http://username:pass@127.0.0.1:8332")

arglength = len(args.BTCAddresses)
print "You have supplied", arglength, "BTC Addresses"

amount_of_btc = bitcoin.getbalance()
print "You have", "{:.8f}".format(float(amount_of_btc)), "BTC in your wallet"

send_to_each = float("{0:.8f}".format(amount_of_btc)) / arglength

print "Thats", float("{0:.8f}".format(send_to_each)), "BTC to be sent to each address"
print " "

for address in args.BTCAddresses:
        bitcoin.sendtoaddress(address, send_to_each)
        print send_to_each, "BTC sent to", address


Just add this to a crontab to run at a certain time and your done Smiley

Hope this helps. Feel free to donate to my house buying fund - 15wHuCKGCsRs7D3WSQEs1H7V9NVxwa8JrL Smiley