クライアント側の実装、とくにイベントの設計において、お客さんへの優しさは欠かせません。
クライアントがいるからアプリになる
じゃなかったらただのデータ
イベントはとても重要。
実装の具体的な方法はこちら
Tx.reciept
contract IndexedReceipt {
event Deposit(address **indexed** _from, bytes32 **indexed** _id, uint _value);
function deposit(bytes32 _id) public payable {
{ ... ... }
Deposit(msg.sender, _id, msg.value);
}
{
"transactionHash": "0xd909c1dc6fef3a673a195a9c775126cf61fc237c26915290c957e2cc617dd69b",
... ...
// this is the value. value hasn't **indexed** keyword
"data": "**0x0000000000000000000000000000000000000000000000000000000000000000**",
**"topics"**: [
// signature of Deposit Event
**"0x19dacbf83c5de6658e14cbf7bcae5c15eca2eedecf1c66fbca928e4d351bea0f",
//** address **indexed** from
**"0x000000000000000000000000627306090abab3a6e1400e9345bc60c78a8bef57",
//** bytes32 **indexed** id
**"0x0000000000000000000000000000000000000000000000000000000000000001"**
],
}
]
}
ContractのEventの仕組み - アルゴリズムとかオーダーとか
Eventにつけるindexedの役割 - アルゴリズムとかオーダーとか
It can be useful to have a way to monitor the contract’s activity after it was deployed. One way to accomplish this is to look at all transactions of the contract, however that may be insufficient, as message calls between contracts are not recorded in the blockchain. Moreover, it shows only the input parameters, not the actual changes being made to the state. Also events could be used to trigger functions in the user interface.