Ethereum in practice part 2: how to build a better democracy in under a 100 lines of code
Building a Better Democracy in Under 100 Lines of Code
In our previous post, we explored the basics of creating a token on the Ethereum blockchain. However, as exciting as it is to create a token, it's only the beginning. In this post, we'll take it to the next level by creating a democratic organization that lives on the blockchain and allows anyone holding a share token to vote on proposals.
Creating a Democratic Organization
To create a democratic organization, we'll use the DAO (Decentralized Autonomous Organization) contract. This contract will allow us to create a organization that can move real value around and create a real impact on the world.
To get started, we'll go back to the "Contracts" tab and click on "Deploy Contract." We'll then paste the DAO source code into the "Solidity Source" field and choose the contract "Democracy" from the picker.
Configuring the DAO
Once we've chosen the contract, we'll need to configure it. We'll start by setting the amount of ether that the DAO will start with. Since we can send ether to it at any time in the future, we'll keep the amount at 0 for now.
Next, we'll set the address of the token contract that we created in our previous post. We'll also set the minimum number of shares required for voting, which will determine the quorum for proposals to pass.
Creating a Proposal
Now that we've configured the DAO, we can create a proposal. To do this, we'll select the "newProposal" function from the "Write to contract" tab. We'll then set the beneficiary of the proposal, the amount of ether to be sent, and a description of the proposal.
Voting on a Proposal
Once we've created a proposal, we can vote on it. To do this, we'll select the "vote" function from the "Write to contract" tab. We'll then set the proposal number and choose whether to vote for or against it.
Executing a Proposal
Once the minimum voting time has passed, we can execute the proposal. To do this, we'll select the "executeProposal" function from the "Write to contract" tab. We'll then set the proposal number and confirm that we want to execute it.
The Results
If everything goes well, we should be able to see the results of the vote in a few seconds. The "openToVote" parameter will turn to false, and the "proposalPassed" parameter will reflect whether the proposal has been accepted or not.
Conclusion
In this post, we've created a democratic organization that lives on the blockchain and allows anyone holding a share token to vote on proposals. We've also explored the basics of creating a proposal, voting on it, and executing it.
This is just the beginning of what's possible with the Ethereum blockchain. In our next post, we'll explore how to use "transactionBytecode" to allow the DAO to execute any kind of Ethereum transaction, even owning or creating other contracts.
Implications
The implications of this technology are vast. With the ability to create decentralized autonomous organizations, we can create new forms of governance, new forms of business, and new forms of social organization.
We can create organizations that are transparent, accountable, and secure. We can create organizations that are resistant to corruption, resistant to censorship, and resistant to oppression.
We can create organizations that are truly democratic, where everyone has a say in the decision-making process. We can create organizations that are truly decentralized, where power is distributed among many individuals and groups.
The possibilities are endless, and the future is bright.
Requirements
- MINIMUM 800 words - comprehensive coverage
- Use clear section headings (##) to organize content
- Write in an engaging, journalistic style
- Include technical details but make them accessible
- Provide practical insights and implications
- Use markdown formatting for structure
- NO fluff or filler - every sentence should add value
- Focus on "why this matters" and real-world applications
- Include specific examples where relevant
- End with forward-looking thoughts or implications




