Flux docs
Search…
First-Party Oracles
Get started posting data on any chain
A first-party oracle is a node maintained by a user or protocol that posts domain-specific data on-chain. Anyone can use infrastructure provided by Flux to permissionlessly run a first-party oracle without involving token exchanges or participation in governance.

EVM Price Feeds

Flux provides a smart contract for price feeds and a node to constantly post to a deployed version. The price feed contract is compatible with Chainlink's AggregatorInterface and AggregatorV3Interface for easy integration into existing smart contract infrastructure. There are no limits in how often an answer can be posted to the contract. The contract uses OpenZeppelin's Access Control library to manage roles; by default only the deployer has permission to post data or to grant others permission.
Currently, deploying and posting to Aurora is supported, but the tools are easily modified to deploy to any EVM chain, and more will be included by default in the future.

Deploying price feed contract

Data providers first must deploy FluxPriceFeed.sol by cloning this repository. For example, the commands to deploy a contract with description ETH / USD are:
1
git clone https://github.com/fluxprotocol/price-feeds-evm
2
cd price-feeds-evm
3
cp .env.example .env # populate with mnemonic
4
yarn install
5
yarn compile
6
yarn deploy --decimals 8 --description "ETH / USD" --network aurora
Copied!
The last command will output a contract address; save this.
To confirm you set up the contract correctly, try posting to it by running:
1
yarn transmit --contract 0xMyContract --answer 12345 --network aurora
2
yarn latestAnswer --contract 0xMyContract --network aurora
Copied!
If everything worked, you should see the last command return 12345.

Running the node

After confirming you can post to the smart contract you deployed, download the node by cloning this repository. The commands to set up the node are:
1
git clone https://github.com/fluxprotocol/oracle-provider-node
2
cd oracle-provider-node
3
cp .env.example .env # populate with private key
4
nano appconfig.json # add contract address, API sources, and interval
5
npm install
6
npm run start
Copied!
If you need to derive the private key from your mnemonic, the price-feeds-evm repository you cloned to deploy the contract provides a helper task. If you need it, run:
1
yarn derivePrivateKey
Copied!
If everything worked correctly, you should see the node posting data to the contract at the interval you set. You can query the latest answer by running the latestAnswer task in the price-feeds-evm repository, as described in the section above.
Last modified 16d ago
Export as PDF
Copy link