Author

Topic: Request: Set the destination pubkey for bitcoind generation (Read 8408 times)

full member
Activity: 199
Merit: 696
To extend on this you can connect to the remote host and request a new key before you send, as right now that reuses the same address over and over.

To connect to the remote server and get an address you could set up pubkey auth with ssh and do something like this : ssh [email protected] bitcoin/bitcoind getnewaddress
full member
Activity: 210
Merit: 100
That's not a terrible idea, though. A better low level interface to the generation and transaction spec would be nice.
full member
Activity: 199
Merit: 696
The JSON-RPC interface can be used to query the balance and send it. Try something similar to this.. this will also start bitcoind if it's not running already.  You can run this every few hours from cron.

Code:
#!/bin/bash

NICE=/bin/nice
BITCOIN=/home/solar/bitcoin/bitcoind

ADDR=1XPTgDRhN8RFnzniWCddobD9iKZatrvH4
NODE=192.75.207.66

date

${BITCOIN} getbalance 2>&1 | while read balance;
do
  if [ "${balance}" == "0.000000000000000" ];
  then
    echo "zero balance";
  elif [ "${balance}" == "error: couldn't connect to server" ];
  then
    echo "server not running, starting...";
    ${NICE} -n 19 ${BITCOIN} -daemon -addnode=${NODE}
  else
    echo "sending ${balance} BTC to ${ADDR}"
    ${BITCOIN} sendtoaddress ${ADDR} ${balance};
  fi
done
newbie
Activity: 10
Merit: 0

I'd like to run some bitcoin daemons unattended, and have them generate the blocks but with a predefined public key, rather than a fresh one, so i don't have to check them manually / transfer coins manually.

I have made do for the moment with a cron job that attempts to send 50 every hour Smiley

Jump to: