Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: doublec on December 07, 2010, 05:47:53 AM



Title: bitcoind running on the N900 smartphone
Post by: doublec on December 07, 2010, 05:47:53 AM
I got bitcoind running on the N900. It wasn't too hard. I had to build the right versions of libdb and libboost and make one minor change to util.cpp. The ParseHex function in util.cpp has code like:

Code:
if (c == -1)


'c' is a 'char' type which is unsigned so this comparison never does what's expected. Changing both instances of this to the following gets a working bitcoind:

Code:
if (c == (char)-1)

Where 'working' means it's currently downloading the block chain. I  haven't extensively tested it yet. Binary here if anyone wants to risk it:

http://bluishcoder.co.nz/bitcoin-pool/bitcoind.gz

gunzip it and run it from the terminal. The standard RPC commands will work with it running.

Update: 2010-02-04: The changes to ParseHex are no longer needed as they're part of the bitcoin source now. An updated build for the N900 is available here:

http://www.bluishcoder.co.nz/bitcoin-pool/bitcoind-b1a657.gz

This is built from github commit b1a657 (https://github.com/bitcoin/bitcoin/commit/b1a657a00d0b4bbdb67f8b97f3bddde3ae9edba9).


Title: Re: bitcoind running on the N900 smartphone
Post by: Anonymous on December 07, 2010, 05:57:20 AM
I got bitcoind running on the N900. It wasn't too hard. I had to build the right versions of libdb and libboost and make one minor change to util.cpp. The ParseHex function in util.cpp has code like:

Code:
if (c == -1)


'c' is a 'char' type which is unsigned so this comparison never does what's expected. Changing both instances of this to the following gets a working bitcoind:

Code:
if (c == (char)-1)

Where 'working' means it's currently downloading the block chain. I  haven't extensively tested it yet. Binary here if anyone wants to risk it:

http://bluishcoder.co.nz/bitcoin-pool/bitcoind.gz

gunzip it and run it from the terminal. The standard RPC commands will work with it running.

Should attach it to the pooled mining effort :)


Title: Re: bitcoind running on the N900 smartphone
Post by: ribuck on December 07, 2010, 01:30:25 PM
This is so cool. I've installed it on my N900 and am up to block 2000. I wonder what the khash/s will be - my guess is 50 khash/s.

Let me know your bitcoin receiving address, and we can make the first p2p (phone-to-phone) transaction.


Title: Re: bitcoind running on the N900 smartphone
Post by: doublec on December 07, 2010, 11:38:34 PM
This is so cool. I've installed it on my N900 and am up to block 2000. I wonder what the khash/s will be - my guess is 50 khash/s.

Let me know your bitcoin receiving address, and we can make the first p2p (phone-to-phone) transaction.

I created 18T1jQ9QT1fsDJ7q8YKBGhdM56iYt4sXoV on my phone. I'm interested in what the battery hit is like for running it full time. It did take a *long* time to get the block chain. I get between 130 and 150 khash/s when I did a short generation test run.


Title: Re: bitcoind running on the N900 smartphone
Post by: MoonShadow on December 07, 2010, 11:42:58 PM
This is awesome.  The battery life has to suck though.  Can you get terminal access to the daemon on the smartphone, or something along the lines of ncurses?  If the generation is disabled, and a frontend could be thrown together, this would likely satisfy the bounty for a standalone smartphone client.


Title: Re: bitcoind running on the N900 smartphone
Post by: doublec on December 08, 2010, 12:26:17 AM
This is awesome.  The battery life has to suck though.  Can you get terminal access to the daemon on the smartphone, or something along the lines of ncurses?  If the generation is disabled, and a frontend could be thrown together, this would likely satisfy the bounty for a standalone smartphone client.

I'm hoping the battery life for just running the client (ie. not generating) won't be too bad. I run skype constantly to receive calls via a skype number and gtalk most of the time. They require a constant connection and I get a days usage out of the phone.

I use the built in XTerm to get terminal access and run bitcoind manually to do stuff. A JSON-RPC frontend for it wouldn't be too difficult - assuming the bitcoind RPC interface exposes enough information.


Title: Re: bitcoind running on the N900 smartphone
Post by: grondilu on December 08, 2010, 12:40:53 AM
I own a n900 too so I might think it's cool to have bitcoin running on it.

An yet, I doubt it will be useful.  Especialy since I don't store any personnal data on my phone (except for backup after encryption).

I mean, the n900 is awesome but anyone who gets his hands on it could see all my personnal data.  :/

I don't know how you guys cope with that, but personnaly I can't.


Title: Re: bitcoind running on the N900 smartphone
Post by: doublec on December 08, 2010, 12:43:35 AM
I don't know how you guys cope with that, but honnestly I can't.

The same way I deal with it on my laptop. Encrypted filesystem.


Title: Re: bitcoind running on the N900 smartphone
Post by: doublec on December 08, 2010, 09:13:54 AM
I'm hoping the battery life for just running the client (ie. not generating) won't be too bad

I've been running bitcoind all day on the N900 and the battery hit has been minimal. There seems to be little overhead if I'm already running the IM protocols (Skype, GTalk, etc).


Title: Re: bitcoind running on the N900 smartphone
Post by: Anonymous on December 08, 2010, 09:22:44 AM
*owns an iphone  :-[


Title: Re: bitcoind running on the N900 smartphone
Post by: dsg on December 08, 2010, 10:16:02 AM
This is awesome.  The battery life has to suck though.  Can you get terminal access to the daemon on the smartphone, or something along the lines of ncurses?  If the generation is disabled, and a frontend could be thrown together, this would likely satisfy the bounty for a standalone smartphone client.

I'm hoping the battery life for just running the client (ie. not generating) won't be too bad. I run skype constantly to receive calls via a skype number and gtalk most of the time. They require a constant connection and I get a days usage out of the phone.

I use the built in XTerm to get terminal access and run bitcoind manually to do stuff. A JSON-RPC frontend for it wouldn't be too difficult - assuming the bitcoind RPC interface exposes enough information.

You can encrypt your filesystem just like any other linux machine, it's what I do. Just compile a new kernel with DM_CRYPT and such, install cryptsetup from extras-devel and make a small boot script in /etc/event.d/.

Encrypted /home and /home/user/MyDocs from SD card FTW :)

btw, nice work getting bitcoind going. I don't think I'd run it on my n900 though (I have a trusted machine and an active VPN from my phone so I don't need to burn battery), but I've been tempted to write a n900 GUI that talks to the JSON-RPC interface. Maybe when I have some more time.


Title: Re: bitcoind running on the N900 smartphone
Post by: ribuck on December 08, 2010, 11:16:52 AM
I created 18T1jQ9QT1fsDJ7q8YKBGhdM56iYt4sXoV on my phone.

I sent 0.42 BTC from my N900 at 10.55 GMT. If you receive it, that's the first ph2ph bitcoin transfer!

Doublec's bitcoind seems to work perfectly. It took me ten hours to get the block chain. I had the phone plugged in to USB all that time, and occasionally a warning flashed up saying that the phone was using more power than the USB was supplying. But now that the block chain is up to date it's fine, even with generating. I think writing the block chain to flash memory was pushing the power consumption up.

Like doublec's phone, mine hashes at between 130 and 150 khash/s. The predicted "average time to generate a block" is 2869 days at the current difficulty level of 8078. That's almost 8 years, so I'm not holding my breath. However, if we had 2869 people generating on phones, someone would generate a block on their phone every day, so it's possible that a block will be generated on someone's phone one day.

For those who don't know the N900, it runs a reasonably standard Linux with root access. The shell is "ash" which is basically a cut-down bash. The utilities are mostly cut-down versions from the BusyBox project, so for example you have to use "more" rather than "less", and the commands don't have so many options, but it's not a big limitation.

Programming for the N900 is generally done in C++ on a Linux PC using a cross-compiler. GUIs are GTK+ or Qt. Masochists have even managed to install gcc on the phone and do their development on-device. The phone comes with Python, and you can install PyQt which provides a straightforward way to develop GUI apps on-device. The phone comes with 32GB onboard, and you can add another 32GB using the microSD socket, so there's plenty of space to develop stuff.


Title: Re: bitcoind running on the N900 smartphone
Post by: ribuck on December 08, 2010, 11:19:00 AM
I mean, the n900 is awesome but anyone who gets his hands on it could see all my personnal data.  :/

If I put 100 bitcoins on my phone, I don't regard that as personal data. If my phone gets lost or stolen, the value of the phone is much greater than the value of the bitcoins it holds.


Title: Re: bitcoind running on the N900 smartphone
Post by: doublec on December 08, 2010, 11:27:07 AM
I sent 0.42 BTC from my N900 at 10.55 GMT. If you receive it, that's the first ph2ph bitcoin transfer!

Successfully received on my phone, thanks!

I think you're right about the writing of the block chain to flash memory. There's also the debug log which is very chatty. See ~/.bitcoin/debug.log. We'd probably want to turn that off on the phone.



Title: Re: bitcoind running on the N900 smartphone
Post by: em3rgentOrdr on December 08, 2010, 11:32:57 AM
I sent 0.42 BTC from my N900 at 10.55 GMT. If you receive it, that's the first ph2ph bitcoin transfer!

Successfully received on my phone, thanks!


Awesome!!!  :D


Title: Re: bitcoind running on the N900 smartphone
Post by: doublec on December 08, 2010, 11:34:13 AM
If you use the 'Desktop Command Execution' widget you can execute bitcoind RPC commands and have the result displayed on the desktop in a widget. So I have my current balance in a widget on the desktop on my phone.


Title: Re: bitcoind running on the N900 smartphone
Post by: Anonymous on December 08, 2010, 11:38:34 AM
I sent .61 btc to your phone because this is pretty cool. Im on a laptop does that count as a mobile device?

Its also cheaper than a text message   :D

Now if starbucks publishes a bitcoin address you can buy a coffee . Does the n900 have copy and paste? :P



Title: Re: bitcoind running on the N900 smartphone
Post by: doublec on December 08, 2010, 12:26:17 PM
I sent .61 btc to your phone because this is pretty cool. Im on a laptop does that count as a mobile device?

Its also cheaper than a text message   :D

Now if starbucks publishes a bitcoin address you can buy a coffee . Does the n900 have copy and paste? :P

I received the .61 on the N900, thanks! Yes, the N900 does have copy and paste although it can be a pain to get exactly the right area to copy in the browser. I need a good way of getting addresses onto the phone. So if I see an address on a web page, or printed out, how to get this on the phone easily so I can send to it. Barcodes were discussed in the android thread so that's a possibility I guess.


Title: Re: bitcoind running on the N900 smartphone
Post by: ribuck on December 08, 2010, 12:39:22 PM
Yes, the N900 does have copy and paste although it can be a pain to get exactly the right area to copy in the browser. I need a good way of getting addresses onto the phone.

I'm surprised to hear you say that.

To send the bitcoin to you, I just browsed your forum post on my phone, double-tapped on your bitcoin address to select it, pressed control-C on the keyboard to copy it, then used the "Paste" menu option in XTerminal. Not at all painful!

I have found though, that bitcoin addresses in Gmail have a nonbreaking space added after the 16th character. To copy those cleanly, click "show original" in Gmail and copy from the raw message text.


Title: Re: bitcoind running on the N900 smartphone
Post by: doublec on December 08, 2010, 02:57:13 PM
To send the bitcoin to you, I just browsed your forum post on my phone, double-tapped on your bitcoin address to select it, pressed control-C on the keyboard to copy it, then used the "Paste" menu option in XTerminal. Not at all painful!

Ah, I didn't realise double tapping the address would select it. I was using the swype from left to right gesture, clicking the mouse pointer that appears, click and dragging the selection area then control-C, etc. The double-tap is much faster.


Title: Re: bitcoind running on the N900 smartphone
Post by: ribuck on December 08, 2010, 04:42:19 PM
I was using the swype from left to right gesture

The swipe gesture is awkward, I agree. You can also easily make precise selections by tapping at the start of the selection then typing shift-rightarrow to extend the selection, or shift-tap to set the end of the selection.


Title: Re: bitcoind running on the N900 smartphone
Post by: ribuck on December 08, 2010, 04:48:56 PM
Here's how it looks on the phone, in case anyone's interested:

http://i55.tinypic.com/2v9ozzk.png


Title: Re: bitcoind running on the N900 smartphone
Post by: MoonShadow on December 08, 2010, 07:33:58 PM
I sent .61 btc to your phone because this is pretty cool. Im on a laptop does that count as a mobile device?

Its also cheaper than a text message   :D

Now if starbucks publishes a bitcoin address you can buy a coffee . Does the n900 have copy and paste? :P

I received the .61 on the N900, thanks! Yes, the N900 does have copy and paste although it can be a pain to get exactly the right area to copy in the browser. I need a good way of getting addresses onto the phone. So if I see an address on a web page, or printed out, how to get this on the phone easily so I can send to it. Barcodes were discussed in the android thread so that's a possibility I guess.

Has anyone tried to intergrate bu.mp?  Use an extra data field in bu.mp that a script can automagicly copy from the bu.mp addressbook into the send money address field in bitcoind?


Title: Re: bitcoind running on the N900 smartphone
Post by: ribuck on December 08, 2010, 08:39:09 PM
Bump currently works on iPhone or on Android, but not on the N900. Anyway, it's a centralised proprietary solution and I think we can do better.


Title: Re: bitcoind running on the N900 smartphone
Post by: The Madhatter on December 08, 2010, 10:11:08 PM
Now if starbucks publishes a bitcoin address you can buy a coffee . Does the n900 have copy and paste? :P

Bah!

That Capulin coffee stuff at Coffee4Bitcoin (http://www.coffee4bitcoin.com/) is far better stuff than starbucks sells, in my opinion. Plus you get to drink it at the best cafe in the world: your own home! :D

Edit: Their slogan "It's a trip" is quite accurate!  Don't use too many of those green beans (light roast).. I haven't slept for days. Seriously. Haha!


Title: Re: bitcoind running on the N900 smartphone
Post by: Ricochet on December 11, 2010, 12:40:41 AM
I'll admit I've been curious how well something like this would run on something like an iPhone or other smartphone, performance aside.  Cool to see it actually working!


Title: Re: bitcoind running on the N900 smartphone
Post by: britschler on January 01, 2011, 12:28:17 PM
Hi all,

I experience problems with the bitcoin version for the n900 (I got it from http://bluishcoder.co.nz/bitcoin-pool/bitcoind.gz). When I try to execute the file I get the following error:
http://img227.imageshack.us/img227/2541/screenshot15d.png
I'm running version 20.2010.36-2.

Cheers,
britschler


Title: Re: bitcoind running on the N900 smartphone
Post by: grondilu on January 01, 2011, 01:25:27 PM
I'm off-topic but :  anyone has a spare USB cable for n900 to sell for bitcoins ?


Title: Re: bitcoind running on the N900 smartphone
Post by: doublec on January 01, 2011, 11:05:21 PM
I experience problems with the bitcoin version for the n900 (I got it from http://bluishcoder.co.nz/bitcoin-pool/bitcoind.gz). When I try to execute the file I get the following error:

Did you download it and gunzip it on the phone? I just tried the following steps from the N900 terminal and it worked:

Code:
$ wget http://www.bluishcoder.co.nz/bitcoin-pool/bitcoind.gz
$ gunzip bitcoind.gz
$ chmod +x bitcoind.gz
$ ./bitcoind


Title: Re: bitcoind running on the N900 smartphone
Post by: doublec on February 04, 2011, 05:26:29 AM
I've updated the N900 binary to a newer version. I built from gitub commit b1a657 (https://github.com/bitcoin/bitcoin/commit/b1a657a00d0b4bbdb67f8b97f3bddde3ae9edba9). It's available here:

http://www.bluishcoder.co.nz/bitcoin-pool/bitcoind-b1a657.gz

I start it on the N900 using:

Code:
./bitcoind -noirc -connect=xx.xx.xx.xx -nolisten

Replacing 'xx.xx.xx.xx' with a node to connect too. This means no incoming connections will be made to the phone and only one connection is made outgoing.


Title: Re: bitcoind running on the N900 smartphone
Post by: Luke-Jr on February 04, 2011, 06:32:01 AM
... make one minor change to util.cpp. The ParseHex function in util.cpp has code like:

Code:
if (c == -1)


'c' is a 'char' type which is unsigned so this comparison never does what's expected. Changing both instances of this to the following gets a working bitcoind:

Code:
if (c == (char)-1)
This "fix" seems wrong. Really, 'phexdigit' should be redefined to a 'signed char' array, and 'c'  a simple 'signed char'-- then none of this casting mess is necessary. The problem stems from the fact that the C standard allows 'char' to be either signed or unsigned: implementors can choose (and I've often see it signed). That means if you might need to use values above 127 or below 0, you must specify signed/unsigned explicitly for your variables. What (char)-1 does, is turn it into 0xff (255) on compilers that have an unsigned 'char', which might work, but it really depends a lot on how the compiler handles the constant "-1" stored in the  (undefined signedness) phexdigit array.


Title: Re: bitcoind running on the N900 smartphone
Post by: ih8censorship on February 27, 2011, 09:34:44 PM
I was referred to this topic from https://www.bitcoin.org/smf/index.php?topic=3940.msg56271#msg56271 . Did you have to change anything in the makefile? If so what all did you have to change and/or replace?


Title: Re: bitcoind running on the N900 smartphone
Post by: doublec on February 27, 2011, 10:20:29 PM
I was referred to this topic from https://www.bitcoin.org/smf/index.php?topic=3940.msg56271#msg56271 . Did you have to change anything in the makefile? If so what all did you have to change and/or replace?

I had to remove the -march and SSE stuff from the makefile. I've posted the makefile I used in the other thread. Hope that helps.


Title: Re: bitcoind running on the N900 smartphone
Post by: JesusTheCaffeine on February 28, 2011, 06:35:48 AM
You can also do this on android by installing a few libs or using a chroot.  :P


Title: Re: bitcoind running on the N900 smartphone
Post by: TiagoTiago on March 11, 2011, 09:39:42 AM
Could you make a .deb for installing this please (optfication and all) ?


Title: Re: bitcoind running on the N900 smartphone
Post by: gohan on March 15, 2011, 03:57:38 AM
I'm getting 280 khash/s while overclocked to 1150 Mhz. Not bad at all. :)


Title: Re: bitcoind running on the N900 smartphone
Post by: Luke-Jr on March 15, 2011, 05:13:00 AM
I'm getting 280 khash/s while overclocked to 1150 Mhz. Not bad at all. :)
If you want to fry your N900 in a matter of months (at most).


Title: Re: bitcoind running on the N900 smartphone
Post by: johnieeliang on March 15, 2011, 03:50:36 PM
lol nice, probably not the most effective thing but nice nonetheless


Title: Re: bitcoind running on the N900 smartphone
Post by: grondilu on March 15, 2011, 03:53:49 PM
Sorry, I haven't read this whole thread but I've seen that some people managed to hash at around 280kH/s.  I know the N900 has some graphic capable hardware:  any chance this device could be used to hash?


Title: Re: bitcoind running on the N900 smartphone
Post by: britschler on March 23, 2011, 09:37:03 PM

Update: 2010-02-04: The changes to ParseHex are no longer needed as they're part of the bitcoin source now. An updated build for the N900 is available here:

http://www.bluishcoder.co.nz/bitcoin-pool/bitcoind-b1a657.gz

This is built from github commit b1a657 (https://github.com/bitcoin/bitcoin/commit/b1a657a00d0b4bbdb67f8b97f3bddde3ae9edba9).

When I'm running bitcoind-b1a657 I notice an irc connection to some irc server being established, e.g.
tcp        0      0 192.168.3.118:56738     irc.lfnet.org:ircd      ESTABLISHED

What's the purpose of this connection?


Title: Re: bitcoind running on the N900 smartphone
Post by: Matt Corallo on March 23, 2011, 09:38:27 PM

Update: 2010-02-04: The changes to ParseHex are no longer needed as they're part of the bitcoin source now. An updated build for the N900 is available here:

http://www.bluishcoder.co.nz/bitcoin-pool/bitcoind-b1a657.gz

This is built from github commit b1a657 (https://github.com/bitcoin/bitcoin/commit/b1a657a00d0b4bbdb67f8b97f3bddde3ae9edba9).

When I'm running bitcoind-b1a657 I notice an irc connection to some irc server being established, e.g.
tcp        0      0 192.168.3.118:56738     irc.lfnet.org:ircd      ESTABLISHED

What's the purpose of this connection?
Bitcoin opens an IRC connection to lfnet for bootstrapping (finding peers).  New nodes have to find out about existing nodes somehow. 


Title: Re: bitcoind running on the N900 smartphone
Post by: doublec on March 23, 2011, 10:11:36 PM
Bitcoin opens an IRC connection to lfnet for bootstrapping (finding peers).  New nodes have to find out about existing nodes somehow. 

Run it with '-no-irc' to prevent it from making an IRC connection. You can also use '-no-listen' to prevent it from listening for incoming connections and use '-connect' to explicitly connect to a node. This minimizes the number of connections to your phone.


Title: Re: bitcoind running on the N900 smartphone
Post by: TiagoTiago on March 24, 2011, 12:13:28 AM
Btw, when i do bitcoind stop it seems it doesn't close (i still see it running with htop, and trying to fire it up again gives me an error about the .lock), am i doing somthing wrong?


Title: Re: bitcoind running on the N900 smartphone
Post by: theymos on March 24, 2011, 01:21:41 AM
Run it with '-no-irc' to prevent it from making an IRC connection. You can also use '-no-listen' to prevent it from listening for incoming connections and use '-connect' to explicitly connect to a node. This minimizes the number of connections to your phone.

It's -nolisten and -noirc.


Title: Re: bitcoind running on the N900 smartphone
Post by: doublec on March 24, 2011, 04:28:03 AM
Btw, when i do bitcoind stop it seems it doesn't close (i still see it running with htop, and trying to fire it up again gives me an error about the .lock), am i doing somthing wrong?

It takes quite a while (a few minutes) to stop but it does eventually. I don't know why.


Title: Re: bitcoind running on the N900 smartphone
Post by: TiagoTiago on March 24, 2011, 12:35:12 PM
Oh, i see, thanx