I'm trying to move cryptographic key operations in the Monero Python module from pure Python to pynacl which is a wrapper around libsodium.

The first problem I stumbled upon is that Monero secret keys are 256 bit (32 bytes) while nacl.bindings.crypto_sign_ed25519_sk_to_pk expects the secret key to be twice as large (64 bytes).

I also see that unclamped scalar is also 64-byte long. Perhaps the reason for key size difference is related to that?

1 Answer 1


Looking at the source you can see it's reading the end bytes from the parameter, and as crypto_sign_SEEDBYTES is defined (1,2) as 32, only the last 32 bytes of the supplied 64 byte parameter are used.

  • 1
    This is impressive how hours of looking int the source code may be saved by a simple remark of fellow developer. Thx!
    – emesik
    Commented Dec 3, 2021 at 8:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.