How to setup DAI for local development

3 years ago, MakerDAO was first formed, with the vision of creating a much needed stablecoin in the ecosystem. 5 months ago, DAI was launched on mainnet.

In this tutorial, we’ll go over the process of setting up SAI (Single Collateral DAI) for local development

(Note this tutorial is for Mac users)

  1. Install Dapp Toolkit
curl | sh
nix-channel --add
nix-channel --update
nix-env -iA dapphub.{dapp,seth,hevm,evmdis}

2. Clone the SAI repo

git clone sai

3. Run the dapp testnet

dapp testnet

Note the (default) account which is:


We’ll need this later

Image for post
Image for post

(If you’re having trouble with this step check out )

4. To make sure we don’t have to add passphrase every time, we can create an empty passphrase file in a new terminal tab

touch emptyphrase

5. In this new terminal tab window export required variables

export ETH_PASSWORD=$PWD/emptypassexport ETH_KEYSTORE=~/.dapp/testnet/8545/keystore

And also export the (default) account from above

export ETH_FROM=fd5c42978bebaa67f850ded1124f982010acd229

6. Now run the deploy-fab and deploy scripts in /bin

./bin/deploy-fab && . load-fab-* && ./bin/deploy && . load-env-*

For context, the deploy-fab script deploys local contracts gem (externally valuable token e.g. ETH contract), vox (target price contract), tub (cup manager contract), tap (liquidator contract), top (global settlement manager contract), mom (admin manager contract), dad (authority contract) and the deploy script deploys the dai contract.

7. Lastly we’ll need to set some default parameters

Let’s set the eth price, mkr price

seth send $SAI_PIP "poke(bytes32)" $(seth --to-uint256 $(seth --to-wei 300 ETH))
seth send $SAI_PEP "poke(bytes32)" $(seth --to-uint256 $(seth --to-wei 220 ETH))

We’ll also and generate some gem (ETH) and some gov (MKR).

seth send $SAI_GEM "mint(uint256)" $(seth --to-uint256 $(seth --to-wei 2000000 ETH))
seth send $SAI_GOV "mint(uint256)" $(seth --to-uint256 $(seth --to-wei 1000000 ETH))

We will also set the debt ceiling, the liquidation ratio to 150% and the liquidation penalty to 20%.

seth send $SAI_MOM "setCap(uint256)" $(seth --to-uint256 $(seth --to-wei 50000000 ETH))
seth send $SAI_MOM "setMat(uint256)" $(seth --to-uint256 $(seth --to-wei 1500000000 ETH))
seth send $SAI_MOM "setAxe(uint256)" $(seth --to-uint256 $(seth --to-wei 1200000000 ETH))

All set!

For a more detailed instructions on developing with DAI be sure to look at

Written by


Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store