Arrow of time
Arrow of time
Developing Bitcoin services - general notes

For some time now I've been developing back-end stuff with Bitcoin, and here are some things I wish I ...

For some time now I've been developing back-end stuff with Bitcoin, and here are some things I wish I could have learned the easy way:

  • If analysing the blockchain (for whatever purposes), it's all fine and breezy until about block 200,000 - that's where the fun starts. Don't test your code with earlier blocks, since compared to the more recent ones they are trivially small.
  • Python is fast enough, PyPy is faster. If you're using bitcoind RPC, chances are that it will be the bottleneck, and not your code. That said, don't use Python if you're going to do computations, crypto or algorithmic work - Python is the slowest thing around for those tasks.
  • bitcoind will not accept RPCs untill it's synced with the network. This is normal.
  • bitcoind will de-sync with the network if there is a clock drift in the machine. This is insane. Use NTP.
  • For analyzing random transactions, don't forget to set txindex=1 in bitcoin.conf!
  • If you're pumping blockchain data into MySQL, you will need around 75 GB of space for the very minimal set of data, and around 150 GB to make it actually useful in production. Enable compression. The DB import will take days.
  • In recent time, it takes around 24h for bitcoind to download the blockchain, and it needs around 65 GB of disk space.
  • The DB import rate will be approximately constant in terms of transactions/s. The number of transactions/block will rise, leading to a sharp drop in blocks/s.