Start On-Chain Rollup
Publish off-chain database operations to the blockchain as an immutable, verifiable record.
Prerequisites Required
Before starting an on-chain rollup, ensure:
- Database is deployed: The database must be deployed on-chain with
deployStatus = "Confirmed"
- Off-chain proofs exist: At least one valid off-chain proof must be generated from document operations
- No duplicate rollups: Cannot rollup the same proof twice (prevents duplicate transactions)
- Sequential integrity: All failed operations must be resolved before rollup (check
proverStatus()
) - Gas fees: Sufficient wallet balance for blockchain transaction costs
Related checks: rollUpOffChainState()
| proverStatus()
| zkProofStatus()
When to use:
- After multiple document operations
- When blockchain verification is required
- Before audits or milestones
Off-Chain Operations Include
Rollup aggregates these document operations that have been processed off-chain with valid zero-knowledge proofs:
insert()
- Document creation operationsupdate()
- Document modification operationsdrop()
- Document deletion operations
Each operation must have a successful proof before being included in rollup.
Definition
await zkdb
.db(databaseName: string)
.rollUpOnChainStart(): Promise<boolean>;
Parameters
- None
Returns
Promise<boolean>
: Returnstrue
when the on-chain rollup process is successfully initiated and the transaction is queued for blockchain submission. This confirms that all prerequisites are met and the rollup operation has begun, though blockchain confirmation may take additional time.
Example
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();
const dbTest = zkdb.db('zkdb_test');
const result = await dbTest.rollUpOnChainStart();
console.log('Rollup started:', result);
await zkdb.auth.signOut();
Result:
true