getAddressFromPublicKey method

String getAddressFromPublicKey(
  1. String publicKey
)

Derives an address from a public key using multiple hashing algorithms.

Implementation

String getAddressFromPublicKey(String publicKey) {
  final pubSHAHashed = getSha256HashToString(publicKey);
  final hash1 = _getMd160HashToString(pubSHAHashed);
  final hash1Encoded = base58Encode(hash1, BigInt.from(58));
  final sum = base58Checksum(hash1Encoded);
  final key = base58DecimalTo58(sum.toString());
  final hash2 = hash1Encoded + key;
  return NosoConst.coinChar + hash2;
}