[ETH Seoul 2024] Ethereum dApps Deployed & Run on Solana by Simeon Kotashki
ETH Seoul 2024 · 11 Apr 2024 · 28:06
Simeon Kotashki, Lead Integration Engineer at Neon EVM, shows how Ethereum smart contracts can be deployed and run on Solana without code changes. The talk explains how an EVM can live inside a Solana program, how Ethereum-style transactions are wrapped by a proxy, how Solana's account model enables parallel execution, and how Solidity can call Solana programs. A demo wraps a Solana token as an ERC-20.
Speakers
Topics
From ETH Seoul 2024, hosted by Kryptoplanet.
Transcript
hey everyone hope you're doing fine today uh my name is Simon I'm integration lead for neon evm so today I will show you how you can deploy your uh ethereum smart contracts on neon evm and first I have a couple of questions so I guess uh all of you are familiar with uh evm and how evm works but is anyone familiar with Solana and how Solana Works no no one okay okay two people out of 50 okay that's still okay three people okay okay I can see some uh mem coin de here so maybe you you traded some mem coins
lately uh yeah so uh why I'm asking that is because um NM is actually a smart contract in Solana and uh we are um basically um combining the best of both words basically we are one of the first parallelized EVMS uh because we share Solana underlying uh properties and um but also from developer perspective and Builder perspective you don't require any code changes you can use your um tools and your evm stack to deploy smart contracts on on Solana and but also benefit from lower gas fees uh and also
um not Global gas SE Market what we have on ethereum but uh just uh gas fee markets per dap so how does it work as I mentioned to you neon evm is a smart contract in Solana and uh I want to share share with you in a nutshell how does the neon evm architect picture looks like so we have Solana and nonm is actually uh a program in Solana that can understand and execute evm bite code inside uh saana virtual machine and but this is one part of our architecture if we only have the newon evm program users
and Builders won't be able to use their um let's say hardhead Foundry metamask uh in order to interact with this smart contract why is that is because uh Solana has a completely different different RPC and has a completely different uh transaction composition so we also have our neon proxy which basically provides um ethereum like uh RPC uh it um does some magic I'm going to explain later uh unwraps the ethereum like RP uh the ethereum like transaction that the the user submits wraps it into a Solana transaction and submits it to Neon evm program and then neon evm
program um just executes the bite code and addresses this transaction it looks uh it looks pretty straightforward and easy but um as some of you don't know uh maybe um that Solana is completely different in terms of architecture than evm so the most distinctive part of that is that uh Solana is Solana smart contracts they're called programs uh they're stateless so they don't have a state and they use different accounts to store State you can see here is um a simple uh Sana program that and that you
can see that we have the Sana program on the left hand side which only contains the saana program bite code and the state is actually stored in another program derived account that the program creates different accounts to store its um its data so you can imagine saana being like um very big file system where you have two different type of files you have executable files which are the programs and you have also data files uh that are not executable so programs can
create their own data files their own text files to store their state and um when we when it comes to neon evm neon evm is actually again a program and it uses uh program derived accounts to represent and to abstract away its own step and um uh for example on the up you can see that um this is how an externally owned account in nonm looks like it's actually a data account and inside it we have all the metadata of an externally owned account we have the uh the dater address the know the
balance and uh and so on and the same is with um contracts so uh the contract is gain um a program derived account that contains all the uh properties of of a contract uh along with the easm bite code and also the storage layout of the contract is stored in different accounts depending on uh depending on the storage slat you're are going to use basically um the first 64 slots are actually stored inside this uh the account that uh uh the program derived account that
is actually the bite code stored but every other slot is actually we neon evm creates different chunks of um of program derived accounts to store the storage layout and um yeah this is how neon evm actually represents the uh the whole uh the whole evm architecture and the whole evm storage uh and probably something interesting is you're going to ask why why why Solana uh decided to go this way and why not having a stateful machine like ethereum it's because of uh optimization and because to they want to um have parallel
execution and in order to have parallel execution you cannot have a global State and what you should have is uh you should have uh for each transaction you should know exactly which account State you're going to be modifying reading or writing from because on a note level if you have this um I would say uh this list of accounts you're going to uh interact and read and write from on a note level the note can easily uh order the transactions and can create and can execute some transactions parall and some transac action sequentially so this
is how a Sana transaction looks like uh as you can see we have account list so account list is actually the list of accounts that are going to be read or read from um for this transaction and this is actually very important as I mentioned for um for leveraging parallel execution if we go back uh you can see that every contract every um let's say chunk of storage layout slots is account even externally owned account is account even NM is account so uh we have um this account list where actually this is what the proxy do as I
showed you here so we submit etherum like transaction the proxy does a little simulation of this transaction in order to determine the account list of uh that is going to be used from from this transaction populates this account list inserts the program index of neon evm the the data as you can see the data is all the metadata that ethereum like transaction needs like nons gas price gas limit value uh the the transaction data and so on and actually submits this with the program index of neon evm so Neon VM understands of of the nones of
of of gas limit and so on um you're going to ask okay but in this account list only neon evm address will always be there yeah so in theory uh we cannot leverage parallel execution uh this is not true because non evm is actually uh a program and programs are state so uh so on a note only cares about program derived addresses and addresses that contain State and that contain data not that are executable so nonm even two transactions that
have non evm transactions if they have different account list if we exclude the address of non evm they will be Pro processed parall so um yeah this is just uh a diagram showing how transactions are ordered uh so the non proxy submits the transaction to uh the salana RPC endpoint as I mentioned to you uh salana is non evm settlement layer so you can think of nonm is like a virtual machine inside the virtual machine like you have a Mac and you launch a Windows Virtual Machine on your Mac or vice versa you
have a Windows machine and you launch a virtual machine uh for um for for Mac on Windows it's like just a composability layer and like a virtual evm inside Solana so we use Solana settlement layer and uh it's uh something really more important is that you can natively call and this is uh part of our road map to achieve General compatibility with Solana so what you can do some use cases all those me mem coins that are um on Solana currently you can basically deploy a Unis swap Fork on neon evm create a erc20 wrapped SPO token
basically you can WRA the meme coin that is on Solana you can wrap it in an ec20 interface and create a pool or do anything so you can access soana liquidity in um um in that case and this is done natively because nonm leaves inside Solana you don't need to uh to to do like a bridge transaction you just need to transfer your uh saana uh your SPO tokens from your saana account to your neon evm account and um some incoming features actually this is already live so we are supporting and the bridge is supporting
us uh um which means that you can transfer um tokens from 16 I think 16 or more EVMS to uh neon evm and also you can see we have neon pass neon pass is our native bridge that is used to transfer tokens from soana to nonm but why I say bridge and Bridge is in quotes is because we are not really bridging from one chain into the other we are just doing a native transfer from one account inside Solana to nonon evm account that represent your metamask address because we know that Solana addresses and um
Solana addresses are different than uh evm addresses so non evm supports evm addresses so you need just to transfer your SPL tokens to um to uh neon evm uh account that represent your ethereum and metamask address um another really interesting feature that is going to go out in the next month or so is uh multi talking gas payments uh this feature is actually really interesting you'll be able to pay um for gas not only in neon because neon is the main gas token you will be able to pay gas in different currencies like
Solana usdc and so on and how this will happen you will just have to connect through different RPC so everything is abstracted away NE only evm will have RPC for example for usdc payment RPC for um saana payment and there will be possibility through the Dow to launch new uh Gas payment tokens for example if the community decides that they want um uh dog with hat and they want to pay the transaction fees with dog with hat okay so if they if the doubt agrees we can add dog with had as a gas payment
token um composability so as I mentioned with you we already have our first case of composability and interoperability with Solana which is um which I'm going to show uh after that and you can in the you can natively call any sonana program within the onm with within your solidity smart contract we um we aim to achieve General interoperability what that means is that for example you can launch uh you can interact with Orca with radium exchange with any other um protocol on salana
from neon evm from your solidity smart contracts and and this is very good use case for example for Dex aggregators because you can aggregate from Two Chains and you can execute uh on on Two Chains uh just using one source of code you can have a solidity contract that can execute on both chains uh you can do you can mint you can um mint nfts um and uh basically uh what to some else you can read any arbitrary data from saana for example you can get some uh account data from saana and distribut rewards on neon evm or vice versa so the
possibilities are endless so we aim to we are releasing this or next week this feature on devet and uh my team is going to test and provide a lot of feedback and also tutorials to developers how they can uh use uh how they can use this General interoperability and I guess in around month or two I think two months because we need uh to undergo some security audits we're going to have this uh feature on on mainnet uh yeah you can um you can follow us uh I will I will leave this uh after uh the the lecture but uh let me
show you uh let me show you something else um I want to show you how you can deploy and basically how does one erc20 looks like that is underlyingly calling um SPL token hope you can see this yeah okay so as you can see this is uh a contract that um is actually having an erc20 interface and you can see that underlyingly we are calling something like metaplex here we are calling SPO token and what is that this is actually
the program on saana that uh is like a centralized registry for all tokens SPO token and metaplex is centralized registry for token metadata uh interest L uh Solana decided to have everything in one centralized place not like evm concept of your c20s where different contract uh different tokens are different contracts by themselves some people think that this is good some people think that's not but it is what it is so um how does uh how does this work is we have created and uh some pre compiles and those two pre-compile
contracts they interact natively with the SPL uh token and with metaplex token so underlyingly you're calling the real token you can see that even for um for approve and transfer I can we are calling underlyingly SPO tokens and you were even for say transfer uh we are calling the the the SP Onana so um you can go and and have a look in we have created think you can see this
no I think it's not here maybe neon so in our GitHub you can new lab GitHub yeah you can come and search tutorials and we have whole bunch of tutorials how to deploy a near C 20 how to deploy a near c721 how to integrate with chain link how to integrate with piss also we
have a Foundry example here you can check it uh and you can play with it uh when it comes to uh when it comes to rpcs you can use chain list and if you click devet you can see that we have two rpcs and also for menet we also have in practice there are two but we also have drpc and drpc is actually uh just the same RPC as ever
stake yeah so you can get this and uh basically as you can see this project it's a simple hardhead project so we have you you just need to add uh your chain configuration here and uh everything uh should work out of the box um we appreciate if you give uh any feedback of our documentation we also have um our documentation here and uh I think it's yeah we also have our documentation so
you have uh also all the information should be here uh how to integrate and how to use metamask uh how to use uh we have also neon faet which uh can give you um 100 neon if you ask it uh for devet of course uh and um yeah so uh I have already deployed one token uh and I just want to show you something uh interesting so let's uh let's just send from account to to account
Tre um this it token send 100 tokens yeah and uh what I want to show you is that this is not um and also in in our tutorials we we always show how you can deploy an erc20 that is under LLY an SPL token so in theor you can even launch your own meme token if you don't have
any knowledge about Solana this is actually the purpose of um neon evm uh to abstruct away all soana complexity because I have also come say uh background uh evm background okay you can see this is our Explorer and interestingly each neon transaction maps to one or more sonana transactions why more is because um sometimes so soana is also restricted in terms of memory per transaction and uh as we know um ethereum and TVM transactions are only
limited by the gas limit of of the block 30 million so sometimes uh evm transactions is too big so we need to um is called iterative mode of transaction we need to perform couple of transactions that constitute in one uh evm transaction but here luckily uh it's only one Solana transaction if we click here you can see initially that we have transferred in the onm 100 uh ethereum so transactions uh so tokens sorry and you can see this is the Solana Explorer and the
underlying Solana transaction and you can see that that here again we have a transfer and this is actually our our token on soana and you can see that we have 100 uh 1,000 token Supply so you can do this you can deploy that and uh probably in the next couple of months after we launch General interoperability uh there will be even much more use cases for nfts and for um anything that can come to your mind so um I would suggest uh to go ahead to
check our docs also follow us uh and uh join our Discord uh we have a developer Channel there so whatever questions whatever um uh problems you might have or even any feedback we accept any feedback regarding our documentation um is is welcome also I want to talk about um uh the Bounty uh we have a bounty here and uh we welcome any um creative ideas uh that can leverage either parel execution or or low transaction fees or even if you decide to create let's say a
native product on uh on neon we can also potentially invest in uh in such kind of projects uh for example uh Pro projects like nft marketplaces are something that is uh really good and we currently don't have I think on neon uh you can go on our website and check our ecosystem page um so if you write Neon evm and if you click ecosystem oops
um I think it's down yeah here explore ecosystem and you and you can check um actually what are the the DBS so any DBS are welcome uh we are going to also uh manage uh uh and assess creativity and vision of the project so whatever idea you have even if it's really crazy idea uh even if you want to do a a meme talken just don't worry about that uh and yeah I think that's the that that's
pretty much it uh please join our Discord and engage with the developer Community uh we are always there and try to support um yesterday we had the devet maintenance I tried it today everything should be working but even if at some point something is not working don't worry just message me or message in the developer channel so uh because on different hackathons um we used to even choose winners that didn't man to deploy some part on newon but they deployed on for example on sepolia but their idea was too good so we can give you another chance to deploy so this is not um not a big
issue um I think that's uh pretty much it uh anyone have any questions no okay then thank you very much everyone it was [Music] pleasure
