Setup
The Starknet Staking v2 validator can be configured using several methods, with the following order of precedence:
For detailed information about validator roles, address types, and security practices in Starknet's staking protocol, see the official Starknet staking documentation.
Configuration Methods
Each tab configures the same validator, so you can compare the methods side by side. The Docker examples use --network host, so localhost reaches the node and the signer running on the host.
- CLI
- Environment variables
- Config file
The validator can be configured directly on the command line:
- Docker
- Binary
docker run --network host nethermind/starknet-staking-v2 \
--provider-http "http://localhost:6060/rpc/v0_10" \
--provider-ws "ws://localhost:6061/rpc/v0_10" \
--signer-op-address "0x123" \
--signer-url "http://localhost:8080"
./validator \
--provider-http "http://localhost:6060/rpc/v0_10" \
--provider-ws "ws://localhost:6061/rpc/v0_10" \
--signer-op-address "0x123" \
--signer-url "http://localhost:8080"
Command line parameters override environment variables and configuration file.
The validator can be configured through environment variables using specific variable names:
- Docker
- Binary
docker run --network host \
-e PROVIDER_HTTP_URL="http://localhost:6060/rpc/v0_10" \
-e PROVIDER_WS_URL="ws://localhost:6061/rpc/v0_10" \
-e SIGNER_OPERATIONAL_ADDRESS="0x123" \
-e SIGNER_EXTERNAL_URL="http://localhost:8080" \
nethermind/starknet-staking-v2
PROVIDER_HTTP_URL="http://localhost:6060/rpc/v0_10" \
PROVIDER_WS_URL="ws://localhost:6061/rpc/v0_10" \
SIGNER_OPERATIONAL_ADDRESS="0x123" \
SIGNER_EXTERNAL_URL="http://localhost:8080" \
./validator
You can also keep them in a .env file. Leave the values unquoted, because docker run --env-file keeps quotes as part of the value:
PROVIDER_HTTP_URL=http://localhost:6060/rpc/v0_10
PROVIDER_WS_URL=ws://localhost:6061/rpc/v0_10
SIGNER_OPERATIONAL_ADDRESS=0x123
SIGNER_EXTERNAL_URL=http://localhost:8080
Then load the file and run the validator:
- Docker
- Binary
docker run --network host --env-file .env nethermind/starknet-staking-v2
set -a exports every variable the file sets, so the validator inherits them:
set -a
source .env
set +a
./validator
Environment variables rank second in configuration precedence. Command line parameters override environment variables.
The validator can be configured using a JSON file:
{
"provider": {
"http": "http://localhost:6060/rpc/v0_10",
"ws": "ws://localhost:6061/rpc/v0_10"
},
"signer": {
"operationalAddress": "0x123",
"url": "http://localhost:8080"
}
}
To run the validator with a configuration file, use the --config option:
- Docker
- Binary
docker run --network host \
--user "$(id -u):$(id -g)" \
-v /path/to/config.json:/app/config/config.json \
nethermind/starknet-staking-v2 --config /app/config/config.json
The image runs as a non-root user. --user runs the validator as your own user instead, so it can read a file that only you can read, such as one holding a private key with mode 600.
./validator --config config.json
Mixed Configuration
You can combine multiple configuration methods. Values set by command line flags will override environment variables, and environment variables will override configuration file settings.
PROVIDER_HTTP_URL="http://localhost:6060/rpc/v0_10" ./validator \
--config config.json \
--provider-ws "ws://localhost:6061/rpc/v0_10" \
--signer-url "http://localhost:8080" \
--log-level debug
Signing Methods
The validator supports two signing approaches:
- Internal signing where you provide your private key to the validator and it signs on your behalf.
- External signing where the validator requests a remote service for your signature. Read more about the remote signer's HTTP protocol.
- Internal signing
- External signing
- Docker
- Binary
docker run --network host nethermind/starknet-staking-v2 \
--provider-http "http://localhost:6060/rpc/v0_10" \
--provider-ws "ws://localhost:6061/rpc/v0_10" \
--signer-op-address "0x123" \
--signer-priv-key "0x456"
./validator \
--provider-http "http://localhost:6060/rpc/v0_10" \
--provider-ws "ws://localhost:6061/rpc/v0_10" \
--signer-op-address "0x123" \
--signer-priv-key "0x456"
- Docker
- Binary
docker run --network host nethermind/starknet-staking-v2 \
--provider-http "http://localhost:6060/rpc/v0_10" \
--provider-ws "ws://localhost:6061/rpc/v0_10" \
--signer-op-address "0x123" \
--signer-url "http://localhost:8080"
./validator \
--provider-http "http://localhost:6060/rpc/v0_10" \
--provider-ws "ws://localhost:6061/rpc/v0_10" \
--signer-op-address "0x123" \
--signer-url "http://localhost:8080"
You must provide exactly one signing method: either a private key for internal signing (--signer-priv-key, SIGNER_PRIVATE_KEY or privateKey) or an external signer URL (--signer-url, SIGNER_EXTERNAL_URL or url). If both are provided, the validator won't start.
What's Next?
- Configuration Options - Complete reference of all available options
- External Signer - Secure signing for production deployments