LearnBitcoin

Bitcoin Dev Archive 2019

Improving Pre and Post Merging Abilities With Rewriting Core In Python

4 messages, 23 to 27 Apr 2019. Started by Ahmer Regos.

Ahmer Regos, Andrew Chow, Hampus Sjöberg, Peter Todd

Permalink Original thread on gnusha.org

Ahmer Regos permalink original

I'm proposing re-writing bitcoin codebase in Python for improving pre and post merging abilities, faster operations and better understandability. Python is a fast language with C support, it is good with hashing things, it has a good syntax and everyone can read / understand it unlike C++.

I am willing the coordinate the transformation operation and i believe it would be really good the get rid of C++.

- Ahmer Regos from Regain Beaches.
Andrew Chow in reply to Ahmer Regos permalink original

Feel free to re-implement Bitcoin Core in Python. It's open source software and you can do whatever you want.

However Bitcoin Core is not going move to Python and rewrite everything in Python. Besides the fact that Python is far less efficient than C/C++, rewriting Bitcoin Core in any other language would be a huge undertaking and introduce many bugs for almost no benefit whatsoever. Bitcoin Core won't be changing languages for the entire codebase, but you are welcome to port it to Python yourself.

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐ On Tuesday, April 23, 2019 4:16 AM, Ahmer Regos via bitcoin-dev <bitcoin-dev@lists•linuxfoundation•org> wrote:

Quoted text (5 lines)
> I'm proposing re-writing bitcoin codebase in Python for improving pre and post merging abilities, faster operations and better understandability. Python is a fast language with C support, it is good with hashing things, it has a good syntax and everyone can read /  understand it unlike C++.
>
> I am willing the coordinate the transformation operation and i believe it would be really good the get rid of C++.
>
> - Ahmer Regos from Regain Beaches.
Hampus Sjöberg in reply to Ahmer Regos permalink original

Bitcoin is a consensus critical system. We have already had consensus problems between Bitcoin Core-versions, rewriting everything in another language would expose us to even greater risks, and moving to a language like Python I see no benefit whatsoever.

Best Hampus

Den tis 23 apr. 2019 kl 16:47 skrev Ahmer Regos via bitcoin-dev < bitcoin-dev@lists•linuxfoundation•org>:

Quoted text (14 lines)
> I'm proposing re-writing bitcoin codebase in Python for improving pre and
> post merging abilities, faster operations and better understandability.
> Python is a fast language with C support, it is good with hashing things,
> it has a good syntax and everyone can read /  understand it unlike C++.
>
> I am willing the coordinate the transformation operation and i believe it
> would be really good the get rid of C++.
>
> - Ahmer Regos from Regain Beaches.
> _______________________________________________
> bitcoin-dev mailing list
> bitcoin-dev@lists•linuxfoundation•org
> https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev
>
Peter Todd in reply to Andrew Chow permalink original

On Tue, Apr 23, 2019 at 03:23:27PM +0000, Achow101 via bitcoin-dev wrote:

Quoted text (3 lines)
> Feel free to re-implement Bitcoin Core in Python. It's open source software and you can do whatever you want.
>
> However Bitcoin Core is not going move to Python and rewrite everything in Python. Besides the fact that Python is far less efficient than C/C++, rewriting Bitcoin Core in any other language would be a huge undertaking and introduce many bugs for almost no benefit whatsoever. Bitcoin Core won't be changing languages for the entire codebase, but you are welcome to port it to Python yourself.

Speaking as maintainer of the Python library python-bitcoinlib, I don't think using Python for security critical codebases is a good idea. It's just too easy to make mistakes; I wouldn't recommend new projects use python-bitcoinlib.

Currently I'm doing 100% of my new projects on Rust. That's not to say Rust is the only language usable for this kind of work. But it fits my style of programming well and the type system - esp good handling of immutability - appears to offer significant benefits.