cheqd / cheqd-node

Ledger/node software for cheqd's decentralised identity network. Built using the Cosmos SDK blockchain framework.
https://docs.cheqd.io/node
Apache License 2.0
64 stars 43 forks source link

[Bug]: Cannot add a key when using `keyring-backend=os` #351

Closed andynog closed 2 years ago

andynog commented 2 years ago

What went wrong?

Trying to add a key using cheqd-noded cli on a Linux machine doesn't work if keyring-backend=os, if using keyring-backend=test then it works.

How can we reproduce this bug?

Testing on an Ubuntu (20.04) Linux machine. Using cheqd-noded version 0.6.0.

Trying to add a key on my machine and setting the keyring-backend to os the key is not stored. But if I use test the key is stored.

Command to add key with keyring-backend=os

$ cheqd-noded keys add local-cheqd --keyring-backend=os

- name: local-cheqd-an
  type: local
  address: cheqd1rz9w6y0m2arqh...
  pubkey: '{"@type":"/cosmos.crypto.secp256k1.PubKey","key":"A/3AjLA..."}'
  mnemonic: ""

**Important** write this mnemonic phrase in a safe place.
It is the only way to recover your account if you ever forget your password.

twenty radar ...

I get prompt ("Choose a password for the new keyring") by the operating systems to set a password to store the key and I chose a password and confirm it. But if I query the keys it doesn't show up:

$ cheqd-noded keys list --keyring-backend=os
[]

Command to add key with keyring-backend=test

$ cheqd-noded keys add local-cheqd --keyring-backend=test

- name: local-cheqd
  type: local
  address: cheqd1q9c....
  pubkey: '{"@type":"/cosmos.crypto.secp256k1.PubKey","key":"A9+P8LqPR8cB...."}'
  mnemonic: ""

**Important** write this mnemonic phrase in a safe place.
It is the only way to recover your account if you ever forget your password.

poet glory...

And listing the keys in the test works:

$ cheqd-noded keys list --keyring-backend=test
- name: local-cheqd
  type: local
  address: cheqd1q9c...
  pubkey: '{"@type":"/cosmos.crypto.secp256k1.PubKey","key":"A9+P8LqPR8cB...."}'
  mnemonic: ""

Environment

Not applicable

Bug prevalence

Everytime I run the command

Which browser/client application did you encounter the bug in? (if applicable)

Other

Relevant log output

no logs, I've added the commands and messages above

Code of Conduct

ankurdotb commented 2 years ago

That's odd. What happens if you don't explicitly mention the keyring backend? (Our default is "os".)

We've done transactions using the binary, so I'm wondering what the issue could be here. Whether it's just the flag failing, or can't interact with "os" keyring at all.

ankurdotb commented 2 years ago

Also follow-up question: is this an Ubuntu server with a GUI/window environment installed?

andynog commented 2 years ago

Yes Ubuntu desktop (with a GUI)

Also I can use binaries from other chains on this machine eg. gaiad and it works with os

ankurdotb commented 2 years ago

@andynog Thanks for clarifying that. So I understand that when using GUI environments, the os backend can fail because there might be multiple targets for it to use, e.g., both seahorse as well as kwallet might exist on the same system. Are you actually running this as a node/server/validator or just for local development purposes?

Your point on this working with gaiad is interesting. Will look into why that's the case...

ankurdotb commented 2 years ago

Closing this as likely an OS issue