Securely Connecting DeFi Smart Contracts to Off-chain Data
ETHCC 4 · July 2021 · 25:26
Johann Eid examines secure connections between smart contracts and offchain data, APIs and payment systems. He discusses oracle failure scenarios, decentralized networks and techniques such as trusted execution environments and DECO, using deployed price feeds as examples.
Speakers
Topics
From ETHCC 4, hosted by Ethereum France.
Transcript
i have my uh my screen to share so i just um let me just see i can share screen here um okay enter screen all right perfect okay can you see my screen here perfect okay yeah so thanks everyone for for attending this talk and you know thanks for sec to you for having me so the way i want to discuss today is i'm gonna go over what smart contracts enable right why do we need smart contracts why they're interesting to us and then i'll be able to link why smart contracts needs oracles and
oracle-based networks like chaining to prosper basically so first i want to go over things we know right today what we know very well and what you're familiar with are web 2 services we're all very familiar with twitter with you know people use facebook people use uber people use many different web 2 services which basically allow you to have a feature rich system that you can easily interact with and that you can do stuff easily with right like creators can upload videos on youtube people can watch these videos creators can tweet stuff on twitter then people can look at it they can like they can retweet all of this stuff right
now the way these systems work behind the scenes right is that it's a very trust-based system you're basically putting all of this info in a kind of a centralized party right into a centralized we could call it custodian here it's a custodian of information whether it's twitter whether it's uh you know apple store or sorry is the app store or the google store you know whenever you download the app whenever you create an app on these stores you're putting for the creator you're basically putting your internet intellectual work onto these platforms and for the consumers they rely on these platforms to go and kind of consume information right now that's all fair that's all well uh
the big issue we're seeing today is that these platforms have a very high counterparty risk right where basically the only guarantee you get is that you trust the system not to kind of you know act maliciously basically so you're trusting a logo you're trusting a brand it's a brand based trust system right and basically transparency is purposefully removed because in this kind of system a lot of time the best option is to not be transparent because there will always be some some stuff happening behind the scenes right now the other option which we see to web2 and to these systems i'm describing is a cryptogram graphic guarantee based
system bitcoin ethereum you have all the things all the kind of components in front of you you know how the text works you know how the security guarantees work you know what's gonna happen how you can be basically um you know in a way screwed right by these systems like you know what can go wrong and what can go right you're basically trusting mathematics and crypto economic incentives instead of trusting your brand and trusting your logo you know and here transparency is built in when you go into ethereum when you use d5 you have the right to transparency you can see everything that's happening nothing can be hidden right so that's those two systems we're comparing
we're comparing a web to based system very centralized but also very feature-rich with a blockchain based system which is very very kind of transverse here right like you can go on to ethereum you can go into bitcoin you trust these systems you know the assumptions there however when you compare the the stuff you can do on ethereum all the stuff you can do on twitter on uber all of this stuff it's a big difference right i mean you can't do a lot of stuff on ethereum uh right off the bat it's a siloed system and that's where oracle networks come in if you look at this diagram i'm showing you right you basically see two things you see thrust minimization
and you see feature richness so as i went over web 2 very feature rich very easy to access a lot of stuff you can do anything on webtoon blockchains very trust minimized very poor in features you know by by default it's a siloed system and that's why you need oracles now oracle networks like chaining are a way to get whatever you can't get on a blockchain right of the part into the chain you can get data you can get randomness you can get you know price data events based data like weather data you can get anything into these chains and what this allows is to get much more
features for dev developers and that consumers right just like you would build uber on the web 2 system thanks to oracles and blockchains you could build the same system in a more transparent way in a more kind of you know decentralized way which doesn't have all of these counterparty risks i was referring to you know so that's the use for oracle's oracle is allowed to build more applications they allow more use cases they make smart contracts really smart so they add the smart in the contract in my view and they are as trust minimized as possible so what oracle networks like chain link are building is a way to get
as little trust into the system as you need to basically would rely on the same crypto economic guarantees and cryptographic guarantees that you have for blockchains right so is that kind of the context of my talk and now i'm going to go into a few examples to really represent that right so we've seen what happened recently with uh this um you know the robin hood short quiz right so that was a few months ago people were buying uh the gm stock because they thought it was undervalued and because it was getting very heavily shorted by wall street funds right so this created a huge kind of you know marketing mania and you know a lot of
people spoke about it now what really happened at this time was that people were basically trading on this robin hood platform thinking the funds were theirs to use right they basically forgot about this stuff i'm referring to here uh you know on the left which is a paper guarantee based system which is you only have as much guarantee as you get through the brand you don't have anything more right so if the brand decides that it's in their benefit to basically censor your trade they will do it if there is some pressure happening back door or if there is some kind of you know talks behind the scenes taking place they can just cut you off
right and this this is what happened with robin hood basically all of these people who thought this was their money to use realized very rapidly that this wasn't their money to use if you put your money on the stock market into a broker or you know any kind of third party that's their money now right it's the same thing as not your crypto not your game not not your keys not your crypto right and that's what happened uh they were basically locked off doing trades and you know this created this whole thing which we will know about and this is where we really saw the value prop of crypto and defy shine right because what does defy allow well dfi you put your money into a platform and you can transact on this platform
and you don't need anyone to agree with your trades you don't need anyone to say yes you can do this or you cannot do this right it's fully automated it's fully transparent it's fully decentralized and that's the beauty of it so people who are trading on robin hood and got shut off from these trains could just go in synthetics and do the same trades without being shut down right and that's the beauty of defy that's a solution basically this whole thing i was discussing with paper-based guarantees well you see those information right like you see that you can be censored when you post something on youtube or when you watch something on youtube or when you go on twitter and people get banned for no reason that's information censorship
and there is also financial censorship which is what we saw here with a robin hood and which happens every day in developing countries where people can't get loans and can get you know mortgages that's financial censorships and it does have very big consequences probably as big as information right and it does restrict the flow of capital and of innovation very very um dramatically basically so that's why you need d5 and the thing with g5 is that it does rely heavily on getting pricing data and other types of data right so for instance synthetics if they want to price an
asset if they want to allow someone to gain exposure against gold or silver right they need to know the price of gold or silver and how do they get this currently they get this through channing price pins chaining price fees are putting the price of gold of silver on chain and this allows applications to basically trade based on this price right same for ave if i'm putting some ether into ave and i want to borrow some usd i need to know what is the price of ether against usd and again that's allowed through chaining price fees and you know you have many other use cases that go into such as vrf proof of reserve weather data many different systems and services which are basically acting as a
abstraction layers to allow this smart contract to interact with on define to be really smart to be able to know what is the price of an asset what is the next random number that's going to be generated for put together what is the weather data for insurance contract that's what training does now as you guys know the g5 ecosystem has grown tremendously we're now at 102 billion dollars which is pretty insane i think one or two years ago when i when i was giving this stock it was maybe a few hundred million right so it keeps growing it doesn't stop and i think we're gonna be by next year probably at 10 trillion or something like this right because that's
exponential growth so what you see with these applications is that they they've been growing quite a lot synthetics are they compounds they're allowing people to have access to stuff that they never had access to for instance in developing countries taking a loan was out of the question so basically a huge fragment of society got um censored from being able to do stuff that you can do on a day-to-day basis on our side right if i live in a poor country and i'm hitting hyperinflation and i want some exposure to gold today i can go on synthetics and gain this exposure to god right that wouldn't be possible otherwise if i want to get a loan to you know pay for a new house i can go on
touave get a loan or compound if i want insurance on all these investments i can go to nexus mutual you know so that's the beauty of d5 and that's why it's growing so much because there is a real product market fit because people have been relying on these paper-based guarantees which are very insufficient based guarantees and today's are discovering these new cryptographic guarantees which are much better transparent and you know open for the world so despite all of this stuff right d5 is still very small if you look at the value uh compared from d5 towards the crypto sector it's it's basically a rounding error right it's 2.6 percent
it's growing but it's still very small compared to what we think it could do and if you put this into kind of um you know retrospective to the rest of the world there you see the real uh kind of crazy thing which tells us how early we are you see that g5 is extremely small compared to the rest of the financial sectors right if you go to stock market global real estate derivatives dfi is basically a very very small insignificant portion of all of those markets you know and that's what tells us that you're still so early and that's also what tells us is that whatever we're working on is really worth working on right because it's so early that even though we see all the benefits it's
still so small that it could just go away tomorrow right and that's why it's important for us to work on this stuff because if you don't have builders working on this stuff then you know something as small as what you're seeing right here disappearing is not that hard right and that's what really tells us that we're at the beginning of something that could be extremely important for the world and the true shift in the way people act and use their money now when we're going to d5 protocols and when we start kind of you know dissecting what they're made up of you see a very common theme which is they have a hybrid model they have on-chain price like on-site contracts which are
basically you know smart contracts deployed on ethereum polygon arbitrariam basically is the chain of your choice and you have off-chain events you have the smart contract execution which needs inputs and these inputs are very often obtained data so for instance ave needs to know the price for the liquidation of a position is i need an input which is going to be the current price of the asset uh used for the collateral right same for synthetics and same for every application which is uh collateral based and allowing for people to to borrow against this collateral right if you need to have let's say an under
collateralized loan in the future you will need the credit score of the person taking this loan right and that's where um chairman comes in basically giving the credit score of this person so they can take this loan so that's the structure we're looking at we have the onshore part we have the option part the option part is chaining nodes basically getting data from multiple different data providers based on the needs from the contract so if the contract wants price data we go to coin gecko keiko revenue coin if the contract wants banking data you go to visa mastercard and if the contract wants you know maybe signing data
docusign weather data or record all of this stuff right so that's what you're looking at as a structure right now now i want to break down um the different services channing has been working on because yeah as i was saying the way we look at the space is you have smart contracts you have a lot of stuff that smart contracts cannot do and that's what you're trying to do we're trying to do everything that smart contracts and blockchain cannot give you right now and are basically a limiting factor right so for instance if i go right now on to some stuff we provide we provide price and market data the way we do this is that we have
different data providers that you can see on this diagram basically these providers are sourcing price data for an asset from multiple exchanges right so something very important we provide is we provide full market coverage for any asset you don't want to ever be using one exchange if you want to get the price of heath let's say because if the exchange goes down you go down and if you're securing 8 billion dollars like ave you never want to go down right so we have multiple exchanges being sourced by multiple data providers these providers then send their data to chaining nodes chaining nodes you can think of them as
infrastructure provider they're running basically blockchain infra and they're you know very kind of a networthy company right so for instance we have dutch telecom we have multiple kind of you know large bitcoin miners large stakers in other networks running training nodes so basically people who have a reputation to keep their infrastructure always up and the chaining nodes then puts this data from data providers onto reference contracts which then is being read by the kind of defy applications right on the right so you have exchanges they get into the data providers the
providers aggregate all of this data they provide full market coverage they send the data to training nodes which then sends them on chain for d5 applications to easily read that's how our system works right now and you know you can access this data.chain.link page to see all of the price feeds we currently support we're also currently deployed on i think around 10 blockchains so you could see that you know we are on ethereum on polygon multiple blockchains that people can get data from right and then obviously these price feeds have been used for a long time and are currently securing lots of value right so last time i saw we had and we don't have all the users
on here but i think we have around 200 users something like this for these price fees which are basically getting data for their applications from the chaining fields and this is securing an aggregate value of around 30 billion dollars give or take so that's what today's ecosystem looks like right and the important thing for us when we see this value is it basically tells us that this service is useful these applications really need this data right because if you were to look at the growth of g5 without channing price feeds i think having applications set up their own feeds and set up their own infrastructure and their own oracles
would basically not be possible right it's like um you know it's like every application launching on the web having to relaunch your whole uh internet infrastructure it's basically a huge amount of work and you end up working on infra instead of working on your app as an application right and that's why training has been in my view so useful for the development of key file as a whole so now that we've discussed this i want to also emphasize what a large user base means for price fields the way these price fees work is that everyone is paying every application is paying a small amount to consume these fees right so what happens is that you get
pulled fees where you can have up to 50 applications for instance on our eqsd pair paying to reads from the price feed and what this means is that all of these feeds can be aggregated all of the user fees can be aggregated to then uh basically promote the security of the network right so let's say i collect millions of dollars in fees on the price field i'm able to add more nodes more data providers i'm able to pay more for security and because i pay more for security i get even more demands because my price fit is even more reliable right so you start getting into this loop where you increase the user fees
you get better security you get better network and economies of scale and get more users you know and that's what you're seeing today we're seeing a lot of applications paying for price fees which means all the fees are being pulled together and all of this gets reinvested into the security into more feeds into building more g5 products right and the other great thing we see here is that we do want d5 to be fully decentralized and self-sustainable so having users pay for the price fields and having the kind of you know users pay more and more of a big part for these price fees to work means
that you're going into a kind of time where the price fees will be fully sustainable where you won't need anyone to run these price feeds except their own users right and the people who will have the bigger stake in getting these prices running and keeping them running will be the users because so much value relies on them so that's a great look we're seeing today and you know we have 200 users today paying for multiple feeds so we're already truly seeing an economic model that's fully sustainable and that's fully scalable take place in this kind of price feed model right so something else you're working on has been proof of reserve and
what proof of reserve is is basically the ability for custodians to prove their reserves for any assets they're issuing on chain to smart contract protocols right to 2d5 so let me give you an example we worked with paxos and paxos is issuing pax and pax g as proxy assets for usd and the gold right now the way we've worked with them is they have an auditing company which is providing us with an endpoint to get how much value they have in reserves on their on their side right so for gold and for dollars we know how much they have in reserves and we're able to
put this value that they have on a smart contract on ethereum through our technique nodes and what this allows applications to do is they can fully uh fully uncheck they can read how much is in a result right so applications as you all know cannot access off-chain data but by putting this data on the chain any application can check how much there is in resource for paxos and the beautiful thing here is that an application using pax and pax g could check that these assets are fully collateralized because they could check that whatever asset they're using in their app
has a real world backing and if it doesn't they can just have a circuit breaker which disallows any new asset to be taken in by the application and any more exposure to be taken in right so the the great thing is that we can actually extend this model and people in the future will hopefully start using this proof of reserve fiends which a test of how much you have in reserves to base the minting condition out of this so basically if you don't have enough reserve you cannot mint more assets then you have in reserve you know and that's something that could be added to any custodial assets and with which we're you know working to make happen because we think it would
tremendously improve the transparency of some of these assets so basically i cannot means more proxy bitcoin if i don't have enough reserves according to the chaining nodes right okay all right yeah guys i i think i went a bit um i've been to too detailed all right well as you can see we're doing kind of lots of new stuff for the ecosystem i think deepa is going to keep growing and the services it relies on are going to keep growing proof of reserves and price fees are actually our two biggest
things so i'm happy i was able to present them and yeah i hope you guys have an awesome event i wish i was there with you guys but you know next time so thank you for hearing me out perfect thank you guys bye you