繁体   English   中英

执行智能合约功能

[英]execute a smart contract function

我的命令有问题吗?

contract.methods.thu().send(
   { from: senderAddress, 
     gasPrice: web3.utils.toHex(GAS_PRICE), 
     gasLimit: web3.utils.toHex(GAS_LIMIT)
   }
);

当我执行它时,出现以下错误:

未处理的拒绝错误:无效的JSON RPC响应:“”

我很确定自己确实已经成功执行了类似的命令,但是现在我不知道为什么不能这样做。

根据文档, gasLimit实际上由gas表示为气体限制器: http : gasLimit

contract.methods.thu().send(
   { from: senderAddress, 
     gasPrice: web3.utils.toHex(GAS_PRICE), 
     gas: web3.utils.toHex(GAS_LIMIT)
   }
)

另外,最好使用文档中的gasPrice (String)gas (Number)的参数类型。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM