Skip to main content

Get Database Information

The info method allows you to retrieve important settings related to a specific database, including the public key and Merkle tree height. These settings are crucial for understanding the cryptographic configuration of the database.

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 database info
const info = (await dbTest.info()).unwrap();
console.log(info);

Returns​

  • A promise that resolves to a TDatabaseInfoResponse object containing the database's public key and Merkle tree height.
{
"databaseName": "zkdb_test",
"databaseOwner": "chiro-user",
"merkleHeight": 64,
"appPublicKey": "",
"sizeOnDisk": null,
"deployStatus": "Unknown"
}