Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: gigatux on September 24, 2013, 11:50:50 AM



Title: bitcoind for ARM / Cubieboard / Raspberry Pi
Post by: gigatux on September 24, 2013, 11:50:50 AM
Dear all,

I've been experimenting with getting the official bitcoind client working on by Cubieboard (a bit like a Raspberry Pi but with SATA and more RAM).

After a fair bit of pain, I've successfully compiled this and am running it with no issues. When building the blockchain, RAM usage was above 512MB so it might not work perfectly on the Pi, but RAM usage after syncing is much lower.

I've targeted this for Debian Wheezy users but it might also work for Ubuntu users. It's compiled for armel so requires a relatively new ARM processor. The debs are basically recompiled (with dependencies slightly tweaked) source packages from Debian Wheezy and the Ubuntu ppa at https://launchpad.net/~bitcoin/+archive/bitcoin (https://launchpad.net/~bitcoin/+archive/bitcoin). The most difficult thing was getting db4.8 working for binary wallet.dat compatibility.

All non-repository .debs, including the bitcoind deb itself have been put up at https://bittylicious.com/downloads/ (https://bittylicious.com/downloads/).

Donations not necessary. If you like it, please feel free to link to Bittylicious or otherwise spread the word.

Marc


Title: Re: bitcoind for ARM / Cubieboard / Raspberry Pi
Post by: Mike Hearn on September 25, 2013, 08:46:04 PM
Nicely done. Showing that you can run full nodes on really cheap devices could lead to all kinds of interesting ideas.


Title: Re: bitcoind for ARM / Cubieboard / Raspberry Pi
Post by: gigatux on September 26, 2013, 07:51:41 AM
Thank you. And running the full client on a cheap node is also great for security - you can dedicate the Cubie/Pi to doing this one task alone. When you're storing dozens of Bitcoins, a tiny expense for a dedicated board makes a lot of sense.


Title: Re: bitcoind for ARM / Cubieboard / Raspberry Pi
Post by: cp1 on September 26, 2013, 08:12:20 AM
When I ran bitcoind on my raspberry pi it took 100% cpu and made the system unusable.  It might have been OK after syncing was over, but I didn't have the patience to wait.  Would be interesting to hear of some successes.


Title: Re: bitcoind for ARM / Cubieboard / Raspberry Pi
Post by: gigatux on September 26, 2013, 08:45:00 AM
With bitcoind just doing its thing (fully synced), here's an example of usage. It's switched between 1% and 30% each few seconds, so seems to average about 15% CPU.

Code:
  PID USER      PR  NI  VIRT  RES  SHR S  %CPU %MEM    TIME+  COMMAND 
 2649 bitcoin   20   0  367m 245m 4460 S  31.7 30.1 852:06.47 bitcoind

As said though, I did notice that bitcoind used more than 50% of the available RAM when syncing, and this is a 1 GB box so it might be too much for a Pi. I bet it would eventually sync though (maybe with swap on SSD?) and once it's synced I bet it'll run just fine.


Title: Re: bitcoind for ARM / Cubieboard / Raspberry Pi
Post by: gdassori on September 26, 2013, 09:29:40 AM
Hi, gigatux, I was always interested about running bitcoind on raspberrypi. I see you're using a Cubieboard but, maybe it's a first step, interesting too.
What about transaction processing, after synching? Is it fast and smooth or... what ? Did you tried transferring some satoshi?

Thank you!


Title: Re: bitcoind for ARM / Cubieboard / Raspberry Pi
Post by: gigatux on September 26, 2013, 09:57:22 AM
Hi, gigatux, I was always interested about running bitcoind on raspberrypi. I see you're using a Cubieboard but, maybe it's a first step, interesting too.
What about transaction processing, after synching? Is it fast and smooth or... what ? Did you tried transferring some satoshi?
It's all working just fine here. Transaction processing (after syncing) is pretty quick and seems to be within a second - this is on real Bitcoin coin sending.

Note that the speed is probably down to a combination of this all running from a SSD (the Cubieboard has a SATA port and bitcoind is I/O intensive) and the CPU being a bit quicker (1GHz vs 700MHz for the Pi). However, I can't see the Pi giving too much trouble.


Title: Re: bitcoind for ARM / Cubieboard / Raspberry Pi
Post by: lelantos on September 27, 2013, 08:34:36 PM

I think the main concern would be the available RAM. I've run bitcoind on VPS's with 512mb. They run slow, especially with updating the blockchain. I've also had bitcoind crash randomly every couple of hours, but as soon as I upgraded the ram to 2GB - no crashes.

The idea of a lowcost ARM bitcoind "appliance" would be better based off of something with a bit more power:

Another member's post about https://bitcointalk.org/index.php?topic=257438.msg2743058#msg2743058

http://images.gizmag.com/gallery_lrg/utilite-computer-3.jpg

They start at $99.

The other "small boxes" I've thought about running the bitcoind node (and tor gateway box) were:
http://media.memoryexpress.com/Images/Products/MX46361/0?Size=Large
BRIX Ultra Compact PC Kit w/ Core™ i3-3227U, HDMI, DisplayPort
Up in Canada the cost starts around $269+

Lelantos



Title: Re: bitcoind for ARM / Cubieboard / Raspberry Pi
Post by: maaku on September 27, 2013, 08:45:44 PM
As said though, I did notice that bitcoind used more than 50% of the available RAM when syncing, and this is a 1 GB box so it might be too much for a Pi. I bet it would eventually sync though (maybe with swap on SSD?) and once it's synced I bet it'll run just fine.

There's no reason you can't sync on a desktop and then copy the data directory over (or just the index files).


Title: Re: bitcoind for ARM / Cubieboard / Raspberry Pi
Post by: gmaxwell on September 27, 2013, 09:55:34 PM
I know a number of people are running bitcoind on odroid U2 http://www.hardkernel.com/renewal_2011/products/prdt_info.php?g_code=G135341370451 quite successfully.  It's super fast (for an arm), easily 32x faster than the rpi on some workloads, and not terribly expensive either.  Quad core cortex-a9 1.7GHz, 2GB dram.

(Odroid now seems to have a new 4x A15 + 4x A7 system, but I've not yet talked to anyone that has one)


Title: Re: bitcoind for ARM / Cubieboard / Raspberry Pi
Post by: gigatux on September 27, 2013, 10:20:47 PM
It's interesting to know that some people have RAM issues. I also read about a few failed attempts with the Raspberry Pi.

Seriously, get the Cubieboard. A Raspberry Pi with 1 GB RAM (and a slightly faster processor, and SATA) for just a little bit more money makes a fantastic bitcoind server. This is what the .debs were built for, and I assure you it works well in production.


Title: Re: bitcoind for ARM / Cubieboard / Raspberry Pi
Post by: natbyte on September 27, 2013, 10:26:35 PM
Awesome, I have a cubieboard 2 I will give this a try many thanks for producing this  :)


Title: Re: bitcoind for ARM / Cubieboard / Raspberry Pi
Post by: K1773R on October 02, 2013, 08:05:45 AM
be aware that this is a sure way to kill your SD Card


Title: Re: bitcoind for ARM / Cubieboard / Raspberry Pi
Post by: gigatux on October 02, 2013, 08:07:39 AM
be aware that this is a sure way to kill your SD Card
Are you sure? Blockchain writes don't typically write over the same area of card. You'll record block information, and then just leave it sitting there.

I recommend running from a SSD anyway as they're so much quicker and more reliable.


Title: Re: bitcoind for ARM / Cubieboard / Raspberry Pi
Post by: Mike Hearn on October 02, 2013, 03:01:01 PM
LevelDB is designed for hard disks, not SSDs. It's not only about writing blocks when they arrive but updating the databases too.


Title: Re: bitcoind for ARM / Cubieboard / Raspberry Pi
Post by: gigatux on October 02, 2013, 03:24:08 PM
LevelDB is designed for hard disks, not SSDs. It's not only about writing blocks when they arrive but updating the databases too.
So I imagine this is more of an issue with SD cards then? I think most SSDs have wear levelling (hence they're used for all sorts of IO intensive operations, and often for databases with few issues).


Title: Re: bitcoind for ARM / Cubieboard / Raspberry Pi
Post by: Ecurb123 on October 02, 2013, 06:40:08 PM
I am working a project like this too so I'd like to know if the SD card will be ok or not. Also how long will a 32Gb card last us with the growing blockchain?


Title: Re: bitcoind for ARM / Cubieboard / Raspberry Pi
Post by: K1773R on October 07, 2013, 03:15:02 PM
LevelDB is designed for hard disks, not SSDs. It's not only about writing blocks when they arrive but updating the databases too.
So I imagine this is more of an issue with SD cards then? I think most SSDs have wear levelling (hence they're used for all sorts of IO intensive operations, and often for databases with few issues).
this is a issue of any NAND device so far, "wear levelling" is just a nasty workaround (which often dosnt work well)


Title: Re: bitcoind for ARM / Cubieboard / Raspberry Pi
Post by: gigatux on October 07, 2013, 08:15:22 PM
this is a issue of any NAND device so far, "wear levelling" is just a nasty workaround (which often dosnt work well)
Surely then you're just saying that using SSDs have no real use in the industry (considering that their real benefit is in random I/O, and wear levelling is similar to writes being spread over the disk)?

Either way, this is all a bit off topic now. All I can say is that good quality SSDs seem to work very well for databases in my professional (hosting services) capacity, and combined with a Cubieboard, it's been running very stable now with an uptime of two weeks and not a single issue.


Title: Re: bitcoind for ARM / Cubieboard / Raspberry Pi
Post by: jl2012 on October 27, 2013, 06:06:56 PM
I compiled it myself on the new cubieboard3 and is running now (I'm using BDB5.1 as I don't know how to do it with 4.8. I'm not using the wallet, anyway)


Title: Re: bitcoind for ARM / Cubieboard / Raspberry Pi
Post by: gigatux on October 27, 2013, 06:42:40 PM
I compiled it myself on the new cubieboard3 and is running now (I'm using BDB5.1 as I don't know how to do it with 4.8. I'm not using the wallet, anyway)
That's really the point of my .debs - compiling DB 4.8 is a bit of a pain but I wanted binary compatibility. It does work rather well though, doesn't it.


Title: Re: bitcoind for ARM / Cubieboard / Raspberry Pi
Post by: jl2012 on October 28, 2013, 03:04:11 AM
I compiled it myself on the new cubieboard3 and is running now (I'm using BDB5.1 as I don't know how to do it with 4.8. I'm not using the wallet, anyway)
That's really the point of my .debs - compiling DB 4.8 is a bit of a pain but I wanted binary compatibility. It does work rather well though, doesn't it.

Yes, running for 10 hours and now at block 216931


Title: Re: bitcoind for ARM / Cubieboard / Raspberry Pi
Post by: alexykot on November 17, 2013, 10:37:48 PM
I was just trying to install these .debs on Ubuntu 12.04 at Beaglebone Black, but it doesn't work. Basically ubuntu repos for ARM have libboost version only 1.48 available, while these debs require 1.49. It probably can be compiled from sources, but that's not as simple as just installing some ready packages and also will probably take much time on a weak ARM CPU.

Trying Debian Wheezy on the same hardware.


Title: Re: bitcoind for ARM / Cubieboard / Raspberry Pi
Post by: gigatux on November 18, 2013, 07:38:29 AM
I was just trying to install these .debs on Ubuntu 12.04 at Beaglebone Black, but it doesn't work. Basically ubuntu repos for ARM have libboost version only 1.48 available, while these debs require 1.49. It probably can be compiled from sources, but that's not as simple as just installing some ready packages and also will probably take much time on a weak ARM CPU.
I might be able to decrease the requirements in the Debian control file, but I would need somebody to confirm whether 1.48 and 1.49 would be compatible and whether there are likely to be any linking issues.
Quote
Trying Debian Wheezy on the same hardware.
That should work as it's what the debs were designed for. You still could well struggle with only 512 MB RAM though (at least for downloading the blockchain).


Title: Re: bitcoind for ARM / Cubieboard / Raspberry Pi
Post by: alexykot on November 18, 2013, 07:13:54 PM
Unfortunately it doesn't work at all on my Debian. I'm not sure what's wrong or if I made a mistake somewhere, but here is what I did:
1) I've installed a fresh Debian wheezy and installed all these debs (apart from bitcoin-qt as I need no GUI).
2) I've copied over whole blockchain from a windows machine with updtodate BitcoinQt 0.8.5
3) I started bitcoind with my custom config:
Code:
paytxfee=0.0001
rpcuser=root
rpcpassword=password
rpcallowip=192.168.1.73
daemon=1
debug=1
checkblocks=20
checklevel=0
Bitcoind starts, but it:
a) always asking for database reindex and doesn't pick the index I've copied;
b) if I start it with -reindex flag - it hangs in processes with max CPU, but it doesn't respond over JSON-RPC, and even after a long time waiting shows no signs of life, so I have to just kill it.

However, I found something interesting elsewhere. Debian Unstable repo has bitcoind package (http://packages.debian.org/sid/bitcoind) available for armhf/armel architectures, and it's last 0.8.5 version. So I installed it and it works nearly fine. Unfortunately it still doesn't like my index copy, but when I run it with -reindex - it start fine, responds over JSON-RPC and indexing goes on, I see it by the quickly increasing blocks count. Full reindex will take I think 24-48h, but I hope it will work fine afterwards.


Title: Re: bitcoind for ARM / Cubieboard / Raspberry Pi
Post by: K1773R on November 21, 2013, 04:53:22 PM
Unfortunately it doesn't work at all on my Debian. I'm not sure what's wrong or if I made a mistake somewhere, but here is what I did:
1) I've installed a fresh Debian wheezy and installed all these debs (apart from bitcoin-qt as I need no GUI).
2) I've copied over whole blockchain from a windows machine with updtodate BitcoinQt 0.8.5
3) I started bitcoind with my custom config:
Code:
paytxfee=0.0001
rpcuser=root
rpcpassword=password
rpcallowip=192.168.1.73
daemon=1
debug=1
checkblocks=20
checklevel=0
Bitcoind starts, but it:
a) always asking for database reindex and doesn't pick the index I've copied;
b) if I start it with -reindex flag - it hangs in processes with max CPU, but it doesn't respond over JSON-RPC, and even after a long time waiting shows no signs of life, so I have to just kill it.

However, I found something interesting elsewhere. Debian Unstable repo has bitcoind package (http://packages.debian.org/sid/bitcoind) available for armhf/armel architectures, and it's last 0.8.5 version. So I installed it and it works nearly fine. Unfortunately it still doesn't like my index copy, but when I run it with -reindex - it start fine, responds over JSON-RPC and indexing goes on, I see it by the quickly increasing blocks count. Full reindex will take I think 24-48h, but I hope it will work fine afterwards.
you cant mix different arch's of leveldb databases!


Title: Re: bitcoind for ARM / Cubieboard / Raspberry Pi
Post by: alexykot on November 22, 2013, 01:47:29 PM
Full reindex took a little more than 48h (I think about 96h), but now it's done and bitcoind works fine on my BeagleBone Black right now.
I will try to copy over this blockchain to RPi and see if it will work there. I had same problem with it before I bought BBB, but since RPi has twice slower CPU, indexing in there would take ages. Yet, maybe with readymade index it will work now.

IO is still a concern, I'm not sure how lond SD card would live with bitcoind running constantly on it. But I will find out, eventually.


Title: Re: bitcoind for ARM / Cubieboard / Raspberry Pi
Post by: gigatux on November 22, 2013, 02:41:40 PM
I will try to copy over this blockchain to RPi and see if it will work there. I had same problem with it before I bought BBB, but since RPi has twice slower CPU, indexing in there would take ages. Yet, maybe with readymade index it will work now.
According to a friend of mine, a full reindex on the Pi took 4-5 days.


Title: Re: bitcoind for ARM / Cubieboard / Raspberry Pi
Post by: gigatux on December 04, 2013, 10:47:33 AM
Has anyone managed to get my debs working on a Cubieboard 2? I'm having trouble and I'm assuming it's something to do with bitcoind using two threads as it's a dual core machine. debug.log reports pthread errors like:

Code:
bitcoind: pthread_mutex_lock.c:62: __pthread_mutex_lock: Assertion `mutex->__data.__owner == 0' failed.


Title: Re: bitcoind for ARM / Cubieboard / Raspberry Pi
Post by: Martijnvdc on December 04, 2013, 10:51:52 AM
Reindex on rpi only took a day or two IIRC...
Also, i wouldn't recommend writing on an SD card; just use a simple old external harddrive. (with seperate power supply, ofcourse)


Title: Re: bitcoind for ARM / Cubieboard / Raspberry Pi
Post by: crazy_rabbit on January 07, 2014, 09:37:13 AM
Has anyone tried running Bitcoind AND a LAMP server on their cubieboard/pi/beaglebone?