Cyfrin / foundry-full-course-cu

GNU General Public License v3.0
3.72k stars 923 forks source link

Lesson 6 : Ganache URL not connecting while deploying SimpleStorage contract #1294

Closed Meherabhossen closed 6 months ago

Meherabhossen commented 10 months ago

Discussed in https://github.com/Cyfrin/foundry-full-course-f23/discussions/1282

Originally posted by **Meherabhossen** January 4, 2024 im getting error on this ``` [⠊] Compiling... No files changed, compilation skipped Error: error sending request for url (http://127.0.0.1:7545/): error trying to connect: tcp connect error: Connection refused (os error 111) Context: - Error #0: error trying to connect: tcp connect error: Connection refused (os error 111) - Error #1: tcp connect error: Connection refused (os error 111) - Error #2: Connection refused (os error 111) ``` this is my command ``` forge create SimpleStorage --rpc-url http://127.0.0.1:7545 --interactive ```
parwejkhan1816 commented 10 months ago

try to change the port number in ganache . Sometime firewall blocking access to some port in PC . Also check anvil is not running on same port
https://github.com/Cyfrin/foundry-full-course-f23/discussions/318 https://github.com/Cyfrin/foundry-full-course-f23/discussions/873 Take a look on above url , hope this help

darom1998 commented 10 months ago

I run this command forge create SimpleStorage --rpc-url http://127.0.0.1:7550 --interactive But this errors had appeared , solution please §§


[⠃] Compiling...No files changed, compilation skipped [⠊] Compiling... Error: error sending request for url (http://127.0.0.1:7550/): error trying to connect: tcp connect error: Connection refused (os error 111)

Context:

xyz899 commented 10 months ago
* Error #0: error trying to connect: tcp connect error: Connection refused (os error 111)

Hi,

This error generally pops up when there is a TCP Connection problem meaning that your CLI cannot connect. What you should try to do is this :

  1. Close the actual Terminal you're using ( Bash, Zsh, WSL ) and make another one
  2. in the temrinal type : foundryup
  3. Before trying on Gananche try to use the --rpc-url with anvil first by opening a second terminal and typing anvil use the rpc url of it generally it's : http://127.0.0.1:8545
  4. Restart VsCode
  5. Be sure to verify you have a solid connection and that you're not far away from a wireless device for example
  6. Restart the Computer

Try this

cryptjohel commented 8 months ago

To solve this issue u have to open a new terminal with same directory to initialize Anvil so to show it is running already

And your code line is not complete due to using interactive is to the fact there should be a private key that you should either use .env or using the latest keystore method

Or if you don't want to do that u can just compile it by using forge create SimpleStorage it will automatically create using anvil default way but when u need to specify with private key follow the steps I gave you

Chujimafa commented 8 months ago

if u use the wsl in vs code, you have to make sure ganache also in wsl, so you need to create a new wroking space in ganache und change it to wsl

cryptjohel commented 8 months ago

Thanks for the tip!

On Fri, Mar 15, 2024, 3:47 PM Chujimafa @.***> wrote:

if u use the wsl in vs code, you have to make sure ganache also in wsl, so you need to create a new wroking space in ganache und change it to wsl

— Reply to this email directly, view it on GitHub https://github.com/Cyfrin/foundry-full-course-f23/issues/1294#issuecomment-1999824493, or unsubscribe https://github.com/notifications/unsubscribe-auth/BEHRX5UPEQW4ZMNA3CWDO43YYMCWPAVCNFSM6AAAAABBQB6ZRKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSOJZHAZDINBZGM . You are receiving this because you commented.Message ID: @.***>

PatrickAlphaC commented 6 months ago

Going to close this for now, those who end up here, please see the discussion!