Development Environment
The Euclid Development Environment is an upgradeable project framework to simplify the process of configuring a local development environment for metagraph developers on the Constellation Network.
Getting started with metagraph development can be challenging due to the infrastructure requirements for a minimal development environment. This is a significantly bigger challenge for Constellation Network developers compared to developers on blockchain-based networks due to the inherent complexity of Constellation's microservice-based architecture. The Euclid Development Environment was created to simplify that process as much as possible for metagraph developers, so that developers can focus on building their applications and business logic rather than deploying infrastructure. It includes open source tools that can be used as a starting point for developing more customized tooling specific to your project teamβs needs.
Minimal Development Environment
A minimal development environment for the Constellation Network consists of the following components:
- 1 Global L0 node
- 1 Currency L0 node
- 3 Currency L1 nodes
- 3 DAG L1 nodes (optional)
Note that a cluster of at least three L1 nodes is necessary for the L1 layer to reach consensus (Currency L1 + DAG L1).
See Network Architecture for an overview of the role each cluster plays in the Hypergraph.
System Requirements
For local development, it is sufficient to run each necessary node in a Docker container on a single developer machine. The minimal setup requires at least 5 docker containers which can be taxing on system resources. For that reason, we recommend your development machine have a minimum of 16 GB of RAM with at least 8GB of that RAM allocated to Docker. We recommend allocating 10GB RAM or more for a smoother development experience if your development machine can support it.
The system requirements for running a Euclid Development Environment project are:
- Linux or macOS operating system
- 16 GB RAM or more
- Docker installed with 8GB RAM allocated to it
Included Tools
The Euclid Development Environment includes the following components:
- The Hydra CLI tool for building and managing clusters of docker containers for each of the network configurations
- Docker files for building and connecting each of the required local clusters
- A Telemetry Dashboard consisting of two additional docker containers running Prometheus and Grafana.
- Optionally, run the Developer Dashboard, a NextJS frontend javascript app for use during development.
Install
Clone the repo from Github
git clone https://github.com/Constellation-Labs/sdk-dev-env.git
cd sdk-dev-env
See Hydra CLI for additional installation and configuration instructions.
Project Directory Structure
The project has the following structure
- infra
- docker
- scripts
- hydra
- hydra-update
- source
- currency-l0
- genesis
- currency-l1
- dag-l1
- global-l0
- genesis
- p12-files
- .env
Infra
This directory contains all docker configuration files for generating each of the network clusters. This directory should generally not need to be edited directly and can be upgraded using the hydra script to gain access to newly released configurations.
Scripts
The scripts directory contains the hydra
and hydra-update
scripts.
.env
The .env file contains your environment variables that allow you to customize the configuration generated by hydra
. The GITHUB_TOKEN variable is required to run hydra build
.
Source
This directory contains your local source code for each project (currency-l0, currency-l1). These directories will be empty by default, until the project is installed using hydra install
which will generate these project directories from a template. The files in these directories are automatically included in the currency-l0 and currency-l1 docker containers when you run hydra build
.
In this directory inside the global-l0
subdirectory, you will find the genesis file for your Global L0 network. Updating this file will allow you to attribute DAG token amounts to addresses at the genesis of your network. The source for the Global L0 network is stored in a jar file under source/docker
since this codebase is not meant to be modified.
Similarly, within the currency-l0
subdirectory, you will find the genesis file for your Currency L0 network. Updating this file will allow you to attribute Metagraph Token amounts to addresses at the genesis of your network.
In the p12-files
directory, you will find p12 files used in the default node configuration. You may update these files to use your own keys for your nodes. Environment variables in the .env
file should be updated with the new file aliases and passwords if you do choose to update them.