forex.pm forex forum binary options trade

 Сryptocurrency exchanges => Binance - Сryptocurrency exchanges => Topic started by: Bitcoin on Feb 08, 2022, 04:24 am

Title: Trying to get the Public key from Private key via secp256k1 [closed]
Post by: Bitcoin on Feb 08, 2022, 04:24 am
Trying to get the Public key from Private key via secp256k1 [closed]

I have the private key in hex format like this: 9E524DE478970A9621C0E52890805D5F28E3620892BA6BFA701B026C6EE10A52 , now I am running the below python function to get the public key via ecdsa:


def privateKeyToPublicKey(s):
    sk = ecdsa.SigningKey.from_string(s, curve=ecdsa.SECP256k1)
    vk = sk.verifying_key
    return ('\04' + sk.verifying_key.to_string()).encode('hex')

print(privateKeyToPublicKey("9E524DE478970A9621C0E52890805D5F28E3620892BA6BFA701B026C6EE10A52"))



I am getting this error though TypeError: memoryview: a bytes-like object is required, not 'str'


Any idea what could be happening? Pretty new to Bitcoin/cryptography here :)


Source: Trying to get the Public key from Private key via secp256k1 [closed] (https://bitcoin.stackexchange.com/questions/112300/trying-to-get-the-public-key-from-private-key-via-secp256k1)