【发布时间】:2020-09-22 10:40:08
【问题描述】:
这是我的合同:
pragma solidity ^0.4.18;
contract Signup {
string fStudentId;
string fLocation;
function setInfo(string _fStudentId, string _fLocation) public {
fStudentId = _fStudentId;
fLocation = _fLocation;
}
function getInfo() public constant returns (string, string) {
return (fStudentId, fLocation);
}
}
我将 studentId 和 location 放入阻止,如何使用 web3 获取此信息?
我尝试使用:
web3.eth.getBlock(7).then(console.log);
我的 studentId 和位置在哪里? 谢谢!!!!!!
【问题讨论】:
-
要获取值,您应该使用使用 web3 的合同方法。 web3js.readthedocs.io/en/v1.2.8/…
标签: blockchain ethereum web3