Cyfrin Updraft.

Publication

Partagez vos connaissances.

Cyfrin Moderator Pst.
Mar 29, 2024
Questions et Réponses avec des Experts

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
Partager
Commentaires
.

Réponses

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
Réponse officielle
Commentaires
.

Connaissez-vous la réponse ?

Veuillez vous connecter et la partager.

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

200Publications201Réponses
Sui.X.Peera.

Gagne ta part de 1000 Sui

Gagne des points de réputation et obtiens des récompenses pour avoir aidé la communauté Sui à se développer.