Skip to content

Onchain secp256k1 signatures operations #1134

@lgalabru

Description

@lgalabru

A decentralized solution / app is usually a combination of on-chain and off-chain logic.
One common way to achieve an on-chain settlement of operations being performed off-chain is to rely on signatures verifications.

If we want to see this kind of hybrid solutions running on Stacks v2, I'd suggest exposing the following native functions in clarity:

  • (secp256k1-recover (buff 32) (buff 64)) -> (response principal): take the message and the signature (compact format), return the recovered principal, or err.
  • (secp256k1-verify (buff 32) (buff 64) (buff 33)) -> (bool): take the message, the signature (compact format) and the public key, return a boolean.

Buffers lengths are consistent with https://docs.rs/crate/secp256k1/0.15.5/source/src/constants.rs

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions