A 159-byte counter: inc() raises a stored number by one and logs an Incremented event carrying the new value and whether it is odd.
Historical Significance
An early demonstration of what indexed event parameters are for. Putting the parity in a topic rather than the data body means a filter can select on it directly, and doing that on a derived boolean rather than an identifier is an unusually clear illustration of the mechanism. Logs were the main way a 2015 dapp watched contract state, so this pattern is the ancestor of every modern indexer subscription.
Context
Deployed 2015-08-26 by 0x092a5172f796d4c3cd0e03520134317fc25b74f6. Three byte-identical copies of this runtime exist. Source recovered by exact runtime bytecode match, verified on Sourcify and Etherscan.
Key Facts
Description
One function, inc() at selector 0x371303c0, pre-increments a uint in storage slot 0 and then emits Incremented(bool indexed odd, uint count). The parity flag is indexed, so it becomes a log topic rather than data, which lets a client filter for only the odd or only the even increments without reading the values. There is no getter, no access control and no way to reset: the count moves in one direction and the log is the only way to observe it.
Source Verified
Heuristic Analysis
The following characteristics were detected through bytecode analysis and may not be accurate.
Frontier Era
The initial release of Ethereum. A bare-bones implementation for technical users.
Bytecode Overview
Verified Source Available
Source verified through compiler archaeology and exact bytecode matching.
View Verification ProofShow source code (Solidity)
// Submitted by EthereumHistory (ethereumhistory.com)
contract Counter {
uint count;
event Incremented(bool indexed odd, uint count);
function inc() {
++count;
Incremented(count % 2 == 1, count);
}
}External Links
Related contracts
Counter
Same deployerA 159-byte counter: inc() raises a stored number by one and logs an Incremented event carrying the new value and whether it is odd.
0x5fda63...9df1f4August 26, 2015Counter
Same deployerA 159-byte counter: inc() raises a stored number by one and logs an Incremented event carrying the new value and whether it is odd.
0x94f658...e90accAugust 26, 2015test
Same deployerThe multiply contract that opens the go-ethereum Contract Tutorial, deployed with the author's own multiplier of 70 in place of 7.
0xdb685d...d68e91August 28, 2015Contract 0x051fdd...9f0723
Same deployerThe go-ethereum Contract Tutorial greeter, deployed with no constructor argument, so its greeting was left empty.
0x051fdd...9f0723August 29, 2015Contract 0x5272fe...b5804a
Same deployerThe go-ethereum Contract Tutorial greeter, deployed with no constructor argument, so its greeting was left empty.
0x5272fe...b5804aAugust 29, 2015Contract 0x13acd0...71885f
Same deployerThe go-ethereum Contract Tutorial greeter, deployed with no constructor argument, so its greeting was left empty.
0x13acd0...71885fAugust 29, 2015