Validators

Validators or solvers solve tasks and vote on validity of solved tasks.

The Validator model

The Validator model contains all information about Validator

Properties

  • Name
    staked
    Type
    uint256
    Description

    How much the validator has staked

  • Name
    addr
    Type
    address
    Description

    Address of the validator


READEngine

Retrieve validator

Look up a validator by their address.

Request

READ
Engine
import { ethers } from 'ethers'
import Config from './config.json'
import EngineArtifact from './artifacts/EngineV1.sol/EngineV1.json';

const provider = new ethers.providers.JsonRpcProvider(RPC_URL);

const engine = new ethers.Contract(
  Config.engineAddress,
  EngineArtifact.abi,
  provider,
)

// validator address here
const address = '0x...'
const validator = await engine.validators(address);
const { staked, addr } = validator;

WRITEEngine

Become validator

Users who want to be validators must deposit validatorDeposit Arbius to become a validator. At the beginning, this is 0 for bootstrapping of network. To continue being a validator, you must keep a staked balance of at least validatorMinimum which is some number less than validatorDeposit. The only thing that reduces your staked balance is being slashed on a task or vote, which reduces your staked balance by slashAmount.

Request

WRITE
Engine
import { ethers } from 'ethers'
import Config from './config.json'
import EngineArtifact from './artifacts/EngineV1.sol/EngineV1.json';

const provider = new ethers.providers.JsonRpcProvider(RPC_URL);

const wallet = new ethers.Wallet(
  process.env.PRIVATE_KEY,
  provider,
);

const engine = new ethers.Contract(
  Config.engineAddress,
  EngineArtifact.abi,
  wallet,
)

// ensure you have granted BaseToken allowance of getValidatorMinimum()
const tx = await engine.becomeValidator()
const receipt = await tx.wait();

WRITEEngine

Exit Validation

Validators who wish to withdraw their staked balance and cease being validators must first perform a call to initiateExitValidator, and after a period of time (exitValidatorMinUnlockTime) may call exitValidator to withdraw staked funds.

Request

WRITE
Engine
import { ethers } from 'ethers'
import Config from './config.json'
import EngineArtifact from './artifacts/EngineV1.sol/EngineV1.json';

const provider = new ethers.providers.JsonRpcProvider(RPC_URL);

const wallet = new ethers.Wallet(
  process.env.PRIVATE_KEY,
  provider,
);

const engine = new ethers.Contract(
  Config.engineAddress,
  EngineArtifact.abi,
  wallet,
)

const tx = await engine.initiateExitValidator()
const receipt = await tx.wait();

// after waiting 1 day
const tx = await engine.exitValidator()
const receipt = await tx.wait();