# How to get x-only public key from the private key, and what does the obtained value represent?

In ECDSA, the public key is the result of multiplying the private key (some random 256-bit value) with a generic point (G). So the public key would be one of the points (X,Y) of the elliptic curve secp256k1. In this case, the public key represents two 32-byte values (encoded as 65 bytes or 33 bytes in compressed form). However, as I see, with Schnorr the public key is just 32 bytes long (not even 33 where one byte would define whether Y is odd or even), so some other process is used.

1. What is the way to get the public key from the corresponding private key in Schnor?
2. What does that obtained value represent? Also point of the elliptic curve? If so, I assume its X coo, so how do we know corresponding Y coo?
3. Does Schnorr (BIP340) also support a classic key tweaking like ECDSA, where we add some value to the public key and then add the same value to the private key and we would produce a valid signature?

1. What is the way to get the public key from the corresponding private key in Schnorr?

Multiply the private key with the generator G (like for ECDSA) and then throw away the Y coordinate.

Given the depth your questions go, I would recommend you to just read the relevant BIPs. In particular, BIP340 has a section on public key generation.

1. What does that obtained value represent? Also point of the elliptic curve? If so, I assume its X coo, so how do we know corresponding Y coo?

Yes, a point on the elliptic curve, of which you only know the X coordinate. Internally in the BIP340 scheme it is treated as the point with given X coordinate and even Y coordinate, but at a more high-level you can also think of the public key as representing "either" of the points.

Given the curve equation y2 = x3 + 7, the corresponding Y coordinates for a given X coordinate can be computed as Y = ±√(X3 + 7) mod p. Note that this is a modular square root modulo the field size p = 2256-232-977. For the specific value p for secp256k1, this is equivalent to ±(x3 + 7)(p+1)/4.

This is not specific to BIP340 public keys. Even for ECDSA, typically public keys are represented in the so-called compressed format, consisting of sign_byte + [32-byte big endian X coordinate], where the sign_byte is 0x02 if the Y coordinate is even, and 0x03 if the Y coordinate is odd. Reconstructing the full point also requires a modular square root for this format.

1. Does Schnorr (BIP340) also support a classic key tweaking like ECDSA, where we add some value to the public key and then add the same value to the private key and we would produce a valid signature?

Yes, Taproot even critically relies on this tweaking operation for representing script paths: in order to spend a Taproot output with point Q as a script, an internal public key P needs to be revealed together with a script (Merkle root) m such that Q = P + H(P || m)G. Since the Y coordinate of Q is not part of the output, it also needs to be revealed at spending time.

Does this mean that the number of possible points, i.e. the private key-public key pairs, is 2 times smaller than in the case of ECDSA since we only use even Ys?

Yes, but note that this is not a reduction in security (not even a negligible one).

• Thanks. Everything clear expect this tweaking. It confuses me that we only take the even Y coordinate. I wrote a question related to that. I hope you can help me. bitcoin.stackexchange.com/questions/120434/… Commented Nov 11, 2023 at 19:08

In the scheme described in BIP 340, private and public keys are generated in the same way as for ECDSA in Bitcoin, with an additional step - use only the X coordinate, and assume that the Y coordinate is even.

BIP 340 continues to use the secp256k1 elliptic curve, so private keys are still just an integer, and public keys are points on that curve. As such, any elliptic curve operations that are independent of signing and verifying still work.

• Does this mean that the number of possible points, i.e. the private key-public key pairs, is 2 times smaller than in the case of ECDSA since we only use even Ys? Commented Nov 11, 2023 at 17:24