☁️
Zus Docs
  • About Züs
  • System
    • Providers and Services
      • Miner
      • Sharder
      • Blobber
      • Validator
      • Authorizer
      • Node Locator (0DNS)
    • Storage
      • Architecture and Data Management
      • Protocol
        • Allocations
        • Reference Objects
        • Challenges
        • Write Markers
          • Chain Hashing
          • Two Commit
        • Blobber Repair Protocol
      • ZS3 Server
        • Backup, Recovery and Replication
        • Encryption and Compression
        • S3FS Setup and Usage
        • Backup & Recovery with Restic on Blimp + ZS3 Server
        • Backup & Recovery with Veeam on Blimp + ZS3 Server
      • File Operations
        • Upload
        • Download
        • File Sharing
        • Partial Error Recovery
        • Streaming
        • Rent a Blobber
    • Smart Contracts
      • Storage S.C.
      • Miner S.C.
      • ZCN S.C.
      • ERC-20 S.C.s
      • Bridge Protocol
    • Blockchain & Consensus
      • Entities
    • User Authentication and Wallet Management System
      • OKTA Integration
      • Key Management System (KMS)
  • APIs
    • 0DNS API
    • JS API
    • Mobile API
  • CLIs
    • Storage CLI
      • Quickstart
      • Configuring the tool
    • Wallet CLI
      • Wallet Configuration
      • Quickstart
      • Configuring the tool
  • SDKs
    • Go SDK
      • GO SDK Microservices
    • JS SDK
  • Tokenomics
    • Staking
    • Reward & Penalty
  • ✨Züs Apps
    • 🗝️Vult
      • Getting Started
        • Web
        • Mobile
      • Vult AI
        • Batch Processing
        • Memory Retention
        • Technical Implementation
        • Architecture Overview
      • Login / Register
      • File Management Pages
      • File Sharing
      • Storage Management Dashboard
      • Storage Maintenance and Troubleshooting
      • Züs Subscription
      • Wallet Management
      • Refer a friend
      • Settings
    • 🏗️Blimp
      • Getting Started
      • Login / Register
      • Configure Storage
        • Create Standard Storage Allocation
        • Create Enterprise Allocation
        • Create S3 Server Allocation
        • Create Cloud Migration Allocation
        • Allocation Maintenance and Troubleshooting
      • File Management Pages
      • File Sharing
      • Manage Allocations
      • Upgrade Storage
      • Blimp Vault
      • Refer a friend
      • Settings
      • Launching ZS3 Server
      • Using CLI to backup files into Blimp + ZS3 Server
    • 🏠Chimney
      • Getting Started
      • Login / Register
      • Create New Deployment
      • Manage Your Deployments
      • Homepage
      • Staking Dashboard
      • Rank Dashboard
      • Monitor Dashboard
      • Stats Dashboard
      • Logs Dashboard
      • Wallet Dashboard
      • Operations on your Deployments
      • Restricted Blobbers
      • Settings
        • Manage Profile
        • Wallet Settings
        • Update Blobber Settings
        • Update Blobber Version
        • Refer a friend
        • Help
    • 🌐Atlus
      • Getting Started
      • Home page
      • Service Providers Page
      • Charts Page
        • Market Charts
        • Network Charts
        • Storage Charts
      • Blockchain Page
      • Server Map Page
      • Storage Explainer Page
      • Details Pages
        • Block Details Page
        • Transaction Details Page
        • Wallet Details Page
        • Miner Details Page
        • Sharder Details Page
        • Blobber Details Page
        • Validator Details Page
        • Authorizer Details Page
        • Allocation Details Page
      • Appendix: Common Components
    • ⚡Bolt
      • Getting Started
        • Web
        • Mobile
      • Login / Register
      • Sign In with external wallet
      • Staking Dashboard
      • Staking/Unstaking a provider
      • Claiming Rewards
      • Send/Receive ZCN tokens
      • Buy ZCN
      • Deposit/Withdraw ZCN tokens
      • Activity Dashboard
      • Refer a friend
      • Settings
  • Releases
    • Hardfork
Powered by GitBook
On this page
  • Validator Structure
  • Updating Validator Settings
  • Retrieving Validator Information
  • Managing Validators
  1. System
  2. Providers and Services

Validator

A Validator in the Züs network plays a critical role in ensuring the correctness and integrity of transactions, storage operations, and smart contract executions.

Validators verify operations and help maintain consensus within the blockchain ecosystem. They participate in staking mechanisms and earn rewards based on their contributions.

Validator Structure

The Validator structure defines key attributes associated with a validator node in the network.

// Validator represents validator information.
type Validator struct {
	ID                       common.Key       `json:"validator_id"`
	BaseURL                  string           `json:"url"`
	PublicKey                string           `json:"-"`
	DelegateWallet           string           `json:"delegate_wallet"`
	MinStake                 common.Balance   `json:"min_stake"`
	MaxStake                 common.Balance   `json:"max_stake"`
	NumDelegates             int              `json:"num_delegates"`
	ServiceCharge            float64          `json:"service_charge"`
	StakeTotal               int64            `json:"stake_total"`
	TotalServiceCharge       int64            `json:"total_service_charge"`
	UncollectedServiceCharge int64            `json:"uncollected_service_charge"`
	LastHealthCheck          common.Timestamp `json:"last_health_check"`
	IsKilled                 bool             `json:"is_killed"`
	IsShutdown               bool             `json:"is_shutdown"`
}

Attributes

  • ID: Unique identifier for the validator.

  • BaseURL: The URL through which the validator communicates with the network.

  • PublicKey: The public key associated with the validator.

  • DelegateWallet: The wallet address associated with the validator for staking and rewards.

  • MinStake: Minimum stake required for participation in validation.

  • MaxStake: Maximum stake allowed for a validator.

  • NumDelegates: The number of delegates that can stake on this validator.

  • ServiceCharge: Percentage of rewards charged by the validator as a service fee.

  • StakeTotal: Total amount staked on the validator.

  • TotalServiceCharge: Total service charge collected over time.

  • UncollectedServiceCharge: Pending service charges yet to be collected.

  • LastHealthCheck: Timestamp of the last health check performed on the validator.

  • IsKilled: Indicates if the validator is terminated.

  • IsShutdown: Indicates if the validator is currently shut down.

Updating Validator Settings

Validators can update their settings using the UpdateValidator structure:

// UpdateValidator is used during update validator settings calls.
type UpdateValidator struct {
	ID                       common.Key        `json:"validator_id"`
	BaseURL                  *string           `json:"url,omitempty"`
	DelegateWallet           *string           `json:"delegate_wallet,omitempty"`
	MinStake                 *common.Balance   `json:"min_stake,omitempty"`
	MaxStake                 *common.Balance   `json:"max_stake,omitempty"`
	NumDelegates             *int              `json:"num_delegates,omitempty"`
	ServiceCharge            *float64          `json:"service_charge,omitempty"`
	StakeTotal               *int64            `json:"stake_total,omitempty"`
	TotalServiceCharge       *int64            `json:"total_service_charge,omitempty"`
	UncollectedServiceCharge *int64            `json:"uncollected_service_charge,omitempty"`
	LastHealthCheck          *common.Timestamp `json:"last_health_check,omitempty"`
	IsKilled                 *bool             `json:"is_killed,omitempty"`
	IsShutdown               *bool             `json:"is_shutdown,omitempty"`
}

Converting UpdateValidator to Blockchain Validation Node

To apply updates to the blockchain, the UpdateValidator struct must be converted to a blockchain-compatible format:

func (v *UpdateValidator) ConvertToValidationNode() *blockchain.UpdateValidationNode {
	blockValidator := &blockchain.UpdateValidationNode{
		ID:      string(v.ID),
		BaseURL: v.BaseURL,
	}

	sp := &blockchain.UpdateStakePoolSettings{
		DelegateWallet: v.DelegateWallet,
		NumDelegates:   v.NumDelegates,
		ServiceCharge:  v.ServiceCharge,
	}

	if v.DelegateWallet != nil ||
		v.MinStake != nil ||
		v.MaxStake != nil ||
		v.NumDelegates != nil ||
		v.ServiceCharge != nil {
		blockValidator.StakePoolSettings = sp
	}

	return blockValidator
}

Retrieving Validator Information

Get a Single Validator

To retrieve information about a specific validator, use the GetValidator function:

func GetValidator(validatorID string) (validator *Validator, err error) {
	if !client.IsSDKInitialized() {
		return nil, sdkNotInitialized
	}
	var b []byte
	b, err = screstapi.MakeSCRestAPICall(
		STORAGE_SCADDRESS,
		"/get_validator",
		map[string]string{"validator_id": validatorID},
	)
	if err != nil {
		return nil, errors.Wrap(err, "requesting validator:")
	}
	if len(b) == 0 {
		return nil, errors.New("", "empty response from sharders")
	}
	validator = new(Validator)
	if err = json.Unmarshal(b, validator); err != nil {
		return nil, errors.Wrap(err, "decoding response:")
	}
	return
}

Get a List of Validators

To retrieve a list of validators in the network, use:

func GetValidators(stakable bool) (validators []*Validator, err error) {
	if !client.IsSDKInitialized() {
		return nil, sdkNotInitialized
	}
	var b []byte
	b, err = screstapi.MakeSCRestAPICall(
		STORAGE_SCADDRESS,
		"/validators",
		map[string]string{
			"stakable": strconv.FormatBool(stakable),
		},
	)
	if err != nil {
		return nil, errors.Wrap(err, "requesting validator list")
	}
	if len(b) == 0 {
		return nil, errors.New("", "empty response from sharders")
	}
	if err = json.Unmarshal(b, &validators); err != nil {
		return nil, errors.Wrap(err, "decoding response:")
	}
	return
}

Managing Validators

Update Validator Settings

func UpdateValidatorSettings(v *UpdateValidator) (resp string, nonce int64, err error) {
	if !client.IsSDKInitialized() {
		return "", 0, sdkNotInitialized
	}

	var sn = transaction.SmartContractTxnData{
		Name:      transaction.STORAGESC_UPDATE_VALIDATOR_SETTINGS,
		InputArgs: v.ConvertToValidationNode(),
	}
	resp, _, nonce, _, err = storageSmartContractTxn(sn)
	return
}

Shutdown a Validator

func ShutdownProvider(providerType ProviderType, providerID string) (string, int64, error) {
	if !client.IsSDKInitialized() {
		return "", 0, sdkNotInitialized
	}

	var input = map[string]string{
		"provider_id": providerID,
	}

	var sn = transaction.SmartContractTxnData{
		InputArgs: input,
	}
	switch providerType {
	case ProviderValidator:
		sn.Name = transaction.STORAGESC_SHUTDOWN_VALIDATOR
	default:
		return "", 0, fmt.Errorf("shutdown provider type %v not implemented", providerType)
	}
	hash, _, n, _, err := storageSmartContractTxn(sn)
	return hash, n, err
}

Validators are integral to the Züs network, ensuring transaction integrity, maintaining consensus, and securing the blockchain. Properly managing validators, staking, and rewards distribution is crucial for a healthy decentralized ecosystem.

PreviousBlobberNextAuthorizer

Last updated 2 months ago