4

I realize these are all closely related, but when should you use these when developing an app? For example, it is easy to get a user's address, but when should you ask them for their key or key_hash, and is this something they need to explicitly provide?

1 Answer 1

8

The key_hash is just the address, which is derived from hashing the key. So if you have the key, you can easily generate the key_hash/address.

The reason you may want the key is because you need this to verify a signature signed by the private_key, which can be used in multiple ways within a dapp/smart contract (one example is a smart-contract based multi-sig wallet). You can't derive the key from a key_hash (as hashing is one way).

Some times though, public keys may be revealed so you can look these up at times using the manager endpoint.

2
  • I must admit I don't quite understand the first sentence... Can you structure it a bit like: key, definition, reference ; address, definition, reference;...; Hash(address) = key_hash ?
    – jdsika
    Commented Mar 16, 2019 at 8:41
  • 2
    You have a public key and private key pair - the public key is the key and can be made public, and is used to verify a signature (which is created using the private key). Every private key has a public key pair. The address (tz*) is created by hashing the public key. Commented Mar 16, 2019 at 9:14

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.