{"id":18819,"date":"2026-03-30T13:32:04","date_gmt":"2026-03-30T13:32:04","guid":{"rendered":"https:\/\/cryptoted.net\/index.php\/2026\/03\/30\/ethereum-in-practice-part-2-how-to-build-a-better-democracy-in-under-a-100-lines-of-code\/"},"modified":"2026-03-30T13:32:04","modified_gmt":"2026-03-30T13:32:04","slug":"ethereum-in-practice-part-2-how-to-build-a-better-democracy-in-under-a-100-lines-of-code","status":"publish","type":"post","link":"https:\/\/cryptoted.net\/index.php\/2026\/03\/30\/ethereum-in-practice-part-2-how-to-build-a-better-democracy-in-under-a-100-lines-of-code\/","title":{"rendered":"Ethereum in practice part 2: how to build a better democracy in under a 100 lines of code"},"content":{"rendered":"<p> <br \/>\n<\/p>\n<div id=\"\">\n<p class=\"chakra-text css-gi02ar\">This is a second post on a series on how to use the current Ethereum tools to build smart contracts without needing programming experience.<a target=\"_blank\" rel=\"noopener\" class=\"chakra-link css-vezwxf\" href=\"https:\/\/github.com\/ethereum\/mist\/releases\/tag\/0.3.7\"> Download the latest version of the Ethereum Wallet<\/a>, <a class=\"chakra-link css-vezwxf\" href=\"https:\/\/blog.ethereum.org\/2015\/12\/03\/how-to-build-your-own-cryptocurrency\">read the first part<\/a> and let&#8217;s have fun!<\/p>\n<p class=\"chakra-text css-gi02ar\"><a class=\"chakra-link css-vezwxf\" href=\"https:\/\/blog.ethereum.org\/2015\/12\/03\/how-to-build-your-own-cryptocurrency\">Creating a token is fun<\/a>, but what is the value of a token that\u00a0doesn&#8217;t do anything new? We are now going to create a new contract that uses the tokens we just created. The contract will be a Democratic organization that lives on the blockchain and that anyone holding a share token will be able to vote on proposals.<\/p>\n<p class=\"chakra-text css-gi02ar\">So let&#8217;s go back to &#8220;<strong>Contracts<\/strong>&#8221; and then &#8220;<strong>Deploy Contract<\/strong>&#8221; and paste the\u00a0<a target=\"_blank\" rel=\"noopener\" class=\"chakra-link css-vezwxf\" href=\"http:\/\/chriseth.github.io\/browser-solidity\/?gist=192371538cf5e43e6dab\">DAO source code<\/a>\u00a0on the\u00a0<strong>&#8220;Solidity Source&#8221;<\/strong>\u00a0field. Choose the contract &#8220;Democracy&#8221; on the Picker and then select these parameters:<\/p>\n<ul role=\"list\" class=\"css-1ars4k6\">\n<li class=\"css-0\">On the\u00a0<strong>amount<\/strong>\u00a0field you can add any ether amount you want your DAO to start with. Since you can send ether to it at any time in the future, if this is the first time you&#8217;ve been doing this then keep the amount at 0 and send the money later.<\/li>\n<li class=\"css-0\">On the\u00a0<strong>sharesAddress<\/strong>\u00a0field, paste the address of the token contract you just created. Pay attention to the icon and color of the little circle that appears by the side of the address. If it doesn\u2019t match exactly the one for the contract you created previously, then there&#8217;s an error.<\/li>\n<li class=\"css-0\">On\u00a0<strong>minimumSharesForVoting<\/strong>\u00a0pick what is the minimum quorum of shareholders that need to vote on an issue before it passes. Here you must put the integer number of the minimum token possible, so if you created a token with 2 decimal places, putting 500 here will mean that in order for a proposal to be executed then the number of votes must be more than 5% of the total shares of the company.<\/li>\n<li class=\"css-0\"><strong>minutesForDebating:\u00a0<\/strong>this is the minimum time a proposal must be discussed and voted on before the results can be tallied up. Put a small number like 10 minutes if you want just to create something for testing, but put something like 20,000 if you want to store large amounts of ether, so all proposals must stay there for at least two weeks.<\/li>\n<\/ul>\n<p>\u00a0<\/p>\n<p class=\"chakra-text css-gi02ar\">Your contract should be looking something like this:<\/p>\n<p class=\"chakra-text css-gi02ar\"><strong><a class=\"chakra-link css-vezwxf\" href=\"https:\/\/blog.ethereum.org\/images\/posts\/2015\/12\/Ethereum-Wallet-Screenshot-2015-12-03-at-3.50.36-PM-16.png\"><img decoding=\"async\" alt=\"Ethereum Wallet Screenshot 2015-12-03 at 3.50.36 PM 16\" src=\"https:\/\/blog.ethereum.org\/images\/posts\/2015\/12\/Ethereum-Wallet-Screenshot-2015-12-03-at-3.50.36-PM-16.png\" class=\"chakra-image css-hw6q2r\"\/><\/a><\/strong><\/p>\n<p class=\"chakra-text css-gi02ar\">\u00a0<\/p>\n<p class=\"chakra-text css-gi02ar\">After a few seconds you&#8217;ll be redirected to a the dashboard where you&#8217;ll see your new contract being created:<\/p>\n<p class=\"chakra-text css-gi02ar\"><strong><a class=\"chakra-link css-vezwxf\" href=\"https:\/\/blog.ethereum.org\/images\/posts\/2015\/12\/Ethereum-Wallet-Screenshot-2015-12-03-at-3.50.36-PM-13.png\"><img decoding=\"async\" alt=\"Ethereum Wallet Screenshot 2015-12-03 at 3.50.36 PM 13\" src=\"https:\/\/blog.ethereum.org\/images\/posts\/2015\/12\/Ethereum-Wallet-Screenshot-2015-12-03-at-3.50.36-PM-13.png\" class=\"chakra-image css-hw6q2r\"\/><\/a><br \/>\n<\/strong><\/p>\n<p class=\"chakra-text css-gi02ar\">You\u00a0can also see the link to the new contract on the &#8220;Contracts&#8221; tab. If it&#8217;s not there (for example:\u00a0if you are adding a contract that you didn&#8217;t create) then you&#8217;ll have to add it manually. To add that you&#8217;ll need the contract&#8217;s address and it&#8217;s JSON interface, a string of text that explains to the wallet how to interact with the code. You can pick any name you want and press OK.<\/p>\n<p class=\"chakra-text css-gi02ar\"><strong><a class=\"chakra-link css-vezwxf\" href=\"https:\/\/blog.ethereum.org\/images\/posts\/2015\/12\/Screen-Shot-2015-12-03-at-9.57.34-AM.png\"><img decoding=\"async\" alt=\"Ethereum Wallet Screen Shot 2015-12-03 at 9.57.34 AM\" src=\"https:\/\/blog.ethereum.org\/images\/posts\/2015\/12\/Screen-Shot-2015-12-03-at-9.57.34-AM.png\" class=\"chakra-image css-hw6q2r\"\/><\/a><br \/>\n<\/strong><\/p>\n<p class=\"chakra-text css-gi02ar\">Click your new contract box and you&#8217;ll see a contract page. If you haven&#8217;t already deposited some ether on that contract, click on deposit and put some small amount of ether so you can test how this particular democracy works. If the contract already has some funds, click the &#8220;show contract info&#8221; button.<\/p>\n<p class=\"chakra-text css-gi02ar\">On the <strong>&#8220;read from contract&#8221;<\/strong> you can see all the functions you can execute for free on the contract, as they are just reading information from the blockchain. Here you can see, for instance, that the &#8220;sharesTokenAddress&#8221; is indeed the correct address or that there are currently 0 proposals on the contract. Let&#8217;s change that.<\/p>\n<p class=\"chakra-text css-gi02ar\">On the <strong>&#8220;Write to contract&#8221;<\/strong> you have a list of all the functions that will attempt to do some computation that saves data to the blockchain, and therefore will cost ether. Select &#8220;newProposal&#8221; and it will show all the options options for that function.<\/p>\n<p class=\"chakra-text css-gi02ar\"><strong><a class=\"chakra-link css-vezwxf\" href=\"https:\/\/blog.ethereum.org\/images\/posts\/2015\/12\/Screen-Shot-2015-12-01-at-6.10.32-PM.png\"><img decoding=\"async\" alt=\"Ethereum Wallet Screen Shot 2015-12-01 at 6.10.32 PM\" src=\"https:\/\/blog.ethereum.org\/images\/posts\/2015\/12\/Screen-Shot-2015-12-01-at-6.10.32-PM.png\" class=\"chakra-image css-hw6q2r\"\/><\/a><\/strong><\/p>\n<p class=\"chakra-text css-gi02ar\">\u00a0<\/p>\n<p class=\"chakra-text css-gi02ar\">For &#8220;beneficiary&#8221; add the address of someone you want to send ether to, then put how many ethers you want on the &#8220;etherAmount&#8221; (must be an integer) and finally some text describing the reason you want to do this. Leave transactionByteCode blank for now. Click execute and type your password. After a few seconds the numProposals will increase to 1 and the first proposal, number 0, will appear on the left column. As you add more proposals, you can see any of them by simply putting the proposal number on the &#8220;proposals&#8221; field and you can read all about it.<\/p>\n<p class=\"chakra-text css-gi02ar\">Voting on a proposal is also very simple. Choose &#8220;vote&#8221; on the function picker. Type the proposal Number on the first box and check the &#8220;Yes&#8221; box if you agree with it (or leave it blank to vote against it). Click &#8220;<strong>execute<\/strong>&#8221; to send your vote.<\/p>\n<p class=\"chakra-text css-gi02ar\">\u00a0<\/p>\n<p class=\"chakra-text css-gi02ar\"><a class=\"chakra-link css-vezwxf\" href=\"https:\/\/blog.ethereum.org\/images\/posts\/2015\/12\/Screen-Shot-2015-12-01-at-6.18.22-PM.png\"><img decoding=\"async\" alt=\"Screen Shot 2015-12-01 at 6.18.22 PM\" src=\"https:\/\/blog.ethereum.org\/images\/posts\/2015\/12\/Screen-Shot-2015-12-01-at-6.18.22-PM.png\" class=\"chakra-image css-hw6q2r\"\/><\/a><\/p>\n<p class=\"chakra-text css-gi02ar\">When the minimum voting time has passed, you can select\u00a0<strong>&#8220;executeProposal&#8221;<\/strong>. If the proposal was simply sending ether, then you can also leave the &#8220;<strong>transactionBytecode<\/strong>&#8221; field blank. After pressing &#8220;execute&#8221; but before typing your password, pay attention to the screen that appears. If there is a warning on the &#8220;estimated fee consumption&#8221; field, then this means that for some reason the function called will not execute and will be abruptly terminated. It can mean many things, but in the context of this contract this warning will show up whenever you try to execute a contract before its deadline has passed, or if the user is trying to send a different bytecode data than the original proposal had. For security reasons if any of these things happens, the contract execution is abruptly terminated and the user that attempted the illegal transaction will lose the all the ether he sent to pay transaction fees.<\/p>\n<p><strong><br \/>\n<a class=\"chakra-link css-vezwxf\" href=\"https:\/\/blog.ethereum.org\/images\/posts\/2015\/12\/Screen-Shot-2015-12-01-at-6.21.30-PM.png\"><img decoding=\"async\" alt=\"Ethereum Wallet Screen Shot 2015-12-01 at 6.21.30 PM\" src=\"https:\/\/blog.ethereum.org\/images\/posts\/2015\/12\/Screen-Shot-2015-12-01-at-6.21.30-PM.png\" class=\"chakra-image css-hw6q2r\"\/><\/a><br \/>\n<\/strong><\/p>\n<p class=\"chakra-text css-gi02ar\">If everything went well you should be able to see the results of the vote in a few seconds. The &#8220;<strong>openToVote<\/strong>&#8221; parameter on the first box will turn to false while the\u00a0<strong>proposalPassed<\/strong>\u00a0will reflect if the proposal has been accepted or not. You should also be able to see that the Ether balance of the contract will go down and the equivalent ether will be sent to the beneficiary of the ether you wanted to send.<\/p>\n<p class=\"chakra-text css-gi02ar\">Now take a moment to let that in: you just created an organization that only exists on the blockchain, that obeys votes based on completely digital tokens, but yet it can move real value around and create a very real impact on the world. Also notice that the organization is not under your control anymore: it will execute only the exact code you used to create it, forever. You can&#8217;t bribe it, you can&#8217;t earmark it and the same rules apply either you are moving 0.01 or 1,000,000 ethers.<\/p>\n<p class=\"chakra-text css-gi02ar\">Can it get any better than this? Actually, it can. <a class=\"chakra-link css-vezwxf\" href=\"https:\/\/blog.ethereum.org\/2015\/12\/07\/ethereum-in-practice-part-3-how-to-build-your-own-transparent-bank-on-the-blockchain\">On our next post we will explore how you can use &#8220;transactionBytecode&#8221; to allow the DAO to execute any kind of ethereum transaction<\/a>, even owning or creating other contracts. We&#8217;ll also modify the token code to allow the DAO to control the amount of a token that exists on circulation and how to send it forward.<\/p>\n<\/div>\n<p><br \/>\n<br \/><a href=\"https:\/\/blog.ethereum.org\/en\/2015\/12\/04\/ethereum-in-practice-part-2-how-to-build-a-better-democracy-in-under-a-100-lines-of-code\">Source link <\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>This is a second post on a series on how to use the current Ethereum tools to build smart contracts without needing programming experience. Download the latest version of the Ethereum Wallet, read the first part and let&#8217;s have fun! Creating a token is fun, but what is the value of a token that\u00a0doesn&#8217;t do [&hellip;]<\/p>\n","protected":false},"author":6,"featured_media":18498,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"tdm_status":"","tdm_grid_status":"","footnotes":""},"categories":[24],"tags":[],"kronos_expire_date":[],"class_list":["post-18819","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ethereum"],"_links":{"self":[{"href":"https:\/\/cryptoted.net\/index.php\/wp-json\/wp\/v2\/posts\/18819","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cryptoted.net\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cryptoted.net\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cryptoted.net\/index.php\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/cryptoted.net\/index.php\/wp-json\/wp\/v2\/comments?post=18819"}],"version-history":[{"count":0,"href":"https:\/\/cryptoted.net\/index.php\/wp-json\/wp\/v2\/posts\/18819\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/cryptoted.net\/index.php\/wp-json\/wp\/v2\/media\/18498"}],"wp:attachment":[{"href":"https:\/\/cryptoted.net\/index.php\/wp-json\/wp\/v2\/media?parent=18819"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cryptoted.net\/index.php\/wp-json\/wp\/v2\/categories?post=18819"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cryptoted.net\/index.php\/wp-json\/wp\/v2\/tags?post=18819"},{"taxonomy":"kronos_expire_date","embeddable":true,"href":"https:\/\/cryptoted.net\/index.php\/wp-json\/wp\/v2\/kronos_expire_date?post=18819"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}