Try it Live
Run Address examples in the interactive playground
- Factory API
- Namespace API
- C
FromPublicKey({ keccak256 })
Create Address from secp256k1 public key coordinates using factory pattern. Enables tree-shakeable imports without bundling unnecessary crypto.Parameters:deps.keccak256: (data: Uint8Array) => Uint8Array- Keccak256 hash function
(x: bigint, y: bigint) => AddressType - Function that creates Address from public keyExample:Algorithm
The address derivation follows Ethereum’s standard process:- Concatenate coordinates - Combine x and y into 64-byte uncompressed public key
- Hash with keccak256 - Compute keccak256 hash (32 bytes output)
- Extract address - Take last 20 bytes of hash
Public Key Format
Ethereum uses uncompressed secp256k1 public keys:- Curve: secp256k1 (same as Bitcoin)
- Coordinates: x and y, each 256 bits (32 bytes)
- Total size: 64 bytes (no 0x04 prefix in Ethereum)
Complete Example
Use Cases
Verifying Signatures
After recovering a public key from an ECDSA signature:Deterministic Address Generation
Generate addresses from known public keys:Performance
Cryptographic dependency: Uses keccak256 hash function internally. Bundle size impact:- Factory API (
FromPublicKey): Tree-shakeable, only includes keccak256 if used - Namespace API (
Address.fromPublicKey): Always includes keccak256 (~5-10 KB)
fromPrivateKey() directly if you have the private key, as it combines key derivation and address generation.
See Also
- fromPrivateKey - Derive from private key
- from - Universal constructor
- Secp256k1 - secp256k1 cryptography
- Keccak256 - Keccak256 hash function
- Yellow Paper - Section 4.2 (Address derivation)

