我的以太坊收到错误:状态目前不可用



当我向BC发送交易时,我得到一些错误信息,即

状态目前不可用。

这是什么意思?如何解决此问题?

我的 Solidity 合约代码如下:

function UserRegister(string memory userName,uint feiyong ) public payable returns(string memory isOK){
if (bytes(users[userName].name).length==0){

users[userName].name=userName;
emit UserRegisterEVENT(msg.sender,"registered");
return ("registered");
}
else
{
emit UserRegisterEVENT(msg.sender,"UserName has been registered");
return("UserName has been registered");
}
}
function getUserRegistered(string memory xyz) public view returns (bool non)
{

if (bytes(users[xyz].name).length==0){

return false;
}
else
{
return true;
}
}

我的 web3 客户端代码是:

var userReg=contract1.methods.UserRegister("LYQ",100).send({from:'0x18244fbf3b47175cd6b4a1183a476c9e70cb7368',gas:900000})  
.on('transactionHash', function(hash){

console.log("hash="+hash); 

})
.on('confirmation', function(confirmationNumber, receipt){

//console.log("confirmation number="+confirmationNumber);
})
.on('receipt', function(receipt){

console.log("receipt="+receipt[0][0]);
} )
.on('error',function(error){

console.log("error="+error);
})
.on('catch',function(error) {
console.log("error="+error);

});
console.log("userEeg="+userReg);
var userName="LYQ";
var xyz= contract1.methods.getUserRegistered(userName).call( (error, result) => {
if(error)
console.log("error="+error);
else
console.log("result="+result);
} );

当我执行代码时,getUserRegistered 返回了 false。 当执行发送函数时,混音会得到以下日志:

status      Status not available at the moment
transaction hash   0x1e484dfa3afbbeadbcd1db20c38ef0427f8cf4ab04344045c0f10d24f1055a02
from   0x18244fbf3b47175cd6b4a1183a476c9e70cb7368
to     WoTResourceACL.UserRegister(string,uint256) 0x3944fb3e4f97b149689dbf9b1e83d8bd361f02ef
gas    900000 gas 
hash   0x1e484dfa3afbbeadbcd1db20c38ef0427f8cf4ab04344045c0f10d24f1055a02
input  0x39c...00000
decoded input  {
"string userName": "LYQ",
"uint256 feiyong": {
"_hex": "0x64"
}
}
decoded output      - 
logs   [
{
"from": "0x3944fb3e4f97b149689dbf9b1e83d8bd361f02ef",
"topic": "0x27948276c58d5b63b61d92a95fe3cf7e2d6cf9c00ecdddac43cbe4a492a011e2",
"event": "UserRegisterEVENT",
"args": {
"0": "0x18244fBF3B47175cD6b4a1183A476c9e70cB7368",
"1": "registered",
"myaddr": "0x18244fBF3B47175cD6b4a1183A476c9e70cB7368",
"result": "registered",
"length": 2
}
}
]
value  0 wei 

@HeiHei @Zulhilmi Zainudin 我遇到了同样的问题。我尝试过Zulhilmi Zainudin的方法,但对我不起作用。 最后,我找到了一种方法,让它在我这边工作。我把它贴在这里,希望对其他人有帮助。 我已经在genesis.json文件中添加了以下行,并重新创建了私有链,它可以工作。

"homesteadBlock": 0,
"eip155Block": 0,
"eip158Block": 0,
"eip150Block": 0,
"byzantiumBlock": 0,
"constantinopleBlock": 0,
"petersburgBlock": 0

相关内容

最新更新