Author

Topic: A Simple python program to autosend a wallets balance(VPS mining FTW) (Read 1032 times)

newbie
Activity: 12
Merit: 0
jgarzik's python-bitcoinrpc (https://github.com/jgarzik/python-bitcoinrpc produces following error:

AttributeError: 'module' object has no attribute 'connect_to_remote'

Which bitcoinrpc python library do you suggest?

Thanks
sr. member
Activity: 420
Merit: 250
member
Activity: 84
Merit: 10
Pretty cool man

Reserved selling spot for CatCoins PM me
sr. member
Activity: 420
Merit: 250
https://github.com/hendo420/Bitcoin-Autosend

I was bored today so I made a program for all of those solo VPS miners out there.

Its stupid simple. Here is the source.
Code:
#!/usr/bin/python
  
import bitcoinrpc
import sys, time
  
serverIP = '127.0.0.1'
serverPort = '1069'
user = 'username'
password = 'password'
address = 'AddressToSendCoinTo'
fee = 0.001

conn = bitcoinrpc.connect_to_remote(user, password, host=serverIP, port=serverPort);
  
while True:

    balance = conn.getbalance()
    print 'Your current balance is', balance
  
    if balance > fee:
        adjbalance = float(balance) - float(fee)
        print 'Sending', adjbalance, 'to your designated address'
      
        try:
            conn.sendtoaddress(address,adjbalance)
        except Exception:
            pass
            print 'Coin send fail'
  
    time.sleep(3)

Just add in your RPC port, username, password, and address to send coins to.
Optionally change the serverIP to your VPS's IP if you are running the program from a remote PC.
You should also change the fee to match the coin you are mining.


Enjoy!  Cheesy Cheesy Cheesy
Jump to: