Skip to content

publicKeyToEthAddress()

SIP Protocol API Reference v0.7.0


SIP Protocol API Reference / publicKeyToEthAddress

publicKeyToEthAddress(publicKey): `0x${string}`

Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:1452

Convert a secp256k1 public key to an Ethereum address

Algorithm (EIP-5564 style):

  1. Decompress the public key to uncompressed form (65 bytes)
  2. Remove the 0x04 prefix (take last 64 bytes)
  3. keccak256 hash of the 64 bytes
  4. Take the last 20 bytes as the address

`0x${string}`

Compressed (33 bytes) or uncompressed (65 bytes) public key

`0x${string}`

Ethereum address (20 bytes, checksummed)