For this workshop we will be using Clevis & Dappartus my tools for rapid prototyping decentralized applications. We will also use ganache-cli to run a local EVM blockchain. Let’s get started.

Let’s install and fire up our local chain:

npm install -g ganache-cli; ganache-cli

Usually I start with some project idea or name. Judging by this summary of the ETHBerlin submissions, DAOs, DeFi, and NFTs are pretty popular. Let’s come up with the minimum viable all-of-those-things. We’ll call it NiftyDao!

There is no way I can build a fully fledged product in the 50 minutes I have, but we’ll cherry pick some code here and there and cut all the right corners. Plus, this barely will count as “DeFi”. Throwing that term around loosely here…

Let’s initialize our project with Clevis:

mkdir niftydao

cd niftydao

npx clevis init;npm i

(You will be prompted for what directories to use, just use the defaults.)

As you’ll read in the Clevis repo, you can install it globally, or you can install it locally and run:

alias clevis='./node_modules/clevis/bin.js'

To make sure Clevis is solid and the latest version let’s run:

clevis version

The goal of using these tools is to rapidly prototype decentralized applications. That will mean building the frontend and smart contracts in parallel. This allows for a very powerful and instant feedback loop.

Let’s fire up the frontend with:

npm start

Navigate to:

If you are using MetaMask make sure it is pointed to localhost:8545

You do not need MetaMask. Dapparatus will detect if you have web3 injected and if not, it will generate an ephemeral Ethereum key pair.

Either way, now you have a dApp and an Ethereum account ready to interact with it.

Let’s send some test ETH to our account:

clevis send 1 0 0x318f227735378a34ef39266f5b5935847d8635d5

All is good, our frontend is representing our local chain correctly and Clevis is working:

Let’s create our smart contract and make sure it’s wired up with the frontend display:

clevis create NiftyDao

Let’s add a string to our contract called name that will be public:

string public purpose = "Rapid Dapp Prototyping - BTC2019";

clevis compile NiftyDao

clevis deploy NiftyDao 0

Take a look at what those two commands create. You’ll see the the ABI that gets created and the bytecode that gets deployed. You’ll see the resulting address of the deployment.

We can even poke at our smart contract from the command line:

But CLIs are for nerds, let’s publish the contract to our frontend:

clevis test publish

We need to load our contract into the frontend. That means supplying it an ABI and address. Luckily, in the name of rapid prototyping, there is a ContractLoader in Dapparatus ready for us to uncomment:

Might as well uncomment the <Transactions/> component while you’re at it!

You’ll see that as soon as we save that we can see the contract in the console:

Let’s grab the purpose from our smart contract when the contracts are loaded:

Then let’s uncomment the UI section of the Dapp, carve out just what we need, and display the purpose :

Finally the key to rapid prototyping is a tight dev loop. How long does it take us to change the purpose, compile, deploy, and publish to the Dapp?