Integrate Tellor on a New Chain
Follow these steps to provide tellor data on a new evm chain
Last updated
Follow these steps to provide tellor data on a new evm chain
Last updated
In this guide, we will go through the steps of providing access to tellor data on a new chain. You do not have to perform these steps yourself, and the tellor team would be happy to help if you contact us on or .
For those with a do-it-yourself attitude, this guide will involve:
deploying the TellorDataBridge contract
deploying an example user contact SimpleLayerUser
installing the relayer
running the relayer
Following the steps in this guide does not guarantee access to absolutely secure oracle data. See the article for more information.
First, clone tellor layer:
Move to the evm directory:
Install the tellor hardhat project:
Create an env file:
Open your new .env
file and add your ethereum private key and an rpc node url.
Open the hardhat.config.js
file and add your evm chain information under networks
. You can use the sepolia
section as a guide.
Now we're going to use deployment scripts to deploy the TellorDataBridge contract. This is the contract responsible for verifying that relayed data is authentic tellor data.
Open the deployment script ./scripts/DeployTellorDataBridge.js
. At the top of the file, you will see a variable guardianaddress
. You will need to choose an address who is responsible for resetting the TellorDataBridge validator set in the event that it becomes stale (no updates within 21 days). As long as the validator set is always kept up to date in the contract, the guardian will have no special privileges or responsibilities.
Set the address to one of your own addresses:
You should also update the PK
and NODE_URL
variables to match those in your .env
file.
Now you should be able to deploy the TellorDataBridge contract:
The following should print in your logs:
We will use the address 0xYOUR_DATA_BRIDGE_ADDRESS
in the steps below.
Now we will deploy the SimpleLayerUser contract as an example oracle user.
Open the deployment script ./scripts/DeploySimpleLayerUser.js
. Set the TellorDataBridge address
You will also need a queryId. We will use the ETH/USD spot price queryId in this example.
Update the PK
and NODE_URL
variables to match those in your .env
file.
Now we are ready to deploy the SimpleLayerUser:
This will print in your logs:
We will use 0xYOUR_TELLOR_USER_ADDRESS
when running the relayer below.
The relayer is used to get oracle data from tellor and submit it to your user contract.
We need to initialize the TellorDataBridge contract with the current tellor validator set information.
Now you should be ready to relay data to your contract.
The relayer should gather tellor oracle data and submit it to your contract. If you see a transaction hash printed in the relayer logs, that's a good sign. Check your evm chain's block explorer to see whether you relayed data successfully.
Given the sleep-time
argument we entered in that last command, the relayer will continuously submit new oracle data once every hour. You may also see the relayer update the validator set in the TellorDataBridge contract occasionally.
Follow the . We recommend you set your ETH_PRIVATE_KEY
in the relayer .env file, using the same evm address you used to deploy the contracts in the steps above. Only the deployer address can initialize the TellorDataBridge contract, but any address can run the relayer after initialization. You should also set the WEB3_PROVIDER_URL
.