I am trying to create a public key whose x starts with "34" and is followed by the minimum number n such that the concatenation of "34" and n is the x of a valid point (x, y) on the elliptic curve secp256k1. Submit the concatenation of 04, x and y in hexadecimal form. This is a valid bitcoin public key, the corresponding secret key of which is not known by anyone.
I was told that the minimum number is 0.
My understanding is that the answer is supposed to be like this: '0434' + hex(n) + y_value. I am not sure how to approach this.
Is it true that x-coordinate is supposed to be 32 bytes and y coordinate 32 bytes too?
Is it true that each coordinate is represented in hex mode of 64 chars?
Is the public key represented by 130 hex chars? I have tried some online tools: e.g. https://iancoleman.io/bitcoin-key-compression/ and some python code but I always get a wrong answer.
X = '0x3400000000000000000000000000000000000000000000000000000000000000' p = 0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f print("x coordinate = %s " % X) x = int(X,16) print(x) ysquared = ((x*x*x+7) % p) print("ysquared= %s " % ysquared) y = pow(ysquared, (p+1)//4, p) print("y1 = %s " % hex(y)) print("y2 = %s " % hex((y * -1 % p))) print("-----------------") print('04' + X[2:] + hex(y)[2:]) print('04' + X[2:] + hex((y * -1 % p))[2:])