【问题标题】:can't deploy contract from web3 to geth node , Error: Transaction has been reverted by the EVM无法将合约从 web3 部署到 geth 节点,错误:交易已被 EVM 还原
【发布时间】:2022-01-06 07:12:18
【问题描述】:

我在 Nodejs 项目中运行 web3。 我用过这个 genesis.json:

{
"config": {
    "chainId": 123456,
    "homesteadBlock": 0,
    "byzantiumBlock": 0,
    "constantinopleBlock": 0,
    "eip150Block": 0,
    "eip155Block": 0,
    "eip158Block": 0,
    "petersburgBlock": 0
},
"alloc": {
    "0xa6B49C993142E**************************": {
        "balance": "120000000000000000000000"
    },
    "0xfd2041dcdc815**************************":{
        "balance": "120000000000000000000000"
    }
},
"difficulty": "0",
"gasLimit": "8000000"

}

我在之前的 genesis 文件中有 geth init。 我在远程实例上运行 geth。 这是 geth 命令:

sudo geth --port 3001 --networkid 123456 --nodiscover --datadir=./blkchain --maxpeers=0 --keystore ~/.ethereum/keystore --http --miner.etherbase 0xa6B49C9931************** --miner.threads 1 --http.port 8545 --http.addr 0.0.0.0 --http.corsdomain "*" --http.api "eth,net,web3,personal,miner" --ws --ws.port 8545 --ws.addr 0.0.0.0 --ws.api "eth,net,web3,personal,miner" --allow-insecure-unlock --unlock 0xa6B49C9931************** --syncmode fast

当尝试从 web3 部署新合约时(我已经尝试了许多 web3 版本,包括所有稳定版本),我收到了这个错误: 错误:交易已被 EVM 还原, TransactionRevertedWithoutReasonError....

但另一方面,对于 Truffle 中的同一个合约,我成功迁移并部署了同一个合约。

有人有这个问题吗?

【问题讨论】:

    标签: blockchain ethereum web3 truffle evm


    【解决方案1】:

    如果您在本地网络上部署以测试您的合同,您应该考虑使用ganache
    它有图形用户界面,与松露配合得很好

    【讨论】:

      猜你喜欢
      • 2021-10-06
      • 2020-01-28
      • 2022-08-12
      • 2021-02-13
      • 2019-01-26
      • 1970-01-01
      • 2021-12-28
      • 2020-12-14
      • 2020-05-26
      相关资源
      最近更新 更多