Donations Now Open!
Our Blog

Sandbox dApp for experimenting with Moloch DAO mechanics Governance is hard, especially on-chain. The Moloch aims to simplify “Decentralized Autonomous Organizations”. This is a sandbox for playing around with the mechanics and game theory behind a minimum viable DAO.

Sandbox dApp for experimenting with Moloch DAO mechanics

Governance is hard, especially on-chain. The Moloch aims to simplify “Decentralized Autonomous Organizations”. This is a sandbox for playing around with the mechanics and game theory behind a minimum viable DAO.

To get started, you’ll need Clevis or at least Docker installed on your machine. With Clevis installed directly it’s faster, but there are few other commands to run. I’ll default to the Docker version because it works universally. Let’s start by cloning down the repo:

cd ~;git clone https://github.com/austintgriffith/moloch

Next, let’s fire up our Docker container. This will bring up a private blockchain, the dApp, and the Clevis command prompt:

docker run -ti --rm --name clevis -p 3000:3000 -p 8545:8545 -v ~/moloch/app:/dapp austingriffith/clevis:latest

Note: the ~/moloch/apppart needs to point to where you cloned down the Moloch repo, specifically the app directory.

Note: Make sure you don’t have anything running on port 3000 or 8545 already. This container brings up ganache and CRA for you.

Eventually, you will get a clevis prompt and you can test that everything works by running:

🗜️ Clevis:/dapp 🗜️clevis test version

Note: don’t paste in “🗜️ Clevis:/dapp 🗜️” this is just an indicator that you are putting a command in the Clevis container.

When the Clevis prompt comes up and everything is ready to go, you’ll want to compile, deploy, test, and publish your smart contracts with:

🗜️ Clevis:/dapp 🗜️clevis test full

You can edit your code that is injecting into the Clevis container from your native operating system used a command like:

atom ~/moloch

When the container comes up, you will also have a Create React App ready:

http://localhost:3000
Make sure you have MetaMask pointed to the local RPC (http://localhost:8545)

The first screen of the Moloch Sandbox is the deployment screen:

You’ll also notice in the top right that we don’t have any ETH in our test accounts. Let’s fix that by editing the app/tests/clevis.js file. Look for the metamask() function in particular:

Replace these addresses with your address and you will be supplied with ETH and coins at deploy.

To make this test payout, you can run:

🗜️ Clevis:/dapp 🗜️clevis test metamask

Note: This will also run any time the “clevis test full” command runs.

Now we have ETH and we are ready to deploy.

foundersAddressesis a comma separated list of founding members for you Moloch DAO. They are added to the initial Members list with having to pay any tribute.

foundersVotingSharesis a comma separated list of the voting shares to be given each respective founding memeber.

periodDurationis the time in seconds each period will last. The default for this will be 86400 to represent one day.

votingPeriodLengthis the number of periods a proposal will be open for votes. The default for this will be 7.

gracePeriodLength is the number of periods after a proposal is closed for voting to allow members that voted no to “RageQuit” (exchange their voting shares for tokens from the Guild Bank).

proposalDepositis mainly just for Sybil resistance. It is a stake that must be put up for each new proposal. Only one new proposal can be introduced per period so it’s important that they can’t be spammed.


After you deploy your contract, you can see the specific parameters of your DAO along with current period information and total voting shares:

The UI is really “nasty” right now. Sorry. It’ll look really nice soon…

The first thing to test is to submit a proposal from your first account that will deposit some coins. Along with the Moloch contracts, clevis test full has also deployed two ERC20 tokens “SomeCoin” and “AnotherCoin”. You should edit the app/tests/clevis.js to mint you some of these on deploy.

You will need to hit “Approve” to make sure you allow the Moloch contract to move your coins.

If you ever see this “out of gas” error, it’s because you need to update your period. This runs at the start of every major action too, but with short periods it can be very dynamic, so if you see this:

You will want to run:

Note: We will fix this soon so the frontend will fake what period it shows based on time, the updatePeriod will run on a cron, and major functions will be provided with the correct amount of gas to update first.

Once you submit your proposal, it will show up in the list with all the parameters:

Wants 100 voting shares for a tribute of the coins. Voting starts at 22, ends at 25, and is processed after 28.

As you vote for a proposal you will see the votes increase:

When enough periods have passed (keep hitting the updatePeriod button). You will be able to “Process” the proposal:

Once this vote passes, we will see coins deposited in the Guild Bank:

And we will also see the members section where voting shares has updated:

We can see votingShares increased to 200 and coin balances decreased.

As an example, let’s say that first user now want’s to Rage Quit. If they “Collect Loot Tokens” and then “Approve” and “Redeem Loot Tokens”. They will exit the DAO and collect their share from the Guild Bank:

Conclusion

These are the basic mechanics of the Moloch DAO. You can fire up your own DAO locally with a couple commands and play with the game theory locally. Please contribute to this repo hereor the main Moloch repo here. Feedback is always welcome, I’m 🛠️@austingriffith on Twitter and Telegram. The original Moloch DAO code was created by 👹Ameen Soleimani (@ameensol).

If you are interested in contributing to this project, a major UI design is in the works. A React wizard might be needed to help integrate a beautiful design.

Read more
Featured Posts

Making Decisions in a DAO: Gitcoin Lessons Learned

The Secret to a Healthy web3 Community

The Merge + GR15 Mitigation and Offset Partners: This is Simply the Beginning

loading
loading