-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: use unspendable taproot public keys for deposits #201
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Beautiful!
Couldn't find any known theory here, so I concluded that it is largely common sense that this is "unspendable". Basically, it is highly unlikely that the SHA256 of the generator G used in bitcoin has a known discrete logarithm since the SHA256 is so random. |
Yeah I don't think it's possible to prove that the discrete log is unknown, because there could always exist some random person managing to guess the point with a lucky shot. The best we can do is prove that the point is not arbitrarily generated, which makes it extremely improbable that anyone would know the discrete log of it. |
Yup I think we're starting from basically the same understanding. But to clarify I was thinking that we (humans) may have identified a set of numbers where we know the discrete logarithm does not exist, and that such a theory was used here. But the SHA256 is a dead giveaway that such a theory, if it is known, was probably not used here. Addendum: Apparently, the curve secp256k11 does not have any points on it that aren't generated by the generator. This appears to be a general well known fact. Basically, the secp256k1 curve has prime order2, which implies that all non-trivial points generate the entire group3. Footnotes
|
Right yeah, all points on the curve has a discrete log. It would be nice if there was a consensus rule reserving a set of points as unspendable, but given how infeasible it is to brute-force DLP - I guess relying on non-arbitrary points is probably sufficient for this purpose. |
Description
Closes #130.
Deposit requests are BTC transactions with taproot UTXOs to an address with no key-spend route. Specifically, we use a key-spend public key with no known private key. This PR implements the change where we expect the taproot address to use such an public key. We choose the specific X-coordinate mentioned in BIP-0341 as the public key, which has an X-coordinate set to the SHA256 of the generator G.
Changes
Testing information
I checked that the point in BIP-0341 is indeed on the curve. This was done by running the following in python:
In SageMath this is done with
which gives the same output as the python script. In the above, I used the same prime used in bitcoin-core, which is
2^256 - 2^32 - 977
or0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F
. Checking this might be overkill, since presumably this is checked when creating abitcoin::XOnlyPublicKey
struct, but it was easy enough to check.I also checked that the X-coordinate
0x50929b74c1a04954b78b4b6035e97a5e078a5a0f28ec96d547bfee9ace803ac0
is indeed the SHA256 hash of the generator that Bitcoin uses. The generator can be found in bitcoin-core (or here https://en.bitcoin.it/wiki/Secp256k1) and computing the sha256 is done using something like:I do not know if the "NUMS" (Nothing Up My Sleeve) X-coordinate point in BIP-0341 has a known discrete logarithm. That is, I do not know how to verify the claims in BIP-0341 regarding "unspendable" public keys. I'll do a little research to see if I can verify the claims there.