Javascript 坚固性错误:JSON中的意外标记h位于
嘿,我正在开发一个简单的智能合同,我遇到了一个问题。每次尝试运行setWord函数时,我都会收到一个错误“transact to HelloWorldContract.setWord errored:错误编码参数:SyntaxError:JSON中位置2处的意外标记h”可能有什么问题Javascript 坚固性错误:JSON中的意外标记h位于,javascript,json,ethereum,solidity,Javascript,Json,Ethereum,Solidity,嘿,我正在开发一个简单的智能合同,我遇到了一个问题。每次尝试运行setWord函数时,我都会收到一个错误“transact to HelloWorldContract.setWord errored:错误编码参数:SyntaxError:JSON中位置2处的意外标记h”可能有什么问题 pragma solidity ^0.4.0; contract HelloWorldContract{ string word = "Hello World"; address issuer; function
pragma solidity ^0.4.0;
contract HelloWorldContract{
string word = "Hello World";
address issuer;
function HelloWorldContract(){
issuer = msg.sender;
}
function getWord() constant returns(string) {
return word;
}
function setWord(string newWord) returns(string) {
if(issuer != msg.sender){
return "this is not the creator!";
}
else{
word = newWord;
return "this is the creator!";
}
}
}
您需要以双引号传递参数字符串-“helloWorld”,而不仅仅是helloWorld。我猜您正在使用 不要忘记在传递的参数周围添加双引号: