How to get mnemonic words or private key from accounts in wallet

I’ve got username, password and mnemonic words for each wallet when they were created with goal. However, when I created accounts within the wallet, it only gives me the account addresses without private key or mnemonic words.

Why do I only get mnemonic words for the wallet, and not for each account in the wallet? How do you get the mnemonic words for these accounts in the wallet?

Hi, depends on how you’re generating your account
Say you’re using a python sdk, after generating a secret key, you need to encode it
this is an example from the algorand samples

  sk = SigningKey.generate()
  vk = sk.verify_key
  a = encoding.encode_address(vk.encode())
  private_key = base64.b64encode(sk.encode() + vk.encode()).decode()

from the private key, you can generate the mnemonic using the mnemonic module in the sdk

mnemonic.from_private_key(private_key)

also the address can be gotten from the private key

pk = base64.b64decode(private_key)[32 :]
address = encoding.encode_address(pk)

Hope this helps

1 Like

Appreciate your reply. I don’t have issue creating acct with python and javascript. I’m having problem with accounts that I create with goal with wallet specified:

~/node$ ./goal account new -w MyWallet -d testnetdata

This will create an account, and puts it into the wallet MyWallet with only the account address displayed. No mnemonic words or private key.

It’s not a big issue as I can just trash those. But I had some large amount of ALGOs in them during tests, and wanted to transfer them to my other test accounts, so I don’t have to spend hours at the dispenser.

I believe you need to use the kmd REST API for that:

and then the SDK should have methods for derivation for each account.

goal account export -a ADDRESS
1 Like

That’s it, “export”. I see it in --help, but I don’t know why I didn’t try it.
Thank you.