将智能合约部署到 PoA 私有以太坊区块链中出现错误:0x0 交易已挖掘但执行失败

问题描述 投票:0回答:1

将智能合约部署到 PoA 共识以太坊私链时,总是会出现错误:“0x0 交易已挖掘,但执行失败”。检查区块信息后发现,由于gas耗尽,部署失败。即使调整了

gasLimit
,部署仍然失败。

genesis.json
喜欢:

{
    "config": {
        "chainId": 377777,
        "homesteadBlock": 0,
        "eip150Block": 0,
        "eip155Block": 0,
        "eip158Block": 0,
        "byzantiumBlock": 0,
        "constantinopleBlock": 0,
        "petersburgBlock": 0,
        "istanbulBlock": 0,
        "berlinBlock": 0,
        "clique": {
            "period": 10,
            "epoch": 30000
        }
    },
    "difficulty": "1",
    "gasLimit": "8000000",
    "extradata": "0x0000000000000000000000000000000000000000000000000000000000000000618C92D30E4a7B21A0D00DC7f5038024752ADFD50000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
    "alloc": {
        "618C92D30E4a7B21A0D00DC7f5038024752ADFD5": {
            "balance": "100000000000000000000"
        },
        "4C8DEE4b7062f10C9D506688c418f1d90654ff86": {
            "balance": "100000000000000000000"
        }
    }
}

和智能合约:

// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.0;

contract Simple {
    function getValue() public pure returns (string memory) {
        return "Hello, World!";
    }
}
ethereum
1个回答
0
投票

考虑到可能是EVM的原因,在Remix中更改Solidity编译器版本后合约部署成功。由于Geth在1.14.x之后的版本不再支持PoA,因此使用Geth 1.13.15部署PoA私链,最高支持Solidity 0.8.19。

© www.soinside.com 2019 - 2024. All rights reserved.