Shardeum 🛠Intro to Shardeum
ETHGlobal·Mon, Oct 9, 2023, 12:00 AM
Join Greg Hemmer and Marcus Wentz from Shardeum for a workshop titled "Intro the Shardeum". ETHIndia is a hackathon — a movement with the goal of inspiring and fostering a community of builders promoting technological advancements for Ethereum. It’s a place where the leading minds in the Ethereum ecosystem are uniting with 1500+ builders from around the globe to build decentralized applications for the future. And we invite you to be one of them. Help us build a garden where everyone is self-sovereign, where everyone is an owner, where hierarchies don’t exist. ----------------- Follow us: https://twitter.com/ETHGlobal​ Check us out: https://ethglobal.co​m Email us at: hello@ethglobal.com
Transcript
foreign [Applause] [Music] welcome to chardium's workshop for eth India my name is Greg hemmer I'm the head of ecosystem at chardium an evm based layer one that scales linearly using Dynamic stage charting at chardium we've noticed a challenge that existing blockchains don't scale you have this upside down J curve where at first blockchains have a great user experience they have low transaction fees that get processed quickly but as these blockchains grow in popularity they reach their scalability bottlenecks where they have more transactions being submitted to the network per second than the network can process resulting in a queue of transactions that build up where users bid on gas fees to prioritize their transaction first resulting in Rising transaction fees and our co-founder nishal Shetty founded chardium as a result of experiencing this challenge firsthand while operating his exchange with 0x where he noticed that users weren't withdrawing crypto like Bitcoin and ethereum to the blockchain because transaction fees are too high and so if we want to live in a world where decentralized applications go mainstream we need to have blockchains that can scale linear to keep transaction fees low while remaining decentralized no matter how many transactions there are that's exactly what shardium is building an evm-based layer 1 that scales linearly using Dynamic state sharding Dynamic State charting is an architecture that shards the compute Network and state where each validator is assigned to a unique range of address space while retaining atomic composability this enables TPS per validator where shardium is the first blockchain in the world to increase its TPS relative to the number of validators in the network just like mainstream web 2 applications when you need more scale you add more servers the same goes for shardium when you need more TPS you add more validators shardium retains decentralization using lightweight consensus mechanisms we used proof of stake in proof of Quorum which translates to low Hardware requirements to operate a validator node it'll only ever cost 50 to 100 a month to rent a dedicated server to operate a shardy invalidator and so because of these low cost is a high number of people in the world that can afford to operate a validator on chardium enabling true decentralization is also a fully permissionless Network where no permission is needed to run a validator anyone who wants to run a validator and has the required stake and the hardware needed can operate a validator on chardium sardium is highly secure in part due to a feature called node rotation where every 60 seconds some of the validator nodes waiting on standby in the shardium network join the network and replace a portion of validator nodes that are active in the shardium network and so every 60 seconds you get this swapping process that happens where some of the validators go to standby and some of the standby replace those validators but no standby node can choose when it is added to the network or which Shard it's added to and this allows for true decentralization and high security in contrast of a dynamic State sharded Network like shardium when we look at an Uncharted blockchain every validator in the network does the same work each validator is responsible for processing all of the addresses transactions in the network and storing all of the transaction history data and so when you add more validators to an Uncharted blockchain we recognize that you only get more decentralization and redundancy but it's our belief that eventually you have too much redundancy and what you really want is parallel processing so you can continue to scale and increase TPS preventing congestion and so if you look at the most popular way blockchains that are unsharted scale today they scale vertically where when they get congested they use more powerful nodes to increase their throughput capacity by using more powerful nodes you're increasing the cost of the hardware needed to run a validator node resulting in centralization because less and less people over time can afford this Hardware to operate a node also scaling vertically isn't really true scaling it just makes the blockchain faster because it just incrementally delays the time it takes to run into your scalability bottlenecks that you're hitting previously for example when executing transactions this happens at the CPU of a node and if the blockchain is getting congested and right reaching you know nodes are hitting their CPU capacity you can scale vertically and use more powerful computers with a more powerful CPU to execute these transactions faster but as the demand of the network continues to grow you're going to hit that CPU capacity bottleneck again and so vertical scaling doesn't really mitigate the scalability bottlenecks that blockchains face to mitigate these bottlenecks we need to Shard the blockchain and scale horizontally this is the way that all web 2 distributed systems scale and this is how web3 distributed systems or blockchains will scale as well using sharding and so with shardium we've built the most advanced sharded architecture that's been built in web3 today where as I've mentioned each validator covers a unique range of addresses and only needs to execute the transactions for the addresses it's assigned to and store the state for the those addresses and so here in this oversimplified diagram you can see rather than every validator doing all of the work you can complete work in parallel and you may also notice that some of the validators while they each have a unique range of addresses that they're assigned to some validators also cover the same address and so with shardium each validator covers a unique range of address space while having a lot of overlap and this overlap results in every address has having the required redundancy of 128 validators in addition to the benefit of linear scaling shardium is also the first blockchain in the world to build Auto scaling where here we have a simplified diagram of a shardium blockchain each black circle represents an active validator and the white circles represent a standby validator node this sharded shardium blockchain is currently processing 750 TPS and using the auto scaling feature every 60 seconds chartium measures its load and comes to consensus on the required number of validators needed to process the current load so as this sharded shardium blockchain grows in popularity and applications acquire more users who are submitting more transactions it's realizing that its load is approaching network capacity and it comes to consensus on the fact that it needs to add more validators to process the current load so it autonomously adds nodes from standby and activates them into an active validator State resulting in an increase in throughput capacity to 1000 TPS this is a simplified diagram of how sardium works and why shardium developers in our community are so excited about what we're building because for the first time you have a blockchain that can increase or decrease its TPS autonomously relative to the load of the network you might be thinking why would any blockchain ever want to remove validators and decrease its TPS well chardian prioritizes efficiency it never wants to pay more node rewards than necessary to process the current load so you know if a Black Swan event happens or issues like some of the recent issues in web3 occur and we go into a bear market and load on the shardium network reduces it doesn't want to pay say a hundred thousand nodes for example if it only needs to process 20tp yes and so it'll remove validators to the minimum number of validators needed to process the current demand so it only needs to pay minimum node rewards at all time one thing we're really excited about that we wanted to ensure could occur is that you have the same developer experience as building on an Uncharted blockchain where you have Atomic composability with all contracts on the network while also getting the benefit of linear scaling so I'm really excited to say shardium has Atomic composability in a sharded Network this means you can have things like defy where you have an amm with a router contract and different token pair contracts that are sharded where these contracts live on different shards and nodes across the network but those nodes can still retain Atomic composability and execute the transaction in in one transaction where the contracts can have composability with each other and all other contracts on the network as a developer you no longer need to worry about which Shard you deploy to and worry about only having composability with the other applications on your Shard with shardium you just need to deploy your contract and you immediately have you know composability with all contracts on the network so an example a journey of a transaction in chardium is a user submits a transaction through a front end with their wallet the front end injects eip2930 which is an access list of all the addresses involved in a transaction that transaction hits the chardium RPC which forwards the transaction to the network and no matter where which validator that transaction hits in shardium every validator in chardium knows the addresses that all other validators in the network are assigned to and it also notice knows the addresses involved in the transaction thanks to the access list under eip2930 therefore the validator can route that transaction immediately to the validators assigned to the addresses in that transaction and those validators come together and form a consensus group where only the validators covering the addresses in that transaction vote on whether the transaction is accepted or rejected and come to a majority agreement or proof of Quorum where they form a receipt showing there's more than 50 percent of agreement on accepting or rejecting that transaction this allows chardium to retain Atomic composability in one transaction where you can call numerous contracts on different charts simultaneously and come to consensus on the output of these contracts in one transaction some other reasons why developers are gravitating the shardium is because shardium has a focus on delivering users to Applications Foundation would like the shardium network to be the first blockchain in the world where applications go mainstream and acquire billions of users thanks to our linear scaling and dynamic State sharding architecture today we have over 300 000 users on our test net and applications building on our testnet have been acquiring around 10 to 20 000 users on average within one to two weeks which is really exciting is also the first evm based layer one that's native to India being built by the community in India from the test snap phase every other layer one has been built outside of India and then tries to enter India at chardium we believe that India is the most important Market in web3 and is going to build more unicorns in web3 than any other country and so everyone in India is really excited to play a role in building chardium and we're here to support you our co-founder nishal Shetty is the founder and of wizir X India's largest exchange and nishal is also one of the top influencers in the web3 ecosystem as you likely know nishal has fought for positive regulation in India for example India went through a banking ban and nishal tweeted out hashtag India wants crypto for a thousand days in a row which helped motivate the government to end the banking ban Nichelle frequently has helped to educate and grow the web3 community in India and he's here today to support those of you who continue to build on chardium following this hackathon our co-founder Omar Syed has 30 years of experience building scalable distributed systems and is one of the most talented distributed systems and engineers in the U.S his second job in his career was at Nasa where in 1996 NASA took the first pictures of Mars posted them on their website became the most popular website in the world for a period of time and Omar was one of the webmasters that had to scale NASA's website and their servers to handle that traffic and so from the earliest days of the internet Omar has been focused on scalability this led to him being hired by Yahoo as their principal architect to re-architect the application they bought from Mark Cuban it was a video streaming application that started crashing in 2006 when the U.S upgraded to broadband internet Omar re-architected that application and Yahoo is granted four patents on the system Omar design for them he's been working on the architecture for chardis and shardium since 2016 and is here to support you today if you have any questions about scalability in web 3 distributed systems or just generally want to talk about what you're building and get his guidance on the technology side of things is one of the fastest growing layer one communities in India and is the most active web 3 Meetup organizer in India today we host eight to ten meetups per month in India across all major cities and some of the less populated cities as well we've had over 1600 attendees visit our meetups in the past two and a half months and over three thousand people register for them we're really excited that these are continuing to grow every month and we're focused on scaling to 50 to 100 meetups per month across the world we would love for you to continue building on shardium and help you create awareness for what you're building in our community we'll invite you to attend all of our meetups which you can see pictures of here you can present what you're building to the community there get feedback on what you're building build Partnerships and become a leading application in the chardium ecosystem here you can see pictures of 16 meetups we've posted over the past few months and we're really really excited to watch this community continue to scale so far this year in just a few months chardium has made great progress we've raced an 18 million dollar seed round we're building really fast we have two test Nets live today our third test net will go live in December this quarter we have 96 000 followers on Twitter who we can help insure is aware of the products you're building on shardium we have over 109 000 followers or members of our Discord Channel we can work with you on things like amas and promotions on Discord to help create awareness for what you're building and help you acquire thousands of users speaking of users we have over 304 000 users on our test net today and we're just getting started we're only in the test net phase this community growth has been all organic we have around 9 600 contracts deployed at the time of this presentation on chardium and we're excited to continue to scale this is just the beginning thank you so much for listening to our presentation during the hackathon today to get started building on shardium please visit our developer docs at docs.chartium.org and with that I'd like to introduce Marcus Wentz who will take you through the shardium demo hi everyone my name is Marcus Wentz I'll be showing you how to connect to shortium so there's a few different ways to connect shorty I'm using metamask which I have installed over here we have my mask installed here are the RPC endpoint details that we would need to add this is one way to do it to get here you'd have to go to the browser extension hit add Network this window will pop up and then you can add a network manually to add custom networks and all the information that you need is here so you would just fill all this information here and then hit save and then it would be recorded into metamask so this is useful for devnets and we recommend you use Liberty 2.
0 because it's shorted so let's try out Liberty 2.0 we have 1.6 and 2.0 on channelists.org 1.
6 is not shorted 2.0 is shorted but you'll need an access to this but we'll get to that later let's just double check that we have Liberty 2.0 installed awesome we have Liberty 2.0 installed as we could see here so now that we're connected to shortium now we need shm tokens to pay for gas so there's two ways to do this we could either use a faucet website that we have here or we could use a Discord faucet for this Workshop we're going to be using the faucet website so to use this we'd have to make a tweet I've copied the Tweet to my clipboard and now all I need to do is paste in that tweet it'll have a null out address by default I just copy and paste my address in so that the faucet can know where to send the tokens I make the tweet I'm gonna refresh the page okay now I'm going to grab the tweet and then just copy and paste the URL of this tweet here just going to close this out and close this other window that will open up and then I would just paste in the Tweet here I already have shm so I'll get an error here but if you didn't have any shm you would after like a few seconds for like a minute or two you should get shm deposited to the address that you tweet with that URL here okay so now we have tokens so now let's do a swap let's swap our shm for wrapped shm so on this front end it'll show wrapped ether but in reality is frap shm on the shortium blockchain we're going to swap one for one this should go to a six and this should go to a seven down here seven wrapped each at the end because we're getting one the cool thing about Liberty 2.0 is as mentioned earlier it's sharded and it uses crossword composability and the way this works is that you need to use an axis list to communicate between the different charts for sending a transaction but we'll get to that in a minute or two so it looks like the transaction went through it might take a few seconds for the balances to update awesome the balances updated as expected we have a seven and we have a six at the balances here okay now that we interacted with the contract on shorty now it's actually deploy some new contracts to shortium here we have a Hello World type contract where we're just going to store value a uint here and it's public so we'll be able to easily view that function once it's recorded or at any point to a set we're actually changing the state we set a uint that would be the new value I'm hitting Ctrl s to compile the contract by default I'm in the virtual machine for remix IDE so to access any type of chain with metamaska to go to injected provider metamask looks like it's connected now I'm going to hit deploy and now I'm going to mask is going to ask me to sign this transaction to confirm I want to deploy this contract to shortium so it'll set this value and then record it to the store slot this is storage slot zero and then it'll send out an event as well okay awesome the transaction went through since we didn't put a value the default value will be zero as expected let's change the value to let's say the number one okay confirm so when the transaction is finalized and accepted this will go from a zero to a one in the storage slot in the contract awesome we have a one here now I'm going to Show an example of an oracle here we have an oracle contract where we're able to get price feeds on chain let's just deploy this contract first this is from Super oracles they offer price feeds for different cryptocurrencies on chain let's check out these functions so with Bitcoin when I click on this I'll get the Bitcoin price relative to dollars or usdt and then when I click on this ethos TT I'll get the price of eth and ustt because we're calling to this address and then we're saying hey if we want eth and then we want Bitcoin and then we could call these other functions somewhere else since we're returning the price right so here I'm just taking the value of Bitcoin over eth and as you can see you could do it could do the math for it we also have this is just the contract being recorded here for this contract instance awesome now let's jump to a more advanced contract so here we have this is very similar to this contract to the original contract where we're just changing the state and being able to see the state and the contract however this contract is actually able to call this contract this contract here called multi-call because it's able to grab the contract here and say oh hey I know this contract I'm saying hey here 's the contract on this blockchain and we're going to be able to interact with it and read and write to it so here we're able to read slot zero because this ax has like a view function when you have it as public it'll just return the value which is very convenient however this will be a little trickier but I'll get to this first I'm going to I already have this contract deployed a liberty 2.
0 I will just load it into remix IDE based off of its address let's just double check this is the right contract the right data sucks correct notice here the prefix is different for the address so this is a b and this is a zero on shortium this means that they'll be on a different chart because their prefixes don't match if we read as we can see here it's simple right this is the last few next time that the state was changed is what this is representing however if I try to change the value without adding an access list the transaction will fail because the transaction will know what shards to go to since this is a multi-shored transaction we should get a failed transaction in the next second or two field transaction as expected so let's pay attention to this value here it ends in 502. we have a script here where we have an access list the way this is structured is we have the other contract we're going to interact with and then we have its storage slot and then a code hash here for that address now what I'm going to do is I'm going to run the script and this is the previous value this is the current time let's say the value updated as expected the value updated because we sent the this transaction with the access list so awesome it's working to give another example when you would need the access list let's think of it in terms of tokens let's say we have an erc20 token with total Supply it's just a view function we're just trying to see how many tokens exist so we're not changing the state of that contract we don't need to pay gas or change storage slots we're just reading however for if we want a transfer token say like we have tokens and we want to give them to someone else this will change the state of that contract and we'll need to pay gas and interact with Store Slots this will actually require the access list because it'll need that access to render which starts to interact with but we pre-load this information in with the reading so the good thing about this is we're actually able to automate the access this with an RPC the way this is structured is we have an address and an API so this is how we Define our contract contract instance and then we have the method that we're going to call from that contract what you could also do for this method as well is you can put in an input argument if that function needs it but this function doesn't have any input arguments so it's just blank and with that we have an unsigned transaction and with that unsigned transaction we could call this RPC which will generate the accesses for us automatically we don't have to compute it all we need to do is just send the transaction and say hey we have a type 1 transaction that will include the access list and we just grab the access list from here and put it in the transaction and that's all we need to do it's very simple you would use ethers.js to access this this is the simplest way to access the RPC so here we have an interface interfaces are very useful for interacting with old contracts wrapped ether wrap shm they're solidity 0.4 and they don't support safe math by default when you build a new contract without safe math you can have underflows and overflows which can be security risks for a contract that's typically why most developers develop with 0.8 now and to interact with this contract we'll abstractly Define all these other functions or the functions that we just need we just need a few functions for this example so we could abstractly call them in this interface and we say hey these are the functions we want to call based off of their names and their input arguments and what they're returning and then point out the address for that contract is deployed and it's as simple as that you will need the access list for contracts like this because it's at a different contract therefore it'll be at a different chart unless you get lucky with the same prefix it was a brief intro into shortium hope you all enjoyed love to see everyone check out the shortium Discord as well thank you for watching
Automatic transcript — names and jargon may be misspelled.