How to Deploy Tellor on an EVM Chain
So, your EVM chain is all ready to go, but one key component is missing…
…a decentralized oracle!
Well, you’re in luck because the oracle experts at Tellor have released a version that can now be implemented on any EVM compatible chain!
Here is a guide on how to spin up your own version of Tellor:
First, let’s start off with the basics to see if Tellor is even a good fit for your chain:
How Tellor Works
Tellor is an oracle protocol built to enable maximally decentralized data feeds to any chain. To read the full whitepaper on how it works head here: https://docs.tellor.io .
For a quick refresh, let’s go over the basics:
- A “reporter” deposits some amount of money(tokens) in a contract
- They can then post data on-chain through the Tellor contract (it can be anything, e.g. BTC/USD price feed, fantasy football scores, transaction details from another chain, etc.)
- If the reporter lied, anyone can pay a dispute fee to challenge the submission (if they lied, they get slashed, if not they get the fee). It’s up to a governance contract (e.g. a vote) to determine the validity.
- Once the user thinks enough time has passed waiting for disputes (or if they check it themselves some way), they use the data.
To give a more concrete example:
- Harry & Justine want to bet on the price of a rare Shakira NFT.
- Luckily for them, Harry’s stepson, Cody, is a shadowy super-coder and knows about an exciting new chain that just launched Tellor. He writes smart contracts for fun when he’s not working his day job, so he offered to help them out.
- Cody writes them a contract where they both deposit some LUSD and then it locks itself for two weeks. If the price of the NFT goes up, Harry gets the pot and vice-versa.
- Upon completion, they call a function to “tip” a few bucks to the query for this data, and then they wait. Within a few minutes (they’re on some blazing fast chain), a Tellor reporter sees the request and posts the change in price over the two weeks.
- It’s not looking good for Harry’s bet, but that’s besides the point. There’s nothing he can do to stop the contract. They wait an hour for disputes and Harry knows that if he makes a false dispute, someone else will just report it and he’ll still lose money, so his schemes are futile. Justine wins the bet and lives happily ever after :)
>>>>>>>>>>>>>This is the power of Tellor<<<<<<<<<<<<<
So how do you become that exciting new chain?
Launch the following smart contract: https://github.com/tellor-io/tellorFlex (it has a hardhat deploy script, but it’s just one contract, so it shouldn’t be too difficult)
You’ll need four constructor arguments:
1. governance address
2. staking token
3. stake amount
For choosing the governance address, you can of course just launch it with a single address, but this would be akin to having all of the disputes and variables managed by one address, so we suggest you don’t do this in production (sort of defeats the whole “decentralization” thing).
A recommended solution would be to either use a prebuilt one (e.g. our polygon governance contract) or you can write your own.
**Know that the governance address is in charge of the validity of disputes (slashing reporters if necessary), and changing the final two variables (stakeAmount and reportingLock)**
On choosing the staking token:
This is a super cool part of Tellor…you don’t even have to use TRB! Of course it would be great if you do and would likely get you support from the current reporter set that holds TRB, but if you don’t have a bridge from Ethereum or dislike us for some reason, you’re more than welcome to use any ERC20 coin.
For choosing the staking amount and reporting lock, they’re based on several things:
a) What token you pick as your staking amount (the amount will be in that token)
b) How fast the chain is
c) Balancing the desire for more reporters with the security of individual reports
**NOTE: If you have a high staking amount, you will likely get less reporters, but each report will be monetarily more secure. The reporting lock controls how long each reporter is locked for after a given report (the max dispute period).
As an example:
- Assume stake amount of 10 tokens and a reporter lock of 12 hours.
- If a reporter stakes 3 times, they can report once every 4 hours, 4 times, once every 3 hours.
- If you want more reporters, you can lower the barrier to entry by reducing the stake amount.
- If you have a fast chain, you need to make sure that you can have enough stakers to provide all the data your users may want. If it costs 10k for one stake and you want minute updates on data, this could get very, very pricey if there is a 12 hour lock on each report
**We’ll be happy to help you pick and go over the details, but as an example, Tellor uses 10 TRB and a 12-hour lock on Polygon.**
Once you’ve chosen your variables, launch away!
That’s it! Congrats! You deployed Tellor!
Reporting Data to the Smart Contract
Now you have to run a reporter to actually do something productive with your deployment. It’s a function you can just call with any software (e.g. an Airflow instance, an automated script, etc.), but you can also run telliot, our reporting software.
You’ll have to change the configs to point to your node’s RPC and the new address, but stake your tokens (telliot does this for you if they’re in your wallet) and that should be about it if you want to use the basic data feeds that are built in.
If you need some custom script/ data feed, you can always just write your own addition to telliot and run it.
You can find examples of those here: https://github.com/tellor-io/telliot-feed-examples (they’re just python scripts to tell the reporter where to get the data / how to format it).
Have Fun being decentralized!
Now your chain has Tellor on it! Congrats and definitely reach out if you have any questions or need support. Looking forward to seeing Tellor grow to every ecosystem and hopefully we’re making it as easy possible to do so.