November 2018
Intermediate to advanced
528 pages
13h 21m
English
In our auction smart contract, we used the indexed argument in BidEvent() declaration for a clever reason:
event BidEvent(address indexed highestBidder, uint256 highestBid);
When you use the indexed keyword in your event, your Ethereum node will internally index arguments to build on indexable search log, making it searchable, meaning you can easily perform a lookup by value later on.
Suppose that the event was emitted by the MyAuction contract with the arguments BidEvent(26, “bidder's address”);. In this case, a low-level EVM log with multiple entries will be generated with two topics and a data field as shown in the following browser console screenshot:
The topics and data fields are as follows:
Read now
Unlock full access