ethereumAddressFromPublicKey function

String ethereumAddressFromPublicKey(
  1. Uint8List publicKey
)

Derives an Ethereum address from a given public key.

Implementation

String ethereumAddressFromPublicKey(Uint8List publicKey) {
  final decompressedPubKey = decompressPublicKey(publicKey);
  final hash = KeccakDigest(256).process(decompressedPubKey.sublist(1));
  final address = hash.sublist(12, 32);

  return checksumEthereumAddress(hex.encode(address));
}