Why StarkNet is Vital for Ethereum’s Scalability
In this article you will learn what Starknet is, why it is important, how it helps alleviate Ethereum congestion, reduces transaction costs and what the future holds for scalable Web3 DApps.
What is it?
Starknet is an L2 scaling solution for Ethereum built by Starkware using STARK technology (Succinct Transparent Argument of Knowledge) or ZK-Proofs. The Starknet eco-system of products is supported through the Starknet Foundation which provides support to community efforts and developer relations.
This article is a high level overview of Starknet as you can really get into the weeds with this stuff. I've been writing technical articles on here for 2 years. And I've noticed that LinkedIn is not the place to get super into the weeds. So I'll just give you the meat and potatoes.
Resource: https://book.starknet.io/index.html
Why do we need L2's?
Starknet is a Layer 2 scaling solution for Ethereum. Essentially the problem with Ethereum mainnet is that where there is a lot of activitity (all the time), the transaction costs are way too high for people to realistically want to interact with the network for performing many transactions. Transactions that send a bigger tip get selected first in the mempool leaving other transactions having to wait in line.
This is why we have all these L2 chains that want to help scale Ethereum. Exchanges also want to onboard users by funding transaction fees right off the bat to get them going. Sending $100 to an EVM address could cost $5 on mainnet and take minutes to finalize on L1. But with L2's these transaction fees are reduced to cents and near instant times.
Starknet also allows us to keep the security of the EVM consensus mechanism present in the Starknet rollup batches through the use of Zero-Knowledge-proofs. While at the same time increasing speed and reducing costs.
L2's typically achieve this by "rolling up" a batch of transactions on their L2 chain and processing some type of proof offchain, in Starknet's case they use ZK-Proofs which is a type of hashing algo on the batch of transactions that acts as a "Proof" of validity saying that "this batch of transactions is true and verified". The Starknet Prover samples the incoming block and if there is 1 piece of bad data, it will revert that block and not send it to L1. The successful block proof is then submitted to L1 Ethereum mainnet to be included in the latest block.
Developer Toolkit
Starknet uses the Rust-like language Cairo for it's Starknet contracts. The compiler on the Starknet virtual machine needs to use an intermediary language called SIERRA (Safe Intermediate Representation) which is then read by CASM (Cairo Assembly) and then a proofs are generated and sent to L1.
Starknet uses Cairo is used to generate proofs offchain, every node on the EVM doesnt need to verify every transaction in the block since it only needs to get that ZK-proof and verify that. This leads to massive increase in speed and reduced costs.
Here are some tools that you will need to build on Starknet.
Cairo
Rust like syntax. Lower level ownership concepts.
Scarb
Rust-like package manager, builds SIERRA code requried for deployment
Starkli
CLI tool for declaring, deploying, calling, invoking. Lets you interact with Starknet from command line.
Starknet.js
Frontend framework similar to Ethers in Solidity
Dojo/Cartridge
Gaming framework. Make games fast. Comes with Torii (Indexer), Sozo (Builder), Katana (Sequencer), controller (smart wallet).
Starknet Explorer
UI tool to track transactions. I like Voyager.
I have a Smart Contract, Now What?
Smart Contracts are different on Starknet than they are on EVM chains. You need to declare and deploy contracts. First you need to tell the Starknet VM that your code is decalred with a hash. Then you need to tell it to deploy that hash. This will finally deploy your smart contract which you can then checkout on Voyager.
Declare:
starkli declare /path/to/class/file
Deploy
starkli deploy <CLASS_HASH> <CTOR_ARGS>
What about Wallets??
There are 2 main wallets. Argent and Bravvos.
Wallets behave differently on Starknet. They use a type of technology called wallet abstraction. Which means that each wallet is its own smart contract. This means that you need to deploy your own wallet if you are using Starkli. But you can just download a wallet extension. This is helpful to know because now you can do different things with wallets including batching multiple transactions or spreading gas fee payments.
Bravvos
Argent
DeFi on Starknet
Like every chain out there Starknet has a plethora of finance protocols for lending/borrowing and Automated Market Markers. Over collateralized lending is interesting and I haven't seen a lot of that on Starknet yet. But we have a host of Uniswap like protocols out there.
Lend/Borrow
AMM
See more:
Games? Can I learn Karate at Dojo?
no. but you can build scalable games using their framework.
Imagine a dungeon instance that spins up only while you are playing that game. It then disappears when you are done playing. This can be done onchain and we can consider each dungeon instance an L3 off of Ethereum.
They provide a whole suite of developer tools to build scalable Web3 onchain games. The problem with gaming is that you have a ton of fast actions and it would be costly for your users to make them pay for every action onchain. Dojo has "Controller" which is essentially a smart wallet where you can batch a whole games worth of transactions so you don't need to sign each sword swing.
With Dojo you can build a game fast with a system that has been desigend for onchain gaming. During testing, you can run a "world instance" inside of Katana Sequencer which is a duplicate of Starknet but local, then run Torii to Index every change you make to your ECS entities, from there you can take those indexed events from onchain and do whatever you want on the front end with Starknet.js.
Thats how you can make onchain games in 6 parsecs.
Here are some onchain games to play right now.
Loot Survivor
Realms World
Node Guardians - Learn to code blockchain stuff in a fantasy RPG
Closing Thoughts
That is the jist of Starknet. It's an emerging Zero-Knowledge validity proof L2 that is growing in user base and also in protocol offerings. It's fast and cheap. There is a really good developer relations community, events and mentorship available for developers looking to start building on Starknet. See here for more information.
Thanks for reading.
#blockchain #ethereum #starknet #softwaredeveloper #halifax
Full-stack application developer
4 个月Great job on the article, Justin! As a developer, I thought I could read it without any constraints, but eventually, I had to ask ChatGPT to translate the content into English. :) Now I am a bit more familiar with blockchain technology, and I learned something new today. Thank you!