8

How can I derive Tezos public key from x,y points on the curve (either SECP256K1 or P-256)?

For example, for Ethereum you can compute this using Keccak-256 on the [x,y]. The address is then obtained by taking the last 40 bytes (20 hex chars) and prefixing it with 0x for a total of 42 bytes.

9

Public keys in Tezos are stored in compressed form:

<1 byte prefix>|X
  1. Prefix is b'\x02' if Y is even, b'\x03' otherwise, now you have a compressed key of 33 bytes long;
  2. Add tezos prefix b'\x03\xfe\xe2V' for secp256k1, b'\x03\xb2\x8b\x7f' for p256;
  3. Encode with Base58 algo with checksum.

Checkout pytezos.crypto sources for implementation examples.

| improve this answer | |
  • What is Y here? (A typo, should be X?) – arvidj Jan 17 at 14:27
  • 1
    X, Y are from the elliptic curve equation, for secp256k1 it's y^2 = x^3 + 7 – Michael Zaikin Jan 17 at 22:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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