Flux docs
Search…
Data Validators
How to manually answer data requests or run a Validator with the testnet deployment of Flux on NEAR
Follow along with our Youtube tutorial! You should be able to set up your account and Data Validator Node within 10 minutes!

Prerequisites

    You want to provide answers to data requests on the Flux Oracle (and earn tokens when mainnet launches!)
    You are comfortable with the command line, GitHub, and crypto wallets
    You acknowledge this is a testnet version intended to display some of the features of the mainnet and no real funds are exchanged

Setting up Account

If you haven't deployed a contract yet on NEAR, follow the instructions here to set up a testnet account and the NEAR CLI, but don't worry about installing the Rust environment (since you aren't required to write any smart contracts to be a validator).
Log on to the Oracle Explorer and log in to your wallet in the top right corner. Once your testnet account is displayed at the top, you may notice you have no wNEAR in your account. To wrap your testnet NEAR, run the following commands in your terminal, replacing YOUR_TESTNET_ACCOUNT_ID with your testnet account id:
1
near call v2.wnear.flux-dev storage_deposit '{"account_id": "YOUR_TESTNET_ACCOUNT_ID"}' --accountId YOUR_TESTNET_ACCOUNT_ID --amount 0.00125 --gas=300000000000000
2
near call v2.wnear.flux-dev near_deposit "{}" --accountId YOUR_TESTNET_ACCOUNT_ID --amount 20 --gas=300000000000000
Copied!
Now you should be able to see the wNEAR amount you have wrapped from NEAR in your account.

Validating requests using Oracle Explorer

Scroll down the navigator and see a list of the requests that have been made. Select one of the recent ones. It will take you to the requests screen where you can view the request in further detail.
Find the bond size in the latest round, or the resolution window. This is the wNEAR necessary in order for an outcome to be finalized as the resolution. For requests that require a lot of financial security, the bond can be raised in order to deter bad actors from being able to manipulate data in order to exploit the system.
To participate in the validation of the request, scroll back to the top and hit the stake button to stake your wNEAR in what you believe to be the outcome, or simply copy someone else's answer and post the rest of the wNEAR needed to fill the bond. If the resolution window closes and nobody disputes your staked answer, you can hit the finalize button and get your rewarded wNEAR!
To find out more about how Data Requests go through the Oracle, check out the Data Requests section of the documentation.

Validating requests using Validator Node

The Oracle Validator Node is set up to automatically provide answers to the API requests that come into the Flux Oracle. If you have the capital and would like to earn a passive income with it, try it out!
The node will listen in on any requests coming to the oracle. If there is an API request that is valid, the node will call the API end_point and extract the outcome from the source_path
Clone the Oracle Validator Node repository and set up your .env file in the directory with the following:
1
# Core options
2
DEBUG = true
3
4
# HTTP server options
5
HTTP_PORT = 28484
6
7
# Database
8
DB_PATH = ./
9
DB_NAME = flux_db
10
11
# Providers
12
ACTIVATED_PROVIDERS = near
13
14
# NEAR options
15
NEAR_CREDENTIALS_STORE_PATH = /PATH/TO/.near-credentials/
16
NEAR_ACCOUNT_ID = YOUR_TESTNET_ACCOUNT_ID
17
NEAR_RPC = https://rpc.testnet.near.org
18
NEAR_CONTRACT_ID = 05.oracle.flux-dev
19
NEAR_NETWORK_ID = testnet
20
NEAR_MAX_STAKE_AMOUNT = 2.5
Copied!
the NEAR_MAX_STAKE_AMOUNT is the maximum amount of wNEAR you would like to post towards the bond for a particular outcome within each resolution window for a given request. If the bond is less than your set amount, you will only post the bond amount.
It will not work if you don't enter the proper path to your .near-credentials folder and replace YOUR_TESTNET_ACCOUNT_ID with your testnet account id.
First install the packages, then start the validator up using the following commands
1
npm install
2
npm start
Copied!
You should be able to see some output on what requests your validator is staking and providing outcomes in from your terminal, and you can check out it's work in the Oracle Explorer.
Last modified 8d ago