rotilho / jnano-commons Goto Github PK
View Code? Open in Web Editor NEWJNano Commons provides a set of low level Nano operations that includes signing, seed generation, block hashing and account creation in Java
License: MIT License
JNano Commons provides a set of low level Nano operations that includes signing, seed generation, block hashing and account creation in Java
License: MIT License
Currently we are using ED25519 provided by k3d3 and as he state in his repo:
This library was the first implementation of ed25519 in Java, and I highly recommend you don't use this for anything serious. It uses BigInteger for everything and is therefore extremely slow (takes 5 seconds to sign a message) and is also not secure against side-channel or timing attacks.
So migrate to str4d/ed25519-java is a must before the first release
Hi,
I recently switched Natrium to use JNano classes and functions, for code simplification and because I planned on using JNano anyway for Mnemonics down the line.
I ran into a couple issues, the first one may not be an issue with library but an issue with my build settings (I haven't been able to figure it out yet though)
On a android 6.0, 32-bit device (armeabi-v7a) - I get the following when trying NanoKeys.createPrivateKey
Process: co.banano.natriumwallet, PID: 6190
java.lang.NoClassDefFoundError: com.rotilho.jnano.commons.-$$Lambda$NanoKeys$To3fvqZ6OqDSbslOGNAscJLDYzE
at com.rotilho.jnano.commons.NanoKeys.createPrivateKey(NanoKeys.java:12)
at co.banano.natriumwallet.KaliumUtil.seedToPrivate(KaliumUtil.java:48)
at co.banano.natriumwallet.model.Credentials.setSeed(Credentials.java:55)
at co.banano.natriumwallet.ui.intro.IntroWelcomeFragment$ClickHandlers.lambda$onClickNewWallet$0(IntroWelcomeFragment.java:74)
at co.banano.natriumwallet.ui.intro.-$$Lambda$IntroWelcomeFragment$ClickHandlers$J_jelFXY-c9L5iUyzoeIh90MgC4.execute(lambda)
at io.realm.Realm.executeTransaction(Realm.java:1431)
at co.banano.natriumwallet.ui.intro.IntroWelcomeFragment$ClickHandlers.onClickNewWallet(IntroWelcomeFragment.java:72)
at co.banano.natriumwallet.databinding.FragmentIntroWelcomeBindingImpl$OnClickListenerImpl1.onClick(FragmentIntroWelcomeBindingImpl.java:147)
at android.view.View.performClick(View.java:5198)
at android.view.View$PerformClick.run(View.java:21147)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Separate, but also occurring on older android versions is an issue with NanoSeeds.generateSeed()
I get the exception:
java.lang.NoSuchMethodError: No static method getInstanceStrong()Ljava/security/SecureRandom; in class Ljava/security/SecureRandom; or its super classes (declaration of 'java.security.SecureRandom' appears in /system/framework/core-libart.jar)
at com.rotilho.jnano.commons.NanoSeeds.generateSeed(NanoSeeds.java:25)
at co.banano.natriumwallet.KaliumUtil.generateSeed(KaliumUtil.java:29)
at co.banano.natriumwallet.ui.intro.IntroWelcomeFragment$ClickHandlers.lambda$onClickNewWallet$0(IntroWelcomeFragment.java:74)
at co.banano.natriumwallet.ui.intro.-$$Lambda$IntroWelcomeFragment$ClickHandlers$J_jelFXY-c9L5iUyzoeIh90MgC4.execute(lambda)
at io.realm.Realm.executeTransaction(Realm.java:1431)
at co.banano.natriumwallet.ui.intro.IntroWelcomeFragment$ClickHandlers.onClickNewWallet(IntroWelcomeFragment.java:72)
at co.banano.natriumwallet.databinding.FragmentIntroWelcomeBindingImpl$OnClickListenerImpl1.onClick(FragmentIntroWelcomeBindingImpl.java:147)
at android.view.View.performClick(View.java:5198)
at android.view.View$PerformClick.run(View.java:21147)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
This is something I could account for myself if you do not want to, but appears older Android SDKs do not support SecureRandom.getInstanceStrong()
, which is likely why NWC went with a custom implementation as seen here: https://github.com/bbedward/natrium-nano-wallet/blob/master/app/src/main/java/co/banano/natriumwallet/util/LinuxSecureRandom.java
I'd appreciate any help on these problems, of course Natrium full source can be seen at https://github.com/bbedward/natrium-nano-wallet
On 64-bit, newer devices everything that I have used has worked with no problems.
Thanks!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.