Bitcoin Forum
July 18, 2024, 04:20:32 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: F-yeah! (bitcoind port)  (Read 3794 times)
P_Shep (OP)
Legendary
*
Offline Offline

Activity: 1795
Merit: 1208


This is not OK.


View Profile
May 20, 2013, 09:19:06 PM
 #1

After countless failed attempts some months ago, I just had another go at trying to build bitcoind for the mipsel architecture... specifically my router.
I recently bought an ASUS RT-N66U which boasts a mighty 256Mb RAM and 600MHz processor, so thought I'd give it another go.
So, after about 3 solid days of finding the right compiler, right GCC/binutils/uclibc combination, tweaking them; finding the right libraries, their right versions and tweaking those, I finally, finally FINALLY managed to build and run it on my router!

Currently using up 99% CPU usage and 75Mb RAM downloading all the blocks.
It's an un-optimised un-striped debug build that's running under GDB right now, so there's some room for efficiency.
jackjack
Legendary
*
Offline Offline

Activity: 1176
Merit: 1257


May Bitcoin be touched by his Noodly Appendage


View Profile
May 20, 2013, 09:36:33 PM
 #2

Wow congratulations! Great piece of work
We need this kind of things

Own address: 19QkqAza7BHFTuoz9N8UQkryP4E9jHo4N3 - Pywallet support: 1AQDfx22pKGgXnUZFL1e4UKos3QqvRzNh5 - Bitcointalk++ script support: 1Pxeccscj1ygseTdSV1qUqQCanp2B2NMM2
Pywallet: instructions. Encrypted wallet support, export/import keys/addresses, backup wallets, export/import CSV data from/into wallet, merge wallets, delete/import addresses and transactions, recover altcoins sent to bitcoin addresses, sign/verify messages and files with Bitcoin addresses, recover deleted wallets, etc.
Mylon
Full Member
***
Offline Offline

Activity: 140
Merit: 100

Mining FTW


View Profile
May 20, 2013, 09:45:37 PM
 #3

I almost feel like grabbing some 20 year old piece of hardware, and forcing BTC to work on that.

Kudos good sir, awesome piece of work, now we can have our routers do something useful besides routing... Tongue

"All Your Base Are Belong To Us" by CATS
ThomasX
Newbie
*
Offline Offline

Activity: 20
Merit: 0


View Profile
May 20, 2013, 10:28:01 PM
 #4

I almost feel like grabbing some 20 year old piece of hardware, and forcing BTC to work on that.

I'll happily dust off my Commodore 64 when the code is ready. Just for the fun of it. Grin

Oh and add some multiplexed sprites and border-interupt flashes that shows the progress in a funky way. And a cool sin/cos text-scroller with greetings, kudos and info of course. I miss all those neat eye-candy stuff from that good old times...
P_Shep (OP)
Legendary
*
Offline Offline

Activity: 1795
Merit: 1208


This is not OK.


View Profile
May 20, 2013, 11:54:28 PM
 #5

Re-compiled a release version and running that now - quite a size difference between unoptimised, unstripped debug version (51Mb) and the release (7.3Mb).

I copied the blockchain over from another computer, otherwise it's probably take a few weeks to sync! Just scanning it on start up took about 15-20 mins.
As it is, it's sitting at 135MB RAM and 200MB swap, and peaking up to 70% CPU every few mins.
piotr_n
Legendary
*
Offline Offline

Activity: 2053
Merit: 1356


aka tonikt


View Profile WWW
May 21, 2013, 03:21:45 PM
Last edit: May 21, 2013, 03:38:28 PM by piotr_n
 #6

Currently using up 99% CPU usage and 75Mb RAM downloading all the blocks.
Good job porting it, though let us know when all the blocks are already downloaded & verified.
My bet would be on somewhere next year... though probably even never Smiley

Check out gocoin - my original project of full bitcoin node & cold wallet written in Go.
PGP fingerprint: AB9E A551 E262 A87A 13BB  9059 1BE7 B545 CDF3 FD0E
P_Shep (OP)
Legendary
*
Offline Offline

Activity: 1795
Merit: 1208


This is not OK.


View Profile
May 22, 2013, 12:58:25 PM
 #7

It's working wonderfully. I think you under estimate the power of routers these days. Some of them are pretty powerful.

Here's the binary, if anyone wants it:
https://www.dropbox.com/s/tksm915gzopvtyj/bitcoind-0.8.1-mipsel.tar.bz2
piotr_n
Legendary
*
Offline Offline

Activity: 2053
Merit: 1356


aka tonikt


View Profile WWW
May 22, 2013, 06:03:52 PM
Last edit: May 22, 2013, 06:24:25 PM by piotr_n
 #8

It's working wonderfully. I think you under estimate the power of routers these days. Some of them are pretty powerful.
Single 600MHz core, with 256 MB of RAM - right?

That's why I seriously doubt it.
I think you underestimate the power that is needed for a single ECDSA verify calculation, not to mention memory needed to take a real-time care of a database with almost 6 millions of unspent outputs.

If you don't believe me, just start it with an empty DB and see by when it catches up. I'm telling you: probably never Smiley
Though the first 100+k blocks should go wonderfully - no doubts about it Smiley

Check out gocoin - my original project of full bitcoin node & cold wallet written in Go.
PGP fingerprint: AB9E A551 E262 A87A 13BB  9059 1BE7 B545 CDF3 FD0E
P_Shep (OP)
Legendary
*
Offline Offline

Activity: 1795
Merit: 1208


This is not OK.


View Profile
May 22, 2013, 06:56:29 PM
 #9

I bet you're fun at parties.

I'm aware that it'll probably take a few weeks to sync from scratch, I've already said so, but given it takes 15 mins to verify the last 288 blocks, why do you think never?
It really is quite happily working away right now.
piotr_n
Legendary
*
Offline Offline

Activity: 2053
Merit: 1356


aka tonikt


View Profile WWW
May 22, 2013, 07:01:57 PM
 #10

You're welcome to try me at your party Wink

AFAIK, it does not verify the last 288 blocks, per se.
It does re-apply transactions from the last blocks at each boot, but without an actual verification their of signatures.
Or am I wrong?

Check out gocoin - my original project of full bitcoin node & cold wallet written in Go.
PGP fingerprint: AB9E A551 E262 A87A 13BB  9059 1BE7 B545 CDF3 FD0E
P_Shep (OP)
Legendary
*
Offline Offline

Activity: 1795
Merit: 1208


This is not OK.


View Profile
May 22, 2013, 07:03:34 PM
 #11

See:
https://en.bitcoin.it/wiki/Running_Bitcoin

Quote
-checkblocks=<n>       How many blocks to check at startup (default: 288, 0 = all)
-checklevel=<n>        How thorough the block verification is (0-4, default: 3)



nb. I've since changed it to 120 @ level 2 for a faster start-up.
piotr_n
Legendary
*
Offline Offline

Activity: 2053
Merit: 1356


aka tonikt


View Profile WWW
May 22, 2013, 07:08:05 PM
 #12

I'm telling you.

I'm not too familiar with the source code, but I know that to verify signatures of the last 288 blocks, using a modern PC, you would need at least a couple of minutes.
And since the bitcoin needs less than one minute to boot on my PC, the only explanation is that it does not redo the signatures verification.

Just put a debug in CKey::Verify and see it gets printed at startup.

Check out gocoin - my original project of full bitcoin node & cold wallet written in Go.
PGP fingerprint: AB9E A551 E262 A87A 13BB  9059 1BE7 B545 CDF3 FD0E
P_Shep (OP)
Legendary
*
Offline Offline

Activity: 1795
Merit: 1208


This is not OK.


View Profile
May 22, 2013, 07:14:13 PM
 #13

Screenshot of htop:

Abdussamad
Legendary
*
Offline Offline

Activity: 3640
Merit: 1571



View Profile
May 22, 2013, 07:21:20 PM
 #14

256MB is not nearly enough. I ran it on a VPS with 768MB ram and from time to time it would run out of memory and kill bitcoind. You might want to install monit too to restart it automatically should it get killed.
P_Shep (OP)
Legendary
*
Offline Offline

Activity: 1795
Merit: 1208


This is not OK.


View Profile
May 22, 2013, 07:31:02 PM
 #15

There's a 1Gb swap disk.
malevolent
can into space
Legendary
*
Offline Offline

Activity: 3472
Merit: 1722



View Profile
May 22, 2013, 08:33:30 PM
 #16

From the screenshot I see the CPU load is no longer 99%?

I would be careful if it was to be close to 100% for extended periods of time because routers' CPUs often lack adequate cooling for the heat generated at such loads. Though you may check yours, maybe it has some sensors and maybe you could read them through I2C.

Signature space available for rent.
P_Shep (OP)
Legendary
*
Offline Offline

Activity: 1795
Merit: 1208


This is not OK.


View Profile
May 22, 2013, 09:27:50 PM
 #17

From the screenshot I see the CPU load is no longer 99%?

I would be careful if it was to be close to 100% for extended periods of time because routers' CPUs often lack adequate cooling for the heat generated at such loads. Though you may check yours, maybe it has some sensors and maybe you could read them through I2C.

The ASUS RT-N66U there has 2 temp sensors, one on each of the transmitters, which actually don't shift from their usual 50 degC even when the CPU is at 99% load for 20 mins.

It only hits 99% occasionally once the initial block scan is done, usually it's 4% or so. The 'Load average' at the top there gives you the 5, 10 and 15 minute averages, where 1.00 is 100% load.

Just ran a test of 120 blocks at check level 4, which form this post, means it includes the signature verification.

Code:
165952 2013-05-22 19:46:31 Bitcoin version v0.8.1.0-g34d62a8-beta ()
165953 2013-05-22 19:46:31 Using OpenSSL version OpenSSL 1.0.1e 11 Feb 2013
165954 2013-05-22 19:46:31 Default data directory /root/.bitcoin
165955 2013-05-22 19:46:31 Used data directory /mnt/Data/bitcoin
165956 2013-05-22 19:46:31 init message: Verifying wallet integrity...
165957 2013-05-22 19:46:31 dbenv.open LogDir=/mnt/Data/bitcoin/database ErrorFile=/mnt/Data/bitcoin/db.log
165958 2013-05-22 19:46:33 Bound to [::]:8333
165959 2013-05-22 19:46:33 Bound to 0.0.0.0:8333
165960 2013-05-22 19:46:33 init message: Loading block index...
165961 2013-05-22 19:46:33 Opening LevelDB in /mnt/Data/bitcoin/blocks/index
165962 2013-05-22 19:46:33 Opened LevelDB successfully
165963 2013-05-22 19:46:33 Opening LevelDB in /mnt/Data/bitcoin/chainstate
165964 2013-05-22 19:46:34 Opened LevelDB successfully
165965 2013-05-22 19:47:24 LoadBlockIndex(): last block file = 61
165966 2013-05-22 19:47:24 LoadBlockIndex(): last block file: CBlockFileInfo(blocks=789, size=129458329, heights=236623..237404, time=2013-05-17..2013-05-22)
165967 2013-05-22 19:47:24 LoadBlockIndex(): transaction index disabled
165968 2013-05-22 19:47:24 LoadBlockIndex(): hashBestChain=000000000000000dc4e0ec58b5d0f872f50ad0ee9f824c973e214911b8584bc5  height=237404 date=2013-05-22 19:32:57
165969 2013-05-22 19:47:24 init message: Verifying block database integrity...
165970 2013-05-22 19:47:24 Verifying last 120 blocks at level 4
165971 2013-05-22 20:35:20 No coin database inconsistencies in last 121 blocks (37183 transactions)
165972 2013-05-22 20:35:23  block index         2929699ms
165973 2013-05-22 20:35:23 init message: Loading wallet...
165974 2013-05-22 20:35:39 nFileVersion = 80100
165975 2013-05-22 20:35:39  wallet                16458ms
165976 2013-05-22 20:35:39 init message: Importing blocks from block database...
165977 2013-05-22 20:35:39 init message: Loading addresses...
165978 2013-05-22 20:35:40 Loaded 14691 addresses from peers.dat  633ms
165979 2013-05-22 20:35:40 mapBlockIndex.size() = 237412
165980 2013-05-22 20:35:40 nBestHeight = 237404
165981 2013-05-22 20:35:40 setKeyPool.size() = 101
165982 2013-05-22 20:35:40 mapWallet.size() = 0
165983 2013-05-22 20:35:40 mapAddressBook.size() = 1
165984 2013-05-22 20:35:40 init message: Done loading
165985 2013-05-22 20:35:40 ThreadRPCServer started
165986 2013-05-22 20:35:40 send version message: version 70001, blocks=237404, us=0.0.0.0:0, them=0.0.0.0:0, peer=127.0.0.1:0

So 48 min to fully verify 120 blocks. Not the worst...


P.S. At check level 2, 120 blocks just takes 3 mins. That's quite tolerable Smiley
piotr_n
Legendary
*
Offline Offline

Activity: 2053
Merit: 1356


aka tonikt


View Profile WWW
May 22, 2013, 09:38:14 PM
 #18

P.S. At check level 2, 120 blocks just takes 3 mins. That's quite tolerable Smiley
Now were talking - numbers, I like. Smiley

Now imagine that the blocks will be growing in size... not unlikely reaching the max of 1MB around the end of this year... Smiley
This great router, that you are advertising, will not stand a chance with the average 10 min new block mining events, especially if 10 of them appear within 20min period. It will be so laggy, that you will just prefer to not use it, because it will never have the most recent info. Or even if it does, you wont be sure...

So my point was that it just won't work. For this kind of hardware better look into solutions that are not actual nodes, but only download transactions that belong to their wallet. This could work.

Check out gocoin - my original project of full bitcoin node & cold wallet written in Go.
PGP fingerprint: AB9E A551 E262 A87A 13BB  9059 1BE7 B545 CDF3 FD0E
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!