Integrate Tellor on a New Chain
Follow these steps to provide tellor data on a new evm chain
In this guide, we will go through the steps of providing access to tellor data on a new chain. This will involve:
deploying the BlobstreamO contract
deploying an example user contact SimpleLayerUser
installing the relayer
running the relayer
Clone Tellor and Install
First, clone tellor layer:
Move to the evm directory:
Install the tellor hardhat project:
Deploy Contracts
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.
BlobstreamO
Now we're going to use deployment scripts to deploy the BlobstreamO contract. This is the contract responsible for verifying that relayed data is authentic tellor data.
Open the deployment script ./scripts/DeployBlobstreamO.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 BlobstreamO 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 BlobstreamO contract:
The following should print in your logs:
We will use the address 0xYOUR_BLOBSTREAM_ADDRESS
in the steps below.
SimpleLayerUser
Now we will deploy the SimpleLayerUser contract as an example oracle user.
Open the deployment script ./scripts/DeploySimpleLayerUser.js
. Set the BlobstreamO 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.
Setup and Run the Relayer
The relayer is used to get oracle data from tellor and submit it to your user contract.
Initialize BlobstreamO
We need to initialize the BlobstreamO contract with the current tellor validator set information.
Now you should be ready to relay data to your contract.
Relay Data
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 BlobstreamO contract occasionally.
Last updated