This is the third and final post in a series on how to use Ethereum Wallet to create your own autonomous organizations. About him first post we detail how to create a tokenand in the second, we show how to generate a digital democracy controlled by these tokens. Now we will go full circle and create a token. reviewed for the Organization!
We are going to modify the token contract so that your DAO can mint it. So save the address of your current DAO in a notepad (pay attention to the icon) and take this source code and you know the exercise: contracts > implement new contract > solidity source code > choose contract
You can fill in the parameters any way you want (yes, emojis are allowed in string fields), but you’ll notice a new field that didn’t exist before: Central Minter. Here add the address of your newly created democracy contract.
Click Deploy and let’s wait for the transaction to be collected. After you have at least two confirmations, go to your democracy contract and you will notice that you now own one million of your new coins. Now if you go to the Contracts tab you will see that there is a new DAO Dollar (admin page) contract for your collection.
Select the “mintToken” function to your right and then put whatever address you own as a “target”, and then the number of new mints you want to create out of thin air in your account. press “run” but don’t press send! You will notice that there is a warning that the transaction cannot be executed. This happens because only the minter (which is currently set to the DAO address) you can call that function, and you’re calling it with your parent account. But the calling code is the same, so you can just copy it.
However, copy the contract execution code from the “data” field and set it aside on a notepad. Also get the address of your new “Mint” contract and save it somewhere.
Now go back to the democracy contract and create a new proposal with these parameters:
- As the beneficiaryput the address of your new token
- Go away etherQuantity white
- About him work description just write a little description that you are minting new coins
- About him transactionBytecodepaste the bytecode you saved into the data field in the previous step
Within a few seconds you should be able to see the details of the proposal. Unlike the other fields, the transaction bytecode can be extremely long and therefore expensive to store on the blockchain. So instead of archiving it, the person executing the call later will provide the bytecode.
But that of course creates a security hole: how can you vote on a proposal without the actual code being there? And what prevents a user from running different code after the proposal has been voted on? That’s why we keep the hash of the bytecode. Scroll down the list of “read from contract” functions a bit and you’ll see a proposal check function, where anyone can put in all the parameters of the function and check if they match the one being voted on. This also ensures that proposals are not executed unless the hash of the bytecode exactly matches that of the provided code.
It’s older code, but check
Now everyone can vote on the proposal and after the voting period has passed, anyone with the correct bytecode can request that the votes be counted and the contract executed. If the proposal has enough support, the newly minted coins should appear in Alice’s account, just like a transfer from address Zero.
Why a transfer from address zero? Because doing the opposite, sending a coin to 0x00 is a way to effectively destroy it, but more importantly, because the contract code says so. You can change that however you prefer.
And now you have a central minter contract that exists solely on the blockchain, completely fraud-proof as all your activities are transparently recorded. The mint can also take coins out of circulation simply by sending the coins it has to Zero’s address, or by freezing the funds in any account, but it is mathematically impossible for the Mint to do either of those actions or generate more coins without the support of enough Mint shareholders.
Possible uses of this DAO:
- The creation of a universal stable crypto currency. By controlling the total number of coins in circulation, Mint shareholders can try to create an asset whose value does not fluctuate too much.
- Issuance of asset-backed certificates: Coins can represent an external currency or items that the Mint owns and can demonstrate to its shareholders and token holders. When the Mint acquires or sells more of these assets, it can burn or generate more assets to ensure that its digital inventory always matches its real-world counterpart.
- Digitally backed assets. Mint may hold ether or other ethereum-based digital currencies and use them to back the value of coins in circulation.
Suggestions for improvements
There are several ways this structure can be improved, but we’ll leave it as an exercise and challenge for the reader:
- Right now, votes are made by shareholders based on free trade tokens. Instead, can membership be based on an invite, each member getting a single vote (or maybe use quadratic voting either liquid democracy)?
- What about other voting mechanisms? Perhaps the vote instead of being a boolean could be a more flexible arrangement: you could vote to postpone the decision, or you could make a vote that is neutral but still counts for quorum.
- Currently all proposals have the same debate period. Can you make it proportional to the value transfer being proposed? How would you calculate that in chips?
- Can you create a better token that can be created automatically by sending it ether, which can then be recovered by burning the token, at a fluctuating market price?
- What else can the DAO own or do, besides tokens?