1

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 :)

1

0

Browse other questions tagged or ask your own question.