Overview
As the number of people using Ethereum has grown, the blockchain has reached certain capacity limitations. This has driven up the cost of using the network, creating the need for “scaling solutions.” There are multiple solutions being researched, tested and implemented that take different approaches to achieve similar goals.
The main goal of scalability is to increase transaction speed (faster finality), and transaction throughput (high transactions per second), without sacrificing decentralization or security.
Rough numbers:
– 135m transaction on StarkEx
– Average gas price of 60 gwei
– On average, 250k gas saved vs. doing the transaction on L1That's 2.025m ETH saved in tx costs vs. doing this on L1!
h/t @rimonl
— Liron Hayman ✨ (@HaymanLiron) March 18, 2022
Starknet is a permissionless decentralized STARK-based ZK-Rollup operating as an L2 network over Ethereum. StarkNet allows any dApp to achieve unlimited scale for its computation — without compromising Ethereum’s composability and security.
Zk-rollup what?
Simply put, Zk-rollups is a mechanism to efficiently do transaction off-chain and then combine them periodically and commit them to main chain. If you are a developer its very similar to how you could edit multiple files and commit them to git history.
Technically, Zero-knowledge rollups (ZK-rollups) bundle (or “roll-up”) hundreds of transfers off-chain and generate a cryptographic proof. These proofs can come in the form of SNARKs (succinct non-interactive argument of knowledge) or STARKs (scalable transparent argument of knowledge). SNARKs and STARKs are known as validity proofs and get posted to layer 1 (Ethereum).
But solutions like ZK-rollups have their own pros and cons:
Pros | Cons |
---|---|
Faster finality time since the state is instantly verified once the proofs are sent to the main chain. | Some don’t have EVM support. |
Not vulnerable to the economic attacks that Optimistic rollups can be vulnerable to. | Validity proofs are intense to compute – not worth it for applications with little on-chain activity. |
Secure and decentralized, since the data that is needed to recover the state is stored on the layer 1 chain. | An operator can influence transaction ordering |
Layer 1 <> Layer 2 Interaction
Starknet includes an L1<>L2 messaging protocol, which allows developers to implement seamless transaction flows between L1 and L2. Developers can now send messages from contracts on L1 to contracts on L2 and vice versa.
ZK-rollup state updates are final, without any delay. This means that messages that were sent from L2 to L1 can be immediately forwarded to their destination contract. This opens the way to build apps that are truly interoperable between the layers.
Fee Support
StarkNet Alpha now supports the first version of the fee mechanism. This mechanism is essential even at this early stage, and even on Testnet, for two main reasons:
- It allows developers to start optimizing their contracts according to StarkNet’s cost model.
- It is a crucial counterpart to improving the system’s performance, as it prevents spamming by sending countless transactions.
This version introduces the components necessary for developers to incorporate fee payments into their tools and applications. Developers can now estimate the transaction fee by calling the estimate_fee
endpoint and make the fee payment as part of the transaction execution.
This gradual transition will allow users and developers to adjust to the new model.
Start Building
We invite you to start writing your own applications over StarkNet by either checking the (new!) website, or jumping directly to the tutorial.
If you are ready to deploy, please follow this onboarding process; created to ensure all developers are well aware of the preliminary state of the system.
Ecosystem
Starknet ecosystem is still pretty new and has a little learning curve. It does not support solidity natively instead it has its own programing language called cairo.
Cairo and Smart Contract Development
StarkNet uses the Cairo programming language both for its infrastructure and for writing StarkNet contracts. It is similar to python, following is a simple smart contract written in Cairo
# Declare this file as a StarkNet contract.
%lang starknet
from starkware.cairo.common.cairo_builtins import HashBuiltin
# Define a storage variable.
@storage_var
func balance() -> (res : felt):
end
# Increases the balance by the given amount.
@external
func increase_balance{
syscall_ptr : felt*, pedersen_ptr : HashBuiltin*,
range_check_ptr}(amount : felt):
let (res) = balance.read()
balance.write(res + amount)
return ()
end
# Returns the current balance.
@view
func get_balance{
syscall_ptr : felt*, pedersen_ptr : HashBuiltin*,
range_check_ptr}() -> (res : felt):
let (res) = balance.read()
return (res)
end
Developer Tools
- OpenZeppelin is defining the standard contracts. Their repo and discussions are worth following
- The Warp Solidity–>Cairo transpiler, developed by Nethermind
- Shard Labs’ HardHat plugin and StarkNet Devnet
- Argent is developing tooling, including its joint effort on StarkNet.js, alongside Sean Han, its creator
Infrastructure Roadmap
Block explorer:
- The Voyager project by Nethermind
- Eth.tx will offer support analysis and a detailed view of StarkNet transactions
Full nodes: two efforts underway: one is the Fermion project led by Erigon, the other is the Pathfinder project, led by Equilibrium
Wallets:
- ArgentX is a browser extension developed by Argent, already available to devs
- Torus key management solution is StarkNet ready
- Ledger is developing a native StarkNet app; to be made available before the end of the year
Cairo Audits: ConsenSys Diligence, Trail of Bits, Peckshield, and ABDK are either conducting Cairo audits already, or about to start soon
API Services: after a StarkNet full node is made available, API services will be offered by Figment, Chainstack, and Infura
Indexer: we will be working on integrating TheGraph to work with StarkNet, together with the Figment team
Conclusion
Starknet has a shown innovative ways to solve ethereum’s scaling problem and has a great community building impactful web3 apps on the platform. It does have some learning curve but you should definitely give it a try.
Leave a Reply