Cyfrin Updraft.

Beitrag

Teile dein Wissen.

Cyfrin Moderator Pst.
Mar 29, 2024
Experten Q&A

Error while running script to compile smart contract with .env file configuration

I have set up a .env file with private key and RPC URL for compiling a smart contract. When I try to run the script using the command:

forge script script/DeploySimpleStorage.s.sol --rpc-url $RPC_URL --broadcast --private-key $PRIVATE_KEY

I encounter the following error:

Error: 
error sending request for url (https://127.0.0.1:8545/): error trying to connect: received corrupt message of type InvalidContentType

Context:

  • Error #0: error trying to connect: received corrupt message of type InvalidContentType
  • Error #1: received corrupt message of type InvalidContentType I have already run Anvil and other necessary components as shown in a video tutorial, but I still face this issue. Any assistance would be appreciated.
  • Transaction
  • Security
  • Solidity
  • Smart Contract
  • Gas
0
1
Teilen
Kommentare
.

Antworten

1
Cyfrin Moderator Ans.
Mar 29 2024, 08:28

The issue is likely due to using https instead of http in the RPC_URL environment variable.

Additionally, it appears to be an Anvil URL. Ensure that Anvil is running in another terminal window as Anvil must be active to execute tasks on it.

0
Offizielle Antwort
Kommentare
.

Weißt du die Antwort?

Bitte melde dich an und teile sie.

Cyfrin Updraft is an education platform specializing on teaching the next generation of smart contract developers

200Beiträge201Antworten
Sui.X.Peera.

Verdiene deinen Anteil an 1000 Sui

Sammle Reputationspunkte und erhalte Belohnungen für deine Hilfe beim Wachstum der Sui-Community.