输出
输出到status
例如
public static bool Put(byte[] key, byte[] value)
{
Storage.Put(Storage.CurrentContext, key, value);
//PutEvent("Put", key, value);
Runtime.Notify("Put");
return true;
}
调用:
输出如下:
{
"Action": "Notify",
"Desc": "SUCCESS",
"Error": 0,
"Result": {
"TxHash": "79a067308224694e6f2e2c022c6ad956c437d1dcbfc3e8eed674b7d2653096a3",
"State": 1,
"GasConsumed": 10000000,
"Notify": [{
"ContractAddress": "4ef8e909d899d7c67d322ed1bb6f4114502f996b",
"States": ["507574"]
}, {
"ContractAddress": "0200000000000000000000000000000000000000",
"States": ["transfer", "AazEvfQPcQ2GEFFPLF1ZLwQ7K5jDn81hve", "AFmseVrdL9f9oyCzZefL9tG6UbviEH9ugK", 10000000]
}]
},
"Version": "1.0.0"
}
可见States有值["507574"]
,转到ASCLL码恰好是Put
我们还可以通过事件的方式来输出:
[DisplayName("putRecord")]
public static event PutRecord PutEvent;
public static bool Put(byte[] key, byte[] value)
{
Storage.Put(Storage.CurrentContext, key, value);
PutEvent("Put", key, value);
//Runtime.Notify("Put");
return true;
}
调用方式相同,输出如下:
{
"Action": "Notify",
"Desc": "SUCCESS",
"Error": 0,
"Result": {
"TxHash": "0914132ab377175a68f3fca330aae9acb5216b052be349833fc81dd1d1285f32",
"State": 1,
"GasConsumed": 10000000,
"Notify": [{
"ContractAddress": "c48560efffaf805a46d0927f5dbf3e4a3b100194",
"States": ["7075745265636f7264", "507574", "010100000111010101110100", "010100000111010101110100"]
}, {
"ContractAddress": "0200000000000000000000000000000000000000",
"States": ["transfer", "AazEvfQPcQ2GEFFPLF1ZLwQ7K5jDn81hve", "AFmseVrdL9f9oyCzZefL9tG6UbviEH9ugK", 10000000]
}]
},
"Version": "1.0.0"
}
States输出依次为:putRecord,Put,"010100000111010101110100", "010100000111010101110100"
此时我们可以在DAPP中使用这些数据