Answer the question
In order to leave comments, you need to log in
Why does the ECDH (bitcoin) function return two public keys?
Playing with the function of generating a public key from a private one from the article Elliptic curve cryptography is available
Script on Gitub
Why does the function produce two public keys for one private key? And which one is who?
Example:
Alice's private key: 0x6cfc11293c8f1ddc4eb121b4a5138d3fa8241162a91b5d2d3cd86c17e9bceb2a
Alice's public key: (0xd618d67c650483a8f7bc785c0271c76dd0d2de14eb123b3b796f1a21fb8ea8c4, 0x9e93b13c39997055f0c74b31d794cd4abf04888d896b25e7c3215eaa6c01278f)
The function code is assigned as a result point_add tuple:
result = (x3 % curve.p, -y3 % curve.p)
And further along the functions, the values already go in pairs. And why are there two of them? From one, a public key is generated, tied to a private one, and from the other, what? Two public ones cannot correspond to one private one.
Or maybe the whole python script is wrong and for games with bitcoin keys you need to look for something else?
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question