16

I recently became aware that python-bitcoinlib is not a full bitcoin node implementation, but rather a set of tools to work with bitcoin-core cpp. I would like to know whether there are some fundamental issues with implementing a complete bitcoin node using python? Also if it were to be tried as a code-golf exercise (the shortest code to get the full node running) how many lines of code will it amount to in python ??

7
  • Performance-wise this would be bad idea, as Python dynamic programming language tend to use more RAM on data structures. It could be however interesting exercise. Dec 7, 2015 at 18:48
  • 1
    @MikkoOhtamaa: Python is perfectly capable of handling the performance requirements of a Bitcoin node. The answers so far point to several projects that do this. Dec 7, 2015 at 19:15
  • @GregHewgill: But none of those can serve as a complete replacement for bitcoin-core, right? Dec 7, 2015 at 19:17
  • 1
    @user2277550: I don't see why not. There's no underlying reason why Python would be unsuitable for this purpose. It's certainly more than capable enough. It sounds like you're asking whether somebody else has already written in Python exactly what you have in mind. Maybe, maybe not. But it's possible to do so. Dec 7, 2015 at 19:19
  • 1
    @MikkoOhtamaa: The existing answers already have several links. I'm not sure what more you're asking for. Dec 7, 2015 at 19:21

4 Answers 4

8

AFAIK, there is no fundamental issues with implementing a complete bitcoin node using python, there is even some cool projects of Bitcoin full node in Python

7

That strongly depends on your definition of complete. There are a number of implementations that implement parts of the Bitcoin node functionality. For example cdecker/pycoin has a solid network implementation, but does not include wallet management code and validation logic. richardkiss/pycoin on the other hand has some of the wallet logic, but lacks networking. Other libraries include:

But as far as I know there is no standalone client that includes a wallet as well as the networking code.

0
2

Check out Tinychain.

It isn't complete and will never inter-operate with the real Bitcoin network, but it is a "code golf" approach to implementing all the Bitcoin core ideas (validation, POW mining, peer-to-peer architecture, data structures like TxIn/TxOut/Block, etc) in Python.

1

There is a project, which is a complete bitcoin implementation in python. The source code at https://github.com/csunny/py-bitcoin

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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