Solidity
MakeInfinite Labs does not generally serve onchain queries (requested by your smart contract) through our Managed DB / REST APIs. However, Space and Time (SXT Chain) includes a network of prover nodes that do! The prover nodes listen to requests emitted at events through [ZKpay LINK HERE].
Execution of ZK-proven query from your smart contract is as simple as sending your request along with a small payment to the ZKpay query relayer contract.
In your smart contract, you simply:
- Import ZKPay and the Proof of SQL onchain verifier
- Set the contract addresses for the chain you're on (see below)
- Authorize a small amount of USDC to cover all payments, such as query execution, return of the final data set back onchain, onchain verification, etc.
- Convert your SQL Statement into a hex query plan - check out the Proof of SQL SDK for details
- Send the request to ZKpay query relayer contract
- Make sure to implement the zkPayCallback function, which will be called back by ZKpay once the data is complete and verified.
For the full docs, see the "ZK-SQL via Smart Contracts" page at the Space and Time Foundation.
Updated about 2 hours ago