Forum Home
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Popular

    [Dev] Java NeoScrypt Implementation

    Technical Development
    7
    16
    6212
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • kris_davison
      kris_davison last edited by

      Your probably right I think maybe that would be a great first solution to the android wallet issue.

      But I do still believe that a java implementation would be useful going forward as its write once run anywhere which may help in the long run.

      (Not that c cant run anywhere but its platform specific so you know what I mean.)

      1 Reply Last reply Reply Quote 0
      • wrapper
        wrapper Moderators last edited by

        It’s an interesting topic to get into but very specialised. Its’ also “once only task”, so difficult to build up experience.

        At the moment I agree with Wellenreiter’s way forward. Unless there is another reason re-using the upstream work would seem more efficient and require less maintenance; if there are changes.

        1 Reply Last reply Reply Quote 0
        • SpartanC001
          SpartanC001 Regular Member last edited by

          This seems like a good idea, as it could also be implemented into the browser (think of bitcoinplus.com), and if its performance can get anywhere close to minerd it could be an easier option for those who only cpu mine, or have a redundant pc or 2 they wanted to use

          also the java applet can be updated on the file server (i believe it works like this) and clients simply restart/refresh to pull the latest version from it, hence updates/performance fixes would be easier,

          as for a java based Feathercoin wallet, im not so sure, because of the vulnerabilities ive heard about it (unless they are just myths - let me know then i can stop being concerned about that), but as for a miner, great, makes it more portable, and hey if it can run on android, i’d even mine with my old galaxy mini! probably hits about 5s per hash its that slow but every little helps xD

          1 Reply Last reply Reply Quote 0
          • ghostlander
            ghostlander Regular Member last edited by

            Kris, you need to create simple test functions like those in NEOSCRYPT_TEST and compare your results with the reference. It saves a good deal of time, really.

            1 Reply Last reply Reply Quote 0
            • kris_davison
              kris_davison last edited by

              Yes that’s the type of thing I was looking for.

              I want to write jUnits to make sure the code works as expected and to make sure if anyone makes any changes in the future they can tell if they have broken anything.

              I cant find NEOSCRYPT_TEST in github could you point me in the right direction please.?

              As for java vulnerabilities are potentially real but really only effect people who are not keeping there version of java up to date. This is much the same with any software as when vulnerabilities are found they are usually quickly fixed but you must update/upgrade to make sure you have the most stable secure version.

              1 Reply Last reply Reply Quote 0
              • ghostlander
                ghostlander Regular Member last edited by

                https://github.com/ghostlander/NeoScrypt/blob/11bb888082b93cf6f7faee1abdc70296c7bd1e66/neoscrypt.c#L1269

                I’ve added more tests already, but they are not there yet.

                1 Reply Last reply Reply Quote 0
                • kris_davison
                  kris_davison last edited by

                  ok ive been doing some work on getting java to call c and i have made some progress at last.

                  i now have my java code calling a c function with this signature

                  in Java

                  neoscrypt(int input, int output, long profile);

                  in my new C method

                  neoscrypt(jint input, jint input, jlong profile)

                  I have had to use int and long respectively as java does not have unsigned char or unsigned int so i have just bumped up to the next size up so it can hold the value needed in c.

                  ok now I have included ghostlanders neoscrypt.h in my own c class (Neoscrypt.c which was a bad name i know lol) and have implemented this method. (its a little non standard as its using JNI so java can call it.)

                  #include "Neoscrypt.h"#include "neoscrypt.h"
                  
                  
                  JNIEXPORT void JNICALL Java_Neoscrypt_printText(JNIEnv *env, jobject obj)
                  {
                     puts ("Hello World  !!!!");}
                  JNIEXPORT void JNICALL Java_Neoscrypt_neoscrypt(JNIEnv *env, jobject obj, jint input, jint output, jlong profile) {   puts("Called Neoscrypt function .....");   const unsigned char *inputChar;   unsigned char *outputChar;   unsigned int profileInt;   inputChar = (unsigned char *)input;   outputChar = (unsigned char *)output;   profileInt = (unsigned int)profile;   puts(".......Neoscrypt function finshed");   neoscrypt(inputChar,outputChar,profileInt);   return; }
                  

                  essentially im stuck as I dont know any C and I need to figure out how to get the value out of the jint and into an unsigned char * so it can be passed to the real method below.

                  I have a hello world c function that is being called from java so Im making progress but im instantly out of my depth with c.

                  any help would be great.

                  1 Reply Last reply Reply Quote 0
                  • kris_davison
                    kris_davison last edited by

                    ok ignore that last post.

                    I now have a working (I think) JNI java wrapper for neoscrypt.

                    its only a standalone one for now but thats a step in the right direction.

                    its hosted here if anyone is interested

                    https://github.com/kris-davison/neoscrypt-jni-standalone

                    1 Reply Last reply Reply Quote 0
                    • ?
                      A Former User last edited by

                      Epic!

                      1 Reply Last reply Reply Quote 0
                      • ?
                        A Former User last edited by

                        +1
                        +1

                        1 Reply Last reply Reply Quote 0
                        • Wellenreiter
                          Wellenreiter Moderators last edited by

                          ok ignore that last post.

                          I now have a working (I think) JNI java wrapper for neoscrypt.

                          its only a standalone one for now but thats a step in the right direction.

                          its hosted here if anyone is interested

                          https://github.com/kris-davison/neoscrypt-jni-standalone

                          Great work :)

                          I’ll give it a try as soon as possible

                          Feathercoin development donation address: 6p8u3wtct7uxRGmvWr2xvPxqRzbpbcd82A
                          Openpgp key: 0x385C34E77F0D74D7 (at keyserver.ubuntu.com)/fingerprint: C7B4 E9EA 17E1 3D12 07AB 1FDB 385C 34E7 7F0D 74D7

                          1 Reply Last reply Reply Quote 0
                          • ketetefid
                            ketetefid Regular Member last edited by

                            Does this mean that we can hash on our mobile devices? Or it can do other things?

                            1 Reply Last reply Reply Quote 0
                            • kris_davison
                              kris_davison last edited by

                              Well technically yes we could write a miner android app. But the implementation was really for validating blocks in a wallet rather than mining. :)

                              1 Reply Last reply Reply Quote 0
                              • Wellenreiter
                                Wellenreiter Moderators last edited by

                                There is a java wrapper around the neoscrypt c-code available on github now.

                                Due to the nature of the native library neoscrypt.so it is working for arm devices only, but it should be no big problem to compile the neoscrypt C-code on other hardware.

                                The java neoscrypt repository is located at: https://github.com/wellenreiter01/neoscryptj

                                Feathercoin development donation address: 6p8u3wtct7uxRGmvWr2xvPxqRzbpbcd82A
                                Openpgp key: 0x385C34E77F0D74D7 (at keyserver.ubuntu.com)/fingerprint: C7B4 E9EA 17E1 3D12 07AB 1FDB 385C 34E7 7F0D 74D7

                                1 Reply Last reply Reply Quote 0
                                • First post
                                  Last post