5 remix部署合约失败

这是我的私链启动命令

geth --rpc --rpcport "7545" --rpcaddr "0.0.0.0" --rpccorsdomain="*" --rpcapi eth,web3,admin,personal,net --datadir data --port "30303" --nodiscover --networkid 1024 --allow-insecure-unlock console 2>>geth.log

这是我的solidity代码

pragma solidity ^0.6.0;
// pragma experimental ABIEncoderV2;

contract noteContract {
    struct Note {
        string title;
        string outline;
        string time;
        string content;
    }
    mapping(address => Note[]) public notes;

    constructor() public {}

    // event NewNote(address indexed sender, Note indexed note);

    // 添加笔记
    function addNote(string memory title,string memory outline,string memory time,string memory content) public {
        notes[msg.sender].push(Note(title,outline,time,content));
        // emit NewNote(msg.sender, note);
    }

    function getNotesLen() public view returns (uint256) {
        return notes[msg.sender].length;
    }
    // event ModifyNote(address, uint256 index);

    function modifyNote(uint256 index, string memory title,string memory outline,string memory time,string memory content) public {
        notes[msg.sender][index] = Note(title,outline,time,content);
        // emit ModifyNote(own, index);
    }
}

这是remix部署显示的图,一直在pending image.png

这是metamask, image.png

这是日志的一部分

INFO [02-25|13:49:30.391] Successfully sealed new block            number=1350 sealhash=7c77ef…a05658 hash=c97eb7…d82c77 elapsed=1.869s
INFO [02-25|13:49:30.391] ?? block reached canonical chain          number=1343 hash=5cbb83…386476
INFO [02-25|13:49:30.391] ?? mined potential block                  number=1350 hash=c97eb7…d82c77
INFO [02-25|13:49:30.392] Commit new mining work                   number=1351 sealhash=f2772c…005703 uncles=0 txs=0 gas=0 fees=0 elapsed=192.646?s
WARN [02-25|13:49:31.526] Served eth_sendRawTransaction            conn=38.147.164.3:53318 reqid=7583936460024 t=365.153?s   err="replacement transaction underpriced"
WARN [02-25|13:49:31.703] Served eth_sendRawTransaction            conn=38.147.164.3:53320 reqid=7583936460025 t=21.711381ms err="replacement transaction underpriced"
WARN [02-25|13:49:31.967] Served eth_sendRawTransaction            conn=38.147.164.3:53322 reqid=7583936460026 t=88.965?s    err="known transaction: d48401ae362d66c923896aa52b33749f7f78ab495ee0bb41e5b29e276651e24d"
WARN [02-25|13:49:32.453] Served eth_sendRawTransaction            conn=38.147.164.3:53342 reqid=7583936460028 t=170.091?s   err="known transaction: 2aa6018329d07f82546589930a58df83921062059836feaec7a39d2629ae5593"
WARN [02-25|13:49:32.835] Served eth_sendRawTransaction            conn=38.147.164.3:53344 reqid=7583936460029 t=211.922?s   err="known transaction: 835e9a425c977c153b67b1fe5f1f6e854a2f680a12785bf080b922468aa1d69b"
WARN [02-25|13:49:33.114] Served eth_sendRawTransaction            conn=38.147.164.3:53340 reqid=7583936460027 t=176.381?s   err="known transaction: fc61d028b1744c38db54ee732f21ee5acdf26078944654b7f61ca3ac02fed0d7"
INFO [02-25|13:49:35.192] Successfully sealed new block            number=1351 sealhash=f2772c…005703 hash=bd0eaf…f05235 elapsed=4.800s
INFO [02-25|13:49:35.192] ?? block reached canonical chain          number=1344 hash=83a03a…c72fab
INFO [02-25|13:49:35.192] ?? mined potential block                  number=1351 hash=bd0eaf…f05235
INFO [02-25|13:49:35.193] Commit new mining work                   number=1352 sealhash=fb6108…a1d898 uncles=0 txs=0 gas=0 fees=0 elapsed=146.75?s

已经尝试过检查防火墙,并没有开,请问怎么解决

请先 登录 后评论

最佳答案 2020-04-13 20:19

我之前也遇到过这个问题,然后一通乱搞又好了。 geth 有一个一直的问题,在--dev 模式下确实有时交易会卡住。

你可以尝试一下:

  1. MetaMask 新建网络时, chainid 和 私链 的保持一致。
  2. 重启geth
  3. 在geth console 看看能否发起交易
  4. 重置Metamask 账号, 设置-》高级-》重置账号。
请先 登录 后评论

其它 1 个回答

panzun
请先 登录 后评论
  • 1 关注
  • 0 收藏,2575 浏览
  • panzun 提出于 2020-02-25 13:59