Bitcoin Forum

Other => Beginners & Help => Topic started by: primeFactor on June 14, 2011, 11:36:24 AM



Title: Bitcoind mining setup
Post by: primeFactor on June 14, 2011, 11:36:24 AM
OK, just a quick noob question:
I want to solo mine, my intended setup is running bitcoind as a daemon and then connecting my workers via rpc.
So, after a while i might get lucky and solve a block, my question is how to tell the bitcoind to which address the 50 BTC shall be transfered.
Also does this address have to be in my wallet, or can I use another address.


Title: Re: Bitcoind mining setup
Post by: taris on June 14, 2011, 11:48:42 AM
The normal bitcoin client and the bitcoind are using the same wallet.dat
So, in case your bitcoind generates 50BTCs they will be added to your wallet.dat directly.

If you do not run your bitcoind and normal client on the same machine/user you want to start the client in the daemon from time to time and transfer the coins to your "real" account. You cannot add a target address to the daemon.


Title: Re: Bitcoind mining setup
Post by: zephram on June 14, 2011, 11:51:54 AM
AFAIK when you solve a block, the btc will be transferred to the pc that has the bitcoind installed and running, you should have the normal bitcoin client present there to, and therefore a wallet.dat file, in that wallet the 50 btc will be but, and the btc will be accessible via the normal bitcoin client there

btw: at a total hashrate of 1000 MHash/s it will take about 2 month per block at current difficulty, so you should check if a pool would be a better choice for your purpose...

jm2p Zeph


Title: Re: Bitcoind mining setup
Post by: primeFactor on June 14, 2011, 12:14:55 PM
Ok, thanks for the answers. However I'm still confused how to setup the address to which the 50 btc will be transfered upon creation. AFAIK an account can have multiple addresses and a wallet can have multiple accounts. So what address is used?


Title: Re: Bitcoind mining setup
Post by: taris on June 14, 2011, 12:17:53 PM
Ok, thanks for the answers. However I'm still confused how to setup the address to which the 50 btc will be transfered upon creation. AFAIK an account can have multiple addresses and a wallet can have multiple accounts. So what address is used?
NONE ..the daemon will put it directly into the wallet file.


Title: Re: Bitcoind mining setup
Post by: primeFactor on June 14, 2011, 12:38:14 PM
Ok, thanks for the answers. However I'm still confused how to setup the address to which the 50 btc will be transfered upon creation. AFAIK an account can have multiple addresses and a wallet can have multiple accounts. So what address is used?
NONE ..the daemon will put it directly into the wallet file.

OK, thanks, so if i make a listreceivedbyaddress rpc call to bitcoind I would see a new address with amount 50 btc?


Title: Re: Bitcoind mining setup
Post by: taris on June 14, 2011, 12:44:54 PM
OK, thanks, so if i make a listreceivedbyaddress rpc call to bitcoind I would see a new address with amount 50 btc?
No, because the BTCs are bound to a wallet and not to a address ..you can use multiple addresses to receive and send BTCs to/from the same wallet.

"listreceivedbyaccount" will display (among other infos) as "amount" the total amount received by addresses with this account. So when the daemon is placing the 50 BTCs directly into the wallet there will be no address that received it.
You are more looking for the call "getbalance (https://en.bitcoin.it/wiki/Original_Bitcoin_client/API_calls_list)"


Title: Re: Bitcoind mining setup
Post by: primeFactor on June 14, 2011, 12:53:52 PM
OK, thanks, so if i make a listreceivedbyaddress rpc call to bitcoind I would see a new address with amount 50 btc?
No, because the BTCs are bound to a wallet and not to a address ..you can use multiple addresses to receive and send BTCs to/from the same wallet.

"listreceivedbyaccount" will display (among other infos) as "amount" the total amount received by addresses with this account. So when the daemon is placing the 50 BTCs directly into the wallet there will be no address that received it.
You are more looking for the call "getbalance (https://en.bitcoin.it/wiki/Original_Bitcoin_client/API_calls_list)"

OK, I see, thank you very much. So after generation I could simply make a sendtoaddress call and transfer the funds to whichever address I like?


Title: Re: Bitcoind mining setup
Post by: taris on June 14, 2011, 01:17:30 PM
OK, I see, thank you very much. So after generation I could simply make a sendtoaddress call and transfer the funds to whichever address I like?
Yes. I never used that function, but thats exactly what the documentation says.
You might want to test it with an amount of "0.01" and another adress of yours first :)


Title: Re: Bitcoind mining setup
Post by: primeFactor on June 14, 2011, 01:38:13 PM
OK, I see, thank you very much. So after generation I could simply make a sendtoaddress call and transfer the funds to whichever address I like?
Yes. I never used that function, but thats exactly what the documentation says.
You might want to test it with an amount of "0.01" and another adress of yours first :)

Thanks again for your answers, problem solved.
:D


Title: Re: Bitcoind mining setup
Post by: taris on June 14, 2011, 01:46:15 PM
You're welcome ..any time :)


Title: Re: Bitcoind mining setup
Post by: nased0 on June 21, 2011, 11:46:09 PM
I wrote a script for starting bitcoind as a Linux system service (daemon) at computer start.
You should put this script in /etc/rc.d/ directory (with permission to execute this script) and bitcoind in /usr/sbin/
Bitcoind will use root account, so create in ~root/.bitcoin/ directory file bitcoin.conf
For example:
Code:
rpcuser=USER
rpcpassword=PASSWORD
rpcport=8332
rpcallowip=*

Now you can start bitcoind using System Services application or by executing this script in /etc/rc.d/
Note that bitcoind becomes responsive about 15 seconds after start.

Script bitcoins
Code:
#!/bin/sh
#
# If you like this script, please donate 0.1 BTC to 19PpvogGn9AeavU7uvPrxfnxGJL3ZMBDni
#
# /etc/init.d/bitcoins
#
### BEGIN INIT INFO
# Provides:          bitcoind
# Required-Start:    $local_fs $network
# Required-Stop:     $local_fs $network
# Should-Start       $named $time
# Should-Stop        $named $time
# Default-Start:     3 5
# Default-Stop:      0 1 2 6
# Short-Description: Bitcoin daemon
# Description:       Bitcoin daemon
### END INIT INFO

BITCOIND="/usr/sbin/bitcoind"
RUNLEVEL=`runlevel|cut -f2 -d' '`

function wait_for_daemon {
# "Waiting for the server start."
if [ $RUNLEVEL -eq 6 ] || [ $RUNLEVEL -lt 3 ]; then
   return 0
fi
$BITCOIND getbalance >/dev/null
while [ $? -gt 0 ]; do
sleep 1
checkproc $BITCOIND
if [ $? -gt 0 ]; then
echo "Critical error: bitcoin daemon failure."
return $?
fi
$BITCOIND getbalance >/dev/null
done
return 0
}

function wait_for_death {
# waiting for daemon's death
if [ $RUNLEVEL -eq 6 ] || [ $RUNLEVEL -lt 3 ]; then
   return 0
fi
checkproc $BITCOIND
while [ $? -eq 0 ]; do
echo -n "."
sleep 1
checkproc $BITCOIND
done
return 0
}

. /etc/rc.status
rc_reset

case "$1" in
start*)
checkproc $BITCOIND
if [ $? -eq 0 ]; then
echo "The bitcoin daemon has been already started - restart is unnecessary."
$0 status
else
echo "Starting the bitcoin daemon."
if [ ! -L /.bitcoin ]; then
   ln -s ~root/.bitcoin /.bitcoin
fi
startproc -s -u root -g root $BITCOIND
rc_status -v
fi
;;
stop)
checkproc $BITCOIND
if [ $? -eq 0 ]; then
echo "Stopping the bitcoin daemon:"
if [ $RUNLEVEL -eq 6 ] || [ $RUNLEVEL -lt 3 ]; then
$BITCOIND stop
else
wait_for_daemon
$BITCOIND stop
wait_for_death
fi
rc_status -v
rm ~root/.bitcoin/.lock
sync
else
echo "The bitcoin daemon has already been stopped or has not been started."
$0 status
fi
;;
restart|reload)
## Stop the service and regardless of whether it was
## running or not, start it again.
$0 stop
$0 start

# Remember status and be quiet
rc_status
;;
status)
echo -n "Status of the bitcoin daemon "
checkproc -k $BITCOIND
if [ $? -eq 0 ]; then
rc_status -v
else
rc_status -u
fi
;;
info)
echo "Info on the bitcoin daemon:"
checkproc $BITCOIND
if [ $? -eq 0 ]; then
wait_for_daemon
$BITCOIND getinfo
rc_status -v
else
echo "The bitcoin daemon has not been started."
$0 status
fi
;;
*)
echo "Usage: $0 {start|restart|reload|stop|status|info}"
exit 1
;;
esac
rc_exit