What Are ZKThreads and How Do They Work?
Home
Articles
What Are ZKThreads and How Do They Work?

What Are ZKThreads and How Do They Work?

Intermediate
Published Jun 6, 2024Updated Jun 7, 2024
6m

Key Takeaways

  • ZKThreads are a framework that can enhance the performance and scalability of decentralized applications (DApps) using zero-knowledge proofs (ZKPs).

  • ZKThreads can offer benefits in the form of improved user experience, lower transaction costs, and enhanced security.

  • ZKThreads can be used in various applications, such as decentralized exchanges (DEXes), session-based games, zk-secured middleware, and on-chain AI systems.

Introduction

Security, composability, and interoperability are key to the efficient performance of decentralized applications (DApps) but are often difficult to balance. ZKThreads propose a potential solution to this trilemma. In this article, we will explore what are ZKThreads, how they work, how they differ from other zk solutions, some of their benefits and use cases.

What Are ZKThreads?

ZKThreads are a zero-knowledge framework that enhances the performance and scalability of DApps. They utilize Starknet’s capabilities to create a standardized environment for developing and running interoperable applications on the blockchain.

How Do ZKThreads Work?

1. Application logic deployment

The process starts with deploying the application logic into ZKThreads’ app contracts. These contracts are essentially the rules and procedures that govern how an application operates.

2. Batching transactions

Instead of handling each transaction individually, ZKThreads group multiple transactions into a single batch. This makes it more efficient to process them in large numbers.

3. Creating proofs

Then, a cryptographic proof called a STARK proof is created to ensurethat all transactions in the batch are valid and have been processed according to the contract rules.

4. Verification

Next, the STARK proof is sent to the Layer 2 sequencer, where it is verified against the canonical record of the DApp. The canonical record refers to the verified and accepted state of an application.

The ZKThread Verifier, a contract on Starknet, checks the proof to ensure its accuracy. It checks for double-spending, ensures that all transactions are authorized, and controls whether the resulting state is consistent with the blockchain’s rules.

If the proof is valid, the ZKThread Verifier updates the canonical state record of the DApp. If the proof is invalid, the changes are rejected, ensuring the integrity of the application.

ZKThreads vs. Other ZK Solutions

Data handling

ZKThreads are designed to store both state and transaction data off-chain while utilizing zero-knowledge proofs (ZKPs) to validate transactions. This differs from many traditional zero-knowledge rollups (zk-rollups) that move computation off-chain but still store transaction data on-chain

By keeping all data off-chain, ZKThreads can significantly reduce the data load on the main blockchain, which enhances scalability and lowers costs. Conversely, zk-rollups like zkSync periodically post batched transaction data on-chain, ensuring that the base layer handles data availability.

Interoperability

ZKThreads prioritize interoperable applications, reducing fragmentation and ensuring different DApps can seamlessly interact within the same ecosystem. In contrast, other solutions like zkEVM focus more on compatibility.

Validation mechanism

The verification process in ZKThreads involves creating STARK proofs that validate the correctness of batched transactions and state changes. These proofs are then verified against the canonical state of the DApp. In comparison, some zk-rollups like zkSync use zk-SNARKs or zk-STARKs to create cryptographic proofs that are verified on-chain.

Benefits of ZKThreads

Improved user experience

ZKThreads enhance the user experience by allowing seamless interaction between different DApps. Users can access multiple applications without having to switch networks.

Lower costs

By grouping transactions together and processing them all at once, ZKThreads reduce the number of transactions that need to be recorded on the main blockchain. This lowers the transaction fees for users, making DApps more affordable.

In addition, they store both state and transaction data off-chain while still maintaining security and integrity through ZKPs. This reduces the data load on the blockchain, leading to lower gas fees.

Enhanced security

ZKThreads utilize ZKPs to enhance security. ZKPs allow the validation of transactions without revealing the underlying data, preserving privacy. In addition, they ensure that all transactions are processed according to predefined rules, preventing unauthorized activities.

Use Cases of ZKThreads

L2 decentralized exchanges

ZKThreads can make DEXes on Starknet more efficient by reducing transaction fees for users. Normally, DEXes on Starknet would be impractical as users would have to pay fees for every trade. With ZKThreads, users only pay fees when they withdraw their funds, lowering the total cost of trading and making DEXes more practical and affordable.

Session-based games

In session-based games, such as poker and chess, ZKThreads can help aggregate fees. Instead of charging a fee for every move, players only pay a single fee at the end of the game when the final results are recorded on Starknet. This allows developers to create a broader range of fully on-chain games without worrying about high transaction costs.

Zk-secured middleware and shared liquidity infrastructure

ZKThreads offer a secure and efficient framework for middleware applications, such as oracles and bridges. By building functionality directly within a ZKThread, these applications can leverage ZKPs to ensure security and interoperability.

On-chain AI

ZKThreads offer the necessary computational power to run AI models directly on the blockchain. This means that an AI program can be managed within a ZKThread, keeping its core data and operations consistent. These AI models can then be used by different applications, such as games, social media platforms, and productivity tools.

Closing Thoughts

ZKThreads are a framework for building scalable and secure DApps using ZKPs. They can be used for Starknet DEXes, session-based games, and middleware applications. Unlike other zk solutions, ZKThreads emphasize interoperability, keep all data off-chain, and utilize a different verification mechanism. Looking forward, ZKThreads have the potential to significantly enhance the performance and usability of DApps.

Further Reading

Disclaimer: This content is presented to you on an “as is” basis for general information and educational purposes only, without representation or warranty of any kind. It should not be construed as financial, legal or other professional advice, nor is it intended to recommend the purchase of any specific product or service. You should seek your own advice from appropriate professional advisors. Where the article is contributed by a third party contributor, please note that those views expressed belong to the third party contributor, and do not necessarily reflect those of Binance Academy. Please read our full disclaimer here for further details. Digital asset prices can be volatile. The value of your investment may go down or up and you may not get back the amount invested. You are solely responsible for your investment decisions and Binance Academy is not liable for any losses you may incur. This material should not be construed as financial, legal or other professional advice. For more information, see our Terms of Use and Risk Warning.