# Fully understanding bitcoin transcation verifying and secp256k1

Hello fellow cryptographers.

I have spent last few days trying to understand and find a way to generate secp256k1 private and public keys from scratch, but i failed.

I have seen tons of videos and read tons of pdfs about it but I still can't understand how to implement it even in pseudocode.

r = Random
k = PrivateKey (64bit hex string that should safely be generated from r and hashed)
K = PublicKey
G =

K = k * G



Now i know G has x,y and that 04 at the beginning means that its in uncompressed form. But i am confused with the way I should multiply k and G, since whenever I tried turning them into decimal values multiplying them and then encoding them into hex afterwards I would get wrong results.

Now lets say I have K(public key).

How would I go about encrypting an message, and then proving that I can decrypt it?