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

Loading player…

Klaytn 🛠 Building on Klaytn - Toniya Sundaram

ETHGlobalMon, Oct 9, 2023, 12:00 AM

Join Toniya Sundaram from Klaytn for a workshop titled "Building on Klaytn." Thank you to everyone who joined us for ETHBogotá 🇨🇴 and helped us kick off Devcon Week. With over 1400 attendees from 62 different countries, ETHBogotá was our biggest hackathon in Latin America ever! ----------------------------------------- Follow us: https://twitter.com/ETHGlobal​ Check us out: https://ethglobal.co​m Email us at: hello@ethglobal.com #ethereum #web3 #blockchain #eth

Transcript

foreign [Applause] [Music] it's really exciting to see so many Builders who has arrived before the main event you know to build something cool so thanks for making it a bit introduction about myself my name is Tonya working as a senior blockchain engineer at Clayton so I am part of the ecosystem team so mainly building the peripherals of the ecosystem like Bridges wallets and explorers and sdks and libraries so today uh I'll be talking about what is Clayton and and what is Clayton architecture and how does it look at like as a protocol and I'll also show the tech stack and some tools which we have in the ecosystem and a quick demo on one of the feature on Clayton and also at the end of the session I'll provide all the resources which would be helpful for you to build for the hackathon so since we are a ecosystem we have many products running on the ecosystem so if we are looking for a workshop 30 minutes won't be enough so I'm going to provide you all the tools which we have and what all you can build on the ecosystem so it should be helpful for the hackathon so um what is Clayton so Clayton is a evm based code base mainly folk from go ethereum before four years so since then it has been highly modified and streamlined in uh in the evm layer and the execution layer and the protocol layer storage layer and the gossip layer um so Clayton is a service Centric hybrid architecture more like a POA or permissioned validator set in terms of generating blocks and validating blocks so Clayton has a main net which is a layer 1 mainnet and also a layer 2 service chain so service chain solution is also a blockchain where you can have independent validator set for generating blocks and validating blocks it's mainly for scalability and we have actually we have achieved some interoperability between the layer 2 side chain and the layer 1 Main chain as well in the protocol level and in this part contract level and Clayton has one second block generation and instant finality which means a block is consensed upon and generated every one second which is quite fast so here we are mainly concerned about the data consistency over data availability if you're familiar with the cap theorem which is uh you know in the Left End which is the picture which says about the cap theorem and since uh this uh we are concerned about the data consistency it is mainly useful for use cases like bridging you know to Port your sets and Clayton has a two second round trip transaction latency so this is quite fast and we did some tests in the mainnet and here are some metrics and this is the statistics compared to the other Leon blockchains and it has a two second um you know response time and the average transaction latency is very low so what is a round-trip uh transaction latency so the round trip meaning uh the time which you submit the transaction to the blockchain and it gets processed it gets validated and added to the block and gets propagated to the entire network and it comes back to you as a finalized transaction the receipt which you receive so the entire uh transaction cycle it only takes two seconds which is quite fast and competitive in the uh industry right now and this is really helpful in building use cases like matawas applications and gaming applications which requires very low transaction latency and you can also build D5 applications uh and Arbitrage Etc and Clayton can process 4000 transactions per a second so this is also based on the real world statistics in the mainnet and not in the test net so it can do a send transaction and it can achieve 4000 transactions per second and for the other uh smart contract uh transactions based on the functions it might add some overhead so it might vary however we were able to achieve 2500 to 2800 transactions per second in the mainnet for the smart contract execution as well and um like I said we have a service Centric hybrid architecture so we have this governance Council which we call as the validator uh set so we have some reputable node operators in the mobile data set like binance net marble and make a Dao and uh like I said we have the service chain and which is the side chain which is for scalability and you can interrupt with the main chain so next we'll see uh how does the Clayton architecture looks like as a protocol so since the beginning we have been on POS for um block selection and particularly ibft for consensus uh this is Istanbul by sentence for tolerance and this uh is mainly helpful for us to have one second you know block generation and instant finality and we have a three node Mo a model architecture uh we have a consensus layer which is the core node and we have um proxy uh proxy node which is around the consensus layer we also have the endpoint uh node so you might ask why it would matter for any user right but in other blockchain protocols if you see uh no matter what job you do you'll be running the entire code um core node architecture but in Clayton it's little different So based on your job if you are a validator you can just run the core node and the proxy node and if you are a endpoint node provider service provider like API service provider you just have to run the endpoint node so the code node is the consensus layer where the consensus mechanism takes place and the way you generate the blocks and everything and the proxy node is like the Sentry note like a gatekeeper which protects the core node from resource exhaustion and from the wild internet and this proxy node also helps the code node to generate the blocks in timely manner and uh lastly the endpoint node is the gossipers of the network um so this is the this exposes the RPC endpoints so if you are a developer and if you are interacting with the Clayton blockchain you're more likely to interact with anyone of the endpoint node so you can submit transaction to through the endpoint node and you can also you know retrieve the data through this endpoint node and we do first and first out transaction ordering from the event pool and we also have Clayton specific pre-compiled contracts starting from 0x3 FF and it goes down like f e f d and so on and we also support ethereum pre-compile contracts so now we can see the unique features which Clayton has to offer when compared to the other blockchain so we have our external account model meaning we have multiple key pairs uh connected to a one on a single on-chain account so what's the difference is if you take in other blockchains you have a private key and a public key and address derived from this uh public key so you have a single uh keeper attached to the on-chain account but here we provide the option of having multiple keypad attached to a single on-chain account meaning it is updatable if at all if you want to update the uh one single keypad the private keys can also be updated and it can be removed and it can be added so we have this option to have and maintain multiple key pairs so this gives us the ability to Native multisig um you know multistig support but in other layers you have to do the SMART contract level multi-signature you know and it also gives us the option to do role-based access control with multiple keypads for example let's say you can have one keypad to just update the permissions uh or to add or remove the keeper and you can have one keeper just to execute smart contracts and one keypad to you know deploy uh smart contracts so this is quite helpful because everything is on chain you don't have to write a separate layer of smart contract and we have support for multi-forma transaction model like a separate transaction model for uh execution and deployment and also anchoring transactions for the site chain and uh the best feature is uh the fee delegation which is on chain where you can delegate the fee to a different person so if you're developing a d app and if you don't want the users to pay themselves for the transaction it can be delegated to a different person so um if you take the other networks they achieve this feed allegation using a relayer network so what they do is they write their logic in the smart contract and you know do some crypto signing magic and send to the network and the relayer network will pay the fee so it is like a huge complex process but in Clayton everything is done on chain so if you want to do a feed allocation so you can just sign the transaction and send to the fee pair the fee pair will in turn sign the deployed transaction and execute the transaction and pay the fee for it I'll show a demo on this at the end of my session so yeah so we have this on chain feed allegation without um you know having this complex layer net related Network and we also have cross chain checkpointing and another interesting feature is the dynamic and the deterministic gas model so here uh based on the network condition and the transaction rate the price might go up and down by five percent uh but in a single block uh every transaction will pay the same fee so we want to be deterministic and as low as possible it's similar to the um base fee of ethereum but in other network you have the option for tipping and you can tip for the transaction and prioritize the transaction and you can skip the queue but because of this the price is very volatile but in Clayton we do not have that tipping model because we wanted to keep it as low as possible and deterministic however the range is between 25 to 750 Stone so stone is something similar to gray so you can see it's very less so for simple transaction like send transaction you can you just have to do like 25 and for complex transaction uh it won't go more than 750. so so for this is a very useful feature for the Dr developers you can predetermine uh how much gas you will be using for a particular transaction so yeah so now we look at the tech stack of the Clayton so the top layer is the the app solution where you can build uh any applications you want D5 nft or gaming on metaverse and the next is the dev environment here we can use all the sdks and the libraries which you will like we also support ethereum Dev tools on Clayton and the next part is the blockchain core which has two interface if you see so one is the ethereum equivalent interface and the other one is the Clayton specific interface so why we have two different interfaces is that in addition to the Clayton specific features like we saw before we also support the ethereum equivalent or ethereum formatted transactions so for example let's say you're using e dot get balance or E DOT sign in ethereum network you can use the same exact methods in Creative Network as well and you can use the same tools and same sdks like web3.js and you just have to change the rpz endpoints um so yeah it's very easy for a d app developer who is building on ethereum to port to Clayton and for using the Clayton specific features like um on-chain multisig or feed delegation or role based access so you can use the clay namespace which is the interface for the you know create and specific features and for this you have to use a keva.js SDK which is very similar to the web 3.js so yeah so we have uh we support a multiple interface as well to communicate with the glitter Network um and yeah we have a pre-compass contracts for Cliff Network and we have a governance model with um um different rewarding mechanism and economics and below that we have the consensus layer and storage Network so yeah here are the tools which you can be using for uh developing your d-app during the hackathon so as a protocol we don't want to be opinionated on what tools you should be using or what services you should be using so we tend uh we wanted to provide all the services and multiple options for you to build on Clayton so um yeah so we have a few of the tools which you can use for the hackathon today so the first part the wallet we have a clip kaikas decent and Clinton safe which is a multisig wallet on Clayton so here if you see all the green boxes has Clayton support and the ones in the green and blue has both Clayton and ethereum support we also support you can also use metamask on uh you know on the D apps which you interact with Clayton and uh yeah these uh ones in the orange we are developing and the team is working hard to release it in Q4 so it will be available soon so the open source tools we have a subgraph surface subgraph service this is like an index solution similar to the graph so you can use the sub graph to fetch the data very efficiently and this is free so you can build some interesting dashboards on Clayton as part of the sackathon using this subgraph surface and we also have Dev sandbox so this has all the boilerplate code for you to uh build something uh you know build something interesting so the thing is we have the boilerplate code to import all the contract library and Deploy on Clayton Network and we have also the front and boilerplate code which can connect to the metamask wallet or the in-house skycast wallet and we also have some boilerplate code to use the keyword SDK and web3 SDK so you don't have to build everything from the scratch you can just use the existing ones and you can just have to think of some good use case for this hackathon so when we have contract library and open source decks and we also have ipfs in-house integrated in Q4 and we have sdks like I said cable web3 and web3 unity for gaming especially and we have explorers similar to etherscan Clinton scope and Clinton finder and we are also having a open source block Explorer so the good thing is you can download the code and if you want to propose a new feature you can add it and get some bounties or if you want you can have you can also build your own feature and run it on your own networks it's fully open source so this is a cool thing and we have oracles we have integrated with chain link and with net so even using the Oracle uh Services you can build on the Creator Network and we have workshops and demos on this Oracle service in our repositories you know we had some workshops for all these how to use this on slate Network because that might take a long time right so 30 minutes is not enough to give a workshop on how to install and how to integrate with Clayton so I'm just going to show all the tools available so that you can just go to the GitHub repository and just see the steps it's very straightforward if you're a developer you can just install and start integrating and yeah we also have RPC API providers so you can find out some public RPC endpoints to interact with the Clayton Network and yeah we have also Bridges so our goal is to provide the best building experience for the devs so we tend to make all the tools as open source like wallets and bridges and sdks uh so if you're if you I mean if you want to build a wallet but since all the wallets are already in place so you can just take the code and if you can think of a new feature which can be integrated with the wallet like play to earn with wallet or anything interesting so you can just use the code and you can integrate that feature and you know and use it for your own so yeah and this one and like I said we have high performing mainnet so you can build uh applications which require low transaction latency and it can be easily interrupted with other networks because we have a support for bridge and um and uh Texas and the last is the community support uh we provide kgf and KR funds so if you have a very interesting use case so we are also ready to support through funds and um um if you have some Bounty programs as well so you can contribute to the ecosystem and yeah so you know now what is Clayton and how it looks like and how you can make use of the tools to build but still if you have some questions on why Clinton I have so many other networks right so for this I'll give a very simple example so let's take all the messaging applications so messaging is the same but you have so many different applications for just the messaging right messaging protocol but why do we have it because every messaging application has something unique to offer for you right and also based on the region it has user adoption different user adoption for example WeChat it's heavily adopted in China China region and if you take cacao talk it's uh adopted in South Korea so it has a very huge user adoption as well as some unique thing to offer similarly Clayton also has some unique things to offer and also it has a huge user adoption in Korean region so first we have better usability through this transaction latency and its stability and this on chain feed allegation this is something interesting or something unique which you can build some interesting use case and we are evm equivalent meaning you can develop a d app and run it on ethereum network and without much changes just by changing the rpz endpoint you can deploy in Clinton as well and regarding user adoption since um Clayton is well established in the South Korean market so if you're developing an app it can you can have more users you know it's very obvious and we have a in-house wallet so this is the first wallet which is integrated with messaging applications called cacao talk so which has 50 million users already this is a custodial wallet so even non-crypto users can be onboarded very easily and they can start using your application whichever you're building and we also have a huge gaming company like net marble and vmix running on our side chains which is the service chain so yeah these are some reasons which you can you know build and run on Clayton so now uh using our uh one of the feature you know the feed delegation let me show a quick demo so I'm going to make this make a use case like having a gasless transaction on Clayton meaning if a user wants to deploy a contract I'm just taking this example for today but you can have uh any example you want or any use case you want to implement or to take advantage of free delegation so so in this example what I'll do is a user wants to deploy a contract but he doesn't have to pay for the transaction so I'm just starting the application and I'm just loading this oops oh my gosh so yeah actually I have to connect to the wallet which I forgot so I'm this is the kaikas wallet which I mentioned so I connected to the wallet so now we have a UI and here in the kika's wallet what I want to show is I have a user and it has zero balance but I'm going to deploy a smart contract you uh with this user so this is a sample ABI and bytecode and you can have any smart contract and any use case using the speed allocation so I have just used this because I want to show that you can do a transaction without paying a fee so now when a user initiates this transaction you know he doesn't want to pay for the transaction so you can just sign it so here you can see it's zero clay and now you got the signature now I am deploying this contract so this signature goes to the back end and the deployer who is the fee payer he will sign the transaction and he'll uh deploy the transaction so in the code uh so you can just see the fee pair I have um added in the EnV variable so this is the transaction which we signed from the front end and here we are signing as a fee pair and then sending uh the executing this transaction um through the fee pair so it's just like few lines of code we were able to do a free delegation meaning uh execute a transaction from a account which doesn't have balance at all so if you look at the code I mean here we have the code for that so yeah some front and boilerplate code and some backend code on how to use the cable SDK and how to connect to the Creator Network so you can just use this piece of code and also give the resources to all these tools so so next as part of the sackathon you can build any of these use cases like uh we are mainly focusing on the metaverse and gaming applications because we have very low transaction latency so which is good for that kind of applications but still you can build any applications like gamify governance or defy nft use case but today's problem statement is uh you can build an implementation for any one of the following in the Clayton ecosystem like you can build any tool for the core protocol and you can build any tool for the ecosystem using the subgraph service or any of the tools which I showed before and you can also have a Dao or defy or nft use case and you can also build some interactive applications using a load trans load transaction latency because this is very much you know useful for interactive applications and it shows the advantage of using this great Network and you can also build any mobile Centric applications so we would expect you to build on the Clayton infrastructure uh be it mainnet or testnet or local Clayton node or the service chain so now you might be thinking what you can build and what resources you might need in order to build and Achieve what you want right so here I have given us a very simple picture for a d app developer if you are a Dr developer and if you want to build on Clayton here are the resources so the front end you can have it in react or next year's or anything you like it can be a web application or mobile mobile application and it can have any of the wallet interaction like matamask or kaikas or website connect so we have boilerplate code for all these to connect from the front end and we also provide this public API endpoints so you just need the wallet and you didn't need a front end and for the back end you can use any of the sdks like web3 SDK or cable SDK and this in turn will deploy the transactions in the blockchain so for all these uh you know tools we have the boilerplate code ready in our GitHub repositories so you just have to think of some interesting use case and use this to build so if you want to build something other than the app you can just scan this QR code which will lead to the GitHub repository of all the resources and we also have Clayton developer Hub website where you can look for the resources and yeah we have some attractive price amount and also all these price I mean all these winners will also get a biometric wallet you know Hardware wallet and uh I'll also show the GitHub repository this is too big I can just yeah so here if you see um we have some sample apps and examples for you to uh you know take uh take it and build something on top of it and we also have some starter kits and um so these are the API service and the public RPC endpoints which which you can use to interact with and the sdks which I mentioned and the wallet code so for all these if you click on the specific repositories you have the sample code and you can also integrate with oracles even for oracles we have a separate a workshop in one of these links you can just check it out so so yeah that's it thank you [Applause]

Automatic transcript — names and jargon may be misspelled.