PublicKey
64-byte uncompressed secp256k1 public key for cryptographic operations.Overview
PublicKey represents an uncompressed secp256k1 public key (64 bytes, x and y coordinates). It’s derived from a private key and used for Ethereum address derivation and signature verification.Type Definition
Usage
Create from Hex
Derive from Private Key
Convert to Address
Verify Signature
Compress Public Key
Decompress Public Key
Check Compression
API Reference
Constructors
| Function | Description |
|---|---|
from(hex) | Create from hex string |
fromPrivateKey(pk) | Derive from private key |
Methods
| Function | Description |
|---|---|
toHex(pk) | Convert to hex string |
toAddress(pk) | Derive Ethereum address |
verify(pk, hash, sig) | Verify ECDSA signature |
compress(pk) | Compress to 33 bytes |
decompress(compressed) | Expand to 64 bytes |
isCompressed(bytes) | Check if compressed format |
Key Formats
Uncompressed (64 bytes)
Used internally by this library. Contains raw x and y coordinates:Uncompressed with Prefix (65 bytes)
Standard SEC1 uncompressed format:Compressed (33 bytes)
SEC1 compressed format for storage/transmission:- Prefix
0x02if y is even - Prefix
0x03if y is odd
Compression Algorithm
Decompression
Decompression solves the curve equationy^2 = x^3 + 7 mod p and chooses y based on the prefix parity.
Address Derivation
Ethereum addresses are derived from public keys:Dependency Injection
For tree-shaking, use the factory pattern:Test Vectors
See Also
- PrivateKey - Private key primitive
- Address - Ethereum address
- Signature - ECDSA signatures
- Secp256k1 - Elliptic curve operations

