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 = await ZkDatabase.connect({
userName: "chiro-user",
privateKey: "EKFTciRxyxshZjimay9sktsn7v5PvmC5zPq7q4JnitHUytxUVnFP",
environment: "node",
// This URL is for test environment
url: "https://api.zkdatabase.org/graphql",
});
await zkdb.auth.signIn();
console.log(await zkdb.db("zkdb_test").info());
await zkdb.auth.signOut();
Returns
Promise<TDatabaseInfoResponse>
: Returns comprehensive database configuration including the database owner, Merkle tree height (affecting capacity), deployment status on blockchain, and storage usage statistics. This information is essential for understanding database capabilities and monitoring operational status.
{
"databaseName": "zkdb_test",
"databaseOwner": "chiro-user",
"merkleHeight": 64,
"appPublicKey": "",
"sizeOnDisk": null,
"deployStatus": "Unknown"
}