Daniel Luca - Doppelganger Networks
ETH Bucharest 2024 · March 2024 · 19:03
Daniel Luca of Eden Block presents doppelganger networks, which replay Ethereum transactions on a private fork with changed rules. Using a simple deposit contract, he shows how developers can swap in mutable code with extra events and analytics while users keep the cheap original contract. He covers Shadow as an example, its centralisation and trust trade-offs, and ideas such as extra compute or storage and one-way L2-like networks. Questions follow on synchronisation and comparison with The Graph.
Speakers
Topics
From ETH Bucharest 2024, hosted by ETH Bucharest.
Transcript
so now we have one more talk by uh Danielle Luca from Eden block and we would like to say a very special thank you to him as he's been supporting e buest and I would like you to welcome him right now [Music] [Applause] okay so here I am
again um good okay so the slides could I also see the slides here so today I want want to talk about uh this concept of doubleganger networks I um I saw this happening in the wild and this gave me the idea that there could be a new category of networks a new category of applications and I wanted to uh make this more known to people so there maybe more of this will happen Okay so I'm going to cover the introduction to doble gang and networks that means like what they are um how you can build one what's an good example and
how this kind of got started um there are some clear advantages but there are some very very bad disadvantages I still think there's a lot of untapped potential that we can probably solve or people can take this idea and and put it forward so I am I'm Daniel luuka I kind of presented myself yeah I'm um I'm a developer at heart I did a lot of security in blockchain I was with a consensus I was with uh consensus diligence where I did security I also founded my own security company I created my own stable coin so I kind of did a lot of things uh but now I work with idom block which is a crypto VC we
like to invest in infrastructure projects but we we're not we can look at everything everything is very important to us so a double Kanga Network has two properties it mimics a network it can mimic an evm node like the ethereum network but it changes the rules so that means that in order to mimic it you replay the transactions on your local Fork but they then you are changing the rules so it makes it incompatible and you can do a lot of interesting things with it I I think it's much simpler if I give
you an example and we walk through this so let's say that you have this very very simple contract and you're trying to do a the simplest for your users to achieve something and in this case you're just calling the deposit function you want users to allow you to uh to allow themselves to to deposit some kind of ether and you need to track that for each user and this is probably the simplest thing but it doesn't help the developers it doesn't help the UI it doesn't help a lot of people because you don't have analytics you're not tracking a lot of things you're not adding a lot of functionality to it so what you can do is that you have these 11 lines of code and then if you replay all of the
transactions and you replay them to your Doppel ganger network uh you can do something very interesting you can change the rules so you allow for code mutability so now you can deploy new code for the same contract you add a new event you start tracking like who deposited when it was deposited what was the block What's the total number of deposits you add all of that functionality you emit the contract you accumulate um the deposits into one variable maybe you add more um you emit those events and the important thing to understand is that the user interact with a contract on the left but the
developers interact with a contract on the right the advantage is that it's very cheap for the user and the devs can update the code fix some kind of um analytics if they want to add more if they want to fix something they can also backtrack and replay all of the transactions again and it's much more expensive to run the uh contract on the right but it doesn't affect the user and the expensive part is something that we think about a lot when we're developing contracts because then we're putting a lot of pressure on the users so in order to do that you kind of
fork the chain or you Fork the state you update the rules that means you have to update the software that runs that it's it could be a GU or it could be something more modular like w you you replace the smart contract code and then you start tracking the events and all of those events are useful because you can now display analytics in your UI you can tell users a lot more but again they're not paying for all of that computation they don't need it you need it so this is this idea started with um with shadow.
XYZ uh in December last year they they said okay we just erased $9 million it's led by Paradigm and we're going to do free logs for everyone free logs for your contracts and this is how we're going to do it so in order to understand the advantages you could add Advanced analytics it's cheap events or free events for users is cheap events or lowc cost events for devs and it's also interesting that the 's a low context switch previously you had to write some kind of JavaScript code or typescript to
add that analytics on top and uh you as a developer then you could start understanding what's going on but now you can use the same developer that wrote the original solidity contract and add more functionality to it and there's no context switch and developers understand that this is uh an important thing and it does increase productiv if you use Shadow it's a very easy setup because then you don't need to do all of those steps yourself they do it for you you just click a few buttons and then you replace the code and then there you have it um there's also it allows you for
code mutability because you can update the code you can add new events and they will just retrack all of the um you redo all of the transactions and you have more data now but there's a a big part which is all of the disadvantages the thing is we're kind of um we do like decentralization and we kind of have a gag reflex when we heard things are centralized and Shadow is very very centralized and for some very good reasons but the problem is that now you have multiple sources of truth um some people know that when uh frontend development was kind of picking
up we would have all those input elements the buttons and so on and we had all that state in each of the parts and Redux came along and said no we're going to have like a huge structure and we're going to uh dissipate all of that state to the events but the real source of Truth is unique and it's in one place so that's exactly what they did and then we were able to see more single Page Apps and this frontend revolution kind of started it started with um Redux but it helped uh view it helped react it helped angular everybody kind of started to adopt this
concept in blockchain it's uh a bit different so let's say that you're trying to track something but then because it's a private Fork chain chain it's a private version of my truth I may interpret that data one way but others have to also do the same computation themselves so they might may have very different outcomes so when they try to interact with you because everything is a Lego piece um they might think that things are one way but they're actually in in a very very different way there's also the possibility of manipulation because it's
centralized Shadow could could manipulate the data you might not even know it you you should probably have to do the computation again yourself but there there's this there's this big risk and it may not be robust um they could go down or they could say our servers don't work and cut you off and then your app doesn't work anymore server ISS isues so we still have this idea of doppelganger like there's still a lot of possibility and I kind of want to present how you how you can think of it in a different
way so let's say that this doubleganger includes the evm node or includes ethereum so everything is that happens on ethereum happens on your network you don't need a bridge because you're replicating all of the transactions and you trust them because they were C cryptographically signed but what can you do on top of that you can add compute so this could be let's say that one user does something on ethereum and they signal on your doubleganger that more compute needs to be done so this could be something like AI more um like inference or some kind of
training or some kind of compute that you want to add and you trust that user because they did the uh transaction on ethereum and it just signaled on your doppelganger that you have to do it you could do more storage so you could store a profile picture you could store an image you could replace something you could delete something and then you just make your doppelganger serve that specific need and I think there's lots of other uh possibilities and we kind of have to explore that and I see this doubleganger like a weird L2 without a bridge which is still connected to ethereum but it's
one way and if you really want to you can still create the bridge and push data to ethereum and this is I think a novel concept and a new way to think about this but also over time we were able to create applications permissionless you didn't need to ask ethereum to accept your application you would just deploy your smart contracts and it would run there but what if you want to add a specific cryptography scheme what if you want to have bigger blobs or to be saved for a longer period of time you can add this functionality still be very tightly
connected to ethereum but you don't have to ask the permission of the ethereum larger community and I think that's very interesting um you would it would still make sense to create a network out of it because up until now I kind of talked to you about only the doubleganger part but not the network part so you can create a new type of transaction that runs on your doppelganger it uses all of the ethereum read State and works with that um so I think there's a lot of possibility there and things are underexplored at the
moment okay so uh I understood there would be questions I'm not sure if we can do that but uh I'm I'm free afterwards uh this is my Twitter can we do questions or not okay okay what could I build on your Doppel Gang Network that would not be possible elsewhere or on the main chain so you can change e ethereum's rules you can add pre- compiles with specific cryptography schemes that are not part of ethereum now you can store
more data you can do GPU computation and and I I didn't create this doubleganger is just a concept so I'm trying to help people think more about this and find new ways to to build um newer applications which are possibly more specific to their use cases so one thing would be maybe you want to create this um pfp storage Network that is tightly connected to ethereum but in order to do things on this network you don't need to pay the ethereum fee you just minted the uh the NF s they exist there they're on the main net you don't have to move to nl2 but if you want to adapt the NFD if you want to adapt the
image if the image has to evolve or do something it can completely live there and and do it in a much cheaper way oh that's crazy that's really interesting that's really cool Concepts we could figure out with that does anyone have any other questions uh uh so you mentioned like this uh centralized part is it like the way I understand it is this is completely separate from ethereum like no no validator is going to run this network but it's just like a centralized point that can um update the code and ensures the computation is correct and everything like that is this how it's
supposed to work and is this what shadow does and why you said it's so centralized so yes Shadow is very centralized because they create your own Universe within their system and let's say that I want to track something related to un swap I'm going to create that Universe for me and you're also a user of Shadow so you're going to create a different Universe because we can both replace code we're going to have to live in different universes so then we have to have a different view of what's going on on unisoft or we're just tracking different things this is what's happening with shadow but I think there's a large possibility
of creating a shared State between uh this type of functionality between Doppel gangers because then we would still have things um Lego pieces we still have modularity and composability within them Does this answer your question um kind of yes so would this be similar to what the graph does I think uh Shadow specifically is a very good competitor to the graph okay yeah okay thank you anyone else so H how easy it is to synchronize
the main evm chain with the doppelganger network uh the doppelganger network with the main evm chain okay this is uh an interesting question because you can do it in multiple ways you can try to create your own node and replicate all of the transactions since Inception or you can do it like on demand depending on how you want to change the rules uh since for example you make code changes and your transactions will use more more gas you also need to change that rule because otherwise your transaction or your doing ER will will fail so you're changing that okay so now the ether that is part of the users's
wallet is different in your network than the original Network okay so you maybe you can't do it since Inception or you don't care about that part and you can do it on demand so when it happens uh you just take the state from ethereum and use it then so basically you have to plug into the main mol of of ethereum and then list to specific transactions for certain apps yes that's right you do do need uh an ethereum URL RPC URL to still read the data from ethereum and to replicate what happens there on your network so it's it's in a in a kind of way it's ethereum and Bitcoin and lots
of other networks are so closed that we we finally started to think like okay this is a very closed Universe whatever happens here only exists here and we cannot take information out of the outside except with some with the Oracle Concept in this case I can connect myself and actually embed a different network within my network and I have complete access over the data there for basically free thank you we have time just for one more question no is that everything yeah well well done that was
an amazing really interesting tool
Related talks
- The Graph by Yaniv Tal
- Building and Publishing an Index of Every Address on Ethereum Mainnet
- Аналитика блокчейн в реальном времени | Алексей Студнев RU
- Cyber Search State | Валерий Литвин RU
- Metabolism Technical Summit - Introduction to the ZORA API
- Día 0: Inmersión a FORK THE SYSTEM by Status Network
- The Graph 🛠️ Quickstart to Subgraph Development & Querying - Marcus Rein
- The Graph 🛠 Building decentralized, serverless applications - Ørjan Auestad
- Dune Analytics 🛠 Open Data for Open Finance
