Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pRuntime: Switch identity and ecdh key to sr25519 #37

Closed
2 of 3 tasks
h4x3rotab opened this issue Aug 1, 2020 · 3 comments
Closed
2 of 3 tasks

pRuntime: Switch identity and ecdh key to sr25519 #37

h4x3rotab opened this issue Aug 1, 2020 · 3 comments
Assignees
Labels
bounty-m Mid-size Bounty attached enhancement New feature or request pRuntime

Comments

@h4x3rotab
Copy link
Contributor

h4x3rotab commented Aug 1, 2020

Substrate already provides full featured crypto libraries including ecdsa (secp256k1). No reason to import the additional libsecp256k1 now. Sr25519 is also the substrate default curve. So it's a good idea to stick to it.

Note that the signature of sr25519 has a different length than its of secp256k1. So we might need to adjust the signature field length accordingly. We don't do it until PoC-3 because it may introduce some serialization compatibility problems.

@h4x3rotab h4x3rotab added enhancement New feature or request pRuntime labels Aug 1, 2020
@h4x3rotab
Copy link
Contributor Author

It turned out the current Substrate in master branch doesn't support "full_crypto" signing in no_std environment. However the upstream has already updated it:

https://github.com/paritytech/substrate/blob/aaba404aa3f14e35d9409a0a76f6b8f5a29bb862/primitives/core/src/sr25519.rs#L458

@h4x3rotab
Copy link
Contributor Author

This is hard, because the upstream ed25519 library never took care of signature signing in no_std env (didn't confirm).

It looks like ed25519 signing requires a source of random number. This issue mentioned rand is the blocking issue for no_std signing, and it's not trivial to fix because it's a deep dependency of ed25519-dalek. We should confirm the problem and file an issue in ed25519-dalek.

@h4x3rotab h4x3rotab added the bounty-m Mid-size Bounty attached label Mar 31, 2021
@h4x3rotab h4x3rotab changed the title pRuntime: Switch identity key from secp256k1 to sr25519 pRuntime: Switch identity and ecdh key to sr25519 Jul 13, 2021
@h4x3rotab
Copy link
Contributor Author

Let's close this so far. The Web end integration can be investigated later, but not too hard. Schnorrkel is already compiled to wasm and used by polkadot.js api now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bounty-m Mid-size Bounty attached enhancement New feature or request pRuntime
Projects
None yet
Development

No branches or pull requests

2 participants