Ethereum Blog

Ethereum in practice part 3: how to build your own transparent bank on the blockchain

Introduction

user

Alex Van de Sande

Alex Van de Sande is an UX designer at the Ethereum Foundation and lead of the Mist team.


LATEST POSTS

How to build server less applications for Mist 12th July, 2016

Ethereum in practice part 2: how to build a better democracy in under a 100 lines of code 04th December, 2015

release

Ethereum in practice part 3: how to build your own transparent bank on the blockchain

Posted on .

This is the third and final post on a series on how to use the Ethereum Wallet to create your own autonomous organisations. On the first post we detailed how to create a token, and on the second we shown how to generate a digital democracy controlled by these tokens. Now we will do the full circle and create a token controlled by the Organisation!

We are going to modify the token contract to allow it to be minted by your DAO. So save the address of your current DAO in a note pad (pay attention to the icon) and grab this source code and you know the drill: contracts > deploy new contract > solidity source code > pick contract

You can fill the parameters any way you want (yes, emojis are permitted on the string fields) but you’ll notice one new field that didn’t exist before: Central Minter. Here add the address of your newly created democracy contract.

Ethereum Wallet 2015-12-01 at 7.09.11 PM

 

Click Deploy and let’s wait for the transaction to be picked up. After it has at least two confirmations, go to your democracy contract and you’ll notice that now it owns a million of your new coins. Now if you go to the Contracts tab you’ll see that there is a new DAO dollar (admin page) contract on your collection.

Select the “mintToken” function to your right and then put any address you own as the “target”, and then the amount of new mints you want to create from thin air in their account. Press “execute” but don’t press send! You’ll notice that there is a warning saying that the transaction can’t be executed. This happens because only the Minter (which is currently set to the DAO address) can call that function and you are calling it with your main account. But the calling code is the same, which is why you can simply copy it.

Instead, copy the contract execution code from the “data” field and put it aside on a notepad. Also get the address of your new “Mint” contract and save it somewhere.

Ethereum Wallet Screen-Shot-2015-12-01-at-7.17.06-PM

Now go back to the democracy contract and create a new proposal with these parameters:

  • As the beneficiary, put the address of your new token
  • Leave etherAmount blank
  • On the jobDescription just write a small description that you are minting new coins
  • On the transactionBytecode, paste the bytecode you saved from the data field on the previous step

 

Ethereum Wallet Screen Shot 2015-12-01 at 7.22.48 PM

 

In a few seconds you should be able to see that the details on the proposal. Unlike the other fields, transactionBytecode can be extremely lengthy 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 a proposal be voted without the actual code being there? And what prevents a user from executing a different code after the proposal has been voted on? That’s why we keep the hash of the bytecode. Scroll a bit on the “read from contract” function list and you’ll see a proposal checker function, where anyone can put all the function parameters and check if they match the one being voted on. This also guarantees that proposals don’t get executed unless the hash of the bytecode matches exactly the one on the provided code.

 

 

Now everyone can vote on the proposal and after the voting period has passed, anyone with the correct bytecode can ask the votes to be tallied up and the contract to be executed. If the proposal has enough support then the newly minted coins should appear on Alice’s account, as if it was a transfer from address Zero.

 

Why a transfer from code zero? Because it says so on the code. You can change that as you will

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 it says so on the contract code. You can change that as you prefer.

 

And now you have a central minter contract that exists solely on the blockchain, completelly fraud-proof as all their activities are logged transparently. The mint can also take coins from circulation by simply sending the coins it has to address Zero, or by freezing the funds on any account, but it’s mathematically impossible for the Mint to do any of those actions or generate more coins without the support of enough shareholders of the mint.

Possible uses of this DAO:

  • The creation of a universal stable crypto currency. By controlling the total amount of coins in circulation the Mint shareholders can attempt to create an asset whose value doesn’t fluctuate too wildly.
  • Issuance of certificates of backed assets: the coins can represent an external currency or items that the Mint owns and can prove to it’s shareholders and token holders. When the Mint acquires or sells more of these assets it can burn or generate more assets to guarantee that their digital inventory will always match their real counterpart
  • Digitally backed assets. The Mint can hold ether or other ethereum based digital currencies and use that to back the value of the currencies circulating

 

 

Improvements Suggestions

There are multiple ways that this structure can be yet improved, but we will leave it as an exercise and challenge to the reader:

  1. Right now votes are made by shareholders based on freely tradable tokens. Can instead membership be based on invitation, each member getting a single vote (or maybe use quadratic voting or liquid democracy)?
  2. What about other voting mechanisms? Maybe the vote instead of being a boolean could be a more flexible arrangement: you could vote to postpone the decision, or you can make a vote that is neutral but still count to the quorum
  3. Currently all proposals have the same debating period. Can you make that proportional to the value transfer being proposed? How would you calculate that to tokens?
  4. Can you create a better token that can be automatically created by sending ether into it, which can then be retrieved by burning the token, at a fluctuating market price?
  5. What else can the DAO own or do, besides tokens?

 

profile

Alex Van de Sande

Alex Van de Sande is an UX designer at the Ethereum Foundation and lead of the Mist team.

Comments
user

Author cryptoanarchy

Posted at 3:59 pm December 7, 2015.

Great work. Both the wallet and mist couldn’t come sooner. Is there any other way non-developers could help support/speed up the project? I know that I could donate to the foundation, but it seems really important that users can directly fund specific projects they like in the eth community, with transparency as to how that would speed them up. I might be missing something that’s been already implemented for that, or perhaps a DApp for micro-funding is currently in the works, or has become stillborn (sadly enough due to the problem it’s trying to solve!). I guess this is an issue for ethereum/open-source projects in general, and one that’s going to become more pressing as time goes by. It’d be awesome if ethereum was the place where it was finally solved.

Many thanks for your effort.

Reply
    user

    Author Alexandre Van de Sande

    Posted at 4:50 pm December 14, 2015.

    Thanks Crypto! We will come up with more transparent ways to donate to the foundation if that’s something you want to do, but right now the best way to help is to download the software, test it and give us some feedback! Another thing you can do is participate in gatherings (either online or real world) of Ðapp developers, you’ll be surprised to see the amount of times there are developers wanting help for their projects that is not necessarily technical in nature. You’ll certainly find something you can contribute and maybe be a part of some team!

    Reply
user

Author m888m

Posted at 5:25 pm December 9, 2015.

First of all: Great effort, Alex, thank you very much +1

I have a conceptual question for you. When you write:

“…the coins can represent an
external currency or items that the Mint owns and can prove to it’s
shareholders and token holders. When the Mint acquires or sells more of
these assets it can burn or generate more assets to guarantee that their
digital inventory will always match their real counterpart…”

What is, in your view, the best way to model the interface between the minter (the ‘real’ world) and the share-/token holders (the ‘digital’ world)?

The problem here is symmetric in the sense that we need to make sure that

a) the minter is not cheating (i.e., she owns the collateral)
b) the shareholders do not collude against the minter (i.e., they accept proposals to reflect inventory changes in the collateral)

What is the best model of checks and balances?

Reply
    user

    Author Alexandre Van de Sande

    Posted at 4:48 pm December 14, 2015.

    That is a great point M! I’m trying to solve the problem of transparency and ease of use in the blockchain side, but how to solve it on the real world part is open to the organisation operation. You should check the Digix project, they have gone in great lengths to try to solve this for gold ownership on the blockchain and there’s a lot to be learned from them.

    Reply
user

Author Strike Force Heroes 3

Posted at 6:21 am December 16, 2015.

Oh it
was wonderful.

I like content.

I make the game page.

invites you to play games here: <a href=http://sites.google.com/site/donkeykongfree1/>Donkey Kong</a>, <a href=http://strikeforceheroes3game.com>Strike Force Heroes 3</a>, <a href=http://happywheels3game.com>Happy Wheels 3</a>

Reply
user

Author Edward

Posted at 12:47 pm January 24, 2016.

Hi Alex,

Thanx4 this great article,

The tokens that you create can these also be send (free+instant)?

Reply
user

Author Davide

Posted at 10:20 am January 29, 2016.

As a non coder i managed the first two posts but this one is far to hard. But I,m exited about where it is heading to… thanks and cant wait for average user solution :)))))

Reply
user

Author J T

Posted at 12:19 pm February 27, 2016.

Thanks so much. Perfect level for me, wanted to get this far for so long but the earlier tutorials were too much for me. So stoked tyty!!!!

Reply

Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

View Comments (8) ...
Navigation