3

I want to start developing a Bitcoin Client in a new language. For this I'm looking for references and resources that could be used to as a guide. Some kind of comprehensive guideline of what a client should include. But haven't been really successful so far. Does anybody knows about something like this?

EDIT: I'm aiming for a full node with wallet capabilities

  • You may want to be specific about what type of client you want to make. There are full nodes with and without wallet capabilities, there are SPV wallets, there are mining nodes, etc. The features and protocols that need to be implemented will be determined by what type of node you want. – Jestin Sep 27 '16 at 18:46
  • just edited the question and added it, @Jestin – ntonnelier Sep 27 '16 at 18:56
  • 6
    If I would redesign Bitcoin Core today, I would start with a design where the wallet and the node functionality were separate (and work towards that is slowly underway in practice). By combining the two you are limiting your options. Write an SPV wallet first, and connect it to an existing full node. That way you don't risk introducing consensus bugs (which are extremely hard to find, experience has shown). – Pieter Wuille Sep 27 '16 at 19:15
  • 1
    The ultimate, and authoritative, documentation is the source code of Bitcoin Core. – Nate Eldredge Sep 27 '16 at 20:12
  • It would be nice if most android spv wallets gave you the option of connecting to a specific set of full nodes. – Erik Aronesty Sep 28 '16 at 20:25
2

The bitcoin.it wiki contains a Protocol documentation section with information about network messages mostly. You can also use other pages of this wiki, but be sure to check it's up to date.

Ultimately, the documentation you are looking for, as mentionned by the commenters, is Bitcoin Core's source code (unfortunately) ; if you want to create a full node implementation, you'll have to be bug for bug compatible.

Finally, to test your progress, you can use https://github.com/TheBlueMatt/test-scripts to see how your implementation handles some edge cases, as well as run it on testnet.

1

I'd suggest you to start from making an offline blockchain-parser. Use the block stored on disk and start parsing them in order to build (and update) the UTXO database. This is the most crucial and performance critical part - if you have it working, the network part will not need much more of the resources.

Later, when you start playing with the network part, you will likely encounter problems that are much harder to analyse and fix, because to the asynchronous matter of the events. Still having a stable (and well performing) blockchain parser will benefit you hugely at this stage.

Also I'd advise you to not implement memory pool and transaction relaying from the start - make sure that processing of new blocks is stable before adding the memory pool feature.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.