This distribution contains Java source code and configuration file samples that enable independent verification of Oracle Blockchain table data. The sample program also provide an example for publishing Oracle crypto-hashes to a Hyperledger fabric.
Oracle Database version 19.10 and above support the creation of Blockchain tables. The data format for Blockchain table column data is described in the Oracle Database Administrator's guide
Software:
- Oracle Database 19.10 or higher
- Java version 9 or higher
- JSON-Java distributable
Services:
The Blockchain verification program Verify_Rows.java requires the following information for connecting to the Database. This information should be updated in the configuration file config.properties in the VerifyRows directory.
hostname: Name of the Oracle Database Hostoracle_sid: Oracle Database SIDport: Port for Database connections
Verify_Rows.java requires Oracle JDBC Driver Jar version 8.0, please ensure that ojdbc8.jar is available in the Java CLASSPATH before building Verify_Rows.java. To build, execute the following:
cd VerifyRows
javac *.java
Verify_Rows.java verifies the rows in a Blockchain table, the program requires the following input parameters:
COPY_BYTESFILE_FOR_FAILED: Boolean parameter specifying whether a failed verification should create an output file. The output file name contains contains the instance, chain and sequence number of the first row failing verification, for example bytes_1_1_2.dat indicates instance 1, chain_id 1, and sequence_no 2 failed verification.SCHEMA: Database schema for accessing the Blockchain tableTABLE: Table name for an Oracle Blockchain tableINSTANCE_ID: (Optional) The instance ID for the RAC instance whose chains should be verifiedCHAIN_ID: (Optional) Chain ID for a specific chain (valid values: 1-32)SEQUENCE_NO: (Optional) Sequeuence number for a specific row in the blockchain table
Verify_Rows.java uses the current directory for creating intermediate files used for the purpose of row verification. The following is a sample output for Verify_Rows.java when a schema name and the blockchain table name are provided as input, implying the verification of all rows in the table across all instances and chains.
$java Verify_Rows true sample_schema sample_table
Verified 2 rows for instance id : 2 , chain id : 1
Verified 2 rows for instance id : 2 , chain id : 2
Verified 4 rows for instance id : 2
Verified 2 rows for instance id : 3 , chain id : 1
Verified 2 rows for instance id : 3 , chain id : 2
Verified 4 rows for instance id : 3
Verified a total of 8 rows
Deleted the file : bytesfile.dat
PublishHash.java requires the following configuration information to connect to an Oracle Database and the Oracle Blockchain platform. This information should be updated in the configuration file config.properties in the PublishHash dir.
hostname: Name of the Oracle Database Hostoracle_sid: Oracle Database SIDport: Port for Database connectionsrest_server_url: URL for the REST serverrest_server_port: Port for the REST serverchannel_id: Channel IDchaincode_name: Chaincode Name
PublishHash.java requires json-java.jar and Oracle JDBC Driver Jar version 8.0, . Please ensure json-java.jar and ojdbc8.jar are available in the Java CLASSPATH before building PublishHash.java. To build execute the following
cd PublishHash
javac *.java
Parameters: PublishHash.java requires the following input parameters:
Operation: Specifying whether the action is toreadorwritefrom/to the Blockchain platformSCHEMA:` Schema name for the Blockchain tableTable: Blockchain table NameInstance_Id: Database instance IDChain_Id: Chain Id for the row whose crypto-hash is being read/written from/to the Blockchain platformSequence_No: Sequence number for the row whose crypto-hash is being read/written from/to the Blockchain platform
Sample usage output for PublishHash.java is listed below:
$java PublishHash write sample_schema sample_table 1 1 1
Insert Sucessful!
Txn Id : 03a16b4e24f8e3ff12b3112ece791bc6aad8cd53abf520389e972bb13607be64
Published Hash : FCAD2F699877B17054EC5FD13D54478BB12ED3F5F98B8FD014046A4460124A82516663A9EA421F974C5E135656AFE9AE39B3CC742E280FBDAA2FACAD950A0D1F