CN113515772B - Database query log information uplink method based on RPCA consensus mechanism - Google Patents

Database query log information uplink method based on RPCA consensus mechanism Download PDF

Info

Publication number
CN113515772B
CN113515772B CN202110425803.1A CN202110425803A CN113515772B CN 113515772 B CN113515772 B CN 113515772B CN 202110425803 A CN202110425803 A CN 202110425803A CN 113515772 B CN113515772 B CN 113515772B
Authority
CN
China
Prior art keywords
query
transaction
processing
database
defining
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202110425803.1A
Other languages
Chinese (zh)
Other versions
CN113515772A (en
Inventor
贺建峰
胡杨升
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Kunming University of Science and Technology
Original Assignee
Kunming University of Science and Technology
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Kunming University of Science and Technology filed Critical Kunming University of Science and Technology
Priority to CN202110425803.1A priority Critical patent/CN113515772B/en
Publication of CN113515772A publication Critical patent/CN113515772A/en
Application granted granted Critical
Publication of CN113515772B publication Critical patent/CN113515772B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/62Protecting access to data via a platform, e.g. using keys or access control rules
    • G06F21/6218Protecting access to data via a platform, e.g. using keys or access control rules to a system of files or objects, e.g. local or distributed file system or database
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/34Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment
    • G06F11/3466Performance evaluation by tracing or monitoring
    • G06F11/3476Data logging
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/21Design, administration or maintenance of databases
    • G06F16/217Database tuning
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/242Query formulation
    • G06F16/2433Query languages

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Databases & Information Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Computer Hardware Design (AREA)
  • Software Systems (AREA)
  • Computer Security & Cryptography (AREA)
  • General Health & Medical Sciences (AREA)
  • Bioethics (AREA)
  • Health & Medical Sciences (AREA)
  • Mathematical Physics (AREA)
  • Computational Linguistics (AREA)
  • Quality & Reliability (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention relates to a database query log information uplink method based on an RPCA consensus mechanism, and belongs to the technical field of block chains. The invention defines a new transaction type for processing the operation of the uplink of the query log; secondly, defining access classes compatible with the on-chain and off-chain databases, and checking the validity of the query statement; and finally, storing the query log on the blockchain network in a mode of first consensus and then query, and simultaneously returning the queried actual data. The method provided by the invention can save the commonly-known actual database query log into the blockchain, and provides a firmer guarantee for the non-tamper property, auditability and openness of the traditional database.

Description

Database query log information uplink method based on RPCA consensus mechanism
Technical Field
The invention relates to the technical field of blockchains, in particular to a database query log information uplink method based on an RPCA consensus mechanism.
Background
Blockchain technology is vigorously developed, and the third generation blockchain technology development stage is entered. Blockchain technology goes from the financial phase to the multi-industry development phase. In this process, many new demands are made, and new solutions are also called for. In a medical scenario, storing patient information through a link-up-link-down log has been a widely accepted method, which places the log of a traditional database into a blockchain network, and does not need to make too great changes to the original data of a hospital while improving the non-tamper property, auditability and openness of the original system.
From a demand perspective, there is no demand for query log uplink for existing blockchain networks due to financial scenario restrictions. The local account book information is queried, and as the copies of each node in the network are the same and all transaction records are disclosed, each account can query the transaction information of all other accounts. However, in a medical setting, patient information is extremely sensitive and requires a complete access record, so it is necessary to place the query log into the blockchain.
From a technical perspective, the addition, deletion, and modification of transaction transactions (transactions) by the existing blockchain system are recorded on the blockchain. The operations of inserting, deleting and modifying belong to the operation of writing data into the blockchain network, and only a small amount of information is needed, such as success or failure, the number of affected databases and the like. The query is different, and the data (query condition and the like) is required to be written into the blockchain when the data is read from the blockchain network. However, the current blockchain networks are all blockchain ledgers of the query nodes, and have no function of putting any query log information into the blockchain log.
Rayleigh (rib) is the first open payment network in the world, and rayleigh blockchain is a validated and excellent financial blockchain network, and the consensus scheme RPCA (Ripple Consensus Algorithm) used is a low-delay consensus scheme in addition to PBFT (practical bayer fault tolerance algorithm). In a blockchain network in a medical scenario, RPCA has greater flexibility than PBFT. Based on RPCA consensus protocol, we propose a specific method for data query log information uplink to solve the current problems.
Disclosure of Invention
In view of the foregoing drawbacks or shortcomings in the prior art, the present invention provides a method for database query log chaining based on RPCA consensus protocol. The method carries out innovation and reconstruction on the flow of the blockchain network under the RPCA protocol mechanism, so that the method can realize the uplink of the query log.
To implement the functionality of data querying while simultaneously linking logs, new commands, transaction types, and related processing classes need to be defined. In this scenario, not the patient's data, but rather a log of a traditional database, is stored in the blockchain, and the blockchain log database and the patient database are referred to herein as D log and D data, respectively.
The invention defines new transaction type for processing the operation of the uplink of the query log; secondly, defining access classes compatible with the on-chain and off-chain databases, and checking the validity of the query statement; and finally, storing the query log on the blockchain network in a mode of first consensus and then query, and simultaneously returning the queried actual data.
Further, the method comprises the following specific steps:
Step1, defining a new transaction type in the Rainbow network for processing the new transaction type; specifically, a transaction type RecordQueryLog is defined for processing the query log uplink;
Step2, defining a processing class for converting a transaction into an SQL statement query, herein named Tx2SQLOp, for compatible read-write access to database D log and database D data; the definition method analyzes the transaction into database operation; the definition method checks the query condition;
step3, defining (remote procedure call) an RPC service command r_get_on_chain, which is a client operation that can be used to link a log while querying data; adding an r_get_on_chain command in the RPC command list, and adding a processing method doGetRecordOnChain pointed by the command;
step4, process the data query using the processing method doGetRecordOnChain of the r_get_on_chain command, and store the database query log information into the region chain while processing the data query.
Further, the Step1 specifically comprises the following steps:
step1.1, defining a method for processing 'take-off preparation', checking whether related fields are provided in a transaction, including a data owner, a database table to be operated, and query conditions; filling a transaction serial number and a previous account book serial number;
step1.2, defining a method for processing statement preparation, and checking whether an account name is legal or not and whether a database table name is legal or not;
Step1.3, defining a method for processing an application transaction, generating a Hash for the transaction, and using the Hash for a subsequent transaction unique mark; calling a current account book to update a related state;
Step1.4, defining a processing class for calling Step2, and executing the attempted SQL statement of the database D data to obtain a result of success or failure of execution.
Further, the Step4 specifically comprises the following steps:
Step4.1, checking the identity of the caller; in a medical scene, the authority is strictly controlled, a patient can only inquire own records, and only authorized doctors can inquire the records of the corresponding patients; this step requires ensuring that the sender's account and key have the rights to query the required records;
Step4.2, after verifying that the query log information passes, submitting the transaction to an RPCA consensus mechanism for consensus processing according to the transaction of Step1, wherein the transaction comprises the serialization information of the query log besides normal transaction meta information, and the information is sent to a consensus network to wait for consensus; after the consensus is successful, the transaction is stored in a blockchain database for the next step; otherwise, jumping to step4.6;
step4.3, inversely sequencing the uplink transaction, and extracting the transaction content information therein; query condition information for transaction type RecordQueryLog is defined herein;
step4.4, analyzing the query log information, organizing the query log information into query SQL sentences, calling global database connection and querying data;
Step4.5, inquiring to obtain a result, and arranging the result into a format suitable for RPC network transmission;
Step4.6, adding Hash verification of the returned result, and organizing the returned result of the RPC; if the data is queried, returning corresponding data; otherwise, returning error information and error type.
The beneficial effects of the invention are as follows:
Defining a new transaction type for processing the uplink operation of the query log; secondly, defining access classes compatible with the on-chain and off-chain databases to check the validity of the query statement; and finally, storing the query log on the blockchain network in a mode of first consensus and then query, and simultaneously returning the queried actual data. The method provided by the invention can save the query log of the patient database which is subjected to consensus into the blockchain, and provides a firmer guarantee for the non-tamper property, auditability and openness of the traditional database.
Drawings
Other features, objects, and advantages of the present application will become more apparent upon reading the detailed description taken in conjunction with the following drawings in which:
FIG. 1 is a process of processing an RPC request by a RAKE blockchain network node service of the present invention;
FIG. 2 is a flow chart of a query log uplink processing method doGetRecordOnChain of the present invention;
fig. 3 is a diagram illustrating a process of checking for inquiry uplink information by Tx2SQLOp according to the present invention;
FIG. 4 is an exemplary query RPC request of the present invention;
FIG. 5 is an RPC response of an exemplary query of the present invention.
Detailed Description
Example 1: 1-3, a database query log information uplink method based on an RPCA consensus mechanism firstly defines a new transaction type for processing the query log uplink operation; secondly, defining access classes compatible with the on-chain and off-chain databases, and checking the validity of the query statement; and finally, storing the query log on the blockchain network in a mode of first consensus and then query, and simultaneously returning the queried actual data.
Further, the method comprises the following specific steps:
Step1, defining a new transaction type in the Rainbow network for processing the new transaction type; specifically, a transaction type RecordQueryLog is defined for processing the query log uplink;
step1.1, defining a method for processing 'take-off preparation', checking whether related fields are provided in a transaction, including a data owner, a database table to be operated, and query conditions; filling a transaction serial number and a previous account book serial number;
step1.2, defining a method for processing statement preparation, and checking whether an account name is legal or not and whether a database table name is legal or not;
Step1.3, defining a method for processing an application transaction, generating a Hash for the transaction, and using the Hash for a subsequent transaction unique mark; calling a current account book to update a related state;
Step1.4, defining a processing class for calling Step2, and executing the attempted SQL statement of the database D data to obtain a result of success or failure of execution.
Step2, defining a processing class for converting a transaction into an SQL statement query, herein named Tx2SQLOp, for compatible read-write access to database D log and database D data; the definition method analyzes the transaction into database operation; the definition method checks the query condition;
step3, defining (remote procedure call) an RPC service command r_get_on_chain, which is a client operation that can be used to link a log while querying data; adding an r_get_on_chain command in the RPC command list, and adding a processing method doGetRecordOnChain pointed by the command;
step4, process the data query using the processing method doGetRecordOnChain of the r_get_on_chain command, and store the database query log information into the region chain while processing the data query.
Step4.1, checking the identity of the caller; in a medical scene, the authority is strictly controlled, a patient can only inquire own records, and only authorized doctors can inquire the records of the corresponding patients; this step requires ensuring that the sender's account and key have the rights to query the required records;
Step4.2, after verifying that the query log information passes, submitting the transaction to an RPCA consensus mechanism for consensus processing according to the transaction of Step1, wherein the transaction comprises the serialization information of the query log besides normal transaction meta information, and the information is sent to a consensus network to wait for consensus; after the consensus is successful, the transaction is stored in a blockchain database for the next step; otherwise, jumping to step4.6;
step4.3, inversely sequencing the uplink transaction, and extracting the transaction content information therein; query condition information for transaction type RecordQueryLog is defined herein;
step4.4, analyzing the query log information, organizing the query log information into query SQL sentences, calling global database connection and querying data;
Step4.5, inquiring to obtain a result, and arranging the result into a format suitable for RPC network transmission;
Step4.6, adding Hash verification of the returned result, and organizing the returned result of the RPC; if the data is queried, returning corresponding data; otherwise, returning error information and error type.
After the steps are defined, the client can call the r_get_on_chain command and input related parameters to query. Figures 4 and 5 present a successful query example that uses Postman software to invoke access to the blockchain network via RPC. Fig. 4 shows the RPC request issued, and fig. 5 shows the result returned by the RPC.
The calling method can be seen in fig. 4 as r_get_on_chain, and the incoming parameters include participation in the common identification offlip, account private key secret, transaction content tx_json. The transaction content includes transaction type RecordQueryLog, sending RPC requester Account Account, account Owner to which data authority belongs, lookup table Tables, and query condition Raw. The request queries a table named table_test2, provided that id=1 or name= "alice", described in JSON format. It can be seen in fig. 5 that the correct result is obtained, including 0 representing the verification diff, representing the verification pass; the queried data lines which meet the conditions represent a data array; success, representing status of RPC communication; the tx_hash representing the current uplink transaction sequence number represents the hash sequence number of the uplink transaction, which can use the original tx command to view the details of the transaction.
While the present invention has been described in detail with reference to the drawings, the present invention is not limited to the above embodiments, and various changes can be made without departing from the spirit of the present invention within the knowledge of those skilled in the art.

Claims (2)

1. A method for uploading database query log information based on an RPCA consensus mechanism is characterized by comprising the following steps: firstly, defining a new transaction type for processing the operation of the uplink of the query log; secondly, defining access classes compatible with the on-chain and off-chain databases, and checking the validity of the query statement; finally, storing the query log on the block chain network in a mode of first consensus and then query, and simultaneously returning the queried actual data;
The method comprises the following specific steps:
Step1, defining a new transaction type in the Rainbow network for processing the new transaction type; defining a transaction type RecordQueryLog for processing the query log uplink;
Step2, defining a processing class for converting a transaction into an SQL statement query, herein named Tx2SQLOp, for compatible read-write access to database D log and database D data; the definition method analyzes the transaction into database operation; the definition method checks the query condition;
Step3, defining a Remote Procedure Call (RPC) service command r_get_on_chain, which is a client operation capable of being used for linking a log while inquiring data; adding an r_get_on_chain command in the RPC command list, and adding a processing method doGetRecordOnChain pointed by the command;
Step4, processing the data query by using a processing method doGetRecordOnChain of the r_get_on_chain command, and storing the database query log information into a region chain while processing the data query;
The specific steps of Step4 are as follows:
Step4.1, checking the identity of the caller; this step requires ensuring that the sender's account and key have the rights to query the required records;
Step4.2, after verifying that the query log information passes, submitting the transaction to an RPCA consensus mechanism for consensus processing according to the transaction of Step1, wherein the transaction comprises the serialization information of the query log besides normal transaction meta information, and the information is sent to a consensus network to wait for consensus; after the consensus is successful, the transaction is stored in a blockchain database for the next step; otherwise, jumping to step4.6;
step4.3, inversely sequencing the uplink transaction, and extracting the transaction content information therein; query condition information for transaction type RecordQueryLog is defined herein;
step4.4, analyzing the query log information, organizing the query log information into query SQL sentences, calling global database connection and querying data;
Step4.5, inquiring to obtain a result, and arranging the result into a format suitable for RPC network transmission;
Step4.6, adding Hash verification of the returned result, and organizing the returned result of the RPC; if the data is queried, returning corresponding data; otherwise, returning error information and error type.
2. The method for linking database query log information based on an RPCA consensus mechanism according to claim 1, wherein: the specific steps of Step1 are as follows:
step1.1, defining a method for processing 'take-off preparation', checking whether related fields are provided in a transaction, including a data owner, a database table to be operated, and query conditions; filling a transaction serial number and a previous account book serial number;
step1.2, defining a method for processing statement preparation, and checking whether an account name is legal or not and whether a database table name is legal or not;
Step1.3, defining a method for processing an application transaction, generating a Hash for the transaction, and using the Hash for a subsequent transaction unique mark; calling a current account book to update a related state;
Step1.4, defining a processing class for calling Step2, and executing the attempted SQL statement of the database D data to obtain a result of success or failure of execution.
CN202110425803.1A 2021-04-20 2021-04-20 Database query log information uplink method based on RPCA consensus mechanism Active CN113515772B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110425803.1A CN113515772B (en) 2021-04-20 2021-04-20 Database query log information uplink method based on RPCA consensus mechanism

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110425803.1A CN113515772B (en) 2021-04-20 2021-04-20 Database query log information uplink method based on RPCA consensus mechanism

Publications (2)

Publication Number Publication Date
CN113515772A CN113515772A (en) 2021-10-19
CN113515772B true CN113515772B (en) 2024-05-28

Family

ID=78061466

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110425803.1A Active CN113515772B (en) 2021-04-20 2021-04-20 Database query log information uplink method based on RPCA consensus mechanism

Country Status (1)

Country Link
CN (1) CN113515772B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115062094B (en) * 2021-12-30 2024-03-29 昆明理工大学 Relational database content synchronization method based on Fabric
CN114969214B (en) * 2021-12-30 2024-08-06 昆明理工大学 Relational database tamper-proof method based on super account book Fabric
CN115051807B (en) * 2022-06-02 2024-05-24 昆明理工大学 Zero-knowledge identity authentication method based on super account book Fabric
CN115357664B (en) * 2022-10-21 2023-03-21 北京航空航天大学 Multidirectional trusted system based on block chain and data query method

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108390891A (en) * 2018-03-28 2018-08-10 电子科技大学天府协同创新中心 Information protecting method based on privately owned block chain
WO2019205860A1 (en) * 2018-04-27 2019-10-31 腾讯科技(深圳)有限公司 Blockchain-based data query method, server and storage medium

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP3767569A1 (en) * 2019-07-18 2021-01-20 Mastercard International Incorporated An electronic transaction method and device using a flexible transaction identifier

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108390891A (en) * 2018-03-28 2018-08-10 电子科技大学天府协同创新中心 Information protecting method based on privately owned block chain
WO2019205860A1 (en) * 2018-04-27 2019-10-31 腾讯科技(深圳)有限公司 Blockchain-based data query method, server and storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
基于链上链下相结合的日志安全存储与检索;吕建富 等;计算机科学;第47卷(第3期);第298-303页 *

Also Published As

Publication number Publication date
CN113515772A (en) 2021-10-19

Similar Documents

Publication Publication Date Title
CN113515772B (en) Database query log information uplink method based on RPCA consensus mechanism
US11811769B2 (en) Systems, methods, and apparatuses for implementing a declarative, metadata driven, cryptographically verifiable multi-network (multi-tenant) shared ledger
US11764950B2 (en) System or method to implement right to be forgotten on metadata driven blockchain using shared secrets and consensus on read
US11824864B2 (en) Systems, methods, and apparatuses for implementing a declarative and metadata driven blockchain platform using distributed ledger technology (DLT)
CN110785760B (en) Method and system for registering digital documents
CN112559627A (en) Alliance chain-based on-chain-under-chain collaborative electronic medical record data sharing method
US7562215B2 (en) System and method for electronic document security
CN111309454B (en) Method and system for realizing service arrangement data context sharing and management control under micro-service architecture
JP2004127273A (en) Bidirectional meta-directory agent, method and computer readable medium
JP2005526334A (en) Application generator
US20230289782A1 (en) Smart contract-based data processing
US6411963B1 (en) External system interface method and system
CN111506589B (en) Block chain data service system, access method and storage medium based on alliance chain
CN113643040A (en) Cross-block-chain transaction verification method
US7287040B2 (en) Test strategy system and method for accounts held direct at-fund
CN115082058B (en) Virtual account transaction management method and system based on dynamic control
CN109120411B (en) Asset securitization basic asset data collection method and device
CN113806817B (en) Method for constructing twin NFT, NFT protocol and system for full trusted storage
KR102413114B1 (en) Open API management system for accepting telegram transaction service conversion processing and the method thereof
US7188109B1 (en) Cool ICE utilization of digital certificates
CN112711592B (en) Data indexing method based on block chain
KR101039419B1 (en) Method for Processing Plural Call Messages
Weippl et al. A new approach to secure federated information bases using agent technology
CN117633099A (en) Block chain-based data processing method, equipment and readable storage medium
US20040148519A1 (en) Sensitive data retrieval system and method

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant