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

Loading player…

NEAR One Chain to Abstract Them All - ETHGlobal Singapore 2024

ETHGlobalWed, Oct 9, 2024, 12:00 AM

Join us for a workshop with Owen Hassall titled, "NEAR: One Chain to Abstract Them All." What if you could control accounts across multiple chains with a simple email login? What if your smart contract could acts across multiple chains? Join us in this technical workshop as we explore how NEAR's vision of Chain Abstract can help you and your users enjoy a barrier-free Web3. This workshop took place at ETHGlobal Singapore 2024, a 3-day hackathon held from September 20 to 22, 2024, that brought together the most skilled web3 developers, designers and product builders from all around the globe for a weekend-long adventure to advance the Ethereum ecosystem! ________ Follow us: x.com/ethglobal Website: https://ethglobal.com Email us at: hello@ethglobal.com

Transcript

[Music] and this Workshop is near the one chain to abstract them all and we'll talk about why it is the one chain to abstract them all so today we're just going to go over like what bounties we have and give an overview of the tech stack most of you here are probably familiar with like evm so I wanted to give a bit an overview how this actually like differs from evm and give a overview of the whole like near stack rather than diving into just like one example so it' be more theoretical rather than me sitting here programming right um and we'll we'll talk about uh like how you can access the documentation how you can get support from most Devils here and I'll give you some ideas if you don't know what you're hacking yet so in general like why should you build on near well it's fast we have like two three second finality uh with like 1 second block generation time and it's sharded by Design so it's horizontally scalable theoretically it's infinitely scalable but we'll see if that is actually the case in the future and it's very cheap we don't have any rollups we don't need any rollups because an average transaction is like less than a Cent and a couple cents for storage and it's pretty uh de friendly which makes it pretty user friendly in the end of the day because we have things like named accounts unique unique access key system uh builtin account abstraction things like meta transactions and we have the ability to sign transactions on other chains with chain signatures which we will look at so first things first the account model we have two types of accounts um well two types of account names the first one is your standard 64 characters of mumbo jumbo that you can never remember and you just have like uh in your clipboard but we also have named accounts I'm py vortex. n um and this is like a really nice way to just remember accounts and to organize your application so for example you can have an app which is like app. n and then you could have the token fall under the same name so like token. app. n and it's really easy to deploy like new accounts we call them sub accounts um from within a contract so for example you can have this like app.

n and then you can create accounts for your users so I might create like py vortex. app. n and within in that account I can like aird Drop you some tokens when your account is created or because as you can see accounts are smart contracts they're the same thing um on there we don't have like external owned account or whatever you call it and like contract accounts um we just have accounts and they're contracts and they're the same thing so basically you can deploy accounts and deploy contracts to them from another contract um um which we call like Factory contracts right and my favorite thing about n is its access key model and this is really undervalued and not utilized so much so if you can build something with access keys of this hackathon I would applaud you because I would love to see it so we have our standard like full access key key PA this is what you think about in ethereum you just have your your one key and your phrase and this gives you full access over your account send transactions um send like view your B well you don't need a key to view your balance but do whatever with your account and on there you can like swap in and out your keys so if you were to say expose your private key or seed phrase if I just put it up on the screen here if I was quick enough I could rotate my key so you if you were to use it it wouldn't do anything anymore um and that's like the power of nears account model and also even more interestingly we have limited access Keys which don't give you full access over account and they allow you to do certain things and sign certain methods on certain contracts and with these Keys you're actually supposed to give them to people or give them to applications which seems a bit of a of a weird concept but let's look at what that means here's sort of the meme you know like the future of gaming on web 3 you want to shoot a bullet well you got to sign in your wallet right well that's not the case with n the idea is that you give this application your access key and it will sign these transactions for you so you don't have to go into your metamask and click sign to shoot a bullet it will just do it and another cool use case is for example say I was uh I had an account that was for social media and I had like an intern I don't want to let that intern delete my social media account or change uh like my bio or something but I want them to make posts and like like or the post so I can give them a function called access key to just post and not edit any of that other stuff and I don't put my funds at risk um to that intern to do stuff and we said that limited access keys can only sign transactions for certain methods on certain contracts but contracts can do everything that an account can do so you can have a method that say creates another account or adds a key or sends funds so I could have a key that allows one to create an account and send fungible tokens to that account so you can really do a lot with these access Keys Next Up meta transactions you may have heard this before but the idea is that you pay for your users's gas for your application and with near it's not some like third party service we actually have this built in at the protocol level so if Anna or anna. n wants to send a transaction what they do is they they sign it um client side and then they W wrap it in like a a meta transaction and send that no they don't do that yet they send it to a relayer first who wraps it in a meta transaction who then signs this this larger transaction that the inner transaction is wrapped in and then they relay it to the network and the network says hey this is a meta transaction let's remove that bigger transaction and look at what's inside um and then it executes that transaction as if it was sent by the user but in the middle of that the relayer paid for their gas and paid for the deposit so this is a really good way to like onboard people to your application because with web 3 you've got to go through like onboarding you got to on ramp you got to sign up for ayc for coinbase or whatever and move some funds move like ethereum onto your account to actually be able to interact and pay for gas but what you could do is just like airdrop someone with aird drop someone an account and just have them sign transactions without funds um or you can have it so they just interact with stables and you don't have to touch like the near token at all and I did say my favorite thing was access key model but chain signatures is my probably my second favorite it's really quite cool so this is the idea that near accounts can control accounts on like nearly every other chain basically a n account is not just a n account anymore it's a multi-chain account and basically you derive new accounts like foreign accounts I like to call them from your n account account and this comes from your account name and like a derivation path you provide it so this could be like you know you know on like a hardware wallet or just any other wallet you have this like derivation path where it's like zero d slash Su numbers that's basically the idea so you can have like thousands of different accounts I think millions of different accounts um just derived from your n account and you can sign transactions for these derived accounts on these different blockchains so I who owns a near account can sign transactions for ethereum via the uh multiparty computation Network which is pretty damn cool to be honest uh so how does this actually work let's work through the flow Anna again she's back she wants to sign a transaction on ethereum so she uh ask the NPC contract to sign this transaction for her and when that happens the NPC contract makes a request to the MPC service which is built up of like I think it's like eight nodes at the moment and that signs the transaction returns that signature back to the NPC contract which then in turn sends it back to Anna and then Anna or a relayer captures that transaction and the signature puts them together and sends it uh to the Target blockchain and that can be whatever you want it to be like Bitcoin or polygon or main net etherum oh I have some QR codes here by the way and these just sort of link to the relevant sections of the documentation if you want to peep them out uh and yeah so the steps to this there's five main steps the first is to derive the address so you pass the uh MPC contract the path uh that you want to use to derive the address so you might have some like path standards to derive them so everyone's using like the same account um so you derive that address you then create the transaction you say what action do I want to do I want to send ethereum from this account to that account or I want to call a transaction uh call a contract on ethereum and then you take that transaction create a payload from that transaction and request a signature from the NPC Network and like I said you you get that back reconstruct the signature and then the last step is is relaying the transaction video will this video load this is just a yeah so this is how it works in like a frontend app so you log in with your near account um this is the derivation path I'm putting in now we'll just call it ethereum it gives you an address we'll send some funds to that address from like a metamask wallet uh this is on sepolia by the way wait for that to go through and you can see we're sending it to an address here uh we can see we have balance now as we would expect and we're going to send .01 e to that account so we request the signature we got the signature and then we relay that and we should yeah there we get a transaction link for that which we can check was successful and that was all from just like having a near account and not having like a private key for an ethereum account um I don't want to play that again so we talked about like three things here right the account model meta transactions and chain signatures and if we bring these Concepts together we end up with chain abstraction which is the idea of interacting with any blockchain interacting with web 3 as a whole and not knowing or really caring uh from a user's perspective of what actual chain you're using um so the idea is to like benefit the user experience through chain abstraction and some things to to think about is that remember that smart contracts are accounts and accounts are smart contracts so contracts themselves can actually call the MPC Network which allows contracts to control accounts on other chains um so this allows you to embed logic like smart contract Logic on to near for other chains so all chains can now inherit the good things about near Maybe you like ethereum fine go ahead I don't care build on ethereum I love ethereum too but why not also have near account model so I can now turn an ethereum count I can now call that py vortex.

near because it's derived from my account and I can also inherit near finality so I don't know how long does a Bitcoin transaction take uh to like be confirmed a while but if I make that swap by uh swapping like a near account for a smart contract I can now inherit n's uh finality of 3 seconds and inherit its gas price of like a couple cents or less than a cent so what can you actually do with this like here's some ideas so the one you think of first um and maybe yeah maybe the most obvious but also like the coolest is swapping assets from different chains so I could swap Bitcoin like native Bitcoin for say usdc on arbitrum um with near finality and gas price or you can create link drops on foreign chain so I air drop you an account with ethereum and or and all and some more usdc on arbitrum you can also one thing I would love to see implemented at this hackathon is oh no you can't see it well we can show my screen I'll just stand like this for the whole thing if you can see it this one here cheap multi I would love to see someone implement this the idea is that you uh you can deploy an multisig on ethereum by just uh like deploying the logic on near is it back lovely so you deploy the logic for a multi oh no we'll give up with the screen uh you can deploy a multisig on near but have it act on ethereum Main net which allows you to deploy a multisig for like cents and you can have like an account with social recovery via implementing it on there um I can see it back so yeah this is something I'd love to see you can also do things like def on bitcoin or inte I don't think this is a word but integration services that available everywhere so you could have some like ZK proof verified on near where it's cheap and then broadcast it to whatever chain you want or things like prize feeds um and you may have heard that near is the AI chain so we've gone back to our AI routs I don't know if you know Elia I don't know know how to pronounce his last name Elin well he is like gigabrain um Google AI who founded near co-founded near well we're going back to his Ai routs and building an ecosystem of uh AI through like data and um like AI agents so how does AI actually come into there well it's less in terms of infrastructure and more about building an ecosystem of where AI can live its best life so if you're building an AI agent why not build it on near because you're not just building it on near you're building it for every chain because this AI agent can now transact on ethereum on Cosmos on arbitrum on polygon just because you buil it on there and things like the named account model really brings like life to these agents so you can can give it better identity and have this this AI agent that has its own name its own account to transact across these multiple chains um and and try to think like how can a smart contract make decisions via AI so on near contracts can yield and resume so what that means is you can have a contract that calls uh like an AI model and waits for it it response and then executes um on the contract and changes its state based upon that result from the model and one thing we're we're quite bullish on is the open sourcing and verification of models so when you're creating um like a response from a GPT you don't necessarily know that its response is a pure function of its inputs and the model that was stated well if you open source this through blockchain you can try to verify that it was a it was a pure function of what you imported um because some of these models might be suggesting for you to vote for one political party rather than another without you knowing uh and and and how can you make like you need to think how can you make blockchain easier to interact with by using AI um so what can you build with these thoughts one thing that is really Dej and is been built on there was Shield GPT and basically what it is is a treasury on near that just has a load of money a load of meme coins and it will buy and sell mem coins based upon how well you shill it a new meme coin and this is controlled by an AI model so you go to this model you go to this smart contract and you say hey I want you to buy more black dragon or more Nico which are mean coins on there and if you convince it well enough the model then it will buy more of those tokens um and if you scan that QR code you'll see how like a smart contract actually uses um gbt um something else that would be cool to implement is like an a Ai indexer and you can just generate an indexer by saying hey make me an indexer for this smart contract that does bets for uh this specific account um and bid amount and also another idea could be like like I say trying to interact with blockchain in a more user friendly way you can navigate that through natural language so I can say hey show me the top 10 nfts by price on there or get it to complete the transaction for you like to swap 10 usdc for some Bitcoin or for some ethereum and yeah AI agents um with a name accounts that can interact with a blockchains uh so I saw that there was this game that had like agents that sort of live in this blockchain game and they just go about transacting by themselves um this would be a really cool idea to implement on in your game and finally an idea I had was I'm a pretty bad developer so I make mistakes all the time but if I could have your have chat GP to search your code for errors but it's not very well trained on on near or eum specifically if you could build a b that checks for like uh near specific erors that would be like so helpful for so many people and I would thank you personally um there are all my ideas um if you have any other ideas I'd love to see them and love to see them implemented and I would love to help you implement them so where can you get support we have our docs the docks are pretty good I've offered some of the pages on there um and come see us we have a booth we would love to help you like I said um and we're going to be here till like I don't know 10 p.m. or something but when we're not here we have a telegram we have colleagues all over the world people in America people in England like myself um people in Asia so people are willing and happy to help you if you have any questions if you're hacking till like 4 a.m. in the morning but please get some sleep people uh I think I'm I think I'm done there but if anyone has any questions I'm I'm happy to take some outside and happy hacking let's get this bread thank you [Music]

Automatic transcript — names and jargon may be misspelled.