-
Notifications
You must be signed in to change notification settings - Fork 850
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
Use keystores in Scaffold-Eth #878
Conversation
Hey @jrcarlos2000 ! Overall working great! But I noticed some things we possibly need to change:
Can we get rid of it?
|
thanks @rin-st , yes still testing out what would be the best Dev Ex here before coming up with an updated README.
so for this, we can do a pre-check, only generates a wallet after
yes, will get rid of this
i think you need to |
update : i have made a change: when you do we also allow them to give it a name if provided.
KEYSTORE_NAME defaults to
|
Thanks for the quick fixes! 🔥 Regarding |
yes this will be taken from the .env , it will be set to cc: @technophile-04 |
Tysm Carlos for this!! As I understand SE-2 basically will be interacting with two keystore named:
I kinda like how we are getting account of keystore from ^ So if above is true(it seems to be, on my testing) then this makes Difference b/w current SE-2 flow and keystore flow is:
Some DX improvements:
But yeah would love to know others thought as well! |
Hey @technophile-04 thanks for the comments :
|
Testing this out and when I run
Prior to running I ran |
Thanks @escottalexander for testing it out! Could you please see if you have You don't need to create the If foundryup This should make all the foundry related stuff like anvil etc upto date and then could you try running |
Thanks @technophile-04 |
EDIT: WAIT I WAS IN Upon seeing @escottalexander 's reply here, I tested it with a clean install of SE-2 and I got the same error. After Usage: forge script --keystore --fork-url --password --broadcast --legacy --ffi [ARGS]... For more information, try '--help'. As @technophile-04 mentioned, I tried to look around a bit but I couldn't figure out where the code that creates the .env file Info about my system: I run wsl2 ubuntu on a win11 EDU machine.
I have run foundryup to get foundry to the latest version. |
Just merged the makefile PR, would love a last couple of tests. git clone https://github.com/scaffold-eth/scaffold-eth-2.git foundry-se-2 --branch feat/keystore Then
then try SE-2 magic command Before deploying to testnet: yarn account:generate
#enter some password Then update yarn account
# enter same password as above to unlock and see the balance Send some eth to generate account on sepolia and then: yarn deploy --network sepolia
# enter same password which you used early This should deploy the contract to sepolia with generated account. and lastly : yarn verify --network sepolia This should verify the contract |
@technophile-04 [elliott@fedora foundry-se-2]$ yarn account:generate
Enter password:
`scaffold-eth-custom` keystore was saved successfully. Address: 0x822bda2a647b1dba555d002964dba61c21d2b84c
Please update .env file with ETH_KEYSTORE_ACCOUNT=scaffold-eth-custom
[elliott@fedora foundry-se-2]$ yarn account
/bin/sh: line 1: source: .env: file not found
make[1]: *** [Makefile:30: verify-keystore] Error 1
🚫️ Unable to access keystore account scaffold-eth-custom
Please run `yarn account:generate` to generate deployer keystore account and update `ETH_KEYSTORE_ACCOUNT=scaffold-eth-custom` in `.env` file |
Thanks @escottalexander for tests! Not sure what caused that problem but pushed a commit so that we don't do sourcing of |
@technophile-04 I just repeated the steps in a fresh download of the repo (and removed my existing scaffold-eth-custom keystore) and this time it is asking for my password which is good but it fails after I give it my password. I tried twice (recreated the keystore) being very careful to enter my password correctly. I am running Fedora Linux 40. |
Strange, not sure whats happening did you get error as previous one after you enter password? Could you paste the error? Also after you do cast wallet address --account scaffold-eth-custom
# after entering the password it should log you wallet address |
@technophile-04 This is the error I get: [elliott@fedora foundry-se-2]$ yarn account
Enter keystore password:
🚫️ Unable to access keystore account scaffold-eth-custom
💡 If you haven't generated a deployer keystore account yet, please run `yarn account:generate`. Then update the `.env` file with `ETH_KEYSTORE_ACCOUNT=scaffold-eth-custom` The simple cast command works. It prints the wallet address after I give it my password. [elliott@fedora foundry-se-2]$ cast wallet address --account scaffold-eth-custom
Enter keystore password:
0x1e2a14D2038bD4DE7976c26Fa6724c81D89Eab20 I don't know much about C Makefiles but it appears when I run [elliott@fedora foundry-se-2]$ cast wallet address
Error:
Error accessing local wallet. Did you set a private key, mnemonic or keystore?
Run `cast send --help` or `forge create --help` and use the corresponding CLI
flag to set your key via:
--private-key, --mnemonic-path, --aws, --gcp, --interactive, --trezor or --ledger.
Alternatively, if you're using a local node with unlocked accounts,
use the --unlocked flag and either set the `ETH_FROM` environment variable to the address
of the unlocked account you want to use, or provide the --from flag with the address directly. It works if I add the --account flag though. [elliott@fedora foundry-se-2]$ cast wallet address --account scaffold-eth-custom
Enter keystore password:
0x1e2a14D2038bD4DE7976c26Fa6724c81D89Eab20 |
Co-authored-by: port <108868128+portdeveloper@users.noreply.github.com>
Ohh actually since we have Also was debugging this with @portdeveloper and I think we finally fixed the issue, seems like executing commands from makefile seems to pass argv at different position for different OS. But it should be good now and hopefully should work 🙌 |
I have just tested it all except the verify, will test it when etherscan is out of maintenance, and everything works great! |
Have tested this, everything still works perfectly for me on Mac OS @technophile-04 😁 |
This is working great!! I've been trying it with Shiv a little bit and pushed a couple of tweaks aa5e957
Thanks! |
@technophile-04 @carletex Works great! No issues this time. I was able to follow all the steps you posted including deploying to sepolia and verifying the contract. Nice work! Also no issues when running the command on the default account. It did not prompt me for a password and everything ran correctly. |
Tested it and it all works amazing!!! Edit: Yes, everything is OK, I just checked with a brand-new contract and it works as intended. |
Actually they are separate already, I think maybe you felt this way because you got "contract already verified" when you deployed "YourContract.sol"? I think this is because etherscan is being smart marking contracts already verified which have same bytecode? |
That is right haha I should've tested it with a separate contract before adding that comment! Now after testing with another contract, I saw that everything works as it should! |
Thanks to @portdeveloper for noticing! Actually fork was not woking, just fixed it at cbc3ac9 So now : and |
Merging this into |
Description
Adds keystore for
yarn generate
and also for all scripts run insidescript/deploy.s.sol
.keystore is saved to '~/.foundry/keystores/scaffold-eth-default'
yarn account:import // uses prompt to ask for private key and password
Additional Information
Related Issues