Skip to main content

Part 2: building a DApp

In this second part of the Midnight developer tutorial, you will:

  1. Learn to install the tools necessary to compile a Midnight contract and DApp from source code
  2. Download the example code needed for the remainder of the tutorial
  3. Build a simple example from source
  4. Run the example and deploy your own smart contract
  5. Learn to install and run your own Midnight network node and its associated pub-sub indexer, rather than relying on a node in the cloud.
important

When going through the tutorial, make sure you use compatible versions of example code and Compact compiler shown in the table below.

ExamplesCompactc
0.1.150.19.0
0.1.140.18.2

The last sections of part 2 of the tutorial examine the Compact code for the example contract and the TypeScript code for the example DApp in more detail.

When you are done with part 2, you will have built a DApp from source, deployed a contract, and run your own non-voting Midnight node, connected to the Midnight network.

The example contract in the DApp in part 2 is very simple: it merely creates a counter on the ledger and provides a circuit to increment it. The contract does not enforce any constraints beyond those implied by the Counter type itself, and the DApp does not work with any interesting private data. Thus, it does not show off Midnight's capability to shield private data, but when you are done with part 2, you will have built a DApp from source and deployed a new contract on the Midnight network.