This is a second article on a series on how to use current Ethereum tools to create smart contracts without the need for programming experience. Download the latest version of the Ethereum portfolio,, Read the first part And let’s be sure!
Creating a token is funnyBut what is the value of a token that is nothing new? We will now create a new contract that uses the tokens that we have just created. The contract will be a democratic organization that lives on the blockchain and that anyone holding an actions token can vote on the proposals.
So let’s go back to “Contracts“And then”Deploy the contract“And glue the DAO source code on “Source of solidity” field. Choose the “Democracy” contract on the selector, then select these parameters:
- On Rising Field you can add any amount of ether with which you want your DAO to start. Since you can send it to ether at any time in the future, if this is the first time you do, keep the amount to 0 and send the money later.
- On sharing Field, stick the address of the token contract you just created. Pay attention to the icon and the color of the small circle that appears on the side of the address. If it does not correspond exactly to that of the contract you created previously, there is an error.
- On MinuMUMSHARESFORVOTING Choose which is the minimum quorum of shareholders who must vote on a question before its adoption. Here, you must put the whole number of the minimum possible token, so if you have created a token with 2 decimals, put 500 here means that for a proposal to be executed, the number of votes must represent more than 5% of the total of the company’s shares.
- Minutesfordebating: This is the minimum time, a proposal of which must be discussed and voted before the results can be completed. Put a small number like 10 minutes if you just want to create something for tests, but put something like 20,000 if you want to store large amounts of ether, so all the proposals must stay there for at least two weeks.
Your contract should look like this:
After a few seconds, you will be redirected to a dashboard where you will see your new contract being created:
You can also see the link to the new contract on the “Contracts” tab. If it is not there (for example: if you add a contract that you have not created), you will have to add it manually. To add that you will need the address of the contract and the JSON interface, a text chain that explains to the wallet how to interact with the code. You can choose any name you want and press OK.
Click on your new contract box and you will see a contract page. If you have not already deposited a little ether on this contract, click on the deposit and put a small amount of ether so that you can test the functioning of this particular democracy. If the contract already has funds, click on the “Show contract information” button.
On “Read contract” You can see all the functions you can perform for free on the contract, as they only read Blockchain information. Here, you can see, for example, that the “Sharestokedress” is indeed the right address or that there is currently 0 proposals on the contract. Let’s change that.
On “Write to the contract” You have a list of all the functions that will try to make a calculation that records data at the blockchain, and which will therefore cost Ether. Select “Newproposal” and it will display all options for this function.
For “beneficiary”, add someone to someone you want to send ether, then put the number of ethers you want on the “Etheramount” (must be an integer) and finally a text describing the reason why you want to do it. Leave transactionbytecode empty for the moment. Click Execute and enter your password. After a few seconds, the Numposals will drop to 1 and the first proposition, 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 “offer” field and you can read everything on this subject.
Voting on a proposal is also very simple. Choose “vote” on the function picker. Type the proposal number on the first box and check the “yes” box if you agree (or leave it empty to vote against). To click “execute“To send your vote.
When the minimum voting time has passed, you can select “Executeproposal”. If the proposal simply sent ether, you can also leave it “TransactionbyTecode“Empty field. After pressing” execute “but before typing your password, pay attention to the screen that appears. If there is a warning on the” consumption of estimated costs “field, this means that for any reason, the function called will not run and will be suddenly terminated. The original proposal had.
If everything went well, you should be able to see the results of the vote in a few seconds. THE “Openvote“The parameter on the first box will turn into false while the propose will reflect whether the proposal has been accepted or not. You should also be able to see that the balance of the contract will drop and that the equivalent ether will be sent to the beneficiary of the ether you wanted to send.
Now take a moment to let in: you have just created an organization that only exists on the blockchain, which obeys the votes according to the completely digital tokens, but it can however advance the real value and create a very real impact on the world. Also note that the organization is no longer under your control: it will only perform the exact code you have used to create it, forever. You cannot bribe it, you cannot affect it and the same rules apply to 0.01 or 1,000,000 ethers.
Can it become better than that? In fact, it can. On our next article, we will explore how you can use “transactionbytecode” to allow the DAO to execute any type of transaction Ethereumeven have or create other contracts. We will also modify the token code to allow the DAO to control the amount of token that exists on traffic and how to move it forward.