How to Set Up a Validator or Masternode in the 3DPass Network: Complete Technical Guide
Setting up a validator in the 3DPass network requires compiling the POSCAN consensus node, generating cryptographic keys, locking a minimum of 100,000 P3D tokens as collateral, and launching the node with the --validator and --author flags to register with the on-chain Validator Set pallet.
The 3DPass network is a Substrate-based blockchain that uses the 3dp repository to implement a unique POSCAN hybrid consensus mechanism. Validators, also referred to as masternodes, serve as authority nodes that both produce blocks and finalize them through GRANDPA finality. This guide walks through the complete technical process of provisioning, registering, and operating a validator based on the actual source code implementation.
Understanding the 3DPass Validator Architecture
Dual Consensus Participation
A validator in the 3DPass network operates across two critical consensus layers simultaneously. First, the POSCAN hybrid consensus layer handles block production and signing, where validators compete to create new blocks based on their staked collateral. Second, the GRANDPA finality layer ensures that once blocks are produced, they are finalized and irreversible. This dual-role architecture requires validators to maintain high availability and consistent network connectivity.
Validator Set Pallet and Collateral Requirements
The on-chain logic governing validators resides in pallets/validator-set/src/lib.rs. This pallet maintains the authorized list of validator accounts, enforces collateral requirements, and handles slashing penalties. According to the runtime configuration in runtime/src/lib.rs, validators must lock a minimum of 100,000 P3D tokens (MinLockAmount) for a period of at least 30 days (MinLockPeriod). The pallet uses a specific lock identifier LOCK_ID = *b"validatr" to track these stakes.
Prerequisites and Environment Setup
System Requirements
Before compiling the 3DPass node, ensure your system meets the hardware requirements for running a Substrate validator. You need a stable server with at least 4 CPU cores, 8GB of RAM, and 200GB of available SSD storage for the blockchain database. A reliable internet connection with low latency is critical because validators that fail to produce blocks or participate in GRANDPA finality face slashing penalties.
Installing the Rust Toolchain
The 3DPass node requires the Rust programming language and the WebAssembly target. Install Rust using the official installer:
curl https://sh.rustup.rs -sSf | sh
source $HOME/.cargo/env
rustup target add wasm32-unknown-unknown
These commands download the Rust toolchain and add the WebAssembly compilation target required for building Substrate runtimes.
Phase 1: Provision the Node and Generate Keys
Compiling the POSCAN Consensus Binary
Clone the 3DPass repository and compile the validator node binary. The main node implementation resides in nodes/poscan-consensus/src/main.rs:
git clone https://github.com/3dpass/3dp.git
cd 3dp
cargo build --release
The compilation process generates the poscan-consensus binary in ./target/release/. This binary includes the POSCAN consensus worker and GRANDPA finality gadgets required for validator operation.
Generating the Validator Author Address
Before launching the node, generate your validator keys using the 3DPass wallet at https://wallet.3dpass.org/. Create a mining address and export the memo seed, which serves as the entropy for deriving your validator's session keys. Set these as environment variables:
export ADDRESS=0xYourMiningAddressHere
export MEMO_SEED="your twelve word seed phrase here"
The ADDRESS value corresponds to your on-chain account that will be registered in the validator set and must hold the required P3D collateral.
Phase 2: Stake Collateral and Register On-Chain
Locking P3D Tokens via the Validator Set Pallet
To become eligible for the validator set, you must lock the minimum required collateral. The Validator Set pallet in pallets/validator-set/src/lib.rs enforces this through the MinLockAmount constant, configured to 100,000 P3D in the runtime. The pallet creates a lock with the identifier b"validatr" using the Substrate Balances pallet's locking mechanism.
The lock remains active for the duration specified by MinLockPeriod (30 days). During this period, the locked tokens cannot be transferred but continue to accrue any associated staking rewards. If you wish to exit the validator set, you must initiate an unlock request, which becomes executable only after the lock period expires and any slashing penalties are cleared.
The Registration Extrinsic Process
When your node starts with the --validator flag, it automatically initiates a registration request with the runtime. The Validator Set pallet exposes the add_validator extrinsic, which can also be called manually via governance or council origin:
ValidatorSet::add_validator(origin, validator_id)
This function, defined in pallets/validator-set/src/lib.rs, performs several validation checks:
- Verifies the caller has sufficient privileges (Root or Council origin for manual addition)
- Confirms the validator_id has the required collateral lock in place
- Ensures the validator is not already present in the active set
Once accepted, the validator enters the waiting set and becomes eligible for inclusion in the active validator set during the next session rotation, which occurs approximately every 2 hours.
Phase 3: Launch and Monitor the Validator Node
Starting the Node with Validator Flags
Launch your validator by executing the compiled binary with the specific flags that enable validator mode and specify your author address. The entry point in nodes/poscan-consensus/src/main.rs processes these arguments:
./target/release/poscan-consensus \
--base-path ~/3dp-chain/ \
--chain mainnetSpecRaw.json \
--name "MyValidatorNode" \
--validator \
--author $ADDRESS \
--telemetry-url "wss://submit.3dpass.network/submit 0" \
--threads $(nproc) \
--no-mdns
The --validator flag signals the node to participate in block production and finality, while --author specifies the on-chain account that will receive rewards and be subject to slashing. The --telemetry-url flag connects your node to the public telemetry dashboard for monitoring.
Telemetry and Health Monitoring
Once running, your validator reports metrics to the telemetry server at wss://submit.3dpass.network/submit. Monitor your node's health and network standing by visiting the public telemetry dashboard at https://3dpass.network/.
Critical metrics to watch include:
- Block production rate: Your node should produce blocks when it is your turn in the rotation
- Finality lag: GRANDPA finalization should proceed without significant delays
- Peer connections: Maintain sufficient peer count for network resilience
If your node goes offline for more than a session, the im-online pallet detects the absence and triggers the slashing mechanism defined in the Validator Set pallet.
Validator Lifecycle and Slashing Mechanisms
Session Rotation and Active Set Participation
The 3DPass network operates on a session-based rotation system, with sessions lasting approximately 2 hours. During each session rotation, the runtime selects validators from the waiting set to form the active set based on their staked collateral and seniority.
Once selected, your validator participates in:
- POSCAN block production: Signing and proposing new blocks using your session keys derived from the memo seed
- GRANDPA finality: Voting on block finalization to ensure consensus
The transition between sessions is handled automatically by the runtime, with the Session pallet coordinating with the Validator Set pallet to update the active validator list.
Offline Penalties and Grace Periods
The Validator Set pallet enforces strict penalties for downtime to ensure network reliability. According to the runtime configuration in runtime/src/lib.rs:
- Offline penalty: 20,000 P3D (
PenaltyOffline) deducted from locked collateral - Grace period: 7 days (
AddAfterSlashPeriod) before the validator can rejoin after being slashed - Lock release: Collateral remains locked for the full
MinLockPeriod(30 days) unless slashed
When the im-online pallet detects that a validator has missed its block production slots, it reports the offense to the Validator Set pallet. The pallet then:
- Deducts the penalty amount from the locked collateral
- Removes the validator from the active set
- Initiates the grace period countdown before the validator can re-register
Programmatic Validator Management
Adding Validators via Extrinsics (Rust)
For governance operations or automated validator management, you can interact with the Validator Set pallet directly using the Substrate API client. The add_validator function requires Root or Council origin and accepts the validator's AccountId:
use substrate_api_client::{Api, XtStatus};
use sp_keyring::AccountKeyring;
use sp_runtime::AccountId32;
fn register_validator(
node_url: &str,
validator_id: AccountId32
) -> Result<String, Box<dyn std::error::Error>> {
// Initialize API with sudo or council member credentials
let api = Api::new(node_url)?
.set_signer(AccountKeyring::Alice.pair());
// Compose the add_validator extrinsic
let xt = api.compose_extrinsic(
"ValidatorSet",
"add_validator",
(validator_id,),
);
// Submit and wait for inclusion
let tx_hash = api.send_extrinsic(xt.hex_encode(), XtStatus::InBlock)?;
Ok(tx_hash)
}
This approach is useful for council members adding validators manually or for scripting bulk operations when migrating validator sets.
Querying the Validator Set via JSON-RPC
To verify the current validator set or check if your node has been successfully registered, query the runtime storage via JSON-RPC:
curl -H "Content-Type: application/json" \
-d '{
"jsonrpc":"2.0",
"id":1,
"method":"validator_set_validators",
"params":[]
}' \
http://127.0.0.1:9933
The response returns the list of AccountIds currently authorized to validate. If your address appears in this list after submitting the registration extrinsic, your validator is queued for the next session rotation.
Summary
- Validator requirements: A 3DPass validator requires 100,000 P3D locked as collateral for 30 days, a stable server environment, and the compiled
poscan-consensusbinary. - Key generation: Use the 3DPass wallet to create a mining address and memo seed, which serve as your on-chain identity and session key entropy.
- Node provisioning: Compile the node from
nodes/poscan-consensus/src/main.rs, then launch with--validator --author <address>to initiate registration. - On-chain registration: The Validator Set pallet (
pallets/validator-set/src/lib.rs) automatically processes your registration, verifies theb"validatr"lock, and adds you to the waiting set. - Slashing protection: Maintain uptime to avoid the 20,000 P3D offline penalty; monitor via telemetry at
wss://submit.3dpass.network/submit.
Frequently Asked Questions
How much P3D do I need to stake to become a validator?
You must lock a minimum of 100,000 P3D tokens as collateral to register as a validator in the 3DPass network. This amount is defined by the MinLockAmount constant in runtime/src/lib.rs and is enforced by the Validator Set pallet through a balance lock with the identifier b"validatr". The collateral remains locked for the duration of your validation service plus a mandatory 30-day minimum lock period.
What happens if my validator node goes offline?
If your validator fails to produce blocks or participate in consensus for an entire session (approximately 2 hours), the im-online pallet detects the absence and reports it to the Validator Set pallet. The pallet automatically deducts 20,000 P3D from your locked collateral as defined by PenaltyOffline in the runtime configuration. Additionally, you must wait 7 days (AddAfterSlashPeriod) before you can rejoin the validator set, and your reputation score may affect future selection priority.
Can I run a validator without compiling the source code?
While the 3DPass repository provides source code for building the poscan-consensus binary, you can potentially use pre-built Docker images if available. The repository includes a docker/node.sh script that encapsulates the validator startup command with the required --validator and --author flags. However, you still need to generate your cryptographic keys using the official 3DPass wallet and ensure your node meets the collateral requirements regardless of the deployment method.
How do I verify that my validator is successfully registered?
After starting your node with the --validator flag, you can verify registration by querying the on-chain validator set using the JSON-RPC method validator_set_validators. Send a POST request to your node's HTTP endpoint (default port 9933) with this method name; if your address appears in the returned array, the Validator Set pallet has successfully processed your registration and added you to the waiting set for the next session rotation. Additionally, check the telemetry dashboard at https://3dpass.network/ to confirm your node is reporting health metrics.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →