Skip to main content

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

Methods

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 0x02 if y is even
  • Prefix 0x03 if y is odd

Compression Algorithm

Decompression

Decompression solves the curve equation y^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