ethAddress function

String ethAddress(
  1. PublicKey pk
)

Implementation

String ethAddress(PublicKey pk) {
  final pubkey = pk as ECPublicKey;
  sha3digest.reset();
  final pub_bytes = pubkey.Q!.getEncoded(false);
  final address_bytes = sha3digest.process(pub_bytes);
  final hex_string = HEX.encode(address_bytes);
  return '0x${hex_string.substring(24)}';
}