I want to talk about a groundbreaking technology that is set to transform the way we handle data in the blockchain era—the Proof of SQL protocol by Space and Time's ZK coprocessor. This blog post aims to explain what Proof of SQL is, how it works, and why it's a game-changer for anyone involved in the development of blockchain applications.
Proof of SQL is a pioneering ZK circuit that enables SQL databases to provide cryptographic assurance that the query execution and the underlying table data have not been tampered with. By leveraging the Proof of SQL protocol, results from queries performed on other outsourced traditional database/data warehouse solutions can be verifiably trusted in a trustless manner, not just within Space and Time’s decentralized data warehouse solution. For example, the cryptographic protocol can be attached to PostgreSQL, Snowflake, Apache Spark, Google BigQuery, AWS Athena/Redshift, Microsoft Fabric, and so forth. This way, users who have already built on these querying tools can plug them directly into smart contracts without breaking the blockchain's trustless model or provide proofs of query execution to verifiers on external client devices.
The Proof of SQL protocol involves two main roles: the client initiating the query and the database service returning the result. These two parties are referred to as the Verifier and the Prover, respectively. When a SQL query reaches the database and is directed to the Prover, the query results are generated along with a proof of their correctness. This proof-result pair is then transmitted to the Verifier nodes where the validation takes place. Additionally, Space and Time provides commitment creation and verification features through client libraries. This shifts the root of trust into the hands of the user. Some clients prefer this approach, while others opt to delegate the verification to Verifier nodes, which perform the verification on their behalf.
Proof of SQL supports immediate finality due to the nature of zero-knowledge proofs, meaning that once data is added to the ledger, it achieves immediate finality. Furthermore, Proof of SQL supports data processing operations (such as select, project, join, aggregate) that extend the complexity of what can be settled on-chain. This increases the scalability and efficiency of data processing and enables seamless interoperability across chains. Since off-chain SQL operations incur no on-chain gas fees, smart contracts can access scalable compute without incurring additional costs.
Proof of SQL enables smart contracts to request ZK-proof queries about activities on their own chain, other chains, or off-chain activities. For example, a smart contract could request Total Value Locked (TVL) information for all liquidity pools deployed more than a month ago and with TVL greater than $1 million, or it could request to "Aggregate total collateral now across all liquidity pools our protocol operates on four chains."
