Try it Live
Run Address examples in the interactive playground
- Wrapper API
- Factory API
Algorithm
- RLP encode sender address and nonce as list:
[address, nonce] - Hash with keccak256 producing 32-byte hash
- Extract address from last 20 bytes:
hash[12:32]
Nonce Handling
Nonce encoding: RLP encodes nonce as minimal big-endian bytes (no leading zeros) Examples:- Nonce
0→ empty bytes[] - Nonce
1→[0x01] - Nonce
127→[0x7f] - Nonce
255→[0xff] - Nonce
256→[0x01, 0x00]
Complete Example
Use Cases
Predicting Contract Addresses
Calculate address before deployment:Factory Contracts
Track contract addresses deployed by factory:Address Validation
Verify contract was deployed by expected address:CREATE vs CREATE2
| Feature | CREATE | CREATE2 |
|---|---|---|
| Determinism | Nonce-based (sequential) | Salt-based (arbitrary) |
| Dependencies | Keccak256, RLP | Keccak256 only |
| Parameters | (address, nonce) | (address, salt, initCode) |
| Predictability | Requires tracking nonce | Fully deterministic always |
| Redeployment | Different address each time | Same address if inputs identical |
Performance
Cryptographic operations:- RLP encoding (~O(n) where n = nonce size)
- keccak256 hash
- keccak256 - Hash function for address derivation
- rlpEncode - RLP encoding for
[address, nonce]list
Error Handling
See Also
- calculateCreate2Address - CREATE2 address derivation
- fromHex - Parse address from hex
- Rlp - RLP encoding
- Keccak256 - Keccak256 hash function
- Yellow Paper - Section 7 (Contract creation)

