Cyfrin Updraft.

Bài viết

Chia sẻ kiến thức của bạn.

Cyfrin Moderator Pst.
Mar 29, 2024
Hỏi đáp Chuyên Gia

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
Chia sẻ
Bình luận
.

Câu trả lời

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
Câu trả lời chính thức
Bình luận
.

Bạn có biết câu trả lời không?

Hãy đăng nhập và chia sẻ nó.

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

200Bài viết201Câu trả lời
Sui.X.Peera.

Kiếm phần của bạn từ 1000 Sui

Tích lũy điểm danh tiếng và nhận phần thưởng khi giúp cộng đồng Sui phát triển.