pg_credereum
pg_credereum · Cryptographically verifiable database auditing backed by blockchain-style transaction blocks.
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 100028 | pg_credereum | pg_credereum | 0.1 | SEC | GPL-3.0 | C |
PostgreSQL · 10
| Relationships | |
|---|---|
| Requires | plpgsql |
Usage
Sources:
pg_credereum is a PostgreSQL 10 prototype for cryptographically verifiable row-change history. Clients sign transaction changesets, a background worker packs them into Merkle-tree blocks, and block hashes can optionally be published to an Ethereum smart contract. Upstream explicitly says it is not production-ready.
Core Workflow
Preload the library, choose the single database and extension schema to manage, then restart the server:
Create the extension and attach its accumulator trigger to tables with exactly one bigint primary-key column named id:
Within a transaction, perform DML, call credereum_get_changeset() and verify the returned proof, then sign it with credereum_sign_transaction(pubkey text, sign bytea) before committing.
API and Configuration
credereum_get_changeset(): returns Merkle-proof rows for changes made by the current transaction.credereum_sign_transaction(text, bytea): records the client’s public key and signature.credereum_merkle_proof(varbit[]): returns history/proof data for selected Merkle keys.credereum_tx_logandcredereum_block: transaction and block history.pg_credereum.block_retry_period: retry interval, default5000ms.pg_credereum.eth_end_point,pg_credereum.eth_source_addr, andpg_credereum.eth_contract_addr: optional Ethereum publication settings.
Caveats
The extension requires PostgreSQL 10 plus its documented Ethereum, CURL, and Jansson build dependencies. It manages only the database named by pg_credereum.database. TRUNCATE is not tracked, and the same row cannot be modified twice within one block; such a second modification raises a unique-constraint error. A shorter block_period can reduce that collision window.
If publishing a block hash to Ethereum fails, the worker skips that hash and tries the next block, so the trusted store can legitimately have gaps. Treat this project as a research prototype, independently verify every proof/signature path, and never use its existence alone as evidence that data is untampered.