This repository has been archived by the owner on Nov 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
contracts: Sr25519 (Schnorrkel) signature verification #13703
Labels
J0-enhancement
An additional feature request.
Z1-easy
Can be fixed primarily by duplicating and adapting code by an intermediate coder
Comments
10 tasks
corresponding polkadot js extension issue: polkadot-js/extension#1237 |
It is possible to do Sr25519/Ed25519 signature verification in ink! by using chain extensions (pallet-contracts extension). However, I also would like to know about potential ink! native multi signature schemes verification support, and current plans. |
As a cryptographic primitive which is native to substrate we should include such a function into the core API of pallet-contracts. |
athei
changed the title
Sr25519 (Schnorrkel) signature verification
contracts: Sr25519 (Schnorrkel) signature verification
Mar 24, 2023
github-actions
bot
added
the
J2-unconfirmed
Issue might be valid, but it’s not yet known.
label
Mar 24, 2023
athei
added
J0-enhancement
An additional feature request.
Z1-easy
Can be fixed primarily by duplicating and adapting code by an intermediate coder
and removed
J2-unconfirmed
Issue might be valid, but it’s not yet known.
labels
Mar 24, 2023
github-project-automation
bot
moved this from Code in review 🧐
to Done ✅
in Smart Contracts
Apr 12, 2023
Ink should use the substrate host calls for sr25519, no? |
Yes. The PR that closes this issue did exactly this. It exposes this host functions to contracts. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
J0-enhancement
An additional feature request.
Z1-easy
Can be fixed primarily by duplicating and adapting code by an intermediate coder
Questions
FAQ
cargo-contract
? Check viacargo contract --version
.Describe the bug
I cannot verify a sr25519 (schnorrkel) signature.
Expected behavior
Ability to verify a sr25519 (schnorrkel) signature in a manner similar to the
ecdsa_recover()
function.Screenshots
Additional context
Our business logic dictates that we need to sign a payload on our frontend using the polkadot JS extension. Unfortunately, the keyring used by the extension stores the keys in sr25519 format and provide no functionality to load keys in a different format.
We need to verify these sr25519 signatures in ink. However, only ecdsa verification is currently provided via the
ecdsa_recover()
function. As we cannot access ecdsa on the polkadot JS extension,ecdsa_recover()
is a no-go.I've managed to add the schnorrkel crate to our ink contract and successfully verify sr25519 signatures from the frontend. Anyone wanting to do the same can see our ink contract code here and js code here (one thing to note is that the polkadot js extension wraps the payload to sign in a
<Bytes>
tag - this was a big "gotcha!" for us).My question is: is sr25519 going to be implemented in ink? Or is importing the schnorrkel crate the only option? Schnorrkel adds ~30KB to the contract size, which is an unfortunate but necessary hit for us at the moment.
The text was updated successfully, but these errors were encountered: