forex.pm forex forum binary options trade - Binance - Сryptocurrency exchanges - Trying to get the Public key from Private key via secp256k1 [closed]
  • Welcome to forex.pm forex forum binary options trade. Please login or sign up.
 

Trying to get the Public key from Private key via secp256k1 [closed]

Started by Bitcoin, Feb 08, 2022, 04:24 am

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Bitcoin

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]