publicKeyToAddress method

  1. @override
String publicKeyToAddress(
  1. Uint8List publicKey
)
override

Implementation

@override
String publicKeyToAddress(Uint8List publicKey) {
  final padding = asciiStringToByteArray("\x0Aaccount-id");
  final hash = getSha244Digest(new Uint8List.fromList(
      [...padding, ...principal!.bytes, ...subAccountFromID(0)]));

  // Prepend the checksum of the hash and convert to a hex string
  final checksum = bigEndianCrc32(hash);
  final accountIdentifier = new Uint8List.fromList([...checksum, ...hash]);
  final address = accountIdentifier.toStr();
  return address;
}