Skip to main content

Try it Live

Run Signature examples in the interactive playground

Signature Recovery

Recover public keys and addresses from ECDSA signatures using the recovery ID (v parameter).

Overview

ECDSA signatures allow recovering the signer’s public key from the signature and message hash. This is a key feature of Ethereum transactions, enabling address derivation without storing public keys. Supported Algorithms:
  • ✅ secp256k1 (Ethereum, Bitcoin)
  • ❌ P-256 (no recovery support)
  • ❌ Ed25519 (no recovery support)

Recovery Process

Public Key Recovery

Secp256k1 signatures can recover the public key that created the signature:
See: Secp256k1.recoverPublicKey in crypto module

Address Recovery

Ethereum addresses are derived from public keys via keccak256 hash:
See: Secp256k1.recoverAddress in crypto module

Recovery ID (v)

The recovery ID determines which of four possible public keys is correct.

Standard Values

Ethereum (pre-EIP-155):
EIP-155 (chain-specific):

Converting v Values

Recovery Examples

Ethereum Transaction Recovery

EIP-712 Signed Message Recovery

Personal Sign Recovery

Recovery Validation

Verify Recovery Success

Handle Recovery Errors

Multiple Recovery Attempts

When v is unknown, try all possibilities:

Security Considerations

Canonical Signatures

Always normalize signatures before recovery to prevent malleability:
Always normalize before recovery:

Message Hash Validation

Recovery ID Bounds

Performance

Recovery Cost

Public key recovery is computationally expensive:

Optimization Strategies

Cache recovered addresses:
Batch recovery:

Algorithm Comparison

Note: Only secp256k1 supports public key recovery. Other algorithms require storing the public key separately.

See Also