小编Axc*_*eus的帖子

当我尝试使用 Ganache 运行 Web3py 时,为什么会收到错误“不支持方法 eth_maxPriorityFeePerGas”?

使用 Ganache-cli 运行 Web3.py 会返回以下错误:

不支持方法 eth_maxPriorityFeePerGas。

然而,当直接使用像 Ropsten 这样的测试网络而不需要 Ganache-cli 时,这确实有效。

按照教程运行此代码:

from solcx import compile_standard, install_solc
import json
from web3 import Web3
import os
from dotenv import load_dotenv

load_dotenv()

with open("./SimpleStorage.sol", "r") as file:
    simple_storage_file = file.read()

install_solc("0.6.0")

compiled_sol = compile_standard(
    {
        "language": "Solidity",
        "sources": {"SimpleStorage.sol": {"content": simple_storage_file}},
        "settings": {
            "outputSelection": {
                "*": {"*": ["abi", "metadata", "evm.bytecode", "evm.sourceMap"]}
            }
        },
    },
    solc_version="0.6.0",
)

with open("compiled_code.json", "w") as file:
    json.dump(compiled_sol, file)

bytecode = compiled_sol["contracts"]["SimpleStorage.sol"]["SimpleStorage"]["evm"][
    "bytecode"
]["object"]

abi = compiled_sol["contracts"]["SimpleStorage.sol"]["SimpleStorage"]["abi"] …
Run Code Online (Sandbox Code Playgroud)

python solidity ganache web3py

32
推荐指数
2
解决办法
7982
查看次数

标签 统计

ganache ×1

python ×1

solidity ×1

web3py ×1