mina icon indicating copy to clipboard operation
mina copied to clipboard

Export of freshly created account failed

Open georgeee opened this issue 1 year ago • 5 comments

Preliminary Checks

  • [X] This issue is not a duplicate. Before opening a new issue, please search existing issues: https://github.com/MinaProtocol/mina/issues
  • [X] This issue is not a question, feature request, RFC, or anything other than a bug report. Please post those things in GitHub Discussions: https://github.com/MinaProtocol/mina/discussions

Description

Export of freshly created account failed on Mina client. Reproduced for ITN node.

Steps to Reproduce

  1. Install mina client
  2. Launch mina node
  3. Create an account
  4. Try to export the newly created account

Expected Result

Account to be exported

Actual Result

georgeee@itn-logging-a8f9e4ea:~$ mina version
Commit 55b78189c46e1811b8bdb78864cfa95409aeb96a on branch rampup

georgeee@itn-logging-a8f9e4ea:~$ mina accounts create
Password for new account: 
Again to confirm: 

😄 Added new account!
Public key: B62qqZ5Vi6EAJJF2YU5iYXRLqfTVMdeQQ688i5CNqrdDka5TEFXPyAP

georgeee@itn-logging-a8f9e4ea:~$ mina accounts export --privkey-path bla --public-key B62qqZ5Vi6EAJJF2YU5iYXRLqfTVMdeQQ688i5CNqrdDka5TEFXPyAP
❌ Export failed -- account not found corresponding to account B62qqZ5Vi6EAJJF2YU5iYXRLqfTVMdeQQ688i5CNqrdDka5TEFXPyAP

georgeee@itn-logging-a8f9e4ea:~$ mina accounts list
<..>
Account .2:
  Public key: B62qqZ5Vi6EAJJF2YU5iYXRLqfTVMdeQQ688i5CNqrdDka5TEFXPyAP
  Balance: 0
  Locked: false

How frequently do you see this issue?

Always

What is the impact of this issue on your ability to run a node?

Medium

Status

Not relevant

Additional information

Executed on buster.

To install mina I used the following commands:

georgeee@itn-logging-a8f9e4ea:~$ cat /etc/apt/sources.list.d/o1.list
deb [trusted=yes] http://packages.o1test.net/ buster unstable
georgeee@itn-logging-a8f9e4ea:~$ sudo apt install mina-berkeley=2.0.0rampup4-rampup-55b7818

georgeee avatar Oct 20 '23 15:10 georgeee

Confirm the issue/expectation

deepthiskumar avatar Oct 25 '23 19:10 deepthiskumar

I have identified the root cause of the issue. The wallet is being loaded from the incorrect conf directory

       let conf_dir =
           Option.value
             ~default:(home ^/ Cli_lib.Default.conf_dir_name  ^/ "wallets" )
             conf_dir

The conf dir assumes the key is in the default wallets directory when in fact each node has its own keys directory in the workspace.

For example the wallets directory is located in ~/.mina-network/mina-local-network-2-1-1/nodes/fish_0/wallets/store for the fish_0 node instead of .mina-network/mina-local-network-2-1-1/wallets

@georgeee @deepthiskumar

svv232 avatar Apr 24 '24 21:04 svv232

I am able to export keys when manually specifying the path

 dune exec -- src/app/cli/src/mina.exe accounts export --privkey-path /Users/neptune/.mina-network/mina-local-network-2-1-1/nodes/fish_0/wallets/store/B62qoUMihGVqcZjx8AMHu2EyArHNEnE3UCuf7Gtk5jnBgwgfaQnUFAp --public-key B62qoUMihGVqcZjx8AMHu2EyArHNEnE3UCuf7Gtk5jnBgwgfaQnUFAp  --rest-server http://127.0.0.1:5001/graphql
*** .      /Users/neptune/.mina-network/mina-local-network-2-1-1/nodes/fish_0/walletsPassword for exported account:
Password for new private key file:
Again to confirm:
😄 Account exported to /Users/neptune/.mina-network/mina-local-network-2-1-1/nodes/fish_0/wallets/store/B62qoUMihGVqcZjx8AMHu2EyArHNEnE3UCuf7Gtk5jnBgwgfaQnUFAp: B62qoUMihGVqcZjx8AMHu2EyArHNEnE3UCuf7Gtk5jnBgwgfaQnUFAp

svv232 avatar Apr 24 '24 21:04 svv232

the command simply works if you specify the correct configuration directory

Sais-MacBook-Pro:mina neptune$ dune exec -- src/app/cli/src/mina.exe accounts create --rest-server http://127.0.0.1:5001/graphql
Password for new account:
Again to confirm:

😄 Added new account!
Public key: B62qmETy7REnQM6qynCisfnGVT2R2rgxm88mErLCTSem9QztYagDvXr
Sais-MacBook-Pro:mina neptune$ dune exec -- src/app/cli/src/mina.exe accounts export --privkey-path /Users/neptune/.mina-network/mina-local-network-2-1-1/nodes/fish_0/wallets/store/B62qmETy7REnQM6qynCisfnGVT2R2rgxm88mErLCTSem9QztYagDvXr --public-key B62qmETy7REnQM6qynCisfnGVT2R2rgxm88mErLCTSem9QztYagDvXr  --config-directory /Users/neptune/.mina-network/mina-local-network-2-1-1/nodes/fish_0/ --rest-server http://127.0.0.1:5001/graphql
Password for exported account:
Password for new private key file:
Again to confirm:
😄 Account exported to /Users/neptune/.mina-network/mina-local-network-2-1-1/nodes/fish_0/wallets/store/B62qmETy7REnQM6qynCisfnGVT2R2rgxm88mErLCTSem9QztYagDvXr: B62qmETy7REnQM6qynCisfnGVT2R2rgxm88mErLCTSem9QztYagDvXr
Sais-MacBook-Pro:mina neptune$

svv232 avatar Apr 24 '24 22:04 svv232

@deepthiskumar I think this is good to close.

svv232 avatar Apr 24 '24 22:04 svv232