ECDSA Signature Parser
Parse ECDSA signatures into r, s, v components
r: The x-coordinate of a random point on the elliptic curve (32 bytes)
s: The signature proof value (32 bytes)
v: Recovery ID that helps recover the public key (1 byte, optional)
Common v values:
- 27 or 28: Legacy Ethereum signatures
- 0 or 1: Modern EIP-2098 compact signatures
- 35+: EIP-155 signatures with chain ID
1. What is an ECDSA signature?
ECDSA (Elliptic Curve Digital Signature Algorithm) signatures are used in Ethereum to prove ownership of an address. A signature consists of three components: r, s, and optionally v.
2. How does it work?
ECDSA uses elliptic curve mathematics to create signatures. The signer generates a random point on the curve (r coordinate), then uses their private key and message hash to compute s. The v value (recovery ID) helps recover the public key from the signature. Ethereum uses the secp256k1 curve for this process.
Signature formats
Ethereum signatures can be in two formats:
- 65 bytes (130 hex): r (32) + s (32) + v (1) - Standard format with recovery ID
- 64 bytes (128 hex): r (32) + s (32) - Compact format without v
Recovery ID (v)
The v value helps recover the public key from the signature:
- 27/28: Original Ethereum (pre-EIP-155)
- 0/1: EIP-2098 compact signatures
- 35+: EIP-155 with chain ID protection
Formula for EIP-155: v = chainId * 2 + 35 + yParity
3. Examples
Standard 65-byte signature
0x + 64 hex chars (r) + 64 hex chars (s) + 2 hex chars (v) = 130 totalCompact 64-byte signature
0x + 64 hex chars (r) + 64 hex chars (s) = 128 totalLegacy v values
v = 27 (0x1b) or v = 28 (0x1c) for pre-EIP-155 signatures