Bitcoin Forum
November 02, 2024, 08:49:18 PM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Request: Set the destination pubkey for bitcoind generation  (Read 8475 times)
darkskiez (OP)
Newbie
*
Offline Offline

Activity: 10
Merit: 0


View Profile
July 15, 2010, 07:19:57 PM
 #1


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

laszlo
Full Member
***
Offline Offline

Activity: 199
Merit: 2384


View Profile
July 15, 2010, 07:36:17 PM
 #2

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

BC: 157fRrqAKrDyGHr1Bx3yDxeMv8Rh45aUet
lachesis
Full Member
***
Offline Offline

Activity: 210
Merit: 105


View Profile
July 15, 2010, 08:03:49 PM
 #3

That's not a terrible idea, though. A better low level interface to the generation and transaction spec would be nice.

Bitcoin Calculator | Scallion | GPG Key | WoT Rating | 1QGacAtYA7E8V3BAiM7sgvLg7PZHk5WnYc
laszlo
Full Member
***
Offline Offline

Activity: 199
Merit: 2384


View Profile
July 15, 2010, 09:49:06 PM
 #4

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 solar@eclipse.heliacal.net bitcoin/bitcoind getnewaddress

BC: 157fRrqAKrDyGHr1Bx3yDxeMv8Rh45aUet
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!