Cyfrin Updraft.

Допис

Діліться своїми знаннями.

Cyfrin Moderator Pst.
Mar 29, 2024
Питання та відповіді експертів

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
Поділитися
Коментарі
.

Відповіді

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
Офіційна відповідь
Коментарі
.

Ви знаєте відповідь?

Будь ласка, увійдіть та поділіться нею.

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

200Пости201Відповіді
Sui.X.Peera.

Зароби свою частку з 1000 Sui

Заробляй бали репутації та отримуй винагороди за допомогу в розвитку спільноти Sui.