The question has been closed for the following reason "0bc won 10.00 mBTC for the best answer." by bitcoind 13 Apr '13, 17:10
bitcoind installation : default APT version
Debian's APT will install the version that matches the latest in the local listings of the repositories for your current Debian release. To check your release version:
Anything 6.0.X is Debian Squeeze. Particularly if you're running Debian Squeeze, the most recent version in the repositories will not be the most recent bitcoind version itself. Though there is a bit of a controversy in this, the idea is to make Debian Squeeze as stable and secure as it gets - so security updates will be rolled back, but otherwise it's a pretty old bitcoind. The version for Debian Stable is currently 0.3.24, which is ancient - July 2011. Still, there are quite recent security patches for that version, which would indicate that like other software there will be security patches to come for a long time for versions 0.4 up to 0.8, and normal bugs as well.
If you're running Squeeze and want to install a newer version than 0.3.24, ask me about that (it involves work like APT package pinning, building backports or building from source). Otherwise, if you like to stay on the stable & secure side ;] - read on!
To make sure that you have the right repositories and up to date repository lists, check
If you are running Squeeze, that should show:
The line starting with *** shows the currently installed version. If it shows anything else while you're running Squeeze, then you need to update your repositories. If the output doesn't show backports.debian.org at all, then you need to add the following line to /etc/apt/sources.list:
If you already have a backports.debian.org line in /etc/apt/sources.list, then the APT repository list is out of date. There are packages that can keep them automatically up to date, for instance cron-apt:
Manually, you can update the lists with:
And of course upgrade packages with:
and then install/upgrade bitcoind and its dependencies:
Updating the lists with apt-get update is generally necessary when you change /etc/apt/sources.list or want to make sure you're getting the latest version of everything.
To check the currently installed bitcoind version, you can do any of the following:
Try dpkg -L bitcoind to see all the files that came with bitcoind. It's really just bitcoind, the binary, and some help files.
For general information see /usr/share/doc/bitcoind/. The most important files there are README.Debian and the directory "examples". README.Debian informs you of a Debian-specific configuration file that you can store per user in ~/.bitcoin/bitcoin.conf. In examples is just one file, bitcoin.conf, but as minimal as it is, there are a lot of comments there that can help you get a leg up. Run "man bitcoind" and bitcoind --help to get deeper into the configuration.
After creating your configuration file to your liking, log in as your non-root bitcoin user (from root: login -f username) and store the bitcoin.conf file in the user's ~/.bitcoin/ directory (mkdir ~/.bitcoin/ if it doesn't exist yet). Then test by just running bitcoind; there's not much output, but you can open another terminal and run tail -F ~/.bitcoin/*log for a barrage of information. Ctrl-C to abort so you can try with different settings; then, when you're done testing, put it in your crontab:
then, enter a line like this:
Then save & exit to store the new crontab file. That @reboot line will start bitcoind under your user at every reboot.
If you don't want to reboot yet, put bitcoind to your background:
Then you can log out and it will keep running nicely in the background, until you reboot at which point the crontab line kicks in and starts it again.
Logfiles described at https://en.bitcoin.it/wiki/Data_directory#Files are all in ~/.bitcoin/.
Monitoring can be done in various ways - I think the easiest would be to add another crontab line that checks whether it's still running and if not just start it again:
This checks every minute (of every hour of every day of the month of every month & and every day of the week) whether there still is a process running named bitcoind, routes the output to /dev/null so it doesn't send you a mail when it does, and then starts bitcoind if it didn't find it. The cron daemon will send the bitcoin user error mails if something goes wrong.
You can stop bitcoind when it's running in the background with pkill bitcoind or bitcoind stop.
bitcoind usage : API calls
Whoops. I was amiss to omit this part; it is more or less the most important part .. To get information from bitcoind, you can use its API commands described at https://en.bitcoin.it/wiki/Original_Bitcoin_client/API_Calls_list . I think the most important ones are the following:
A nice way to keep an eye on these API calls is to use watch:
I would like to add some info on the setup.
Usually I prefer to use the packages in the debian repositories. The latest version of bitcoind, as you requested, is in the experimental repository, but it is not recommended to use it with debian squeeze. So I suggest you to consider debian 7 (wheezy), it is the current testing but it is imminent to be released as the next stable, and should have less or no problem at all with bitcoind from the experimental repository.
Here the step-by-step setup. Follow the procedure as root, or as user but use sudo when needed. I'll use sudo here.
1) Add the experimental repository to get the latest version of bitcoind. To do so, run nano (or your preferred text editor) to open the sources.list:
and add to the end of the file the following line:
save and exit.
2) Run the update:
3) Install bitcoind from the experimental repo:
4) comment out the experimental repo line in sources.list.
To run bitcoind, you can do as stated in the previous message, or do what follow.
5) To run bitcoind at the startup, add it to /etc/rc.local, use nano or your text editor:
add the string "bitcoind" before "exit 0", like this:
save and exit.
At the next reboot you should have bitcoind running.
For the monitoring and other actions, what stated in the previous message should be very complete.
answered 12 Apr '13, 11:31 Joif 21●2
The first step is to install bitcoind which can be done by running the command:
Once bitcoind is installed you will want to create a script that runs bitcoind on bootup. To do this simply create a file, let's call it bitcoind.sh. In bitcoind.sh you will want to put simply:
Note that you can add -generate if you wish to mine (
After saving the bitcoind.sh run the command:
This command allows bitcoind.sh to be e[X]ecuted by [A]ll users. Next move bitcoind to the startup scripts directory. You can do so by running the command:
Next add bitcoind.sh to startup. You can do so by running:
Now to make sure that it will restart if it bitcoind crashes. I am not very fluent in bash scripting so instead I will write you a script to do so in python. I am not sure if you want to restart the entire computer if bitcoind stops/crashes or if you simply want to start bitcoind again. You said that you want it all to be run as non-root, and shutting down/restarting/switching runlevels requires root, so I will write you a script that auto-restarts bitcoind in the event of a crash. If you wish to restart the computer (needs root) it should be quite easy to modify to your liking.
Here is a script that checks if bitcoind is still running/has not crashed and starts it again if bitcoind crashes. Please note that I am using Python3 syntax and this will need to be run with Python3 (Instead of 2.7)
Here is a link to the script, as the formatting on here makes it hard to write code.
Copy and paste the script from pastebin to a file, let's call it autorestart.py. After saving autorestart.py, put it somewhere such as your home directory (/home/bob/autorestart.py). Next make a startup script for autorestart.py. Create a shell script and put the following into it.
Then repeat the same steps that you did to bitcoin.sh to autorestart.sh by running
answered 12 Apr '13, 21:12 QuestionAn... 11●1