near-cli icon indicating copy to clipboard operation
near-cli copied to clipboard

no matching key pair found error related to subaccount

Open dakeshi opened this issue 3 years ago • 2 comments

Describe the bug I created subaccount through following steps and wanted to get SEED phrase to login on wallet.near.org but I got no matching key pair error in some instructinos. and I don't know how to delete new created subaccount.

  • testing ENV: mainnet

To Reproduce Steps to reproduce the behavior:

1. Creating sub account

near create-account mysubaccount —masterAccount myMasterAccount

2. I found out that it is impossible to import private key on wallet.near.org. So, I'd like to update current keys based on SEED phrase. I expected that will be updated existing public/private key pairs and get SEED recovery phrase through generate-key command

near generate-key mysubaccount --seedPhrase="12 words"

3. Tried to import my subaccount on wallet.near.org through SEED phrase I used in step 2. but I got error message.

Error: Cannot find matching public key

4. I checked my json file on credential directory and compared it with near keys mysubaccount result. it show me different public keys.

5. I want to delete mysubaccount to reset my sub account process. but I got failed.

near delete mysubaccount myMasterAccount

Error: Can not sign transactions for account mysubaccount on network mainnet, no matching key pair found in InMemorySigner(MergeKeyStore(UnencryptedFileSystemKeyStore(/Users/myaccount/.near-credentials)

Expected behavior 1. updating existing public/private keys through generate-key with SEED phrase option 2. successful login on wallet.near.org using SEED phrase(which I set on generate-key command) 3. near key result should match with public key saved in credential directory

Desktop (please complete the following information):

  • OS: MacOS 11.2.1
  • near cli version: 2.0.1

dakeshi avatar Jun 02 '21 02:06 dakeshi

I'd love to add a +1 on this issue. My reproduction was almost the same, just that at step 3, I was trying to add the new key to my existing subaccount instead, like so:

near add-key mysubaccount my-newly-generated-pubkey

I got the same error:

Adding full access key = <my-newly-generated-pubkey> to <mysubaccount>.
An error occured
Error: Can not sign transactions for account <mysubaccount> on network testnet, no matching key pair found in InMemorySigner(MergeKeyStore(UnencryptedFileSystemKeyStore(/path/to/.near-credentials), UnencryptedFileSystemKeyStore(/path/to/current/project/neardev))).

I'm pretty sure all credentials exist in my .near-credentials directory.

My setup:

  • near cli version: 2.1.1
  • env: testnet

Any pointer would be much appreciated!

Thesephi avatar Oct 01 '21 23:10 Thesephi

I'd love to add a +1 on this issue. My reproduction was almost the same, just that at step 3, I was trying to add the new key to my existing subaccount instead, like so:

near add-key mysubaccount my-newly-generated-pubkey

I got the same error:

Adding full access key = <my-newly-generated-pubkey> to <mysubaccount>.
An error occured
Error: Can not sign transactions for account <mysubaccount> on network testnet, no matching key pair found in InMemorySigner(MergeKeyStore(UnencryptedFileSystemKeyStore(/path/to/.near-credentials), UnencryptedFileSystemKeyStore(/path/to/current/project/neardev))).

I'm pretty sure all credentials exist in my .near-credentials directory.

My setup:

  • near cli version: 2.1.1
  • env: testnet

Any pointer would be much appreciated!

I think I've found out why. Prior to calling the add-key command, I also invoked the command near generate-key mysubaccount --seedPhrase "12 words". As a result, the keys were overwritten for mysubaccount on my local computer where I invoked that command.

Meanwhile, mysubaccount is already associated with the "old" key on-chain. This causes the subsequent add-key command to fail, as obviously there's now a conflict.

Thankfully, before running the generate-key command, I did make a backup of my existing keys. After restoring those backup keys, I was able to run add-key successfully.

Thesephi avatar Oct 02 '21 00:10 Thesephi