Space and Time's ZK coprocessor

https://spaceandtime.io.

The Core Idea Behind Proof of SQL

Proof of SQL is a zero-knowledge proof protocol that provides a cryptographic mechanism for a client to verify that the query execution and the underlying table data have not been tampered with in a SQL database. By leveraging the Proof of SQL protocol, the results of queries performed on other outsourced traditional database/data warehouse solutions can be verifiably trusted in a trustless manner, not just 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, etc. This way, users already built on top of these querying tools can plug them directly into smart contracts without breaking the trustless model of the blockchain, or provide proofs of query execution to verifiers on external client devices.

The Workflow of Proof of SQL

The Proof of SQL protocol involves two main roles: the client initiating the query and the database service returning the result. We refer to these two parties as the Verifier and the Prover respectively. In practice, the Verifier does not necessarily have to be the one sending the query.

When a SQL query reaches the database and is directed to the Prover, the query results are generated along with a proof of its 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.

Key Features of Proof of SQL

  • Immediate Finality: Due to the nature of zero-knowledge proofs, once data is added to the ledger, it achieves immediate finality.

  • Data Processing and Scalability: Proof of SQL supports data processing operations (select, project, join, aggregate) thus extending the complexity of what can be settled on-chain.

  • Minimal Bridge and Gas Fee: Unlike other Layer 2 solutions requiring bridges to move assets between mainnet and Layer 2, Proof of SQL facilitates seamless inter-chain communication. Moreover, since off-chain SQL operations incur no on-chain gas fees, smart contracts can access scalable compute without incurring additional costs.

Practical Applications of Proof of SQL

The Proof of SQL protocol 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."