Calling ProvenDB from PL/SQL

Guy Harrison
ProvenDB
Published in
3 min readOct 7, 2021

We introduced ProvenDB for Oracle in a previous post — it allows us to anchor data in Oracle databases to your choice of blockchain. The resulting blockchain proofs allow you to prove the origin date of your Oracle data and to prove that the data has not been tampered with.

Originally, the functionality of ProvenDB for Oracle could only be invoked from the provendb-oracle command line. While working with early adopters, it became obvious that a PL/SQL interface would be superior — that would allow provendb-oracle functionality to be invoked from within database logic.

Therefore, the current version of ProvenDB for Oracle installs a PL/SQL interface that allows anchors to be created and validated from a database connection.

To use the PL/SQL interface we need to run provendb-oracle in the monitor mode with the — monitorRequests flag:

✗   provendb-oracle monitor --monitorRequests
15:40:05.292 INFO Monitoring with 120 s interval.
15:40:05.292 INFO Looking for new requests in the provendbRequests table
15:40:05.384 INFO Sleeping for 120 seconds
15:40:05.384 INFO Will awake on dbms_alert
15:41:24.184 INFO Looking for new requests in the provendbRequests table

The provendboracle PL/SQL package has two main entry points. The fanchorrequest function creates a blockchain anchor for selected data. The function accepts a table name, an optional column list, where clause and key column:

If the KEYCOLUMN argument is not provided, then we’ll use ROWID as the key for each proof. COLUMNLIST allows us to restrict the columns included in a proof. This means that you can allow a user to change some columns without invalidating the proof. For instance, it might be OK for a “last accessed” column to be updated, but not a “signature date” column.

We can check the status of the anchor request by accessing the PROVENDBREQUESTS table:

To validate a proof we call the FVALIDATEREQUEST method:

FVALIDATEREQUEST recomputes the hashes for all rows involved in the proof and compares the root hash to that stored on the blockchain. This proves indisputably that the data concerned has not been changed since the proof was created:

If any tampering has occurred, we’ll list the keys for the invalid rows.

Provendb for Oracle has other capabilities — you can read more about those capabilities in the documentation or in our last blog post.

Give it a try

ProvenDB for Oracle is available now!. You can download the binaries for Linux, windows or mac here, and follow the instructions in the documentation to install the utility. We’d love to hear what you think.

ProvenDB uses Blockchain technology to provide the world’s first entirely trustworthy database. Immutable versions of database state are anchored to the Blockchain, delivering an unparalleled level of data integrity. ProvenDB allows developers to build high-performance applications that include cryptographic proof of data integrity and provenance without having to understand Blockchain programming complexities. Setup a free account today at ProvenDB.com.

--

--

Guy Harrison
ProvenDB

CTO at ProvenDB.com. Author of many books on database technology. Hopeless old geek. http://guyharrison.net