以太坊JSON RPC常见错误及解决办法

以太坊JSON RPC常见错误及解决办法。

invalid sender

报错信息如下

{'code': -32000, 'message': 'invalid sender'}

这种情况下一般是提交交易eth_sendRawTransactioneth_sendTransactionchainId传参错误,主网是1,ropsten是3,注意要传数字而不是字符串,也不是0x1这种格式。

intrinsic gas too low

这种情况一般是gas参数传递错误,需要提高gas,注意传的是0x开头的16进制码。

eth_estimateGas报错

{"code":-32602,"message":"invalid argument 0: json: cannot unmarshal non-string into Go struct field TransactionArgs.chainId of type *hexutil.Big"}}

这种情况我遇见过一次,是由于chainId传参错误,需要传的是0x1这种格式而不是数字,跟提交交易正相反,为啥它俩没统一也是很不理解。

Leave a Comment

豫ICP备19001387号-1