btcd: a bitcoind alternative written in Go

btcd is an alternative full-node implementation of the bitcoin protocol written in Go and is currently under active development. btcd has been under development for 10 weeks and the initial code is nearly ready for public release. We feel that by providing an alternative to bitcoind we can substantially improve the diversity and resilience of the bitcoin ecosystem and infrastructure.

A number of us at Conformal Systems had been keeping an eye on bitcoin as passive observers for the past couple years since bitcoin combines technologies that are already of interest to us: practical use of cryptography, distributed systems, and electronic payments. In January 2013 I had one of our developers, David Hill, attempt to port bitcoind and its GUI to Bitrig, an OS that several of our developers forked from OpenBSD. David encountered several problems with porting to Bitrig and in the process found issues with unit tests, non-portable functions and seeding of a PRNG. While pushing to get the port complete, it was clear that it would take a lot more effort than usual to complete this port. After seeing these issues with the porting, I felt that the bitcoin ecosystem could use an alternative to bitcoind.

Until starting on btcd, most of our developers had written almost exclusively in C. Our CTO, Marco Peereboom, and developers had been pushing for a new project written entirely in Go. Writing a bitcoind replacement seemed like an interesting project that would take less than 6 months to complete. Once discussion on btcd began in earnest, it became clear that using Go offered a number of advantages over C or C++, especially for financial software:

  • integrated test infrastructure
  • no active memory management
  • standard formatting
  • platform independent code
  • simpler parallelism
  • virtually crash-proof
  • built-in profiling and documentation facilities

The most important Go feature in the context of btcd is that of the test infrastructure: by having robust test infrastructure from the outset, all code can and shall have test coverage. Having full test coverage will ensure that most bugs are caught early in the development cycle, before they cause widespread problems. Since btcd is financial software and errors could lead to someone losing money, we take test coverage particularly seriously.

btcd is a work-in-progress and we will be making the initial source code release in the next couple weeks. At the moment, we have approximately 40% automated test coverage on our code but we will be expanding our test coverage once more of the core functionality is complete. We have setup btcd at our colocation facility and are using it to generate output similar to, have a look at to see btcd-generated output.

Currently, the following components of btcd are tested as working:

  • Discovery
  • Protocol
  • Crypto, hashing, base58 etc
  • Populating the block database
  • Serve blocks from the database
  • Peer-to-peer manager
  • IPv6 and IPv4 connectivity
  • Execute all transaction scripts currently in use
  • JSON RPC that deals with blocks and transactions
  • Verification of transaction signatures

Most of the code is in pretty good shape however some pieces are incomplete. Within 2 weeks we should have enough core functionality written and at that point we are going to release parts of the code to the general community. After this initial release, we plan on adding new functionality to handle wallets, Tor connectivity, etc.

If you are interested in talking to our developers about btcd, come chat on our public IRC server in channel #btcd.

4 thoughts on “btcd: a bitcoind alternative written in Go”

Leave a Reply

Your email address will not be published. Required fields are marked *