2

I want to generate a tezos 'tz1' aka manager address from scratch. But I cannot find any detailed algorithm of generation.

For example to generate a ETH wallet we will calculate public key than hash it using keccak256, take last 40 characters of hash add "0x" and you get address.

But I am unable to find similar algorithm for tezos 'tz1' address. So please help with it.

1 Answer 1

3
  1. You need to apply blake2b hash on the public key;
  2. Add the perfix respective to the elliptic curve you are using;
  3. Encode the bytes with base58.

Code example from: https://github.com/murbard/pytezos/blob/master/pytezos/crypto.py#L143

    def public_key_hash(self):
        """
        Public key hash for this key.
        :return: the public key hash for this key
        """
        pkh = blake2b(data=self._public_key, digest_size=20).digest()
        prefix = {b'ed': b'tz1', b'sp': b'tz2', b'p2': b'tz3'}[self.curve]
        return base58_encode(pkh, prefix).decode()

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.