Back to Home

Association

Utility
0x8bfd7f777cdf...43ba262aea40
HomesteadContract #12KSource VerifiedEdit this contract
Deployed March 16, 2016 (10 years ago)Block 1,160,879

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.

Homestead 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
1,160,879
Deployment Date
Mar 16, 2016, 07:00 PM
Code Size
3.5 KB
Gas at Deploy
1,098,650

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 0xb51415543f8658209a41a25c727c972c2b92b0be, requires 501 shares of weight for a vote to count, and gives each proposal 5 minutes 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,597
Unique Opcodes199
Jump Instructions143
Storage Operations103

External Links

Related contracts