* squashing localnet-v2 commits (again) cargo fmt fixes to localnet purge provide path in the error message output args log failed exec print based on tty check-prerequisites cmd checked iptables update basic kernel features check enable ipv6 rules add forwarding rules squashing localnet-v2 commits additional changes propagate custom-dns flag to all run containers remove is_mock from EcashManager another localnet squash unused import chore: remove redundant testnet manager missing impl additional linux fixes command to rebuild container image wait for at least 2 blocks additional node startup fixes added --custom-dns flag to nym node setup add gateway probe + wait for DKG magic file fixed localnet down on linux container ls re-enable state resync additional feature locking macos adjustments working nyxd startup on linux wip linux box wip separating network inspect betweewn macos and linux initial linux feature locking moved all container commands into a single location finally working initial node performance squashing orchestrator commits cleanup fixed condition for naive rearrangement added cache of cosmwasm contracts for speed up on subsequent runs 'down' command refreshing described cache after nodes are bonded nym nodes setup + wip on nym api refresh nodes setup WIP first pass cleanup placeholder for nym-node setup bypassing the dkg further progress on nym-api setup wip: api setup up/down/purge placeholders persisting contract setup data fix contract upload by forcing amd64 container platform wip: contracts setup4 wip: contracts setup3 wip: contracts setup2 wip: contracts setup include network setup init and spawn nyxd build nyxd image in dedicated orchestrator build nyxd image squashed cherry-picked lp changes Bits and bobs to make everything work Title MacOS setup instructions Docker/Container localnet * clippy * fixes on non-unix targets --------- Co-authored-by: durch <durch@users.noreply.github.com>
Nym Validator
This contains the configuration needed to run a Nym validator using Docker
SECURITY: This runs the validator as the root user inside the container for simplicity and development purposes. This setup should NOT be used in any other fashion.
Initial Setup
Before building and running the validator, you'll need to create the required directories:
# Create required directories
mkdir -p data/validator data/addresses
chmod -R 777 data
Running on Apple (Mx) Macs with Colima
When running on Apple Silicon Macs, we are using Colima with x86_64 emulation to properly run the validator:
- Install Colima
brew install colima
- Set up a Colima VM with x86_64 architecture and Rosetta support:
# Create a Colima VM with x86_64 architecture
colima start nym-validator --arch x86_64 --cpu 4 --memory 8 --disk 20 --vm-type=vz --vz-rosetta --mount-type=virtiofs
- Build and start the validator:
# Make sure you're using the Colima context
docker context use colima-nym-validator
# Build the validator
docker-compose build validator
# Start the validator
docker-compose up -d validator
Standard Operation (Intel/AMD x86_64 Systems)
For standard x86_64 systems:
# Build the validator
docker-compose build validator
# Start the validator
docker-compose up -d validator
The genesis validator will be initialized with the network configuration defined in the docker-compose.yml file.
Managing the Validator
To check the validator logs:
docker logs -f validator
To get the admin mnemonic:
docker exec validator cat /root/output/node_admin_mnemonic
To stop the validator:
docker-compose down
Terminating and Cleaning Up Validator Data
If you need to completely terminate your validator and remove all associated data:
# Stop the containers
docker-compose down
# Remove the volumes
docker-compose down -v
# Delete the data directories
rm -rf data
# If you want to start fresh, recreate the directories
mkdir -p data/validator/config data/addresses
chmod -R 777 data
This will completely remove all blockchain state, keys, and configuration, allowing you to start with a clean validator instance
Using nym-cli for Smart Contract Operations
The nym-cli utility can be used to manage and execute WASM smart contracts. You can access the CLI from within the validator container:
docker exec -it validator ./nym-cli cosmwasm --help
Available Commands:
- upload: Upload a smart contract WASM blob
- init: Init a WASM smart contract
- generate-init-message: Generate an instantiate message
- migrate: Migrate a WASM smart contract
- execute: Execute a WASM smart contract method
- raw-contract-state: Obtain raw contract state of a cosmwasm smart contract
Example Usage:
To upload a contract:
docker exec -it validator ./nym-cli cosmwasm upload \
--mnemonic $(cat /root/output/node_admin_mnemonic) \
--wasm-file /path/to/contract.wasm
To initialize a contract:
docker exec -it validator ./nym-cli cosmwasm init \
--mnemonic $(cat /root/output/node_admin_mnemonic) \
--code-id <CODE_ID> \
--init-msg '{"key": "value"}'
For more detailed options, use the help command:
docker exec -it validator ./nym-cli cosmwasm <COMMAND> --help