Use both Java and C++ for cryptocurrency development
codablecash·@iizuka·
0.000 HBDUse both Java and C++ for cryptocurrency development
<html> <p><img src="https://steemitimages.com/DQmf1spPzfvNWuvTJBUHMm9Dx5DEnfiYhRymF9UQsAhdwH6/Screenshot%20from%202018-02-24%2022-41-18.png" width="616" height="295"/></p> <p>Now making ASIC & GPU resistant hash algorithm, which is yescript. And I decided to use JNI(Java Native Inerface) in calculating nonce.</p> <p>Performance of nonce calculation is very severe issue to make all full nodes fair for fair coin distribution.</p> <p>The demerit of using JNI is to make compiled Java binary incompatible for all OS platform. But full node is server software, so I'm going to specify OS and distribution. </p> <h2>Why C++ is necessary</h2> <p>I've told <a href="https://steemit.com/codablecash/@iizuka/development-environment-for-new-cryptocurrency">Java is good programming language</a> before. That's because maintain code is easy. But it has some weakpoints. There are two reasons to use C++.</p> <h3>Java can't use pointer</h3> <p>Java doesn't have pointer, so it have to make new object in order to implement following code.</p> <ul> <li>Giving pointer of byte array to other variables</li> <li>Manipulating value on byte array</li> </ul> <p>Java has Bytefuffer class which can share byte array. But it makes more memory object on comparing with C and C++.</p> <h3>Fastest implementation for fair distribution</h3> <p>C++ is much faster than Java, on such codes which use pointer. Therefore if a full node user make codablecash server which uses C++ implementation, the person can calculate nonce much faster.</p> <p>That means the full node can mine more blocks than others. It causes coin distribution problem.</p> <p>Therefore I decided to use C++ code with JNI.</p> <h2>Platform of full node server of Codecash</h2> <p>At first, I'm going to make server software whose target is 64bit linux. I guess most of users will use cloud servers, like Digital Ocean and AWS.</p> </html>