Oracle DBMS_BLOCKCHAIN_TABLE
Version 21c

General Information
Library Note Morgan's Library Page Header
Which has the higher priority in your organization: Deploying a new database or securing the ones you already have? Looking for a website, and resources, dedicated solely to securing Oracle databases? Check out DBSecWorx.
Purpose A blockchain table is an append-only table designed for centralized blockchain applications.

In an Oracle Blockchain Table, peers are database users who trust the database to maintain a tamper-resistant ledger which is implemented as a blockchain table,

A blockchain table is defined and managed by the application. Existing applications can protect against fraud without requiring a new infrastructure or programming model. And, although transaction throughput is lower than for a standard heap table, performance for a blockchain table is better than for a decentralized blockchain.

The DBMS_BLOCKCHAIN_TABLE package lets you do the following:
  • delete rows in a blockchain table that are beyond the row retention defined for the blockchain table
  • get the bytes that are input to the signature algorithm so you can sign a row you inserted into the blockchain table
  • get the bytes that are input to the cryptographic hash for a row so you can verify the hash in the row
  • sign a row you inserted into a blockchain table after the row is added to a chain in the blockchain table
  • have the database verify the hashes and signatures on some or all rows in a blockchain table
AUTHID CURRENT_USER
Constants
Name Data Type Value
General
SIGN_ALGO_RSA_SHA2_256 NUMBER 1
SIGN_ALGO_RSA_SHA2_384 NUMBER 2
SIGN_ALGO_RSA_SHA2_512 NUMBER 3
SIGN_ALGO_DEFAULT NUMBER 3
Dependencies
ALL_OBJECTS DBMS_LOB NLS_DATABASE_PARAMETERS
ALL_USERS DBMS_UTILITY ORABCTAB_ROW_ARRAY_T
DBMS_ASSERT DUAL UTL_I18N
DBMS_BLOCKCHAIN_TABLE_LIB KUPM$MCP UTL_RAW
Documented Yes
Exceptions
Error Code Reason
ORA-TBD  
First Available 20c
Pragma PRAGMA SUPPLEMENTAL_LOG_DATA(default, UNSUPPORTED);
Security Model Owned by SYS with EXECUTE granted to PUBLIC
Source {ORACLE_HOME}/rdbms/admin/dbmsbctab.sql
Subprograms
 
DELETE_EXPIRED_ROWS (new 20c)
Deletes rows outside the retention window created before before_timestamp if the time stamp is specified; otherwise, deletes all rows outside the retention window. dbms_blockchain_table.delete_expired_rows(
schema_name            IN  VARCHAR2,
table_name             IN  VARCHAR2,
before_timestamp       IN  TIMESTAMP WITH TIME ZONE DEFAULT NULL,
number_of_rows_deleted OUT NUMBER);
BEGIN
 rowsDel NUMBER;
DECLARE
  dbms_blockchain_table.delete_expired_rows('UWCLASS', 'LEDGER', NULL, rowsDel);
  dbms_output.put_line(TO_CHAR(rowsDel) || ' rows deleted');
END;
/
8 rows deleted
 
GET_BYTES_FOR_ROW_HASH (new 20c)
Returns in row_data the bytes (series of {meta-data-value} {column-data-value} in column position order} for the particular row identified, followed by the hash (in data format) for previous row in the chain, in the data format supported. dbms_blockchain_table.get_bytes_for_row_hash(
schema_name IN     VARCHAR2,
table_name  IN     VARCHAR2,
instance_id IN     NUMBER,
chain_id    IN     NUMBER,
sequence_id IN     NUMBER,
data_format IN     NUMBER,
row_data    IN OUT BLOB);
PRAGMA SUPPLEMENTAL_LOG_DATA(get_bytes_for_row_hash, READ_ONLY);
TBD
 
GET_BYTES_FOR_ROW_SIGNATURE (new 20c)
Bytes returned are the bytes in the row hash. No metadata is included. dbms_blockchain_table.get_bytes_for_row_signature(
schema_name IN     VARCHAR2,
table_name  IN     VARCHAR2,
instance_id IN     NUMBER,
chain_id    IN     NUMBER,
sequence_id IN     NUMBER,
data_format IN     NUMBER,
row_data    IN OUT BLOB);
PRAGMA SUPPLEMENTAL_LOG_DATA(get_bytes_for_row_hash, READ_ONLY);
TBD
 
GET_SIGNED_BLOCKCHAIN_DIGEST (new 21c)
Undocumented dbms_blockchain_table.get_signed_blockchain_digest(
schema_name             IN     VARCHAR2,
table_name              IN     VARCHAR2,
signed_bytes            IN OUT BLOB,
signed_rows_indexes        OUT ORABCTAB_ROW_ARRAY_T,
schema_certificate_guid    OUT RAW,
signature_algo          IN     NUMBER default SIGN_ALGO_DEFAULT)
RETURN RAW;
PRAGMA SUPPLEMENTAL_LOG_DATA(get_signed_blockchain_digest, READ_ONLY);
TBD
 
IMPORT_CHAIN (new 21c)
Undocumented dbms_blockchain_table.import_chain(
schema_name IN VARCHAR2,
table_name  IN VARCHAR2,
instance_id IN NUMBER,
chain_id    IN NUMBER,
epoch_num   IN NUMBER,
hash        IN RAW,
min_seqnum  IN NUMBER,
max_seqnum  IN NUMBER);
TBD
 
IMPORT_EPOCH (new 21c)
Undocumented dbms_blockchain_table.import_epoch(
schema_name IN VARCHAR2,
table_name  IN VARCHAR2,
epoch_num   IN NUMBER,
reason_id   IN NUMBER,
pdb_guid    IN RAW,
hash_algo   IN NUMBER,
hash_format IN NUMBER);
TBD
 
SIGN_ROW (new 20c)
Provides a signature on row content of a previously inserted row. The user who inserted a row into a blockchain table is the only user that can sign the row. dbms_dbms_blockchain_table.sign_row(
schema_name      IN VARCHAR2,
table_name       IN VARCHAR2,
instance_id      IN NUMBER,
chain_id         IN NUMBER,
sequence_id      IN NUMBER,
hash             IN RAW DEFAULT NULL,
signature        IN RAW,
certificate_guid IN RAW,
signature_algo   IN NUMBER);
TBD
 
VERIFY_ROWS (new 20c)
Verifies all rows on all applicable chains for integrity of HASH column value for rows created in the range of LOW_TIMESTAMP to HIGH_TIMESTAMP. Optionally verifies row signatures. dbms_blockchain_table.verify_rows(
schema_name             IN  VARCHAR2,
table_name              IN  VARCHAR2,
low_timestamp           IN  TIMESTAMP WITH TIME ZONE DEFAULT NULL,
high_timestamp          IN  TIMESTAMP WITH TIME ZONE DEFAULT NULL,
instance_id             IN  NUMBER                   DEFAULT NULL,
chain_id                IN  NUMBER                   DEFAULT NULL,
number_of_rows_verified OUT NUMBER,
verify_signature        IN  BOOLEAN                  DEFAULT TRUE);
PRAGMA SUPPLEMENTAL_LOG_DATA(verify_rows, READ_ONLY);
TBD
 
VERIFY_TABLE_BLOCKCHAIN (new 21c)
Undocumented dbms_blockchain_table.verify_table_blockchain(
signed_bytes_latest     IN  BLOB,
signed_bytes_previous   IN  BLOB,
number_of_rows_verified OUT NUMBER);
PRAGMA SUPPLEMENTAL_LOG_DATA(verify_table_blockchain, READ_ONLY);
TBD

Related Topics
Built-in Functions
Built-in Packages
Database Security
BlockChain Tables
DBMS_BLOCKCHAIN_UTL
DBMS_TABLE_DATA
DBMS_USER_CERTS
What's New In 19c
What's New In 20c-21c

Morgan's Library Page Footer
This site is maintained by Dan Morgan. Last Updated: This site is protected by copyright and trademark laws under U.S. and International law. © 1998-2019 Daniel A. Morgan All Rights Reserved
  DBSecWorx