Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

Allow --unlock functionality when ganache is already running #588

Closed
iamdefinitelyahuman opened this issue Apr 22, 2020 · 7 comments
Closed

Comments

@iamdefinitelyahuman
Copy link
Contributor

Summary

It is possible to unlock accounts with the --unlock flag when launching ganache. It would be useful to be able to do this while ganache is already running.

Context

When combined with--fork, --unlock is very powerful in that it lets the me simulate mainnet transactions from accounts I don't control. However, I like to play around in the console and so often don't know which accounts I want to unlock ahead of time. Currently each new unlock means exiting, restarting, and repeating a (sometimes lengthy) series of transactions.

Possible Solution

I have three ideas for possible implementations:

  1. Add a cli flag --unlock-all that arbitrarily allows transactions to be broadcast from any address, without having to explicitly unlock first. In my mind this is the best approach.
  2. Add a new custom RPC endpoint that accepts an address as a single parameter, and unlocks that address.
  3. Modify the behavior of personal_unlockAccount so that any account may be unlocked with a passphrase of null. Optionally add a cli flag that enables this behavior.
@iamdefinitelyahuman
Copy link
Contributor Author

Did I open this in the wrong repo? Should I move it to ganache-core?

@davidmurdoch
Copy link
Member

Either repo is fine. I do prefer to triage these issues in core. We'll be switching to a mono repo Soon™️, so all issues will be merged together anyway.

This sounds like an excellent idea, btw. I'm not sure the best way forward. I'm leaning towards a custom RPC method, but could be persuaded to implement other ideas instead.

@davidmurdoch davidmurdoch transferred this issue from trufflesuite/ganache-cli-archive Jun 20, 2020
@iamdefinitelyahuman
Copy link
Contributor Author

An RPC method would work fine for me.. I see in my initial writeup I suggested a flag as the best approach, but today I feel the custom RPC method is actually better as it doesn't require me to do anything special prior to launching.

Thanks for your work on this tool btw!

@ItsNickBarry
Copy link

It would be useful to be able to simply unlock all accounts, preventing the need for RPC calls. I can't think of a test case that would rely on an account's being locked.

@ItsNickBarry
Copy link

I now see that that's already been suggested. In that case, I agree that --unlock-all would be a useful addition.

@iamdefinitelyahuman
Copy link
Contributor Author

Implemented in #622

@surajsjain
Copy link

Is there any way I can use this with the latest version (or a different branch) of Ganache CI so that I can unlock all the accounts?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants