Bitcoin Forum
May 21, 2019, 02:09:37 PM *
News: Latest Bitcoin Core release: 0.18.0 [Torrent] (New!)
 
  Home Help Search Login Register More  
  Show Posts
Pages: [1]
1  Bitcoin / Development & Technical Discussion / Working Android App on: July 22, 2010, 08:56:59 AM
App is now available on the Android Market. Look for Bitcoin.
Now that we have RPC passwords, I am tunneling bitcoind over SSL, and can query the daemon from anywhere. So, I whipped together an Android app that provides access to the API. At this point, I am just calling "getinfo" and parsing the output, which I think demonstrates the basic functionality needed for a complete app. I'm attaching a fresh screenshot, straight from my Nexus One. I'll be hacking more features in over the next few days.

If you
  • are running the headless client on a server somewhere,
  • have an Android device,
  • want to help with beta testing,
  • and will have lots of patience with my schedule...
Then I would love three or four volunteers to help with testing and to suggest fixes and improvements.



                 


For reference, here's how I've set up my Ubuntu server:

1. I created a startup script, /etc/init.d/bitcoind-ssl. It looks like this:

#!/bin/sh -e

##
# /etc/init.d/bitcoind-ssl
##

[ -x /usr/local/bin/bitcoind ] || exit 0
. /lib/lsb/init-functions
. /etc/default/rcS

#The port on which the SSL tunnel will run
PORT=38332
#Run as this user.
USER=rodin

case "$1" in
    start)
   log_begin_msg "Starting bitcoind..."
   su $USER -c ~$USER/bin/bcstart
        /usr/bin/stunnel -d $PORT -r 8332
   ;;
    stop)
   log_begin_msg "Stopping bitcoind..."
   su $USER -c ~$USER/bin/bcstop
   echo Waiting for server to shutdown cleanly...
   sleep 2
   fuser -n tcp $PORT -k
   ;;
    restart|force-reload)
   su $USER -c ~$USER/bin/bcstop
   echo Waiting for server to shutdown cleanly...
   sleep 2
   fuser -n tcp $PORT -k
   su $USER -c ~$USER/bin/bcstart
        /usr/bin/stunnel -d $PORT -r 8332
   ;;
    status)
   su $USER -c ~$USER/bin/bcstatus
   ;;
    *)
   echo "Usage: /etc/init.d/bitcoind-ssl {start|stop|restart|force-reload}"
   exit 1
   ;;
esac

exit 0


2. I made three scripts in ~/bin, bcstart, bcstop, and bcstatus. The names are pretty descriptive. These scripts contain my password but are only readable by me and root, so that's relatively safe (esp. since I'm root).

3. I scheduled the init script to start at boot-time. You can do something like sudo update-rc.d bitcoind-ssl defaults.

And, just for completeness, I use logrotate to simultaneously rotate my bitcoin logs and do staggered backups of my wallet:

##
# logrotate.conf
# Schedule me to run in crontab:
# 0 1 * * * /usr/sbin/logrotate --state /home/rodin/.bitcoin/logrotate.state /home/rodin/.bitcoin/logrotate.conf
##

/home/rodin/.bitcoin/debug.log{
      rotate 5
      prerotate
         /home/rodin/bin/bcstop
         sleep 3
         cp ~/.bitcoin/wallet.dat.4 ~/.bitcoin/wallet.dat.5
         cp ~/.bitcoin/wallet.dat.3 ~/.bitcoin/wallet.dat.4
         cp ~/.bitcoin/wallet.dat.2 ~/.bitcoin/wallet.dat.3
         cp ~/.bitcoin/wallet.dat.1 ~/.bitcoin/wallet.dat.2
         cp ~/.bitcoin/wallet.dat ~/.bitcoin/wallet.dat.1
      endscript
      compress
      postrotate
         /home/rodin/bin/bcstart
      endscript
}



Hope this is all useful to somebody.
Pages: [1]
Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!