/vegacapsule

Run a complete Vega Protocol network locally

Primary LanguageGoMIT LicenseMIT

Vegacapsule

Quick start

Pre-start

  1. Make sure you have Go 1.17+ installed locally. Get Go.
go version
  1. Make sure Docker is running on your machine. Get Docker.
docker version
  1. Install vegacapsule
  • Clone Capsule repository
git clone git@github.com:vegaprotocol/vegacapsule.git
git config --global url."git@github.com:vegaprotocol".insteadOf "https://github.com/vegaprotocol"
cd vegacapsule
  • Turn off GONOSUMDB for private vega repositories
export GONOSUMDB="code.vegaprotocol.io/*"
  • Build Capsule from source
go install
  • Validate Capsule installation
vegacapsule --help
  1. Install vega, data-node and vegawallet binaries on your machine and. Install Vega binaries.

Start Capsule Network

  1. Start nomad
vegacapsule nomad
  1. In another Terminal window run bootstrap command to generate and start new network
vegacapsule network bootstrap --config-path=net_confs/config.hcl
  1. Check Nomad console by opening http://localhost:4646/

Restoring network from checkpoint

Bootstrapping a new network

  1. First generate the network
vegacapsule network generate --config-path=net_confs/config.hcl
  1. Run restore command to change networks genesis files
vegacapsule nodes restore-checkpoint --checkpoint-file PATH_TO_YOUR_CHECKPOINT_FILE
  1. Lastly the network can be started. It will load it's state from the checkpoint
vegacapsule network start

Restoring on existing network

  1. Stop the currently running network first (if the network is running)
vegacapsule network stop
  1. Reset current network nodes state
vegacapsule nodes unsafe-reset-all
  1. Run restore command to change networks genesis files
vegacapsule nodes restore-checkpoint --checkpoint-file PATH_TO_YOUR_CHECKPOINT_FILE
  1. Lastly the network can be started. It will load it's state from the checkpoint
vegacapsule network start

Commands

You can see all available commands calling the vegacapsule --help command.

Examples

# Generate the network config files
vegacapsule network generate --home-path=/var/tmp/veganetwork/testnetwork --config-path=net_confs/config.hcl

# Starts the network
vegacapsule network start --home-path=/var/tmp/veganetwork/testnetwork

# Stop the network
vegacapsule network stop --home-path=/var/tmp/veganetwork/testnetwork

# Resume the network with previous configurationh
vegacapsule  network start --home-path=/var/tmp/veganetwork/testnetwork

# Destroy the network
vegacapsule network destroy --home-path=/var/tmp/veganetwork/testnetwork

Commands for ethereum network

You can set up the multisig smart contract with the following command:

vegacapsule ethereum multisig init

Procedure executed by the above command:

  1. Set threshold to 1
  2. Add validators as signers
  3. Remove the contract owner from the signers list
  4. Set threshold to 667

Configuration

Capsule can bootstraps network based on configuration. Please see config.hcl for examples.

[TODO expand on this]

Templating

Capsule is using Go's text/template templating engine extended by useful functions from Sprig library.

[TODO expand on this]