Starting PeercoinJ in Scala


#1

I am planning on using my upcoming summer vacation on writing a port of the Peercoin protocol in Scala. Scala runs on the JVM and is fully compatible with Java. And the old PeercoinJ project seems to be completely abandoned.

Ideally I’d like to have a fully functional PeercoinJ project up and running which is up to date with the latest Peercoin core protocol. Although it would internally be written in mostly Scala, I believe that having it be accessible and usable from Java would make it much easier for the many Java developers out there to start using and contributing to the Peercoin ecosystem. For example, making a JavaFX based graphical wallet, or making an Android wallet would be possible and far easier if there’s a PeercoinJ project available as a maven repository to add as a dependency in your favorite build system manager like Gradle or SBT.

As previously stated, I’m familiar with Java and Scala, but I have no knowledge of C++. Starting out with reading the source code for PeercoinJ and BitcoinJ, how familiar with C++ and Python would I have to be in order to be able to read the original Peercoin Core code and understand it. At least understanding on a high and abstract level how it works, so I can write some code in Scala which does exactly the same thing?

Regards,


#2

Sounds interesting!

My opinions below

Are you planning on a complete rewrite of ppcoind in Java?

Is there a java implementation of bitcoin? If so, that would be a good starting point since the codebases are related.

What about wrapping ppcoind in JNI calls? That way can avoid reimplementation and can also keep up as ppcoind evolves. Since there are some big changes coming in with merging the latest bitcoin to ppcoind, amongst the other features that are being added.


#3

I am a moderate beginner in Java/Scala, so this is both a learning project and an actual production project as I will need a PeercoinJ available dependency on Maven Central for other Peercoin related ideas I have. To begin with I will most likely just take what is available in the old but still working PeercoinJ port and rewrite the code in Scala, while also reading the sourcecode for BitcoinJ. This way I’ll get familiar with base 58 encoding and other nuts and bolts of how this actually work, while also having the possibility to read the original source code from Peercoin and Bitcoin in C++.

It is possible to wrap it in JNI calls, and it is probably also a shorter way to do it, but I am not sure that is the optimal solution if you want to make this as a dependency people can rely on when they want to make a wallet or PPC related piece of software for Android. The external dependency would make the jar file and apk package way too large for it to be running well on a mobile device.

Once the new changes are merged into ppcoind whne it is released, then I will deal with that and upgrade to that version, but in the meantime I’ll focus on just writing and porting as much of the code as possible into Scala in the PeercoinJ project, and learn as much as possible. Then I am ready to port the newly merged changes when they are released. And then finally I’ll be able to start making the JavaFX/ScalaFX Desktop and Android wallet I have been wanting to make for a long time. There really a a lot of features I have ideas for which I have not seen implemented anywhere. And just like @hrobeers I’d like to have it such that a certain percentage of the gains from minting, are donated to the Peercoin development foundation. And hopefully with many many many small such donations, by giving perhaps 5% of what is earned from minting among thousands of users, we’ll be able to get a continuous funding for Peercoin.


#4

I hope to bring my Android wallet and peercoinj more uptodate with the Bitcoin equivalents sooner or later. Unfortunately I do not have the time now, and I likely wont have much time until at least August.

I also would like to introduce minting to my Android wallet, but that is far off at this stage. I have many ideas, but too little time to do everything I want to!


#5

Like you I also won’t have much time until August. But I will slowly get started in July, and then August I will have all of my time available to work on Peercoin, which I also fully intend to do.

Perhaps we can work together a bit on the programming part on PeercoinJ or something :slight_smile:


#6

So you’re the guy behind PeercoinJ? Then I guess perhaps it might be better that I contribute to your repository instead of completely rebooting it. Although that would force it to be in Java and not Scala, and I’d like to explore Scala some more.

Anyway, I am also just finished moving, and only today have I managed to turn on the computer and getting internet, the next month will still be very busy, so I’d say in August I am also ready to really start working.