Part 2: building a DApp
In this second part of the Midnight developer tutorial, you will:
- Learn to install the tools necessary to compile a Midnight contract and DApp from source code
- Download the example code needed for the remainder of the tutorial
- Build a simple example from source
- Run the example and deploy your own smart contract
- 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.
When going through the tutorial, make sure you use compatible versions of example code and Compact compiler shown in the table below.
Examples | Compactc |
---|---|
0.1.15 | 0.19.0 |
0.1.14 | 0.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.