This is the second entry in a series discussing how to utilize existing Ethereum resources to generate smart contracts without any coding skills. Acquire the latest Ethereum Wallet version, explore the initial section and let’s enjoy!
Creating a token is enjoyable, but what worth does a token hold if it doesn’t introduce anything innovative? We are about to develop a new contract that will utilize the tokens we have just created. This contract will represent a Democratic entity residing on the blockchain, enabling anyone with a share token to vote on proposals.
Let’s return to “Contracts” and subsequently select “Deploy Contract“, then paste the DAO source code in the “Solidity Source” field. Choose the contract titled “Democracy” from the Picker and then set the following parameters:
- In the amount field, you can specify any ether amount you wish your DAO to commence with. As you can transfer ether to it anytime in the future, if this is your initial attempt, keep the amount at 0 and send funds later.
- For the sharesAddress field, insert the address of the token contract you just established. Pay attention to the icon and color of the small circle that appears beside the address. If it doesn’t perfectly match the one for the contract you previously created, then there is a mistake.
- For the minimumSharesForVoting option, select the minimum number of shareholders that must vote on an issue before it is approved. Here, you should input an integer representing the smallest token possible; so if you established a token with 2 decimal places, entering 500 here means that for a proposal to be approved, the number of votes must exceed 5% of the total company shares.
- minutesForDebating: This is the minimum duration a proposal must be deliberated and voted on before the outcomes can be calculated. Enter a small duration like 10 minutes for testing purposes, but use something like 20,000 if you intend to secure large ether amounts, ensuring all proposals remain for at least two weeks.
Your contract should resemble something like this:
After a brief moment, you will be redirected to a dashboard displaying your newly created contract:
You can also find the link to the new contract in the “Contracts” tab. If it is missing (for instance, if you are adding a contract you didn’t create), you’ll need to input it manually. To do so, you will require the contract’s address and its JSON interface, a text string that informs the wallet how to engage with the code. You can choose any name you prefer and click OK.
Click on your new contract box to access a contract page. If you haven’t deposited any ether into that contract yet, click on deposit and enter a small ether amount to test how this specific democracy operates. If the contract already contains funds, click the “show contract info” button.
In the “read from contract” section, you’ll find all the functions you can execute at no cost on the contract since they merely retrieve information from the blockchain. Here, you can verify, for instance, that the “sharesTokenAddress” is indeed the correct address or confirm that there are currently 0 proposals within the contract. Let’s change that.
In the “Write to contract” section, you will discover a list of all functions that will attempt to perform actions that save data to the blockchain, thus incurring ether costs. Choose “newProposal” and it will display all the options for that function.
For “beneficiary,” enter the address of an individual you wish to send ether to, then specify how many ethers you want in the “etherAmount” (must be a whole number) and finally write a description detailing your reason for this transaction. Leave transactionByteCode empty for the time being. Click execute and input your password. After a few seconds, the numProposals will increase to 1, and the first proposal, number 0, will show up in the left column. As you introduce additional proposals, you can view any of them by simply entering the proposal number in the “proposals” field, allowing you to read all about it.
Voting on a proposal is also quite straightforward. Select “vote” in the function picker. Enter the proposal Number in the first box and check the “Yes” box if you support it (or leave it unchecked to vote against it). Click “execute” to submit your vote.
Once the minimum voting duration has elapsed, you can select “executeProposal”. If the proposal merely involves sending ether, then you may also omit the “transactionBytecode” field. After clicking “execute” but prior to entering your password, be vigilant about the screen that appears. If there is an alert in the “estimated fee consumption” section, this indicates that for some reason the invoked function will not proceed and will be abruptly halted. This could signify various issues, but in the context of this contract, the warning will appear whenever an attempt is made to execute a contract before its deadline is reached, or if the user is attempting to transmit a different bytecode than what the original proposal specified. For safety reasons, if any such situations arise, the execution of the contract is abruptly halted, and the user who attempted the invalid transaction will forfeit all the ether sent for transaction fees.
If all proceeds smoothly, you should witness the results of the vote within moments. The “openToVote” parameter in the initial box will switch to false while the proposalPassed will indicate whether the proposal has been approved or not. You should also observe that the Ether balance of the contract will decrease, and the equivalent amount of ether will be transmitted to the recipient you intended to send it to.
Now take a moment to absorb this: you have just established an entity that solely exists on the blockchain, governed by votes using entirely digital tokens, yet it can transfer actual value and create a tangible impact on the world. Also recognize that the organization is no longer within your control: it will execute only the precise code you utilized to create it, perpetually. You are unable to influence it, you cannot designate it for specific purposes, and the same regulations apply whether you are transferring 0.01 or 1,000,000 ethers.
Can it possibly improve beyond this? Indeed, it can. In our upcoming post, we will investigate how to utilize “transactionBytecode” to enable the DAO to perform any type of Ethereum transaction, even managing or establishing other contracts. We will also adjust the token code to empower the DAO to regulate the quantity of a token in circulation and how to proceed with sending it forward.





