Bitcoin Node and Development

These are my experiences on setting up and running a full Bitcoin node, one that can also be used for development.

The reason for both of these is because I believe in Bitcoin and want to give something back. Jeff Garzik (of of the top core dev) has six suggestions on how to support Bitcoin core development. I am attempting to address suggestions 2. and 3. (help with testing and running a node).

The whole process takes almost a week.

This guide here has similar instructions.


Why Run a Full Node?

Nodes are how the Bitcoin network processes transactions and keeps the Blockchain. Any node can be a ‘bad node’. As long as most of the nodes are good, Bitcoin runs just fine. Of course, what is good and bad is a matter of perspective, so I am attempting to influence the network to what I think is good. This happens to be running the ‘core’ or ‘reference’ Bitcoin code at this time.

Why Help Development?

Only small number of people (only 254) contribute to the core Bitcoin code base. This code is run on most of the nodes in a world, without question/review. Another set of eyes is a good thing. Also, there is a lot to do, especially with respect to testing.

Personally, I want to know how the code works at a deeper level, as well as practice contributing to an open source project, something I’ve been neglecting to do for a while.

Machine Setup

This section details the setup of my development machine running a node.


Debian 7.7.0 Installation Steps [4 hours]

  1. Download network install .iso [1.5 hours]
  2. Burn that to a CD-R
  3. Put disk in laptop and booted to it (F12 on boot screen)
  4. Installed it as a desktop OS [2 hours, periodic interaction]
    • I also needed some non-free drivers from here on a USB dongle
    • Chose the following components
      • Debian desktop environment
      • SSH Server
      • Laptop
      • Standard system utilities

Getting and Building Core Bitcoin Code Steps [6 hours]

  1. Put main/default user in the sudoers file
    1. su
    2. enter root password
    3. visudo
    4. Find ‘root’ and copy/paste that line
    5. Rename ‘root’ to ‘youUserNameHere
    6. Save and quit text editor
    7. exit
  2. Install Supporting Packages [3 hours]
    1. Update apt-get source list
      1. sudo vi /etc/apt/sources.list
      2. append the following lines
        • deb oldstable main
        • deb jessie main
      3. sudo add-apt-repository ppa:bitcoin/bitcoin
      4. sudo apt-get update
        • Some failed to install:* ones
    2. sudo apt-get dist-upgrade -y
      • Took over 2 hours, with occational prompts
      • I had to force power off, then restart, but appears to have worked
    3. sudo apt-get install git -y
    4. sudo apt-get install build-essential libtool autotools-dev autoconf pkg-config libssl-dev -y
    5. sudo apt-get install libboost-all-dev -y
    6. sudo apt-get install libminiupnpc-dev -y
    7. sudo apt-get install libqt5gui5 libqt5core5a libqt5dbus5 qttools5-dev qttools5-dev-tools libprotobuf-dev protobuf-compiler -y
    8. sudo apt-get install libqrencode-dev -y
    9. sudo apt-get install libdb4.8-dev -y
    10. sudo apt-get install libdb4.8++-dev -y
  3. Grab the repository
    1. cd ~
    2. git clone
  4. Build [1 hour]
    1. cd ~/bitcoin
    2. ./
    3. ./configure
    4. make
    5. sudo make install

Get the Block Chain [> 30 GB Download]###

  1. cd ~

  2. wget

  3. sudo apt-get install rtorrent

    • To quit rtorrent, press ctrl + q
  4. mkdir ~/rDownloads

  5. mkdir ~/session

  6. Create ~/.rtorrent.rc with the following content (replace your_userName with your username twice):

     # Maximum and minimum number of peers to connect to per torrent.
     min_peers = 50
     max_peers = 80
     # Same as above but for seeding completed torrents (-1 = same as downloading)
     min_peers_seed = 1
     max_peers_seed = 50
     # Maximum number of uploads single torrent may use
     max_uploads = 4
     # Maximum number of simultaneous downloads
     max_downloads_global = 10
     # Maximum number of simultaneous uploads
     max_uploads_global = 20
     # Global upload and download rate in KiB. "0" for unlimited.
     download_rate = 0
     upload_rate = 50
     # Default directory to save the downloaded torrents.
     directory = /home/your_username/rDownloads
     # Default session directory. Make sure you don't run multiple instance
     # of rtorrent using the same session directory. Perhaps using a
     # relative path?
     session = /home/your_username/session
     # Watch a directory for new torrents, and stop those that have been
     # deleted.
     schedule = watch_directory,5,5,load_start=./rtactive/*.torrent
     schedule = tied_directory,6,5,start_tied=
     schedule = untied_directory,7,5,stop_untied=
     # Close torrents when diskspace is low.
     schedule = low_diskspace,5,60,close_low_diskspace=2000M
     # Periodically save session data
     schedule = session_save,240,300,session_save=
     # Enable the default ratio group.
     # Change the limits, the defaults should be sufficient.
     # Upload to a minimum ratio of 4.0
     # Upload to a maximum ratio of 20.0
     # Upload a minimum of 250 MB
     # When seeding ratio is reached close the torrent
     system.method.set = group.seeding.ratio.command, d.close=
     # Move files to ./unsorted when download completes
     system.method.set_key =,move_complete,"execute=mv,-n,$d.get_base_path=,./unsorted/;d.set_directory=./unsorted/"
     # Port range to use for listening.
     port_range = 60125-64125
     # Start opening ports at a random position within the port range.
     port_random = yes
     # Check hash for finished torrents. Might be useful until the bug is
     # fixed that causes lack of diskspace not to be properly reported.
     check_hash = yes
     # Encryption options, set to none (default) or any combination of the following:
     # allow_incoming, try_outgoing, require, require_RC4, enable_retry, prefer_plaintext
     # The example value allows incoming encrypted connections, starts unencrypted
     # outgoing connections but retries with encryption if they fail, preferring
     # plaintext to RC4 encryption after the encrypted handshake
     encryption = allow_incoming,try_outgoing ,enable_retry
     dht = auto
     # UDP port to use for DHT.
     dht_port = 63425
     # Enable peer exchange (for torrents not marked private)
     peer_exchange = yes
     # Sort the main view by ratio
     view.sort_current = main,greater=d.get_ratio=
     view.sort_new = main,less=d.get_ratio=
     view.sort = main
     # Sort the seeding view by the upload rate and only show torrents with peers
     view.sort_current = seeding,greater=d.get_up_rate=
     view.filter = seeding,"and=d.get_complete=,d.get_peers_connected="
     view.sort_new = seeding,less=d.get_up_rate=
     view.sort = seeding
     # Sort the leeching view by name
     view.sort_current = leeching,greater=d.get_name=
     view.sort_new = leeching,greater=d.get_name=
     view.sort = leeching
     # Filter the active view by connected peers
     view.sort_current = active,less=d.get_name=
     view.sort_new = leeching,less=d.get_name=
     view.filter = active,d.get_peers_connected=
     view.sort = active
     schedule = sort_main,11,5,view.sort=main
     schedule = sort_seeding,12,5,view.sort=seeding
     schedule = sort_leeching,13,5,view.sort=leeching
     schedule = sort_active,14,5,view.sort=active
  7. rtorrent

  8. Hit Enter

  9. bootstrap.dat.torrent (Press enter)

  10. Press Up Arrow Key (see stars/asterisks appear)

  11. Press ctrl + s to start the download

    • If you need, press ctrl + d to stop, again to delete
  12. Wait 6 hours to 3 days for the download to complete

And my HDD failed… TBC. I booted to a recovery CD/Live OS and ran fsck.ext4 -y /dev/sda1/ and that seemed to fixed things. We’ll try again. I first had to ctrl + d inside rtorrent to remove the previous attempt.

  1. Press ctrl + q to quit rTorrent once the blockchain is downloaded
    • Though I’d recommend you keep it open after syncing the blockchain
  2. cd ~
  3. mkdir .bitcoin
  4. mv rDownloads/bootstrap.dat .bitcoin

Verify and Sync Blockchain [72 hours]###

  1. bitcoin-qt
    • Wait for the wallet to sync
    • See “Importing blocks from disk”
    • Progress should advance several weeks/minute to start, then slow

Forward Port 8333

At this point, your node is connected and can receive data, but will not send any data. It is being selfish.

  1. If you hover over the connection bars, you’ll see “8 connections”
    • This means you are not contributing
  2. Open you network settings (click network icon in top rightish)
    1. Click Wi-Fi Settings or similar for ethernet
    2. Click the gear icon
    3. Select IPv4 on the left and enter a unique IP address, netmask and gateway:
      • (IP Address of your router)
    4. Reconnect to your network
  3. Visit your router (visit its IP address, log in)
    1. Find the port forwarding section and forward TCP on port 8333 to you IP address ( if using the example above)
  4. I reset my computer, not sure if this is required
  5. In a terminal, launch bitcoin-qt
    1. Hover over the connection bars in the Qt bitcoin client
    2. Verify you get more than 8 connections
  6. You can optionally move the bootstrap.dat.old back to your ~/rDownloads directory and start up the rT orrent to allow others access to it.

Congratulations, you are now running a full node.

When I get time, I will begin testing the code and will share my progress here.