Ethereum in Action Part 3: How to Build Your Own Transparent Bank on the Blockchain
This is the third and final post in a series on how to create your own autonomous organization using an Ethereum wallet. to The first post detailed how to create a token.and Second, we showed how to create a digital democracy governed by these tokens.. Now let’s do a full loop and generate a token. controlled By organization!
We will be modifying the token contract to allow your DAO to issue it. So, save the address of the current DAO in notepad (note the icon) and Get this source code And you know the drill: Contract > Deploy new contract > Solidity source code > Select contract
You can fill out the parameters any way you like (yes, string fields allow emojis), but you’ll discover a new field that didn’t exist before: Central Minter. Add the address of your newly created Democracy Agreement here.
Click Deploy and wait for the transaction to be selected. After receiving at least two confirmations, go to your democracy contract and you will see that you now own one million new coins. Now if you go to the Contracts tab you will see that there is a new contract. DAO Dollar (Admin Page) Sign a contract for your collection.
Select the “mintToken” function on the right, then enter an address you own as the “destination” and then enter the amount of new mints you want to generate for that account. Press down “Execute” but Don’t press send! You will see a warning that the transaction cannot be executed. Why does this happen? Minter You can call the function (currently set to the DAO address), and it will be called with the main account. However, the calling code is the same, so you can simply copy it.
Instead of, Copy the contract execution code from the “Data” field. And keep it separately in a notepad. Also, get the address of your new “Mint” contract and save it somewhere.
Now go back to your democracy contract and create a new proposal using the following parameters:
- As follows beneficiaryEnter the address of your new token
- leave ether amount gap
- to job description Write a brief description that you are minting a new coin.
- to Transaction byte codePaste the bytecode you saved in the data field from the previous step.
You can view the details of your proposal in seconds. Unlike other fields, transactionBytecode can be very long, making it expensive to store on the blockchain. So, instead of keeping it, whoever makes the call later will provide the bytecode.
But of course this creates a security hole. How can I vote a proposal without actual code? And how to prevent users from executing other code after a proposal is voted on? This is why we keep a hash of the bytecode. If you scroll a bit through the list of “Read Contract” features, you’ll see the Proposal Checker feature, which allows anyone to enter any feature parameters and see if they match the parameters being voted on. This also ensures that the proposal will not be executed unless the hash of the bytecode exactly matches the hash of the provided code.
It’s old code, but check it out.
Now everyone can vote on the proposal, and after the voting period, anyone with the correct bytecode can tally the votes and request that the contract be executed. If the proposal receives enough support, the newly minted coins should appear in Alice’s account as if they had been transferred from address 0.
Why are you sending from address 0? Conversely, sending coins to 0x00 is an effective way to destroy them, but more importantly, because the contract code says so. You can change it as you wish.
There is now a central mining contract that exists only on the blockchain, and all activity is recorded transparently, preventing fraud at all. The mint can also pull coins from circulation by simply sending them to a zero address or freezing funds in all accounts. mathematically impossible It forces the Mint to take this action or create more coins without sufficient shareholder support.
Possible uses for this DAO:
- Creating a universal and stable cryptocurrency. By controlling the total amount of coins in circulation, Mint shareholders can attempt to create an asset whose value does not fluctuate significantly.
- Issuance of Collateral Asset Certificates: Coins can represent external currency or items owned by the mint and can be proven to shareholders and token holders. As the mint acquires or sells more of these assets, it can burn or create more assets to ensure its digital inventory always matches its physical assets.
- Digitally backed assets. Mint can hold Ethereum or other Ethereum-based digital currencies and use them to back the value of currencies in circulation.
Improvement suggestions
There are many ways to improve this structure, but I will leave that as an exercise and challenge for the reader.
- Currently voting is done by shareholders based on freely tradable tokens. Instead, membership could be invitation-based, with each member getting a single vote (or you could also use: secondary voting or liquid democracy)?
- What about other voting mechanisms? Maybe a vote instead of a boolean would be a more flexible array. You can vote to postpone a decision, or you can vote neutrally but still count as a quorum.
- Currently, all proposals have the same discussion period. Can it be made proportional to the proposed value transfer? How do I calculate this into tokens?
- Is it possible to send ether to create better tokens that are automatically generated and can be recovered by burning the tokens at a fluctuating market price?
- What can a DAO own or do besides tokens?