我已经编写了下面的代码,它运行得很完美。在挖掘和传递值以及特定的gas值之后,我在geth控制台上得到事务哈希作为输出。现在我想知道在代码中应用的sha3函数的输出?
contract C {
string a;
string b;
bytes32 d;
function identify(string sm, string bm, bytes32 i) returns (bytes32 hash){
a = sm;
b =bm;
d = i;
return sha3(sm, bm, i);
}
}一旦采矿完成。我输入以下命令:
c.identify("Bob","Alice",1234);我知道交易有
Contract mined! address: 0x1df37eeccc9278b04497b4a3c97388cac3a98e6f
transactionH
ash: 0x7bf49540c9db92cab84b483514ffebdb600d39889ef2319904bc788d7c87afd9
c.identify("rahul","ankesh",1234,{from:primary,gas:300000})
"0x24d344a11f9aa84d43ccf0e17e635750e3d44fee0c4eaba1c1dea8ebbdaf3376".现在,sha3函数的输出在哪里?
发布于 2016-11-15 08:25:15
一些选项,显式地标记函数constant:
function identify(string sm, string bm, bytes32 i) constant returns (bytes32 hash)
或显式执行call:
c.identify.call("Bob","Alice",1234);
我在浏览器中进行了测试,您应该可以看到值0xc479d062d8322fb8b4207d9967174220d6d86d90fef3b5c6cefc8ec6577e21c8。
更多信息:交易和呼叫之间有什么区别?
https://ethereum.stackexchange.com/questions/10028
复制相似问题