Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Importing from a Keystore #440

Closed
Skyge opened this issue Apr 23, 2020 · 4 comments · Fixed by #448
Closed

Importing from a Keystore #440

Skyge opened this issue Apr 23, 2020 · 4 comments · Fixed by #448

Comments

@Skyge
Copy link
Contributor

Skyge commented Apr 23, 2020

I am trying to import from a keystore file to test my contract on a test net, so I run the following command:

brownie accounts import owner ./UTC--...--5ce9454909639D2D17A3F753ce7d93fa0b9aB12E

But I got an error:

Brownie v1.7.2 - Python development framework for Ethereum

  File "brownie/_cli/__main__.py", line 58, in main
    importlib.import_module(f"brownie._cli.{cmd}").main()
  File "brownie/_cli/accounts.py", line 41, in main
    fn(*args["<arguments>"])
  File "brownie/_cli/accounts.py", line 89, in _import
    accounts.load(source_path)
  File "brownie/network/account.py", line 121, in load
    raise FileNotFoundError(f"Cannot find {json_file}")
FileNotFoundError: Cannot find /Users/token/UTC--...--5ce9454909639D2D17A3F753ce7d93fa0b9aB12E.json

So it seems like it would add a .json suffix to the file, I created my keystore file form the application MyCrypto, it does not provide a suffix, and I remembered that if you tried to generate a keystore file from the geth, the file do not has a suffix either, so I think for most of cases, the keystore file does not have a suffix, so is there a need to add the suffix?

@Skyge
Copy link
Contributor Author

Skyge commented Apr 23, 2020

In order to pass this checking, so I add .json suffix to me file, but I got another error:

Brownie v1.7.2 - Python development framework for Ethereum

Enter the password to unlock this account:
  File "brownie/_cli/__main__.py", line 58, in main
    importlib.import_module(f"brownie._cli.{cmd}").main()
  File "brownie/_cli/accounts.py", line 41, in main
    fn(*args["<arguments>"])
  File "brownie/_cli/accounts.py", line 90, in _import
    shutil.copy(source_path, dest_path)
  File "/Users/Envs/token/lib/python3.7/shutil.py", line 245, in copy
    copyfile(src, dst, follow_symlinks=follow_symlinks)
  File "/Users/Envs/token/lib/python3.7/shutil.py", line 120, in copyfile
    with open(src, 'rb') as fsrc:
FileNotFoundError: [Errno 2] No such file or directory: '/Users/token/UTC--...--5ce9454909639D2D17A3F753ce7d93fa0b9aB12E'

@iamdefinitelyahuman
Copy link
Member

You need to pass a path to the keystore file, which should be saved as a json. For example, if you saved the keystore as my_keystore_file.json:

brownie accounts import owner my_keystore_file.json

@Skyge
Copy link
Contributor Author

Skyge commented Apr 23, 2020

Yeah, I have changed my file name, so later, I got the another error like above

FileNotFoundError: [Errno 2] No such file or directory: '/Users/token/UTC--...--5ce9454909639D2D17A3F753ce7d93fa0b9aB12E'

@iamdefinitelyahuman
Copy link
Member

Ahh sorry, I misunderstood! Working on a fix.

iamdefinitelyahuman added a commit that referenced this issue Apr 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants