Skip to main content

Get Verification Key

The verificationKey method allows you to retrieve important verification keys associated with specific contracts in the database. These keys include details like the Merkle tree height, key hashes, and raw encoded data. They are essential for verifying zero-knowledge proofs and understanding the cryptographic configuration of the system.

Method Signature​

const verificationKey = (await zkdb.db(databaseName).verificationKey()).unwrap();

Syntax​

import { ZkDatabase } from 'zkdb';

const zkdb = new ZkDatabase({
apiKey: 'zkdb_536aac02a1b7.c001b6b8f...da3aa4185d8d2ad07f0ae94aT',
// This URL is for test environment
url: "https://serverless.zkdatabase.org/graphql",
});
const dbTest = zkdb.db('zkdb_test');

// Get verification key
const verificationKey = (await dbTest.verificationKey()).unwrap();
console.log('Verification key retrieved, length:', verificationKey);

Returns​

  • A promise that resolves to a VerificationKey object or null if no verification keys are available.