Becoming a Validator

This part should only be followed if you intend to run a validator node or are planning to become one. In order to forge on the Mainsail network, a Validator requires to register a BLS Public Key.

Install Mainsail TX tester by following the TX Tester Installation guide before you continue.

Prepare wallet

Before you can start forging, you need to register your validator on the network. You can do this by sending a validator registration transaction.

If you don't have a wallet yet create one using the pnpm run wallet as described in Create Wallet section.

Ensure your wallet has enough funds to cover the transaction fee. Check Receive Tokens section to receive additional tokens.

Generate a BLS keypair

You can use the mainsail-tx-tester to generate a BLS key pair.

Run the pnpm run validator command and this will output a BLS keypair based on a randomly generated mnemonic similar to below:

Validator Public Key:  b277d65805a9abdb2f2a60a62fd54d805564cb09f8a402d02c8edab69a2f2774b980886a499fe70996eddaca9516fcae
Validator Private Key:  08c90b5ee0ea1f2c47f233105dd8b16b9cac41587bca5600a86a7f2d95029df8

If you prefer to use a known mnemonic to generate the BLS keypair from, you can run pnpm run validator "custom mnemonic" instead. For example running pnpm run validator "hover conduct consider jealous flame dress tuna piano among climb salt maple reunion off chicken pair seven setup reason wine cute wave skirt client" results in the following keypair:

Validator Public Key:  80e5dfcedf4051a4b819e533200d8574976f0c32e12f149ceaed50795608dc6bd2ce2c4bf7e440655bed563f366c4d06
Validator Private Key:  3b62590e2083b629ce83b2a6c40293e3892e710b57db1bf1a2e48291fe5b7b62

Register Validator

To register your validator, you need to send a validator registration transaction. This transaction will register your BLS public key on the network. You can do this by using ARK Vault or by using the Mainsail TX tester.

For ARK Vault you can log in to your profile and select the address you want to use for the registration. Then navigate to the 3 dot menu and selecting "Register Validator". Follow the steps and input your BLS public key when prompted to finish the registration.

When using the Mainsail TX tester, you can register your validator by sending a transaction with the registerValidator function.

Modify the registerValidator args in the config/contracts/consensus.js file. You need to provide the validator's public key in the args field. See the previous section for how to generate a BLS Key Pair.

export const consensus = {
  abi: ConsensusAbi.abi,
  name: 'Consensus',
  contractId: '0x535B3D7A252fa034Ed71F0C53ec0C6F784cB64E1',
  transactions: [
    {
      functionName: 'registerValidator',
      amount: '250000000000000000000',
      args: ['YOUR_VALIDATOR_PUBLIC_KEY'], // <-- HERE
    },
    // ...
  ],
}

Make sure to set the passphrase to your address from which you want to register the validator in the config/config.js file in the senderPassphrase field.

const config = {
    senderPassphrase: "", // REPLACE senderPassphrase WITH THE PASSPHRASE OF YOUR WALLET
    senderSecondPassphrase: "", // REPLACE senderSecondPassphrase WITH THE SECOND PASSPHRASE OF YOUR WALLET if you have one
    ...
}

To send a validator registration transaction, run the following command:

pnpm run start 3 0

Prepare for Forging

After you have registered your validator, you need to set up your node to start forging.

Node will check validator.json file located on the config path. If mnemonic is included node will automatically detect validator and start forging if your validator is part of active validators list. You can check that in the ARK Scan - Validators.

Configuration path can be obtained by running the following command:

mainsail env:paths

You can register the validator on your node by running the following command:

mainsail config:forger:bip39

This requires you to provide the BIP39 mnemonic that was used to generate your BLS keypair, it is not your validator address' mnemonic. This will set the mnemonic in the validators.json file which will be used to sign blocks you forge.

Start the node:

mainsail core:start

Active validators

Your validator will become a forger once it is part of the active validators list. You can check that in the ARK Scan - Validator monitor tool.

Active validator are validators that are not resigned and have enough votes to be part of the consensus. Mainsail currently uses 53 active validators.

Network participants (wallets) need to vote for your validator to become active. You can check the current votes and rank for your validator in the ARK Scan - Validator page.