Overview
Address:0x0000000000000000000000000000000000000003
Introduced: Frontier
The RIPEMD160 precompile implements the RIPEMD-160 cryptographic hash function, producing a 20-byte hash of arbitrary input data. RIPEMD-160 is used in Bitcoin for generating addresses from public keys.
This precompile enables Ethereum contracts to verify Bitcoin addresses, validate Bitcoin-style address generation, and interact with systems using RIPEMD-160.
Gas Cost
Formula:600 + 120 * ceil(input_length / 32)
- Base cost:
600gas - Per-word cost:
120gas per 32-byte word - Partial words round up
- 0 bytes: 600 gas
- 32 bytes: 720 gas (600 + 120*1)
- 33 bytes: 840 gas (600 + 120*2)
- 64 bytes: 840 gas (600 + 120*2)
Input Format
Accepts arbitrary-length byte array. No restrictions on input size.Output Format
Usage Example
Error Conditions
- Out of gas (insufficient for 600 + 120 * ceil(len/32))
Use Cases
- Bitcoin address generation: Generate Bitcoin P2PKH addresses from public keys
- Bitcoin integration: Verify Bitcoin address ownership in Ethereum contracts
- Cross-chain bridges: Validate Bitcoin-style addresses
- Legacy cryptography: Interface with systems using RIPEMD-160
Implementation Details
- Zig: Uses RIPEMD-160 implementation from crypto module, left-pads output to 32 bytes
- TypeScript: Wraps Ripemd160.hash from crypto module, applies padding
- Integration: Standalone, no dependencies on other primitives
- Output format: Right-aligned 20-byte hash in 32-byte word
Bitcoin Address Generation
Bitcoin P2PKH addresses use RIPEMD-160:Performance Considerations
RIPEMD-160 is the most expensive hash precompile (600 base gas vs 60 for SHA256, 30 for Keccak256). The high cost reflects its computational complexity and relatively rare usage. Gas costs favor larger inputs:- Per-byte cost: ~3.75 gas/byte
- 10x more expensive than SHA-256 per byte
Test Vectors
References
Specifications
- Yellow Paper - Appendix E (Precompiled Contracts)
- Bitcoin Address Generation
- RIPEMD-160 Specification

