The zkURL protocol is Cubiq Network's innovative solution for decentralized, verifiable, and efficient distribution of zero-knowledge proofs.
zkURL treats zero-knowledge proofs as addressable resources, enabling seamless fetching and verification across the network.
In a zero-knowledge blockchain like Cubiq, proofs are fundamental. They attest to the correctness of computations performed off-chain, allowing lightweight nodes (Qubes) to verify the entire network state without re-executing every transaction. However, efficiently distributing and retrieving these proofs across a decentralized network, especially to mobile devices, presents a unique challenge.
The zkURL protocol addresses this by providing a standardized, secure, and resilient mechanism for proof publication and retrieval, making proofs as accessible as web pages.
Traditional content distribution methods are often centralized or not optimized for the specific requirements of cryptographic proofs. The need for zkURL arises from:
The zkURL protocol defines a URI scheme for addressing zero-knowledge proofs. Its structure is designed to be intuitive yet comprehensive:
zk://[proverID]@[domain_or_hash]/[proof_id]#[metadata]
Each component serves a specific purpose:
zk://prover01@prover.cubiq.org/block/8472934#v1
zk://QmHash...CID@ipfs/tx/0xabc...def#gzip
A uniform way to locate and reference any zero-knowledge proof on the network.
Supports fetching proofs from both centralized endpoints and decentralized storage.
The zkURL protocol integrates seamlessly into the Cubiq Network's proof lifecycle:
zkURL is designed with robust security and reliability features:
Ensures that retrieved proofs have not been altered since publication.
Proofs remain accessible even if some distribution points go offline.
The Cubiq SDK provides convenient functions for interacting with the zkURL protocol:
import { zkURL } from "@cubiq/sdk";
const url = "zk://prover01@prover.cubiq.org/block/8472934#v1";
const parsed = zkURL.parse(url);
console.log(parsed.proverID); // "prover01"
console.log(parsed.domainOrHash); // "prover.cubiq.org"
console.log(parsed.proofId); // "block/8472934"
console.log(parsed.metadata); // { v: "1" }
import { zkURL } from "@cubiq/sdk";
async function fetchAndVerifyProof(zkUrl: string) {
try {
const proof = await zkURL.fetch(zkUrl, {
fallbacks: ["ipfs", "arweave"], // Optional fallback sources
timeout: 5000 // Optional timeout
});
const isValid = await zkURL.verify(proof, {
checkSignature: true,
checkTimestamp: true,
maxAge: 3600 // Proof valid for 1 hour
});
if (isValid) {
console.log("Proof verified successfully!");
return proof;
} else {
throw new Error("Proof verification failed.");
}
} catch (error) {
console.error("Failed to fetch or verify proof:", error);
throw error;
}
}