Git Product home page Git Product logo

Comments (8)

orogvany avatar orogvany commented on July 28, 2024

I think this is potentially user error

which hash256 algorithm are you using? you should be using
HASH_ALGORITHM = "BLAKE2B-256";

from semux-core.

orogvany avatar orogvany commented on July 28, 2024

in your code you aren't signing the transaction...
you need to sign it before verifying :D

I was able to successfully validate this with both Native and non native implementations. So it looks like if you sign the tx, it validates.

from semux-core.

orogvany avatar orogvany commented on July 28, 2024

Please try running

  byte[] msg = Bytes.random(100);
     byte[] hash = Hash.h256(msg);
     byte[] nativeHash = Native.h256(msg);
     System.out.println(Arrays.equals(hash,nativeHash));

and let me know what it prints

from semux-core.

orogvany avatar orogvany commented on July 28, 2024

Is this mobile/android? Yea, you might want to call Native.disable() when your program starts up.

It's weird that the native call executes without error... I'm not sure if JNI calls work on android, or if we need to compile for that platform, but using Native.disable() should help you.

from semux-core.

phash avatar phash commented on July 28, 2024

I disabled native completely.
I am using Blake2b-256 .. but i will check that.

I sign the tx... Without signing the error message is: not a correct hex string
So its simply signing wrong...

I will check fir blake- iirc it is set to default like in semux.

Pending mgr would accept a signed msg from own wallet- uses the same Algorithm for sig and validate...

from semux-core.

semuxgo avatar semuxgo commented on July 28, 2024

I believe we have compatibility tests between the native and Java BLAKE2b implementation. @phash please update this ticket if get more findings.

from semux-core.

semuxgo avatar semuxgo commented on July 28, 2024

Was running the following unit test, and get consistent behavior with/out native impl.

    @Test
    public void testCompatibility() {
        String raw = "0x00031409c5f2794d69717d538bfcc150644f7685945cfa00000002540be40000000000004c4b40000000000000000100000165c4f4f54700";
        Transaction tx = Transaction.fromEncoded(Hex.decode0x(raw));
        System.out.println(tx.validate(Network.MAINNET));
        Native.disable();
        System.out.println(tx.validate(Network.MAINNET));
    }

from semux-core.

phash avatar phash commented on July 28, 2024

Imho, this seems to be my fault... damn... Strings... it was blake2s instead of blake2b...

from semux-core.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.