Back to Home

Association

Utility
0x1d0299164a58...6cc2c406263d
Tangerine WhistleContract #25KSource VerifiedEdit this contract
Deployed November 11, 2016 (9 years ago)Block 2,603,480

The ethereum.org democracy tutorial: token holders propose a transaction, vote on it for a fixed period, and the contract sends it if it passes.

Tangerine Whistle EraVerified Source

Historical Significance

This is the pattern The DAO was built on, reduced to something one person could deploy: votes weighted by token balance, a fixed debating period, and a passing proposal that executes as a raw call from the treasury. The tutorial also shows the defence that mattered, committing to a hash of the transaction when the proposal opens so that voters and executor cannot be shown different code. Weighing votes at execution time rather than at voting time is the flaw it kept: a voter can sell their shares and their vote still counts.

Context

The democracy tutorial sat on ethereum.org beside the token and crowdsale tutorials and was revised repeatedly through 2016. Copies of it were deployed both before and after The DAO was drained in June 2016, which suggests it was read as a worked example of shareholder voting rather than as a warning.

Key Facts
Deployment Block
2,603,480
Deployment Date
Nov 11, 2016, 02:55 AM
Code Size
3.7 KB
Gas at Deploy
1,147,799

Description

The democracy contract from the ethereum.org tutorial: an association whose members are whoever holds a balance in a separate token, and whose decisions are transactions the association itself sends.

Any holder may open a proposal naming a recipient, an amount in whole ether, a text description and the bytecode of the transaction to send. What is stored is a hash of the recipient, the amount and that bytecode, so the exact transaction being voted on is committed in advance and cannot be swapped afterwards. Holders then vote for or against until the debating period expires, and each address may vote once.

After the deadline anyone may execute the proposal, supplying the bytecode again for the contract to check against the stored hash. Votes are weighed by the token balance each voter holds at that moment, not at the time they voted, and the tally has to clear a minimum quorum measured in shares before it counts. If more weight is in favour than against, the association makes the call with the proposed value attached.

This one takes its shares from the token at 0xe8c082a4ce6b7cb794d3c1ea87e4d858107f741f, requires 5 shares of weight for a vote to count, and gives each proposal one minute of debate.

Heuristic Analysis

The following characteristics were detected through bytecode analysis and may not be accurate.

Detected Type: Utility
Has ERC-20-like patterns

Bytecode Overview

Opcodes3,748
Unique Opcodes195
Jump Instructions172
Storage Operations105

External Links

Related contracts