Bitcoin Forum

Bitcoin => Project Development => Topic started by: jackg on November 19, 2018, 03:32:15 PM



Title: C# bitcoin core code conversion
Post by: jackg on November 19, 2018, 03:32:15 PM
I was talking with a friend a few days ago and we were looking at benchmarking times for c++ and c# and it seems that c# may be faster for coding bitcoin core in (or at least won't make too mcuh difference).

I'm considering taking on the task of converting the entire source from c/c++ to c# and I'm wondering whether it would increase node speeds b quite a bit when I publish the code. I'm realistic and would look to publish the code in around 10 months (I've had a quick look at the bitcoin core source code and since I'm not really building anything from scratch, I feel it should take about this time as a bit of a hobbyistic process - not loooking forward to doing teh gui, maybe I'll just make it console based to start with)... IS there alos a list of when each version is planned to be released or is there no such planning involved in bitcoin core's programming?


Title: Re: C# bitcoin core code conversion
Post by: Elliptic23 on November 20, 2018, 03:42:42 AM
What's the point of doing a conversion? Better to build a client from scratch that is compliant with the Bitcoin protocol.


Title: Re: C# bitcoin core code conversion
Post by: Coding Enthusiast on November 20, 2018, 05:59:47 AM
Programming language (in my opinion) is the last thing that is affecting speed and efficiency of a code. It is the programmer that is making it fast or slow depending on the way their implementation is.
In any case I always love to see projects that are in C♯ although I would suggest building it from scratch instead of "converting" code. That way you won't import bugs or inefficiencies in your own code. What you can do is to implement each part then compare implementations with each other to improve your code (that is what I have been doing for my library so far).


Title: Re: C# bitcoin core code conversion
Post by: Piggy on November 20, 2018, 07:06:32 AM
As much as i like .Net and C# in particular ( it's great as is making much faster to develop and prototype), it will always have some overhead compared with other low level languages, in particular if you are performing heavy calculations. But in this case it may not matter indeed.

In any case I always love to see projects that are in C♯ although I would suggest building it from scratch instead of "converting" code. That way you won't import bugs or inefficiencies in your own code. What you can do is to implement each part then compare implementations with each other to improve your code (that is what I have been doing for my library so far).

There is also the chance of adding new bugs going that way :), however starting from the begin with a good set of unit tests may help to avoid problems.


Title: Re: C# bitcoin core code conversion
Post by: HeRetiK on November 20, 2018, 10:09:08 AM
Seems like quite an undertaking! Despite c# being as popular as it is, I'm not sure how much usage such a project would see in practice, as I believe most c# developers are fine with simply using wrappers. I'm not a c# developer myself though, so I know little about what's commonly used. Still I could imagine such a project being a welcomed addition to the ecosystem.


not loooking forward to doing teh gui, maybe I'll just make it console based to start with)...

I think it's fine to start with a console-only version, if the project gains traction you might easily find someone else supporting you with the GUI.


IS there alos a list of when each version is planned to be released or is there no such planning involved in bitcoin core's programming?

As far as I'm aware of there's neither a planned release cycle nor an official development roadmap for Bitcoin Core.

To stay up-to-date with current developments it may make sense to join the mailing list, if you haven't already:
https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev

There's little being discussed in terms of timelines though.


Title: Re: C# bitcoin core code conversion
Post by: jdbtracker on November 20, 2018, 11:04:05 PM
Great Idea! Totally go for it as a Hobby. It'll be fun... just use Microsoft Visual Studio and create a windows template so it does the layout for you. It's faster and keeps you focused on the important stuff. If you like you can learn how to make your own Windows for the UI.



Title: Re: C# bitcoin core code conversion
Post by: jackg on November 21, 2018, 12:02:20 AM
Great Idea! Totally go for it as a Hobby. It'll be fun... just use Microsoft Visual Studio and create a windows template so it does the layout for you. It's faster and keeps you focused on the important stuff. If you like you can learn how to make your own Windows for the UI.



Yes! This is what I was thinking too.

Ms vs is quite good for programming stuff and there err also compilers for Linux with c# if I manage to make anything useful. I think there are also built in things for visual studio too. I’ll have to try to spend a month designing and looking at how bitcoin core functions in order to write my code to be as compatible as possible. (It needs to be able to down,lad and validate the blockchain for a start)...


Title: Re: C# bitcoin core code conversion
Post by: pooya87 on November 21, 2018, 03:05:31 AM
Great Idea! Totally go for it as a Hobby. It'll be fun... just use Microsoft Visual Studio and create a windows template so it does the layout for you. It's faster and keeps you focused on the important stuff. If you like you can learn how to make your own Windows for the UI.



Yes! This is what I was thinking too.

Ms vs is quite good for programming stuff and there err also compilers for Linux with c# if I manage to make anything useful. I think there are also built in things for visual studio too. I’ll have to try to spend a month designing and looking at how bitcoin core functions in order to write my code to be as compatible as possible. (It needs to be able to down,lad and validate the blockchain for a start)...

if you want your code to run on multiple platforms and not just be for windows then you have to write it using .Net core and avoid anything that is windows focused (e.g. WPF is only for windows, .Net framework is only for windows,...).
my suggestion is to use .Net standard library project type for your libraries and for your GUI you can use Avalonia[1] which is a WPF like GUI that works on multiple platforms.
and good luck.

https://github.com/AvaloniaUI/Avalonia


Title: Re: C# bitcoin core code conversion
Post by: Piggy on November 21, 2018, 06:59:19 AM
I never used .Net core and i believe is the best way to go, but running Windows applications built with .Net it's working fairly well out of the box with Mono as well for that little i have tried. However the overhead must be pretty high i guess.

My bot is essentially just compiled in visual studio and then the same exe and libraries are just working by magic with mono on Linux.  :)


https://www.mono-project.com