On-Chain Rollup History
Retrieve the history of on-chain rollup operations with transaction details and confirmation status.
Use for:
- Compliance auditing
- Debugging rollup issues
- Database state recovery
Related: rollUpOnChainStart()
| rollUpOnChainState()
No Gas Fees
This is a read-only operation that queries existing blockchain data. No gas fees are required.
Definition
await zkdb
.db(databaseName: string)
.rollUpOnChainHistory(pagination?: TPagination): Promise<TRollupOnChainHistoryResponse>;
Parameters
pagination
(TPagination, optional):{ limit: number; offset: number }
.
Returns
Promise<TRollupOnChainHistoryResponse>
: Returns a paginated list of all blockchain rollup transactions with their confirmation status, transaction hashes, and state transitions. This provides a complete audit trail of database state changes published to the blockchain, essential for compliance and recovery purposes.
type TRollupOnChainHistoryResponse = {
total: number;
offset: number;
data: Array<{
step: bigint;
txHash: string;
blockHeight: number;
timestamp: string;
}>;
};
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 history = await dbTest.rollUpOnChainHistory({ limit: 5, offset: 0 });
console.log('On-chain history:', history);
await zkdb.auth.signOut();
Result:
{
"total": 3,
"offset": 0,
"data": [
{
"step": 10,
"txHash": "0x123...",
"blockHeight": 12345,
"timestamp": "2025-01-01T00:00:00.000Z"
}
]
}