Cyfrin / foundry-full-course-cu

GNU General Public License v3.0
2.99k stars 694 forks source link

hi #144

Closed aliweb3 closed 12 months ago

aliweb3 commented 1 year ago

hi i have issu whith this command in my terminal

forge create SimpleStorage --rpc-url http://127.0.0.1:7545
 --interactive

when i want to run this command i got this error:

 forge create SimpleStorage --rpc-url http://127.0.0.1:7545
 --interactive
[⠢] Compiling...
[⠆] Compiling 1 files with 0.8.19
[⠰] Solc 0.8.19 finished in 81.31ms
Compiler run successful!
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, --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.
zsh: command not found: --interactive

how can i fix this? please help

DevSwayam commented 1 year ago

Did You make sure that your Local blockchain was running parallely on another terminal?

aliweb3 commented 1 year ago

Yes, in anvil is working , but in ganache have problem

ChefAharoni commented 1 year ago

Looks like there's a problem with your private key.

Are you sure you've pasted it correctly? You should click on the key button here -

image

And copy the private key (the second option) - that's the key you paste into the terminal.

image

If that doesn't work, you can try pasting the private key into an .env file like so:

DUMMY_PRIVATE_KEY=0x97d40ee0e......

In your terminal source the .env so you can use it

source .env

And then run the command with the variable

forge create SimpleStorage --rpc-url http://127.0.0.1:7545
 --private-key $DUMMY_PRIVATE_KEY



(Note - these private keys are dummies and are "okay" to post online, and this method with .env should be only used in testing, not real production.)


Also, in the future - please keep this issues section in the repo for issues in the course, such as a broken link, file missing, etc.. For problems you're having, you should open a discussion, where people look more often to help other people. It's also better to give an informative title, instead of "hi", to give better context for your problem. A good title would be - "Problem with Ganache accessing local wallet".

ultronio commented 1 year ago

Hi Guys! New here and excited to become a great contributor to this new cryptographic world :D

PatrickAlphaC commented 12 months ago

Closing this as it's a stale isssue. For questions, please use the discussions!