Giter Club home page Giter Club logo

Comments (14)

jacogr avatar jacogr commented on July 22, 2024 1

This maps to what is done in substrate/polkadot, i.e. https://github.com/paritytech/substrate/blob/master/core/primitives/src/ed25519.rs#L334-L340

At launch, the default pairs will be sr25519 (for general accounts, i.e. https://github.com/w3f/schnorrkel) and TBD for sessions (currently the only place ed25519 generally should be used atm since sr25519 is not supported there yet)

from common.

jacogr avatar jacogr commented on July 22, 2024 1

@hskang9 I would suggest contacting the W3F for a couple of reasons -

  • they did the w3f/schnorrkel and worst-case can get you in touch with the guy behind that
  • they may very well be open for the suggestion of a port + bounty on the port

from common.

jacogr avatar jacogr commented on July 22, 2024 1

The C wrapper is fine, but doesn’t really help in a RN or browser environment, only in a Node.js env.

And yes, Jeff is the right person from a technical POV. (Obviously:))

from common.

jacogr avatar jacogr commented on July 22, 2024 1

Really looking forward to playing with whatever you come up with. (Like I mentioned earlier, not something I would attempt myself since I'm no immersed enough in the crypto world, and well, idiots shouldn't do crypto, but would love a JS impl)

from common.

0xthreebody avatar 0xthreebody commented on July 22, 2024 1

The C wrapper is fine, but doesn’t really help in a RN or browser environment, only in a Node.js env.

And yes, Jeff is the right person from a technical POV. (Obviously:))

The Hardware wallet need C or C++ sr25519 lib. Such as: Arduino Nano

from common.

0xthreebody avatar 0xthreebody commented on July 22, 2024 1

@hskang9
C language implementation.
https://github.com/Warchant/sr25519-crust

https://travis-ci.org/Warchant/sr25519-crust

from common.

hskang9 avatar hskang9 commented on July 22, 2024 1

@jacogr don't just discourage yourself, there must be something that we can do together. I will post the repo for that here. @jiangfuyao Thank you for introducing wrapper interface, I should look into that and use it to build js wrapper, but I think I will first make ristretto point layer to feed as a seed in x25519 algorithm. After I tweaked around the code, it looks like sr25519 consists of

seed -> ristretto point serialized as 32 bytes for key property in x25519 extended key -> sr keypair

I am excited as well to build this layer for sr25519.

from common.

hskang9 avatar hskang9 commented on July 22, 2024

Will sr25519 lib be used asynchronously due to the fact that wasm has to be compiled asynchronously or will it be synchronous by porting sr25519 in javascript or update when wasm can be compiled synchronously?

from common.

jacogr avatar jacogr commented on July 22, 2024

Currently the WASM is instantiated in an async manner. (Not pretty since it "hacks around" the Rust wasm-pack somewhat - https://github.com/polkadot-js/wasm/blob/master/scripts/build-package.sh#L76. Build process used wasm-pack to build and then adjusts the outputs for async and some other polyfills).

In a Node.js env sync works really well, however in browser webpack environments the sync init does not work as well, or rather results in something that doesn't work and throws warnings.

For all the functions exposed in that repo, there are JS fallbacks, e.g. ed25519 or blake2, etc. (when the WASM is not instantiated yet), however there is nothing like that for sr25519. Atm there are no plans to port this to JS - would love a JS implementation, however prefer not doing crypto code myself and leave it yo people who work with thius stuff the whole day.

(As an aside there has been some playing with an asm.js fallback version, however it just bloats the packages completely to >13MB, so effectively if you don't have a WASM-capable env. at present, there is no sr25519 support at all)

from common.

hskang9 avatar hskang9 commented on July 22, 2024

I agree that wasm for now is really tricky, and I heard that they are working on synchronous compilation this year. Okay working on js implementation starting now. I hope if there is a bounty on this.

from common.

hskang9 avatar hskang9 commented on July 22, 2024

@jacogr Thank you! I have already sent burdges in w3f for my plan to work on this, but here are two plans to share the suggestion that I have thought.

  1. w3f/schnorrkel is based on curve25519-dalek from Ristretto Group, and I found a C implementation. I am thinking to make Js wrapper of that C library and build schnorrkel great again with js.

  2. Configure some constants in existing ed25519 js lib. After I investigated and asked Mr.Burdges, I found out that the curve is same between ed25519 and sr25519 hopefully, so I think this is probably the easiest one if I can just apply the corresponding configuration there(e.g. ristretto points).

from common.

hskang9 avatar hskang9 commented on July 22, 2024

I think I would have to add ristretto group layer to use it with ed25519's key in Extended key type to make sr25519.

I will get confirm from him in a day or tmrw.

from common.

jacogr avatar jacogr commented on July 22, 2024

Closing this one. Happy as it stands with the WASM bridge.

from common.

polkadot-js-bot avatar polkadot-js-bot commented on July 22, 2024

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue if you think you have a related problem or query.

from common.

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.