How I can extract or generate signature?

Hello, I have a seed phrase (mnemonic). How I can convert it to Signature for sui json-rpc transactions? Can I use my software (for example - python) without sui cli-client? And how I can do this? For example, sui_executeTransactionSerializedSig need signature.


I also had a problem with access not with mnemonic. I tried to use keys from devnet to testnet and their types was different and there wasn’t instruction how to solve that. Only at the discord one of the moderators shared thу link. But I didn’t understand any word of this :see_no_evil: :see_no_evil: :see_no_evil:

Maybe someone help me finally

As far as keypairs go, prior to Sui 0.21.0 the keypair encoding structurally (using ed25519 as example):

  1. Keypair on disk is encoded as base64 string
  2. Decoding that string to bytes resulted in a 65 byte list
  3. Byte 0 contained the key scheme:
    Value of 0 indicates ed25519
    Value of 1 indicates secp256k1
    Value of 2 indicates secp256r1
  4. For ed25519: The next 32 bytes were the Public key
  5. For ed25519: The remaining 32 bytes were the Private key

However; in 0.21.0 it was changed where the Public key was dropped.
Now the keystring decodes to a 33 byte list
The first byte is still the key scheme
The remaining 32 are the Private key

1 Like

The seed phrase (words) need to be converted to bytes representing a seed to your key generation.

You need to do this to get a private key and from that a public key

You also need to identify the derivation path, varies based on key type

You can generate the key pair using the sui keytool

See: sui keytool import -h on the command line.

1 Like