StarkWare blockchain service improves scalability and privacy in blockchains using STARK technology which involves ZK-Starks, StarkEx, and StarkNet. Their contribution is much needed when it comes to fixing the high gas costs on Ethereum that plagues its users. You may already be familiar with SNARKs and ZK-SNARKs, but this article looks at StarkWare and STARKs, along with ZK-STARKs.
This article will look into the different aspects of StarkWare and its role in the Layer-2 solution game. But StarkWare isn’t about quick bandaid solutions for Layer 2. They’re in it for the long run and want their systems to be future-proof. That means finding ways to keep users’ privacy intact with the ominous power of quantum computing looming on the horizon. Amongst everything else they’re working on, Starkware seeks to be Post Quantum Secure.
Regarding Layer 2 solutions, the ecosystem is rapidly moving through its adoption and innovation phase testing different solutions. Only the best will survive in the long run, and those that can satisfy the insatiable demand for scalability will enjoy the fruits of explosive growth.
If you’re not sure what Layer 2 is, please read our article, “Comparing Layer-2 Ethereum Scaling Solutions.”
Eli Ben-Sasson, co-Founder and President of StarkWare, has been researching cryptographic and Zero-Knowledge Proofs since he received a Ph.D. in Theoretical Computer Science. He also co-invented STARK and is the founding scientist of Zcash.
If you want to learn more about Zcash, make sure to take the Cryptography & Privacy Coins course at Ivan on Tech Academy.
StarkWare’s mission is the same thing that fascinated Eli when he began as a researcher. He’s always working on better ways to build up the public’s trust in computation while still preserving financial privacy – which brings us to the subject of Computational Integrity.
StarkWare and Computational Integrity
So, what is Computational Integrity? Well, Computational Integrity underpins commerce. Essentially, it means that a computation that’s correct is the thing that allows us to trust an account balance. For example, when you take money out of an ATM, do you stand there and count it, or do you trust the computation?
Permissionless blockchain can achieve Computational Integrity without trusting in third parties, but they pay the price in terms of scalability and privacy. Preserving both scalability and privacy is where StarkWare comes in.
Starting in the 1980s, theoretical work in proof systems such as Zero-Knowledge Proofs, Interactive Proofs, and Probabilistically Checkable Proofs has illuminated the path to solving both issues and manifested into practical applications.
StarkWare and STARKs
STARKs are cryptographic proofs co-invented by Eli-Ben Sasson. They are both scalable and transparent, and it’s StarkWare’s goal to bring them to the world. STARKs use lightweight cryptographic hash functions, which means they’re both fast and post-quantum secure. This kind of security isn’t the case with other cryptographic proofs that rely on public-key cryptography, which is more expensive and vulnerable to quantum adversaries’ attacks.
STARKs promise is to provide trustless verification of Computational Integrity. Its cryptography is battle-tested and a result of the aforementioned academic breakthroughs. STARK represents security, scale, and unmatched speed and results from the proof systems’ journey from theory to practice.
Long Proofs and the Cryptographic Hash Function
STARK combines long proofs with a cryptographic hash function (such as SHA-256). Long proofs bring scalability, while the cryptographic hash function brings transparency without hampering scalability. As a result, the STARK prover and verifier (see below) are the best in class, outperforming competitors in scale while relying on fewer but safer cryptographic assumptions.
Developers can move both storage and computations off-chain with STARK technology. By moving most of the computational work off-chain, blockchain infrastructure can scale exponentially and maintain computational integrity “trustlessly.”
STARKs Prover and Verifier
The prover and verifier take turns sending messages to each other. So, they work together, albeit with conflicting objectives. The prover wants to prove Computational Integrity. Its job is to convince the verifier that the computation is correct. However, the verifier plays the role of a suspicious gatekeeper. Its task is to distinguish truisms from falsities.
Randomness also plays a role. Randomness is used to achieve zero knowledge on the prover side and is necessary for generating queries to the prover. At the end of this back-and-forth, the verifier outputs its decision and can either accept or reject the new state.
An easier way to think about this interactive communication is the court of law analogy where one party makes a claim and the counterparty questions it.
STARK or SNARK?
You can see proof systems at work in cryptocurrencies like Zcash, which uses SNARKS and Bulletproofs used by Monero. However, in comparison, the STARK prover is 10x faster than that of SNARK and Bulletproof for a given computation, and its verifier is 2x quicker than SNARK and 10x quicker than Bulletproof.
What distinguishes STARKs is the combination of the following three properties:
- Scalability (the “S” in STARK)
- Transparency (the “T” in STARK), and
- Lean cryptography
ZK-Snarks vs. ZK-Starks
A ZK-Snark (Zero-Knowledge Succinct Non-Interactive Argument of Knowledge) is a cryptographic proof used for various things like computation verification, anonymous cryptocurrencies (like Zcash), and authentication without passwords.
They can be tough to grasp with their large number of moving parts, but you can read our article on ZK-Snarks and ZK-Rollups to get a better understanding.
ZK-Starks (Zero-Knowledge Scalable Transparent Arguments of Knowledge) is a type of cryptographic proof that can prove something is true without revealing what exactly it is proving. ZK-Snarks created ZK-proof systems before ZK-Starks came along.
However, ZK-Snarks required a trusted party to set up the ZK proof system. This requirement introduced a vulnerability. What if the trusted parties ended up compromising the privacy of the entire system? ZK-Starks improve upon ZK-Snarks by removing this requirement for a trusted setup. StarkWare is focusing on scalability initially and then privacy later on.
Besides not requiring a trusted setup phase, ZK-Starks also use publicly verifiable randomness and are more scalable when compared to ZK-Snarks. Also, ZK-Starks are not vulnerable to attacks from quantum computers like ZK-Snarks due to their cryptography.
What Is StarkEx?
StarkEx is Starkware’s L2 scalability engine. DeversiFi‘s customers have been using it on Mainnet since June 2020, and more recently, dYdX has deployed it with ImmutableX starting soon. StarkEx handles complex trading logic like derivatives, spot trading, NFTs, and payments.
It scales applications such as cryptocurrency exchanges and gaming platforms utilizing a STARK-based ZK-Rollup. The good news for projects integrating with StarkEx is that it requires minimal changes to the existing business setup. Every dApp defines its business logic and runs on top of StarkEx.
Another positive is that StarkEx drastically reduces gas costs and requires no trust by the user. It also integrates into multiple wallets, including MetaMask.
StarkEx has an off-chain component that holds the order transaction execution, the state and sends state updates to the on-chain component. The on-chain component enforces the validity of state transition and holds the state commitments and system assets.
To master Layer-2 solutions for Ethereum like ZK-Rollups, you need to begin with the basics. An excellent place to start is the Ethereum 101 course at Ivan on Tech Academy.
The Road to StarkNet
Starkware is also building StarkNet, a permissionless, decentralized, and censorship-resistant STARK-powered Layer-2 ZK-Rollup. Okay, that’s a mouthful, so let’s break it down.
StarkNet will enable applications to scale without security compromises, and users will be able to execute transactions on StarkNet just like they do on Ethereum today.
It will also have Cairo, a Turing-complete language running “under the hood.” Scaling measurements include an impressive 300K transactions in a single proof on mainnet with gas per transaction rate way cheaper than Ethereum Layer 1.
It’s not surprising that StarkWare will build StarkNet in its usual manner—and that is to tackle the complex problems first, build the core technology, and then release it to production in a piecemeal fashion.
StarkWare’s Founders and Advisors
StarkWare has a mathematical expert in co-founder Eli-Ben Sasson, but it also has impressive advisors like Naval Ravikant involved. If you haven’t heard of Naval, he has many accomplishments and titles, such as Chairman and co-founder of AngelList and CoinList. He’s the Founder of the oldest altcoin fund, MetaStable Capital, and a seed investor in companies like Twitter, Uber, Kraken, Yammer, Stack Overflow, Zcash, and others.
Eli-Ben Sasson, StarkWare Co-Founder
StarkWare and dYdX
So, now that you have an overview of StarkWare and how some of its technical components function, let’s take a look at a real-life case study with dYdX.
dYdX is a full-featured decentralized exchange for margin and spot trading and lending and borrowing. Approximately eight months ago, StarkWare announced they were partnering with dYdX. Following that, the teams collaborated to get dYdX’s perpetual contracts trading platform running on StarkEx.
Antonio Juliano, dYdX Founder
In a recent interview with Antonio Juliano, he explained some of the decision-making processes that went into selecting StarkWare amidst all the other Layer-2 Solutions.
First off, perpetual contracts (a type of derivative contract) are the most popular trading product in all of crypto. It offers users access to leverage and other features. So dYdX decided to launch StarkEx for their perpetual contracts.
Anyone involved in DeFi knows that the gas fees are insanely high. For dYdX users, it costs about $150 in gas fees per trade on average. Sometimes fees spike into the hundreds of dollars, and they can soar into the thousands of dollars for trades at peak times.
With all of the hopes for DeFi to provide a more democratic ecosystem to the world of finance, there’s nothing democratic about a “whale chain.” And that’s what DeFi will become if gas fees keep spiking on Layer 1. A chain for big, fat whales with fat crypto wallets.
dYdX also considered Layer 1 solutions for their problems, but the scalability is still too bounded. Plus, Layer 1 isn’t there yet in terms of wallet quality. For example, what will users go to instead of MetaMask?
Furthermore, if dYdX were to go to a side chain network like Binance Smart Chain, they would be trusting an entirely different protocol rather than Ethereum. They’d be trusting the validators on a handful of computers, leaving their assets to their whims or malicious actors who could compromise them.
They also considered Optimism with their Optimistic Virtual Machine. The problem with Optimism, however, is the long withdrawal period. dYdX knew their users weren’t going to wait a week to remove their funds. StarkWare was the easiest choice for them, even with all the other options.
Ethereum’s co-founder Vitalik Buterin on ZK-Rollups
Interestingly enough, Vitalik Buterin has stated that Optimistic Rollups are the choice for the near and mid-term because they’re ready to go while ZK-Rollups are still a ways off and will be the choice for the longer term.
ZK-Rollups vs. Optimistic Rollups
But dYdX is already live with a ZK Rollup solution in StarkEx. It’s a massively scalable application on the mainnet way ahead of its Optimistic Rollup rivals. StarkEx is a live system now handling dYdX’s complex computations at below 5000 gas per transaction.
The fact that ZK Rollups have beat some of these Optimistic Rollups to market calls into question this notion that ZK Rollups aren’t a viable solution yet.
StarkEx offers the ability to have Cairo, a Turing complete programming language inside of a ZK Rollup, considered to be one of the most complex parts that would take longer to accomplish.
So dYdX liked what it saw in StarkEx—that it was a leader in its field and that it’s been live in production with DiversiFi. As of now, dYdX can support both minting and trading of NFTs. Not to mention instant trading that’s way better than a centralized exchange with all their KYC requirements. However, dYdX isn’t the only project onboard with StarkEx.
StarkEx and Immutable X (Gods Unchained)
Immutable X’s Gods Unchained was the first blockchain game to receive wide adoption. But with its great success came high gas costs. Despite making significant gas optimizations, Immutable X still had to spend approximately $6 million on gas. They needed a scaling solution that could handle both the minting and trading of low-value assets.
Immutable chose StarkEx because it offered them the ability to mint NFTs directly on Layer 2 as well as a fast withdrawal system.
Some of the more popular Layer-2 solutions worth checking out are:
This Layer-2 solution has been integrated with Gitcoin for some time now.
Presently powering dYdX, Immutable, and DiversiFi.
Right out the gate, it’s apparent that a single solution won’t win the scalability wars. Each scalability solution comes with its set of strengths, weaknesses, and trade-offs. Some are better for payments, while others allow for better EVM-compatibility, while some can only offer greater scalability at the cost of decentralization.
Ultimately, Ethereum users will be the real winners of these scalability wars. Especially the early investors who have the vision to pick projects offering solutions with a strong use case and some longevity.
Are you ready to design your own Layer 2 solution? How about developing the coding skills for future employment in this red-hot industry? Either way, you’ll need to build a strong foundation, so enroll at Ivan on Tech Academy and learn how to become a blockchain developer today!