Skip to content
Get startedGetting started →

getEvmAddress

Derives the EIP-55 checksummed EVM address for a secp256k1 public key: keccak-256 over the uncompressed key’s coordinates, last 20 bytes, mixed-case checksum.

import { getEvmAddress } from "@category-labs/mera";
import {
createSecp256k1SigningSession,
getEvmAddress,
} from "@category-labs/mera";
const session = createSecp256k1SigningSession({
privateKey: crypto.getRandomValues(new Uint8Array(32)),
});
const address = getEvmAddress(session.publicKey);
// EIP-55 checksummed, like "0x8ba1f109551bD432803012645Ac136ddd64DBA72"
  • Type: Uint8Array
  • Required

A secp256k1 public key, compressed (33 bytes) or uncompressed (65 bytes). Normalized internally, so both forms give the same address.

An EvmAddress: the EIP-55 mixed-case checksummed address as a 0x-prefixed string. EvmAddress is the structural type `0x${string}`.

  • INPUT_INVALID: publicKey is not valid secp256k1 (wrong length, wrong prefix, or not a point on the curve).