How to Set Up a Validator for peaq on OnFinality

How to Set Up a Validator for peaq on OnFinality

OnFinality is a blockchain infrastructure platform that saves web3 builders time and makes their lives easier. We deliver easy-to-use, reliable and scalable API endpoints for the biggest blockchain networks and empower developers to automatically test, deploy, scale and monitor their own blockchain nodes in minutes.

We are already supporting over 120 networks across ecosystems such as Ethereum, Polkadot, Avalanche and Cosmos, and are continuously expanding these mission-critical services to other ecosystems to help developers build the decentralised future, faster!

Introduction

In this How-To Guide, you will learn how to set up your own Collator (Validator) node for peaq network, which will enable you to earn block rewards. This guide should be used alongside peaq’s official guide which is kept up to date and includes more detail.

What is peaq?

Democratizing abundance in the age of automation

On peaq, the more value AI-powered machines create, and the more human jobs they take, the more everyone earns. The 100%, not just the 1%.

For as long as you rely on regular apps, the data, value, and power generated by machines will go to the 1%. What if the apps, app store, network, and servers they ran on were owned by you? That's peaq's promise.

Why be a Validator for peaq

peaq block production relies on validators and delegators working together to ensure that transactions are propagated into blocks in a fast, reliable, censorship-resistant manner.

The main role of a validator is to create blocks and keep the state of the network up to date. After creation blocks are provided to validators on the relay chain for final approval.

Validators together with delegators receive 40% of the total rewards, consisting of new blocks being minted and transaction fees paid by the network users.

Disclaimer

Running a Collator (Validator)  comes with a high risk and requires a high level of technical knowledge and skill. As per our Terms of Service, OnFinality is neither responsible for any rewards nor losses incurred when running a Collator node on OnFinality. Users should read and fully understand the relevant documentation for the Network before setting up the node, and get in touch directly with the Network if they have any questions or concerns.

HOW TO SET UP A PEAQ COLLATOR (VALIDATOR NODE)

1. Log In To OnFinality

Create an account and log in to OnFinality, then add a payment method.

2. Create Dedicated Node

Select the Dedicated Nodes menu and press “Deploy New Node”

2.1 Select Network

Search for peaq and then click “Deploy Node”

2.2 Configure peaq Node

Enter an easily identifiable Display Name and select the Collator Node Type. Select the recommended Image Version.

Scroll down to set the Cloud Provider and Region where you will run the node. Networks may have a preference of where you should run your collator, so check with their official documentation.

Look out for the Lightning Restore indicator to get the node running as fast as possible.

Use at least the recommended configuration suggested by the network, then press “Next”

2.3 Configure Launch Arguments

Next, review the node’s Launch Configuration. The recommended settings are usually sufficient, but we recommend comparing with official documentation to be certain.

Important! — rpc-methods must be set to “Unsafe” while configuring the collator on chain, then changed to “Safe” once the setup is complete.

Press “Next” at the bottom of the screen

2.4 Review Node

Finally, review the node’s settings and press “Deploy Node”

3. Sync Your Dedicated Node

Once your node is successfully deployed, you can find it in the “Dedicated Nodes” section on our portal. Click on your node and confirm the following:

  • Relay chain/parachain blocks are syncing appropriately
  • No configuration errors in the console log. You can find your console by clicking on “Console logs” on the top right hand.
  • CPU, Memory, and Storage are within reasonable range of use.

You can cross-reference the respective network blocks on the PolkadotJS App.

4. Set Up Account And Stake

Create a Wallet Address with the minimum of 50,000 $PEAQ to stake

Note: Check peaq’s requirements - the minimum stake may change 

5. Generate Session Keys

Session keys are what links the validator or collator to your account.

First, locate your Dedicated Node’s RPC endpoints under API Endpoints. Access is secured by an API Key at the end of the URL, so keep it safe and private.

Option 1 — Polkadot-JS:

Copy your RPC — Websocket endpoint into the Polkadot-JS Custom Endpoint and press save to connect to the node

Navigate to Developer > RPC Calls and submit an author rotateKeys call.

Record the result.

Option 2 — CLI:

Generate the session keys on your Dedicated Node via the author_rotateKeys RPC Request, using your Dedicated Node’s RPC — Http url.

Example request

curl **Node’s RPC Http endpoint here** -H \ “Content-Type:application/json;charset=utf-8” -d \

 ‘{

 “jsonrpc”:”2.0",

 “id”:1,

 “method”:”author_rotateKeys”,

 “params”: []

 }’

You will get a response like this

{

 “jsonrpc”: “2.0”,

 “result”:”0xc05a9d093e4db4c1bde31977716e7a0a39d6f3d1f1bf749e7fec8371147de730af6860aeef81a11130c9fcd317b96e736f6c36141c28f382a18f9faf6e7df797eaa951ead00d12db10937003f0956e3d3444d1774d452ed045dbc1b84d1bf1471abf5d77bf5033845f01be1188a852c6f0ba703042b4d06d14314841c1096c50",

 “id”:1

}

The content after “result” is the session keys of your collator node

6. Associate your session key with your validator account

In Polkadot.js portal open Developer > Extrinsic

Select your collator account and extrinsic type: session / setKeys

Enter the session keys using the response from author_rotateKeys in step 5 and set proof to “0x00”

Submit the transaction.

7. Double-check that your session key is associated with your wallet address

Open the Developer tab, and click Chain state. There, you'll need to submit the following state query:

  1. Developer → Chain state → Session → nextKeys
Session Keys
  1. Toggle the switch include option and select your collator address in the AccountId32field.
  2. Click the + button.
  3. Confirm that your key is displayed.

8. Remove unsafe rpc methods from your node

Open your collator in OnFinality and press Edit on the Launch Configuration tab

Untick –unsafe-rpc-external and update –rpc-methods to safe

Press Save Changes at the bottom of the screen

9. Join the Validator Candidate Pool

Go to the polkadot.js portal, open the Developer tab, and click Extrinsics. There, you'll need to submit the extrinsic:

Note

The min stake amount for the collator is 50,000 $PEAQ

Enter your stake into the stake: u128 (BalanceOf) field.

Note

Keep in mind that krest has 18 decimals, so if you want to stake 50,000 Tokens, you'll need to enter 50,000,000,000,000,000,000,000.

Click Submit Transaction.

10. Check if you are in the Active Set of Collators

Open the Developer tab, and click Chain state. There, you will be able to check whether your stake was big enough to get a set in the active set of collators (top 16 collators by total stake).

Developer → Chain state → Storage → parachainStaking → topCandidates()

Chain state

Confirm that your collator account is in the result

Congratulations!

If you have followed all of these steps, and been selected to be a part of the collator set, you are now running a peaq Collator!

Wait for two sessions (2400 blocks or ~8hrs) to see whether your node starts authoring blocks. You can verify it by going to the krest block explorer and checking that your address started getting collator rewards.

More Resources:

peaq’s validator guide: ​​https://docs.peaq.network/docs/node-operators/become-validator/

OnFinality developer documentation: https://documentation.onfinality.io/support/

About OnFinality

OnFinality is a blockchain infrastructure platform that saves web3 builders time and makes their lives easier. OnFinality delivers scalable API endpoints for the biggest blockchain networks and empowers developers to automatically test, deploy, scale and monitor their own blockchain nodes in minutes. To date, OnFinality has served over 300 billion RPC requests across 70 networks including Polkadot, Ethereum, Moonbeam, Astar, Avalanche and Cosmos, and is continuously expanding these mission-critical services so developers can build the decentralised future, faster!

App | Website | Twitter | Telegram | LinkedIn | YouTube