To get started, you might want to explore the project directory structure and the default configuration file. Working with this project in your development environment will not affect any production deployment or identity tokens.
To learn more before you start working on Veiling, see the following documentation available online:
- Quick Start
- SDK Developer Tools
- Motoko Programming Language Guide
- Motoko Language Quick Reference
- JavaScript API Reference
There are a few steps to perform in order to set up the project before running it. Let's take a look.
In order to be able to install Motoko dependencies you have to download Vessel package manager first. The steps are the following (assuming you are using Linux or MacOS):
- Go to Vessel releases page and download the latest one for your OS
- Open the terminal and
cd
inside the directory where the file has been dowloaded (e.g. Downloads) - Run the following commands:
# "vessel-linux64" if you are on Linux
mv vessel-macos vessel
mv vessel /usr/local/bin
chmod 774 /usr/local/bin/vessel
- Close and re-open the terminal
- Run
vessel --version
, it should output the Vessel version you are currently using - Congratulations! You managed to install Vessel!
Make sure you have yarn installed on your system, open the terminal in the project root directory and run yarn
command in order to install the node modules.
To create and use a new identity, run the following:
dfx identity new admin
dfx identity use admin
Before deploying the canisters locally, you have to start the dfx server:
# Starts the local replica, running in the background
dfx start
# Sometimes you may also want to clean things up if stuff is not working properly
dfx start --clean
After you are done, you can stop the server with:
dfx stop
In order to be able to authenticate with your local deployment, you have to run internet-identity canister locally, on the same running server as Veiling.
The steps to run it properly are as follow:
- Make sure you started the server from the Veiling root directory.
- Make sure you have properly installed Rust on your computer.
- Clone or download the internet-identity repo in a directory external to this project.
cd
inside the internet-identity directory and run:
npm install
- After run:
npm ci
- Build and deploy everything with the following command (the first build may take a while):
II_FETCH_ROOT_KEY=1 dfx deploy --no-wallet --argument '(null)'
Follow these steps. You can skip the first 4 steps.
You can also just run make ledger
, but first read the comments in Makefile
.
Run the following command to create the canisters:
make create
Run the following command to build and deploy the actors on the canisters:
make deploy
If you want to redeploy after doing some changes to a particular canister you can just run:
make upgrade
Or you can run:
make <canister_name>
Once the job completes, your application will be available at http://localhost:8000?canisterId={asset_canister_id}
.
Additionally, if you are making frontend changes, you can start a development server with
npm start
or you can use
yarn start
Which will start a server at http://localhost:8080
, proxying API requests to the replica at port 8000.
If you are hosting frontend code somewhere without using DFX, you may need to make one of the following adjustments to ensure your project does not fetch the root key in production:
- set
NODE_ENV
toproduction
if you are using Webpack - use your own preferred method to replace
process.env.NODE_ENV
in the autogenerated declarations - Write your own
createActor
constructor
In order to run the tests, you must have at least 2 actors and run:
# the provided principal must be different from the one used to deploy the cannisters
dfx canister call test run "(principal \"mr2qb-wnilp-33aar-ep7ht-jqv4z-5ocdt-mmz2c-tm3of-2vt7q-bjf5i-6ae\")"