New Ethereum talks, every Monday. The week's conference uploads by event, in your inbox.

Loading player…

Neon Labs 🛠️ Ethereum dApps deployed & run on Solana: No changes to original code - Simeom Kotashki

ETHGlobalMon, Oct 9, 2023, 12:00 AM

Join Simeom Kotashki from Neon Labs for a workshop titled "Ethereum dApps deployed & run on Solana: No changes to original code". During this workshop you will learn about Neon EVM, the technical tricks that were done to enable execution of Eth txs on Solana, to optimise data storage, and to enable payments, according to Ethereum rules. You will also get insights into the Neon ecosystem, it’s components like proxy server and tracing API. Neon EVM is a solution for anyone looking to scale Ethereum dApps on Solana in a developer-friendly manner and tap into Solana's vibrant ecosystem. Thank you to everyone who joined us for ETHGlobal Paris 2023! Paris is the city of light and birthplace of many revolutions. Therefore we were thrilled to be back in one of the most buzzing and free-spirited cities in Europe for ETHGlobal Paris 2023. A lot has changed in the European ecosystem since the last time we hosted a hackathon in 2019. ----------------- Follow us: https://twitter.com/ETHGlobal​ Check us out: https://ethglobal.co​m Email us at: hello@ethglobal.com

Transcript

foreign [Music] I'm leading Integrations with neon evm so today we'll speak about what the heck is neoni VM and what are we doing and we're gonna be conducting a really short demo so in a nutshell the only VM is easym inside Solana it's not like layer 2 is not like a side chain but because Solana provides a very scalable architecture we have the opportunity to build uh the evm the entire evm execution layer inside of Sola smart contract and how this is possible it's possible because in Solana in one account you can store up to 10 megabytes of executable data and actually the easy end that's pretty interesting is around two megabytes so we built a DVM inside Solana and we provide an ethereum-like interface for users and developer to to use it and uh basically from developer perspective and user perspective you can use the scalability and low low transaction fees for uh from Solana infrastructure and at the same time you don't really need to change your context and you know from user perspective you know change wallets or if you're a developer I know it's really hard to change your Tech stack or to learn new blockchain mechanics so we abstracted the way all the Solana complexity and so what we are going to do today I'm going to deploy one contract both on sepolia and neon evm to show you what uh what the difference is and what chord changes we need to do and also I'll show you one more thing and we're gonna see so uh the best place to get more info is the the developer documentation and here you can for example uh go to uh let's say neon faucet and get some testnet Neons um you can get from chain list for example you can just write neon uh include test Nets and art uh neon devnet in your in your metamask I already have it and I already have new off but let's let's just try it out so uh so yeah we can request 100 neons and they should be here shortly now yeah so uh let's uh yeah we we have an ethereum like uh blockchain Explorer so everything is uh evm Native and you don't really need to know about how Solana works and how transactions said to also along there so let's look at the project I have prepared basically it's a very simple hardcat project if we go and check you can see we have just two or three dependencies like we have Hardware toolbox cards yet and heart header scan uh uh to verify our contract and also we have open sapling and Dot dance to store our environment variables in different file that will not be committed in our repository so let's see the first contract that we are going to deploy so we have a simple erc20 token that we have Supply limit uh burnt amount storage variable and just for the sake of the demo I just added zero decimals so we don't have to add all those extra decimals for example if you want to Mint from from the Explorer so we we don't need to count them uh yeah so let's try and deploy in the first dish this contract in sepolia and verify to see to to verify that it works on uh just a normal evm uh yep okay before running yeah I'm gonna just run it and show to the hardcat configuration so as you can see we have configure 2 networks one of them is sepolia and the other is neon devnet basically as you can see you you don't need to do any extra configuration uh for for this and we also have uh another configuration this is for uh the verification of the smart contract we have the API key for sepolia and also for neon devnet as of now you can just put any key so you'll be able to uh to verify the contract um yeah it's strange we are waiting so much for for this contract to get deployed on sepolia it usually takes a four seconds okay I just try again foreign it always happens like this when you need your contract to be deployed it doesn't yeah excellent okay let's try to yeah I mean uh yeah we can we can just try to uh to deploy it to uh Neon devnet foreign yeah so uh uh which one of you have deployed contract on Solana only one okay uh only one person okay so that that which one of you has deployed on easy and chain okay we have more so that's for you yeah so you don't really need I've never deployed contracts on Solana for the simple reason that I'm just you know too lazy and just to learn any other and to change my tech stack to change uh the code to learn new tools learn new blockchain mechanics so I really find it that I really find it very fascinating what uh neon achieved so basically I don't know why for sepolia it doesn't really work but for for let's let's try one more time I just uh maybe we can check some other maybe the the public RPC let's just get another I think that's right physically get another RPC note maybe this one is down so we already deployed uh our contract on neon devnet I just want to make sure that uh you know I'm supposedly everything's right but if not we are gonna just proceed to it with new on devnet it's just a simple contract so as you can see we just imported from open sapling and it should be no no changes made actually okay spot is not that important so the good thing is that we managed to deploy on Neon and let's just verify this contract oops yeah just a second try to deploy it again and it says that it cannot find the beautiful which is strange let's do it like this we're gonna hack it funeral later now we should have the correct build E4 okay foreign okay yeah uh I forgot to clean the cache of hardcat it always happens if if there's a problem the problem is in your cash always uh yeah so we verified the contract successfully and let's just go in your scan and Siri thank you yeah we can see we've deployed the contract we have the contract here maybe we can try and add it in our metamask uh yeah let's import this token here it is okay and let's maybe try to Mint yeah we need to connect and let's mean to 100 tokens okay let's see did we no yeah it will we need to provide a little bit more because I found a bug yesterday Neo scan doesn't yeah we need to have this value as gas because otherwise the transaction just requires a bit more gas but uh actually a pretty uh interesting thing is that neon doesn't use um gas measurement from ethereum we use gas gas measurement based on Solana and it's a bit different but we support um all the RPC calls so uh most of the libraries they estimate a use estimate gas and then put this uh this as a gas limit so we are fully compatible with this and obviously Neons can don't use estimate gas maybe hard coded some some value so so yeah let's just check yeah we have we caught it two times so we have um um we have 200 tokens and yeah basically as you can see like it works uh one more interesting thing is that uh maybe if we open the transaction you can see that there is like a five maybe more than nine Solara transactions and if we open even one of them you can see those are all the underlying transactions that executed and they that were wrapped in one ethereum transaction basically why is that is because um in order to scale Solana it has a completely different infrastructure from ethereum and uh it it's stateless uh it's really stateful it uses um accounts as like in a nutshellana is like a big file system so it has two different kinds of accounts it has a data account and executable account so uh and neon ECM basically creates a executable accounts for smart contracts and smart contract state is saved in data accounts in like different files and read from them so sometimes we need to create one or two transactions when we are using for example as a store we need to create a new data account to in order to execute this opcode and this is one of the reasons we have more than one transactions and there are more more limitations that we can discuss for example um one Solana transaction is actually has limited to 256 kilobytes of memory per transaction and all the ECM privileges like memory call stack is saved in this transaction memory all the metadata that is related to to the transaction and and evm and sometimes we need we need to make two or three different iterations in order to complete the the ethereum transaction Okay so the other contract that we are going to deploy is as a bit more interesting so it's called ERC 24 SPL how many of you know what SPL token is no one okay okay one person okay that's good so I'll explain to you so SPO token is the ERC let's say the ERC equivalent in Solana so in ezm networks we have each year C20 as a separate contract right but in Solana we have a token program that is like a centralized smart contract centralized program for all of of the tokens it's like a registry for tokens so in order to create to transfer the two main tokens you need to call this um centralized program that is native on Solana and perform some token operations so what we are going to do here we have um we have the SPL token contract here as you can see we wrapped it in the SPL token interface this is the interface for for Solana we also have metaplex metaplex is where the metadata for all the tokens resides in Solana so we also need this to get the token name the token symbol and so on so we also need this this contract in Solana as you can see we are using the some some precompass and um we wrapped the erc20 interface we wrapped it in uh to call the underlying either metaplex or SPL token and what we are going to do now is we are going to deploy an erc20 on neon evm that under the hood will basically create a Solana SPL token and tweaking to transfer it back and forth so let's just see our script uh it's just a straightforward script do we get the contract Factory for erc20 for SPO mintable as you can see in this contract we have two tokens one is erc2 erc20 for SPL and the other is um yeah there's a 24 mintable the only difference is that we have exposed mean functions here and the the deployment script is actually pretty straightforward we take the contract Factory deploy it and then we mint token so why we put nine decimals here is before because Solana don't store the variables and uh in uh 266 bits but uh for 64 and basically we don't want to have a big uh a big decimal because otherwise we'll sacrifice to have really low uh um really low cap of how much tokens we can have so nine decimals is okay let's just try and deploy it um okay now the most the most interesting part and again yeah okay so we deployed let's try to verify it oh yeah we need to provide arguments okay now we don't have more time so let's just see the the transaction and I want to show you the interesting thing okay so you can see we have two transactions one is the contract created and the other one is the mean transaction uh so if we go to the contract create transaction you can see we have 25 Solana and this is actually the the deployment transaction nothing that interesting but for for the other transaction you can see that here we transferred from zero address to our address 100 uh token thread and if we go and see and check the Solana transaction you can see that on Solana again we have mint so it means that we have created a native Solana SPL token we deployed it and we can natively from neon devnet access liquidity and if we scroll down a bit we can see that for example here we have the token program basically that means those those tokens so yeah so that was pretty much it and do you have any questions regarding neon and yes yes so yes so uh Solana um because neon EDM is inside Solana controls can interact natively with Solara contracts this was actually the demo I wanted to show you how we interact with uh SPL token program and basically that's a good thing because you can create composable modules for Solana but writing so logical and don't change your Tech stack and that's that's pretty nice only maybe I can just tell you about one one problem that is not compatible but I think more most of the Roll-Ups and l2s have it you can you cannot use um log time stamp and block number as a mapping index this is still not supported but it's not I mean I've never seen it protocols use block number and block timestamp as indexing more probably as mapping value but not as key so I guess there's no more questions thank you very much guys

Automatic transcript — names and jargon may be misspelled.