Setup a development testnet
This is a guide on setting up a local development testnet (aka devnet) for testing protocol changes or contracts in a live environment. Devnets are short lived in nature and can be reset easily.
Hive testnet
Section titled “Hive testnet”This is just a standard haf_api_node deployment with the exception of using the HAF testnet image.
- Clone the
haf_api_noderepository and make a copy of.envfile.
git clone https://gitlab.syncad.com/hive/haf_api_nodecd haf_api_nodecp .env.example .env- Locate and modify the following in the
.envfile:
# required profilesCOMPOSE_PROFILES="core,hafah,servers"
# use the prebuilt testnet HAF imageHAF_IMAGE=registry.gitlab.syncad.com/hive/haf/testnet
# swagger hostname (replace YOUR_HOSTNAME)PUBLIC_HOSTNAME="YOUR_HOSTNAME"
# caddy sites (read description in the .env file for info)CADDY_SITES="http://"Optionally update ZPOOL, TOP_LEVEL_DATASET and ZPOOL_MOUNT_POINT to your desired directory.
- Create the folders.
sudo ./create_directories.sh- Copy the
config.iniandpgtune.conffiles from here into the dataset folder andhaf_postgresql_conf.dfolder respectively.
Using the default values for example:
Directoryhaf-pool
Directoryhaf-datadir
- config.ini
Directoryhaf_postgresql_conf.d
- pgtune.conf
- Start the Hive testnet.
docker compose up -dTo reset the Hive testnet, delete the HAF data directory and repeat from step 3 to 5 above.
Magi testnet
Section titled “Magi testnet”- Clone and compile Magi node executables.
git clone https://github.com/vsc-eco/go-vsc-nodecd go-vsc-nodego mod downloadmake- Run the devnet setup script. Run
-helpto view more options.
./build/devnet-setup -db-url 'mongodb://db:27017' -data-dir ./data/devnet -hive-urls 'http://haftestnodeip:80' -nodes 5 -p2p-host /dns4/magi-\? -drop-db- Start all devnet nodes.
# Outside docker: run this for every node./build/magid -network devnet -data-dir ./data/devnet/data-1- Broadcast the genesis election using one of the instances (shut down the instance’s magid first).
./build/genesis-elector -network devnet -data-dir ./data/devnet/data-5To reset the Magi testnet, reset the Hive testnet first then repeat step 2 to 4.