Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: ziomik on October 21, 2012, 03:50:12 PM



Title: bitcoind for synology nas (ARM)
Post by: ziomik on October 21, 2012, 03:50:12 PM
Hi, has anyone tried to compile with success bitcoind for nas synology DS211j (arm)?
I'm going crazy!


Title: Re: bitcoind for synology nas (ARM)
Post by: Panoramix on October 22, 2012, 03:12:44 PM
Hi, has anyone tried to compile with success bitcoind for nas synology DS211j (arm)?
I'm going crazy!
I've been thinking about doing this as well. I'd be very interested in your experiences.


Title: Re: bitcoind for synology nas (ARM)
Post by: P_Shep on October 22, 2012, 04:59:42 PM
Been trying for DD-WRT (MIPS).

Not gone well.


Title: Re: bitcoind for synology nas (ARM)
Post by: ziomik on October 22, 2012, 05:34:06 PM
I'm very stubborn and I did;)
You can download the compiled file , here (v0.7.1-64-g2ef1569-beta): http://www.sendspace.com/file/rnr45y (http://www.sendspace.com/file/rnr45y)

If you want to compile your own (with some variations may be fine for other ARM platforms)
I worked on clean Debian platform for a Cross-Compiled.

Download the correct toolchain for your ARM. For Synology NAS: http://download.synology.com/download/ds/userguide/Synology_DiskStation_Manager_3rd_Party_Apps_Developer_Guide.pdf
Download db http://pkgs.fedoraproject.org/repo/pkgs/openldap/db-4.8.26.tar.gz
Download openssl http://www.openssl.org/source/openssl-1.0.1c.tar.gz
Download boost http://sourceforge.net/projects/boost/files/boost/1.49.0/boost_1_49_0.tar.bz2

Code:
apt-get install git build-essential libncurses5-dev bison flex gettext texinfo libgmp3-dev libmpfr-dev
git clone https://github.com/bitcoin/bitcoin.git

Put all the downloaded files in a folder and start a sh file with the following code:
Code:
export CC=/usr/local/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-gcc
export CXX=/usr/local/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-g++
export LD=/usr/local/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-ld
export CFLAGS=-I/usr/local/arm-none-linux-gnueabi/include
export LDFLAGS=-L/usr/local/arm-none-linux-gnueabi/lib
export PATH=$PATH:/usr/local/arm-none-linux-gnueabi/bin
export CROSS_PREFIX=arm-none-linux-gnueabi
 
 
tar -xvzf db-4.8.26.tar.gz
cd db-4.8.26/build_unix
../dist/configure --enable-cxx --host=${CROSS_PREFIX} --prefix=/root/arm-libs &&
make &&
make install &&
cd ../..
 
tar -xvzf openssl-1.0.1c.tar.gz
cd openssl-1.0.1c/
./Configure --prefix=/root/arm-libs dist &&
make &&
make install &&
cd ..
 
tar -xvjf boost_1_49_0.tar.bz2
cd boost_1_49_0/
echo "using gcc : arm : /usr/local/arm-none-linux-gnueabi/bin/arm-none-linux-gnueabi-g++ ;" >> tools/build/v2/user-config.jam
./bootstrap.sh
./bjam toolset=gcc-arm link=static
./bjam toolset=gcc-arm link=static --prefix=/root/arm-libs install
cd ..
 
export BOOST_INCLUDE_PATH=/root/arm-libs/include
export BDB_INCLUDE_PATH=/root/arm-libs/include
export OPENSSL_INCLUDE_PATH=/root/arm-libs/include
export BOOST_LIB_PATH=/root/arm-libs/lib
export BDB_LIB_PATH=/root/arm-libs/lib
export OPENSSL_LIB_PATH=/root/arm-libs/lib
 
cd /bitcoin/src/
 
make STATIC=1 -f makefile.unix bitcoind USE_UPNP=-
arm-none-linux-gnueabi-strip bitcoind

Finally, you will find the file in bitcoind in bitcoin/src/
It's not all my work, but I have a little changed from an old post on the forum synology of a user named "PK"


Title: Re: bitcoind for synology nas (ARM)
Post by: hamdi on October 22, 2012, 05:39:27 PM
doesnt i slow down the nas?


Title: Re: bitcoind for synology nas (ARM)
Post by: ziomik on October 22, 2012, 05:44:52 PM
Now is downloading blockchain and the CPU is used 100%  ::) :o
I want to see, when it will end, if it changes the workload

Code:
Mem: 102484K used, 16000K free, 0K shrd, 600K buff, 9312K cached
CPU:  0.0% usr  0.0% sys  9.0% nic  0.0% idle 81.8% io  0.0% irq  9.0% sirq


Title: Re: bitcoind for synology nas (ARM)
Post by: runeks on October 23, 2012, 06:14:47 PM
Cool! Might be an idea to copy over a block chain from another computer you have though. I imagine verifying the block chain on a device like that will take weeks.


Title: Re: bitcoind for synology nas (ARM)
Post by: ziomik on October 23, 2012, 06:20:06 PM
Maybe you're right ...  :D :D

Code:
userDiskManager> ls -l
total 973812
-rw------- 1 user user 134217728 Oct 22 18:57 blk00000.dat
-rw------- 1 user user 134217728 Oct 22 20:58 blk00001.dat
-rw------- 1 user user 134217728 Oct 23 09:56 blk00002.dat
-rw------- 1 user user 134217728 Oct 23 13:24 blk00003.dat
-rw------- 1 user user 134217728 Oct 23 15:36 blk00004.dat
-rw------- 1 user user 134217728 Oct 23 19:00 blk00005.dat
-rw------- 1 user user  83886080 Oct 23 20:21 blk00006.dat
-rw------- 1 user user  15728640 Oct 22 18:57 rev00000.dat
-rw------- 1 user user  15728640 Oct 22 20:58 rev00001.dat
-rw------- 1 user user  15728640 Oct 23 09:56 rev00002.dat
-rw------- 1 user user  15728640 Oct 23 13:24 rev00003.dat
-rw------- 1 user user  15728640 Oct 23 15:36 rev00004.dat
-rw------- 1 user user  16777216 Oct 23 19:00 rev00005.dat
-rw------- 1 user user  11534336 Oct 23 20:21 rev00006.dat
userDiskManager>


Title: Re: bitcoind for synology nas (ARM)
Post by: runeks on October 23, 2012, 06:53:23 PM
Looks like it downloaded 640 MB in 24 hours. But I don't think it verifies any transactions until block 190,000 (the latest check point). After that it will probably slow down significantly.

Also, note that you seem to be running the ultra-prune version (https://bitcointalk.org/index.php?topic=119525.0;all) (which you should, since it has been merged to main), which has been known to corrupt wallets (https://bitcointalk.org/index.php?topic=119525.msg1287382#msg1287382). Just a heads up.


Title: Re: bitcoind for synology nas (ARM)
Post by: ziomik on October 23, 2012, 07:32:45 PM
Isn't the  ultra-prune in action. I downloaded the sources from the official github..
Code:
git clone https://github.com/bitcoin/bitcoin.git
Maybe I misunderstood, what you want to tell me?   :-\


Title: Re: bitcoind for synology nas (ARM)
Post by: runeks on October 23, 2012, 09:21:56 PM
Yes, you are running the ultra-prune version.

I was just letting you know that there have been reports of this version corrupting wallets, and that it's a fairly big code change, so it might not be as stable as the official releases. So if you want to run bleeding edge, this is the version to get. If you want stable, it might be better to grab an official release like 0.7.1 (http://downloads.sourceforge.net/project/bitcoin/Bitcoin/bitcoin-0.7.1/bitcoin-0.7.1-linux.tar.gz) and building that.


Title: Re: bitcoind for synology nas (ARM)
Post by: hardcore-fs on October 24, 2012, 02:48:47 AM
Why bother, all you would do is increase the CPU temp of the synology , causing it to NOT enter the sleep mode, thereby using MORE electricity than you can earn from generating bitcoins.

HC


Title: Re: bitcoind for synology nas (ARM)
Post by: ziomik on October 24, 2012, 06:02:31 AM
The purpose is not to generate bitcoin, but having a personal wallet I'll put on the network and will manage through the web wherever I am.


Title: Re: bitcoind for synology nas (ARM)
Post by: ziomik on November 10, 2012, 12:16:53 PM
I have a strange answer bitcoind running. I have not found solutions. Aid?
Code:
./bitcoind -datadir=/volume1/.bitcoin/
Bitcoin: Failed to connect best block


Title: Re: bitcoind for synology nas (ARM)
Post by: ziomik on December 23, 2012, 01:28:11 PM
Help.....  :'(

debug.log

Code:
Default data directory /root/.bitcoin                             
Used data directory /volume1/.bitcoin/                             
dbenv.open LogDir=/volume1/.bitcoin/database ErrorFile=/volume1/.bitcoin/db.log
Bound to [::]:8333                                                             
Bound to 0.0.0.0:8333                                                         
Loading block index...                                                         
Opening LevelDB in /volume1/.bitcoin/blktree                                   
Opened LevelDB successfully                                                   
Opening LevelDB in /volume1/.bitcoin/coins                                     
Opened LevelDB successfully                                                   
LoadBlockIndex(): last block file = 18                                         
LoadBlockIndex(): last block file: CBlockFileInfo(blocks=1051, size=90935905, heights=192137..193187, time=2012-08-03..2012-08-10)
LoadBlockIndex(): hashBestChain=000000000019d6689c08  height=0 date=01/03/09 18:15:05                                             
Verifying last 0 blocks at level 1                                                                                               
 block index           35045ms                                                                                                   
Loading wallet...                                                                                                                 
nFileVersion = 79900                                                                                                             
 wallet                16219ms                                                                                                   
ERROR: CheckProofOfWork() : nBits below minimum work                                                                             
ERROR: CBlock::ReadFromDisk() : errors in block header                                                                           
ERROR: SetBestBlock() : ReadFromDisk for connect failed                                                                           
Loading addresses...                                                                                                             
Loaded 118 addresses from peers.dat  22ms                                                                                         
mapBlockIndex.size() = 193188                                                                                                     
nBestHeight = 0                                                                                                                   
setKeyPool.size() = 101                                                                                                           
mapWallet.size() = 0                                                                                                             
mapAddressBook.size() = 4                                                                                                         
Done loading                                                                                                                     
Bitcoin: Failed to connect best block                                                                                             
Flush(false)                                                                                                                     
wallet.dat refcount=0                                                                                                             
wallet.dat checkpoint                                                                                                             
ThreadRPCServer started                                                                                                           
send version message: version 60002, blocks=0, us=0.0.0.0:0, them=0.0.0.0:0, peer=127.0.0.1:0                                     
ThreadIRCSeed exited                                                                         
ThreadSocketHandler started                                                                 
ThreadOpenAddedConnections started                                                           
ThreadOpenAddedConnections exited                                                           
ThreadOpenConnections started                                                               
ThreadMessageHandler started                                                                 
ThreadMessageHandler exited                                                                 
ThreadDumpAddress exited                                                                     
ThreadDNSAddressSeed started                                                                 
Loading addresses from DNS seeds (could take a while)                                       
ThreadRPCServer exited                                                                       
wallet.dat detach                                                                           
ThreadSocketHandler exited                                                                   
wallet.dat closed                                                                           
DBFlush(false) ended              77ms                                                       
StopNode()                                                                                   
GetMyExternalIP() received [xxx.xxx.xxx.xxx] xxx.xxx.xxx.xxx:0                                   
GetMyExternalIP() returned xxx.xxx.xxx.xxx                                                     
AddLocal(95.228.138.78:8333,5)                                                               
ThreadOpenConnections exited                                                                 
Added 31 addresses from 178.18.90.41: 0 tried, 149 new                                       
Added 24 addresses from 173.242.112.53: 0 tried, 173 new                                     
120 addresses found from DNS seeds                                                           
ThreadDNSAddressSeed exited                               
Flushed 173 addresses to peers.dat  123ms                 
Committing 0 changed transactions to coin database...     
Flush(true)                                               
DBFlush(true) ended               0ms                     
Bitcoin exited     


Title: Re: bitcoind for synology nas (ARM)
Post by: ziomik on December 23, 2012, 04:52:34 PM
solution is recompiled new build.  :D


Title: Re: bitcoind for synology nas (ARM)
Post by: Raize on December 24, 2012, 04:49:04 PM
Holy crap ziomik. That's awesome. How long did it run at 100% CPU before it finished verifying the blockchain? I'm tempted to give this a shot.


Title: Re: bitcoind for synology nas (ARM)
Post by: ziomik on December 24, 2012, 10:41:16 PM
Hello, I had to stop because, as you can see from the post above, the version I had compiled was the ultra-prune and was clobbered.
Now I have compiled 0.7.2 and began again to download the blockchain. At this time are the block number 15432. At the download has worked 100% cpu but now it is the ram that is consumed much.
My nas use it as a video straming and while doing this work, I just finished looking at the film "The Watch" without a hint of problems ..  ;)


Title: Re: bitcoind for synology nas (ARM)
Post by: Raize on December 25, 2012, 12:39:09 AM
When you say video streaming do you mean Plex or Video Station? That's too bad about RAM usage, but I'm actually thinking of upgrading my NAS. I can especially justify it if it can host the blockchain for me!


Title: Re: bitcoind for synology nas (ARM)
Post by: ziomik on December 25, 2012, 08:19:36 AM
use Plex.
I want to see if it will decrease the use, when bitcoind end of download ... we will see ..


Title: Re: bitcoind for synology nas (ARM)
Post by: lebuen on January 28, 2013, 04:13:15 PM
Any news? Is it working? :)


Title: Re: bitcoind for synology nas (ARM)
Post by: ziomik on January 28, 2013, 04:22:53 PM
Arrived at block 19967 !
it's hard!  :P


Title: Re: bitcoind for synology nas (ARM)
Post by: JhonDoe on January 28, 2015, 06:50:17 PM
Hi.
I am interested in continue this topic because I try to install a Bitcoin node in a Synology and it is the nearest information to do it that I have found.

If someone has new information about this I will feel happy if he/she shares with us.

I'll try to follow this guide step by step and I will tell here my progress.

Thanks.
Doe


Title: Re: bitcoind for synology nas (ARM)
Post by: johoe on January 29, 2015, 11:50:42 AM
I am interested in continue this topic because I try to install a Bitcoin node in a Synology and it is the nearest information to do it that I have found.

If someone has new information about this I will feel happy if he/she shares with us.

I'll try to follow this guide step by step and I will tell here my progress.

I gave up on this idea.  My ARM-based synology has only 512 MB of RAM.  This is less than what bitcoind used to take on my desktop.  Maybe it is better now. Still the ARM processor is slow and it will take a long time to catch up with the block chain (if it will catch up at all).  Maybe one can "pre-index" the blockchain by copying the .bitcoin/blocks directory from another computer.  I'm not sure if the index can be ported over to a different architecture, though.

I thought about making a non-verifying bitcoind that just stores the blockchain without doing any checking at all (or at least avoid the most expensive ones, like signature and UTXO checking).  Then use an SPV client that connects to this bitcoind.  This avoids leaking any information about the transactions you are requesting and it still has the security of SPV.  I haven't started doing anything in this direction, though.

If you have a x86-based synology with 2 GB of RAM then you should be able to run bitcoind out of the box.


Title: Re: bitcoind for synology nas (ARM)
Post by: Carlton Banks on January 29, 2015, 12:59:08 PM
I am interested in continue this topic because I try to install a Bitcoin node in a Synology and it is the nearest information to do it that I have found.

If someone has new information about this I will feel happy if he/she shares with us.

I'll try to follow this guide step by step and I will tell here my progress.

I gave up on this idea.  My ARM-based synology has only 512 MB of RAM.  This is less than what bitcoind used to take on my desktop.  Maybe it is better now.

If you run the configure script with --disable-wallet, make will build a bitcoind executable that consumes only ~200 MB RAM.

The processor will still get tortured by the verification. Possibly the use of Intel low power chips with libsecp256k (the Bitcoin Core developed crypto library) verification code could make this sort of idea more practicable, but it'd be wise to wait until that code is being used in the main client (apparently the library is only used for signing txs in 0.10.0)


Title: Re: bitcoind for synology nas (ARM)
Post by: theringe on June 17, 2017, 07:33:34 PM
I still have a try on this moment although it's nothing worth trying at all  :P

I originally want to save the power/time from syncing data, which use my DS115j to get latest blickchain files 24/7 and docking my laptop with faster synchronization when needed.

so I didn't compile wallet and gui(qt) in my case.

here's my platform:
VMWare Ubuntu 64 bit 16.04 netboot only with openssh
Host CPU: 4 of 8 core intel xeon E3-1505M v5
MEM: 4GB

and here's the processes, and it's taking about 20 minutes
Code:

# unnecessary installation but useful
apt-get install sudo ssh vim ntpdate screen htop iftop nmap bzip2

# compiling tools
apt-get install make binutils xutils-dev libc6-i386

# cross compiling tools
apt-get install g++-arm-linux-gnueabihf curl

# bitcoin needed
apt-get install git-core autotools-dev automake pkg-config bsdmainutils build-essential autoconf libssl-dev libboost-dev libboost-chrono-dev libboost-filesystem-dev libboost-program-options-dev libboost-system-dev libboost-test-dev libboost-thread-dev libtool libevent-dev

# bitcoin optional
apt-get install miniupnpc libminiupnpc-dev libzmq3-dev

# create working dir
cd ~
mkdir ds115j
WDIR=/root/ds115j
DIST=$WDIR/dist

# prepare your toolchain file to working dir (says xvf armada370-gcc493_glibc220_hard-GPL.txz is for DS115j in my case)
cd $WDIR
tar xvf armada370-gcc493_glibc220_hard-GPL.txz

# setting the variables
cd $WDIR
export PATH="${WDIR}/arm-unknown-linux-gnueabi/bin:${PATH}"
export CC="${WDIR}/arm-unknown-linux-gnueabi/bin/arm-unknown-linux-gnueabi-gcc"
export CXX="${WDIR}/arm-unknown-linux-gnueabi/bin/arm-unknown-linux-gnueabi-g++"
export AR="${WDIR}/arm-unknown-linux-gnueabi/bin/arm-unknown-linux-gnueabi-ar"
export LD="${WDIR}/arm-unknown-linux-gnueabi/bin/arm-unknown-linux-gnueabi-ld"
export RANLIB="${WDIR}/arm-unknown-linux-gnueabi/bin/arm-unknown-linux-gnueabi-ranlib"
export CFLAGS="-I${WDIR}/arm-unknown-linux-gnueabi/arm-unknown-linux-gnueabi/include"
export LDFLAGS="-L${WDIR}/arm-unknown-linux-gnueabi/arm-unknown-linux-gnueabi/lib"
export LINK=$CXX

# specify your target version of bitcoin (says 0.14.1 in my case)
export ver=0.14.1

# cross compiling related tools
cd $WDIR
git clone -b v${ver} https://github.com/bitcoin/bitcoin
cd bitcoin/depends
make HOST=arm-linux-gnueabihf NO_QT=1 NO_WALLET=1 -j4

# cross compiling bitcoin
cd ..
./autogen.sh
LDFLAGS="-static-libstdc++" \
./configure \
--prefix=`pwd`/depends/arm-linux-gnueabihf \
--enable-upnp-default \
--enable-glibc-back-compat \
--enable-reduce-exports \
--disable-wallet \
--with-gui=no
make -j4
make install

# packing
cd depends
mv arm-linux-gnueabihf bitcoin-${ver}-arm-linux-gnueabihf
tar -c ./bitcoin-${ver}-arm-linux-gnueabihf/ | gzip -9 > ./bitcoin-${ver}-arm-linux-gnueabihf.tar.gz


after that, you can copy your bitcoin-${ver}-arm-linux-gnueabihf.tar.gz to the DS115j


Title: Re: bitcoind for synology nas (ARM)
Post by: spin on June 21, 2017, 10:56:02 AM
Assuming you are running another node who's output you trust you could use the assumevalid option to speed things up perhaps:

Quote
assumevalid=<hex>   If this block is in the chain assume that it and its ancestors are valid and potentially skip their script verification (0 to verify all, default: 00000000000000000013176bf8d7dfeab4e1db31dc93bc311b436e82ab226b90, testnet: 00000000000128796ee387cf110ccb9d2f36cffaf7f73079c995377c65ac0dcc)
You would specify a more recent block than the default of course.

Or also copy over an up to date blockchain directory from a node you trust.



Title: Re: bitcoind for synology nas (ARM)
Post by: jackcole on June 25, 2017, 12:48:22 PM
Hi, has anyone tried to compile with success bitcoind for nas synology DS211j (arm)?
I'm going crazy!


That looks quite promising. A bit techy, but seems like it can be pulled off.
Still, I'd have to put quite a few pieces together myself and I'm not really interested in downloading someone else's work as this would be a perfect place to implement a trojan horse to empty the wallet.
In my opinion the perfect scenario would be if the Bitcoin team officially offered this as a downloaded package I could trust, but that's probably pretty far down on their TODO list.