You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Remix-IDE部署Solidity 0.4.17合约失败:参数编码错误求助

Solidity 0.4.17版本Inbox合约部署错误解决

错误场景

部署基于Solidity ^0.4.17的Inbox合约时,触发报错:

creation of Inbox errored: Error encoding arguments: Error: invalid params

合约代码如下:

pragma solidity ^0.4.17;

contract Inbox {
    string public message;

    function Inbox(string initialMessage) public {
        message = initialMessage;
    } 
    function setMessage(string newMessage) public {
        message = newMessage;
    }

    function getMessage() public view returns (string) {
        return message;
    }
}

问题原因

该错误核心是构造函数参数编码失败,通常是部署时传入的字符串参数格式不符合要求:Solidity 0.4.x版本中,字符串参数必须用双引号包裹,直接输入无引号的文本会被识别为无效参数。

解决步骤

  • 在Remix部署面板的构造函数参数输入框中,输入带双引号的初始字符串,例如"Hello Inbox"
  • 确认Remix编译器已选择0.4.17版本(或兼容的^0.4.17版本),避免版本不匹配问题
  • 重新执行部署操作

内容的提问来源于stack exchange,提问作者Almighty Drake

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.25 20:19:51