Try it Live
Run Transaction examples in the interactive playground
Transaction Signing
Signature verification and sender address recovery using secp256k1.getSender
Recover sender address from transaction signature.Parameters
tx: Any- Signed transaction (any type)
Returns
AddressType - 20-byte sender address recovered from signature
Throws
Error("Transaction is not signed")- If transaction has zero r or sError("Unknown transaction type")- If transaction type is invalidError("Not implemented")- If type-specific recovery not implemented yet- Signature recovery errors for invalid signatures
Usage
verifySignature
Verify transaction signature is valid.Parameters
tx: Any- Signed transaction
Returns
boolean - true if signature is valid, false otherwise
Usage
isSigned
Check if transaction has a signature.Parameters
tx: Any- Transaction to check
Returns
boolean - true if transaction has non-zero r and s, false otherwise
Usage
assertSigned
Assert transaction is signed (throws if not).Parameters
tx: Any- Transaction to check
Throws
Error("Transaction is not signed")- If r or s is zero
Usage
Signature Components
Legacy Transactions
Legacy transactions usev/r/s signature format:
- Pre-EIP-155:
v = 27 + yParity(yParity is 0 or 1) - Post-EIP-155:
v = chainId * 2 + 35 + yParity
Typed Transactions (EIP-2930+)
All typed transactions useyParity/r/s format:
Sender Recovery Process
- Get signing hash (transaction data without signature)
- Recover public key from signature using secp256k1
- Hash public key with keccak256
- Take last 20 bytes as address
Type-Specific Methods
Each transaction type has specialized methods:Usage Patterns
Transaction Pool Validation
Authorization Check
Replay Protection
Batch Verification
Safe Sender Recovery
Signature Malleability
ECDSA signatures have malleability issue - for every valid signature(r, s), there’s another valid signature (r, -s mod n).
Ethereum requires s value to be in lower half of curve order:
Performance Considerations
Signature recovery is expensive (elliptic curve operations):Implementation Status
| Type | getSender | verifySignature | Status |
|---|---|---|---|
| Legacy | Partial | Partial | In progress |
| EIP-2930 | Partial | Partial | In progress |
| EIP-1559 | Partial | Partial | In progress |
| EIP-4844 | Partial | Partial | In progress |
| EIP-7702 | Partial | Partial | In progress |
See Also
- Hashing - Transaction and signing hash computation
- Serialization - RLP encode and decode transactions
- Secp256k1 - ECDSA signature operations
- Address - Ethereum address primitive

