signaturesecp256k1 Sign

Sign a 32-byte message hash using a secp256k1arrow-up-right private key. Produces a 65-byte signature in the (r, s, v) format. This allows contracts to generate signatures on-chain -- something that is normally only possible off-chain with a user's wallet.

circle-exclamation

Input

Raw bytes in the following layout (64 bytes total):

Offset
Field
Type
Description

[0:32]

private key

32 bytes

secp256k1 private key

[32:64]

message hash

32 bytes

Hash of the message to sign

Output

Bytes
Type
Description

signature

65 bytes

Signature in (r, s, v) format

Use cases

  • Generating on-chain attestations or proofs

  • Building contracts that can act as signers (e.g., smart-contract wallets)

  • Creating signed messages for cross-chain verification

Examples

Built-in helper

Manual usage

Last updated