Nightfall Truffle Box¶
The easiest way to get started on Nightfall.
Supported hardware & prerequisites¶
Mac and Linux machines with at least 16GB of memory and 10GB of disk space are supported.
Nightfall requires the following software to run:
- Docker
- Launch Docker Desktop (on Mac, it is on the menu bar) and set memory to 8GB with 4GB of swap space (minimum - 12GB memory is better) or 16GB of memory with 512MB of swap. The default values for Docker Desktop will NOT work. No, they really won't.
- Node (tested with 10.15.3) with npm and node-gyp
- If running macOS, install Xcode then run
xcode-select —install
to install command line tools. - Note: Currently will not work with node v12. To check the node version, run
node --version
. If using mac/brew, then you may need to runbrew install node@10
andbrew link --overwrite node@10 --force
- Python
- Be sure npm is setup to use v2.7 of python, not python3. To check the python version, run
python --version
- You may need to run
npm config set python /usr/bin/python2.7
(or wherever your python 2 location is)
Installation¶
First ensure you are in a new and empty directory.
-
Run the
unbox
command vianpx
and skip to step 3. This will install all necessary dependencies.npx truffle unbox nightfall
-
Alternatively, you can install Truffle globally and run the
unbox
command.npm install -g truffle truffle unbox nightfall
-
Start Docker.
-
In the root project directory, we generate the keys and constraint files for our Zero Knowledge Proofs. This is about 7GB and depends on randomness for security. This step can take a while, depending on your hardware (1-3 hours). Before you begin, check once more you have provisioned enough memory for Docker.
npm run setup
-
Alternatively, you can generate specific verification keys and constraint files one at time using a prompt.
npm run setup-prompt
-
Now, run the development console.
truffle develop
-
Compile and migrate the smart contracts. Note inside the development console we don't preface commands with
truffle
.compile migrate
-
Execute the script provided for registering Zero Knowledge Proof verification keys on-chain. Note inside the development console we don't preface commands with
truffle
.exec scripts/registerVks.js
-
Truffle can run tests written in Solidity or JavaScript against your smart contracts. Note the command varies slightly if you're in or outside of the development console.
// inside the development console. test // outside the development console.. truffle test
FAQ¶
-
How do I use this with Ganache-CLI?
It's as easy as modifying the config file! Check out our documentation on adding network configurations.
-
Where can I find more documentation?
This box is a marriage of Truffle, Nightfall, and ZoKrates. Any of them would be a great place to start!