Product

ZK Coprocessors 101

The what, the why and the how of a ZK Coprocessor

Ahmad Ali Jafri

Ecosystem/Community Growth Specialist

“A SQL ZK Coprocessor that connects indexed blockchain data to your smart contracts” is how we define Space and Time. If words like “ZK Coprocessor” and “indexing” make you scratch your head, then congratulations, you're in the right place.

Before understanding how SXT leverages Proof of SQL to ZK-prove analytic queries against a million rows of data in sub-second time, let’s first get acquainted with the what, the why, and the how of a ZK Coprocessor.

ZK Coprocessors: The What

The term “ZK Coprocessor” can be split into two words:

  • ZK: A zero-knowledge proof is a method by which the prover (person A) can prove to the verifier (person B) that they have a specific piece of information about something, without actually revealing the information itself.
  • Coprocessor: It is a secondary processor that works with the primary processor to efficiently carry out specific tasks. 

Example: The GPU that boosts your game’s graphics on your PC is a coprocessor.

In simple words, a ZK Coprocessor is basically a secondary processor that works alongside the main blockchain to perform computationally intensive tasks, particularly those related to ZK proofs. By offloading complex calculations, the ZK Coprocessor helps improve the efficiency of the main blockchain while ensuring secure and scalable data verification.

Let’s break this down even further and try to understand this with a real life analogy:

Imagine you’re at a bank trying to complete a transaction, but the line is very long, and the banker has limited capacity to handle everything quickly. Normally, the banker would manually check your details—like your ID, account balance, and transaction history—and then complete your transaction, but this process takes time and is extremely inefficient.

Now, instead of doing all of the above, what if the banker sends your information to a special verification service that can quickly verify your identity, check your account details, and send back the confirmation? This service does all the heavy lifting, like cross-checking data across multiple systems, while the banker waits for the confirmation.

Once the verification is complete, the service sends back a secure result confirming everything checks out. The banker can then proceed with the transaction, trusting the result without reviewing all the details. However, the banker makes sure that the result is tamperproof and traceable, relying on a system that guarantees data integrity. This way, the banker can confidently trust the verification, knowing it can be validated and audited at any time.

Now if it wasn’t already clear, in this analogy:

The Banker is the Blockchain: It handles tasks like checking basic transaction details or processing simple requests, and also ensures maximum security and verifiability—ensuring that the verification is tamperproof and can be independently verified at any time.

The Special Verification Service is the ZK Coprocessor: It handles specific tasks, like verifying your identity or processing large datasets quickly.

The Verification Result is the ZK Proof: It ensures the banker can trust the result without needing to re-check everything themselves, speeding up the process while ensuring security and privacy.

Since now we have an idea of what a ZK Coprocessor actually is, let’s jump into why we need it in the first place.

ZK Coprocessors: The Why

To understand “The Why” of a ZK Coprocessor, we must first understand the concept of Blockchain Trilemma.

Blockchain Trilemma refers to the challenge of achieving the three key goals of blockchain technology—scalability, security, and decentralization—at the same time. These goals are often in conflict with one another, meaning that enhancing one can sometimes come at the expense of the others.

Below is a graphic representation of the trilemma taken from Vitalik Buterin’s blog:

Data is the new oil, but smart contracts still don’t have the right drill! Blockchains hold an enormous amount of valuable data, yet smart contracts often find it extremely difficult to access or utilize it fully. Neither can they easily access the entire history of onchain data, nor leverage powerful offchain indexing solutions without compromising verifiability.

This, in turn, creates a tension at the heart of the blockchain trilemma—balancing scalability, security, and decentralization, which, in our case, means that the need for efficient data access challenges the blockchain’s ability to remain decentralized while also ensuring secure and trustworthy computation.

Let’s take a closer look at some of the issues that smart contracts are currently facing:

  1. Limited access to historical data: Smart contracts can only easily and trustlessly access very limited data from the most recent block, which makes querying historical blockchain data impossible without external solutions. As a result, fully onchain applications like DeFi protocols cannot retrieve past states or events, thus restricting the contract’s ability to make data-driven decisions based on historical information.
  1. Smart contracts can't ask questions: Smart contracts can't query the blockchain for specific information. They can't ask questions about past events, cross-chain activity, or offchain data, which limits their ability to support complex financial instruments like cross-chain derivatives and tokenized RWAs.
  1. Scalability and Performance Challenges: Applications like AI, DeFi, and GameFi demand high performance, particularly in terms of data access and computation. However, smart contracts encounter several limitations, including restricted data access, inadequate optimization for large-scale computations, and a lack of standardization. These challenges hinder the scalability and performance of onchain applications. Traditional blockchain solutions are not designed to support high-performance applications that require real-time data processing, which makes it challenging for smart contracts to meet these demands efficiently.

We can understand all of these challenges with a simple example:

Traditional gaming platforms offer rewards and achievements based on the player’s previous records because rewards are simple to manage. Player’s data (achievements, scores, purchases) is stored in a centralized database, making it cheap and quick to track progress and calculate rewards.

However, most of the onchain games struggle to implement the rewarding system due to the following issues:

  1. Storing player data directly on the blockchain is expensive due to high storage costs and gas fees for each action or transaction.
  2. Even if storage were feasible, calculating and distributing rewards for players with many actions can cost millions in gas and can’t necessarily be aggregated/calculated by a smart contract.

All these limitations hinder the ability of dapps to leverage the full potential of blockchain and make the development of high-performance applications onchain, such as games, extremely difficult.

After understanding “The Why”, let’s take care of the question, “how does SXT come into play here?”

ZK Coprocessors: The How

Our goal at Space and Time from day one has been focused on delivering trustless, cross-chain data processing to make smart contracts “smarter” and ultimately make it easier for everyone to build onchain. 

Say GM to SXT Chain: The blockchain for ZK-proven data

SXT Chain can essentially be defined as a decentralized database for onchain and offchain data. It provides developers with a robust platform to securely access, store, and query complex data using Proof of SQL, SXT’s ZK coprocessor. Proof of SQL allows developers to run analytic queries against up to a million rows of data in less than a second, while generating ZK proofs to ensure the integrity of their queries.

Our chain leverages powerful but lightweight indexing nodes to collect data from a wide range of chains, including Ethereum, ZKsync Era, Bitcoin, Sui, Aptos, and Polygon. These nodes are responsible for continuously ingesting data into the SXT network to provide builders access to up-to-date, real-time information from all across the ecosystem.

By bridging the gap between onchain and offchain data sources and providing ZK-proven query results, SXT Chain introduces a new way to handle data in real time and empowers developers to build tamperproof, data-driven dapps.

Let’s take a look at how SXT addresses the problems outlined in the 'WHY' section of the blog:

  1. Limited access to historical data: As mentioned above, SXT Chain serves as a decentralized database that continuously collects and stores data from all major blockchains in real time, thus taking care of the problem of smart contracts getting limited access to historical data. With Proof of SQL, developers can quickly run queries against large datasets, while generating ZK proofs to ensure the integrity of the result.
  1. Smart contracts can't ask questions: SXT Chain solves this by enabling smart contracts to query historical data, cross-chain activity, and offchain information through a secure, decentralized database. Using Proof of SQL, smart contract developers can now ask complex, context-rich questions that were previously impossible to answer onchain.
  1. Scalability and Performance Challenges: SXT Chain overcomes scalability and performance challenges by employing Proof of SQL, SXT's ZK Co Processor. It currently allows sub-second querying against up to a million rows of data, and it's getting even faster. Using Proof of SQL, developers can run scalable queries and ensure data integrity with ZK proofs, enabling real-time performance as data grows.
Our goal at Space and Time from day one has been focused on delivering trustless, cross-chain data processing to make smart contracts smarter and ultimately make it easier for everyone to build onchain

Whether it be indexing data from major chains, building our own ZK Coprocessor or creating a decentralized database. All the steps we've taken have driven us towards our one major goal — making smart contracts rich in information and empowering developers to build data-driven dapps. 

With SXT Chain, we’re simplifying the process of building onchain applications by providing developers with the tools they need to access, query, and process real-time data in a secure and trustless way. By enabling seamless access to historical, cross-chain, and offchain data, SXT empowers the creation of more sophisticated and data-driven dapps. The future of onchain development is here, and it’s powered by SXT.

Ahmad Ali Jafri

Ecosystem/Community Growth Specialist

Ali Jafri is the ecosystem/community growth specialist at Space and Time Labs. He has been in the Web3 space for close to three years and has worked with multiple marketing agencies to deliver growth for a wide variety of clients. He hails from India and is an engineering major.