CN112966001A - BCTkPQ query method based on block chain - Google Patents

BCTkPQ query method based on block chain Download PDF

Info

Publication number
CN112966001A
CN112966001A CN202110216456.1A CN202110216456A CN112966001A CN 112966001 A CN112966001 A CN 112966001A CN 202110216456 A CN202110216456 A CN 202110216456A CN 112966001 A CN112966001 A CN 112966001A
Authority
CN
China
Prior art keywords
transaction
index
query
path
score
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.)
Granted
Application number
CN202110216456.1A
Other languages
Chinese (zh)
Other versions
CN112966001B (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.)
Northeastern University China
Original Assignee
Northeastern University China
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 Northeastern University China filed Critical Northeastern University China
Priority to CN202110216456.1A priority Critical patent/CN112966001B/en
Publication of CN112966001A publication Critical patent/CN112966001A/en
Application granted granted Critical
Publication of CN112966001B publication Critical patent/CN112966001B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • 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/245Query processing
    • G06F16/2455Query execution
    • 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/22Indexing; Data structures therefor; Storage structures
    • 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/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computational Linguistics (AREA)
  • Computing Systems (AREA)
  • Software Systems (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention discloses a BCTkPQ query method based on a block chain, which comprises the following steps of 1: constructing a collaborative query framework CQM; step 2: constructing a source-destination S-D index, and constructing a business logic relation in each transaction; and step 3: on the basis of the S-D index, constructing a path-score P-SC index according to a query request sent by a user, establishing a mapping relation between the path and the transaction score, wherein the P-SC index and the S-D index form a secondary index; and 4, step 4: and acquiring the first k transactions with the highest score of the weight W on the attribute O in the transaction of the path p in the query request. Based on the CQM model and the secondary index, the block chain-based BCTkPQ quick query can be realized, and the query efficiency is improved along with the increase of the number of CP nodes and the number of users.

Description

BCTkPQ query method based on block chain
Technical Field
The invention relates to the technical field of path query, in particular to a BCTkPQ query method based on a block chain.
Background
Currently, blockchains have received a high degree of attention from the industry and academia as the cornerstone of cryptocurrency systems. Blockchains have been successfully applied in various realistic scenarios, such as internet of things, smart medicine, supply chain, database architecture, data service outsourcing, and the like. A blockchain may be viewed as a distributed database maintained by nodes that are not fully trusted by each other through a consensus protocol. According to different scenes, the blockchain can design a specific transaction model according to specific business logic. Among them, a common transaction model is based on financial transactions, which represent transfer information between banks or financial institutions. Obviously, in a financial transaction scenario, the blockchain may safely and completely store the user's financial bills and daily transfer records. All transaction data contain useful information and knowledge, express business preference of users in different scenes, and can be used for improving the quality of application services such as data analysis, data security, recommendation systems and the like. Thus, there is an increasing demand for diversified query processing.
The traditional query method is to send a query request to a complete node that maintains a complete block and transaction, and to obtain a eligible transaction by traversing all blocks of the entire blockchain. Obviously, the efficiency of this solution is too low to meet the large number of query requirements. The main reason for the inefficiency is that the entire node needs to traverse all the blockchain data stored in the local storage, resulting in a too high computational workload.
Disclosure of Invention
Aiming at the defects of the prior art, the invention provides a BCTkPQ query method based on a block chain. For a top-k transaction Path Query (BCTkPQ) in a block chain, the first k transactions in a given Query Path p that satisfy a specified condition are returned.
In order to solve the technical problems, the technical scheme adopted by the invention is as follows: a BCTkPQ query method based on a block chain comprises the following steps:
step 1: constructing a collaboration Query framework CQM (collaborative Query model) comprises three key parts, namely an application programming interface API, a collaboration network CN (collaborative network) maintained by a group of collaboration peers CP (collaborative peer), and a block chain BC (Block chain) for storing original transaction data; wherein the API comprises a distributor and a responder;
step 2: constructing a Source-Destination S-D (Source-Destination) index, and constructing a business logic relationship in each transaction, wherein the process comprises the following steps:
step 2.1: initializing three sets < S, D, E > for storing the logic of each transaction;
step 2.2: definition of TxDefining T for transactions on blockchains, according to a general financial transfer operation between accountsxHas the structure of Tx={ID,TxHash, from, to, O }, where ID denotes TxSerial number of (1), TxHash represents TxThe hash value of (a) of (b),<from,to>the field being a representation of TxThe business logic of the transmission operation is called a transaction path p, O is the rest attribute of the transaction when the block chain transaction TxWith m attributes, O is { attr1,attr2,……,attrmAttr is a certain attribute;
step 2.3: traversing all transactions on the blockchain, and dividing TxThe from field and the to field of (1) are added to the S set and the D set respectively;
step 2.4: the path of the current transaction is saved to the E-set, i.e., p → < from, to >.
And step 3: on the basis of the S-D index, according to a query request < P, k, W, O > sent by a user, a Path-Score P-SC (Path-Score) index is constructed, a mapping relation between the Path and the transaction Score is established, and the P-SC index and the S-D index form a secondary index; wherein p is a transaction path, O is a set of other attributes of the transaction, W is a weight set, and k is the first k transactions with the highest query score. The specific process is as follows:
step 3.1: obtaining newly added path p in E set of S-D indexi
Step 3.2: when p is obtainediWhen the P-SC index does not exist, a new packet is created to store the path PiI.e. pi→<Txi>Adding to bucketiPerforming the following steps;
step 3.3: when p is obtainediWhen the P-SC index exists, acquiring a corresponding bucket and storing PiCorresponding TxiGo to bucket.
And 4, step 4: obtaining the query result, assuming that the user sends the query request < p, k, W, O >, so as to obtain the first k transactions with the highest score of the weight W on the attribute O in the transactions with the path p ═ from, to >, and the process is as follows:
step 4.1: the user broadcasts the request < p, k, W, O > to all CPs through the distributor of CQM;
step 4.2: each CP gets all the contents P → in the local P-SC index<from*,to*>According to the weight set W in the query condition, the transaction score of the packet is calculatedi
The transaction scoreiThe calculation method of (2) is as follows:
Fs(Tx)=∑attri×wi
wherein, Fs(Tx) Score for a transactioni,attriFor a transaction TxThe ith attribute of (1), wi≧ 0 is the ith value of weight set W in query condition, and is the corresponding attribute attriThe weight of (c).
Step 4.3: according to the transactions score, sorting from big to small, adding the first k blockchain transactions with the highest scores in the bucket into a result set resultSet;
step 4.4: calculating digest for the resultSet, and broadcasting the digest to other CPs;
step 4.5: when the received digests are all the same and the number exceeds a given threshold (the common threshold is set to be two thirds of the number of all CPs), a resultSet is returned, the current calculation is terminated and the next call is waited.
Adopt the produced beneficial effect of above-mentioned technical scheme to lie in:
1. the method for processing the BCTkPQ problem based on the collaborative query model CQM can realize the BCTkPQ fast query based on the block chain.
2. The query method constructs a secondary index based on the P-SC index and the S-D index, compared with the traditional query method, the diversified query method based on the secondary index can improve the query efficiency and reduce the number of the nodes, and the whole node needs to traverse all block chain data stored in a local storage, thereby causing overhigh calculation workload. Based on a CQM model and a secondary index, the block chain-based BCTkPQ quick query can be realized, and the query efficiency can be improved along with the increase of the number of CP nodes and the number of users.
Drawings
FIG. 1 is a schematic structural diagram of a collaborative query framework in an embodiment of the present invention;
FIG. 2 is a flow chart of the construction of an S-D index according to an embodiment of the present invention;
FIG. 3 is a flowchart of constructing a P-SC index according to an embodiment of the present invention;
FIG. 4 is a diagram illustrating a structure of a secondary index according to an embodiment of the present invention;
FIG. 5 is a flow chart of a query process in an embodiment of the invention.
Detailed Description
The following detailed description of embodiments of the present invention is provided in connection with the accompanying drawings and examples. The following examples are intended to illustrate the invention but are not intended to limit the scope of the invention.
In this embodiment, 3 subscribers S are usedU={U1,U2,U3Where five nodes CP ═ P1,P2,…,P5The experiment was performed with 100 pieces of data, each in the format of Tx={ID,TxHash, from, to, money }. In this embodiment, a block chain-based BCTkPQ query method is as follows:
step 1: constructing a Collaborative Query Model (CQM), the structure of which is shown in fig. 1, and which includes three key parts, namely an Application Programming Interface (API), a Collaborative Network (CN) maintained by a group of Collaborative Peers (CPs), and a Block Chain (Block Chain, BC) storing original transaction data; wherein the API comprises a distributor and a responder;
the execution flow of the CQM is briefly described as follows: first, the query request is broadcast to all CPs through a dispatcher (dispatcher) in the API. All CPs then respond to the query request synchronously, each CP containing three modules, a parser, an indexer and an executor. These modules may access the BC in a read-only manner, meaning that all modules may read the data objects stored in the blockchain and create an index to complete the query request locally. Finally, after the CN has processed the query request, the CN returns the result through a responder (responder) in the API.
Step 2: constructing a Source-Destination (S-D) index, and constructing a business logic relationship in each transaction, wherein the flow is shown in FIG. 2;
step 2.1: initializing three sets < S, D, E >, and storing the logic of each transaction;
step 2.2: definition of TxDefining T for transactions on blockchains, according to a general financial transfer operation between accountsxHas the structure of Tx={ID,TxHash, from, to, O }, where ID denotes TxSerial number of (1), TxHash represents TxThe hash value of (a) of (b),<from,to>the field being a representation of TxThe business logic of the transmission operation is called a transaction path p, O is the rest attribute of the transaction when the block chain transaction TxWith m attributes, O is { attr1,attr2,……,attrmAttr is a certain attribute;
in this embodiment, only one of the other attributes of the transaction is money;
step 2.3: traverse all transactions on the chain, will TxThe from field and the to field of (a) are added to the S set and the D set, respectively, and as shown in fig. 3, the from field S ═ { U } is extracted from 100 pieces of data1,U1,U2,U2,U3,U1The to field D & ltu & gt is extracted from 100 pieces of data2,U3,U1,U3,U1,U3···};
Step 2.4: the mapping relationship between the current transactions is saved as E set, i.e. p →<from,to>Construction of E ═ tone in 100 pieces of data<U1,U2>,<U1,U3>,<U2,U1>,<U2,U3>,<U3,U1>H, the structure is shown on the left side of FIG. 4;
and step 3: root on the basis of S-D indexSending a query request according to a user<p,k,W,O>Simulating queries<<U1,U3>,2,1,money>Constructing a Path-Score (P-SC) index, and establishing mapping of the Path and the transaction Score, wherein the process is shown in FIG. 3, the P-SC index and the S-D index form a secondary index, and the structure is shown in FIG. 4;
step 3.1: obtaining newly added path p in E set of S-D indexi
Step 3.2: when p is obtainediWhen not present in the P-SC index, e.g. Tx3Path p3=<U2,U1>When the P-SC does not exist, a new packet is created to store the path Pi=<U2,U1>I.e. pi→<Tx3>Adding to bucket3Performing the following steps;
step 3.3: when p is obtainediWhen present in the P-SC index, e.g. Tx6Path p6=<U1,U3>Obtaining corresponding bucket when the P-SC exists, and storing P6Corresponding Tx6Entering a bucket;
and 4, step 4: obtaining the query result, assuming that the user sends the query request<p,k,W,O>=<<U1,U3>,2,1,money>Taking the acquisition path as p ═<from*,to*>=<U1,U3>The top k of the transaction with the highest score of the weight W of 1 on money is 2 transactions, as shown in fig. 5;
step 4.1: user will request through distributor of CQM<p,k,W,O>=<<U1,U3>,2,1,money>Broadcast to all CP ═ P1,P2,…,P5};
Step 4.2: each CP gets all the contents P → in the local P-SC index<from*,to*>=<U1,U3>The transaction score of the bucket is calculated according to the weight set W in the query conditioni. Transaction scoreiIs Fs(Tx),Fs(Tx)=∑attri×wi. Wherein, attriFor a transaction TxThe ith attribute of (1), wi≧ 0 is the ith value of weight set W in query condition, and is the corresponding attribute attriThe weight of (c).
In this embodiment, W only includes one attribute money, and its weight is 1, so the transaction T in the E setxi,scorei=Fs(Txi)=moneyi×1;
Step 4.3: according to score, in descending order, adding the 2 transactions with the highest scores in bucket to a result set resultSet, wherein resultSet is { T }x2={2,Tx2Hash,U1,U3,money2},Tx6={6,Tx6Hash,U1,U3,money6}};
Step 4.4: calculating digest for the resultSet, and broadcasting the digest to other CPs;
step 4.5: when the received digests are all the same and the number exceeds a given threshold, two thirds of the total CP number, a resultSet is returned, the current calculation is terminated and the next call is waited.

Claims (5)

1. A BCTkPQ query method based on a block chain is characterized by comprising the following steps:
step 1: constructing a collaboration query framework CQM comprising three key parts, namely an Application Programming Interface (API), a Collaboration Network (CN) maintained by a group of Collaboration Peers (CP) and a Blockchain (BC) for storing original transaction data; wherein the API comprises a distributor and a responder;
step 2: constructing a source-destination S-D index, and constructing a business logic relation in each transaction;
and step 3: on the basis of the S-D index, constructing a path-score P-SC index according to a query request < P, k, W, O > sent by a user, and establishing a mapping relation between the path and the transaction score, wherein the P-SC index and the S-D index form a secondary index;
wherein, p is a transaction path, O is a set of other attributes of the transaction, W is a weight set, and k is the first k transactions with the highest query score;
and 4, step 4: obtaining the query result, assuming the user sendsQuery request<p,k,W,O>Taking the acquisition path as p ═<from*,to*>The first k transactions with the highest weight W on attribute O in the transactions of (2).
2. The block chain-based BCTkPQ query method of claim 1, wherein the procedure of step 2 is as follows:
step 2.1: initializing three sets < S, D, E > for storing the logic of each transaction;
step 2.2: definition of TxDefining T for transactions on blockchains, according to a general financial transfer operation between accountsxHas the structure of Tx={ID,TxHash, from, to, O }, where ID denotes TxSerial number of (1), TxHash represents TxThe hash value of (a) of (b),<from,to>the field being a representation of TxThe business logic of the transmission operation is called a transaction path p, O is the rest attribute of the transaction when the block chain transaction TxWith m attributes, O is { attr1,attr2,……,attrmAttr is a certain attribute;
step 2.3: traversing all transactions on the blockchain, and dividing TxThe from field and the to field of (1) are added to the S set and the D set respectively;
step 2.4: the path of the current transaction is saved to the E-set, i.e., p → < from, to >.
3. The block chain-based BCTkPQ query method of claim 1, wherein the procedure of step 3 is as follows:
step 3.1: obtaining newly added path p in E set of S-D indexi
Step 3.2: when p is obtainediWhen the P-SC index does not exist, a new packet is created*To store the path piI.e. pi→<Txi>Adding to bucketiPerforming the following steps;
step 3.3: when p is obtainediWhen the P-SC index exists, acquiring a corresponding bucket and storing PiCorrespond toTx ofiGo to bucket.
4. The block chain-based BCTkPQ query method of claim 1, wherein the procedure of step 4 is as follows:
step 4.1: the user broadcasts the request < p, k, W, O > to all CPs through the distributor of CQM;
step 4.2: each CP gets all the contents P → in the local P-SC index<from*,to*>According to the weight set W in the query condition, the transaction score of the packet is calculatedi
Step 4.3: according to the transactions score, sorting from big to small, adding the first k blockchain transactions with the highest scores in the bucket into a result set resultSet;
step 4.4: calculating digest for the resultSet, and broadcasting the digest to other CPs;
step 4.5: when the received digests are all the same and the number exceeds a given threshold, returning to resultSet, terminating the current calculation and waiting for the next call.
5. The block chain-based BCTkPQ query method of claim 4, wherein the transaction score is scoreiThe calculation method of (2) is as follows:
Fs(Tx)=∑attri×wi
wherein, Fs(Tx) Score for a transactioni,attriFor a transaction TxThe ith attribute of (1), wi≧ 0 is the ith value of weight set W in query condition, and is the corresponding attribute attriThe weight of (c).
CN202110216456.1A 2021-02-26 2021-02-26 BCTkPQ query method based on blockchain Active CN112966001B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110216456.1A CN112966001B (en) 2021-02-26 2021-02-26 BCTkPQ query method based on blockchain

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110216456.1A CN112966001B (en) 2021-02-26 2021-02-26 BCTkPQ query method based on blockchain

Publications (2)

Publication Number Publication Date
CN112966001A true CN112966001A (en) 2021-06-15
CN112966001B CN112966001B (en) 2023-08-04

Family

ID=76275986

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110216456.1A Active CN112966001B (en) 2021-02-26 2021-02-26 BCTkPQ query method based on blockchain

Country Status (1)

Country Link
CN (1) CN112966001B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113360504A (en) * 2021-06-22 2021-09-07 东北大学 Connection query optimization method based on multi-block chain environment

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20150199354A1 (en) * 2012-11-20 2015-07-16 Netapp, Inc. Method and system for optimizing traversal and storage of directory entries of a storage volume
CN108509514A (en) * 2018-03-09 2018-09-07 史玉成 A kind of big data analysis method and system based on block chain
CN109165224A (en) * 2018-08-24 2019-01-08 东北大学 A kind of indexing means being directed to keyword key on block chain database
CN111209336A (en) * 2019-12-30 2020-05-29 广州博士信息技术研究院有限公司 Data distribution method and device based on block chain and server
US20200374105A1 (en) * 2019-05-22 2020-11-26 Salesforce.Com, Inc. System or method to implement consensus on read on distributed ledger/blockchain

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20150199354A1 (en) * 2012-11-20 2015-07-16 Netapp, Inc. Method and system for optimizing traversal and storage of directory entries of a storage volume
CN108509514A (en) * 2018-03-09 2018-09-07 史玉成 A kind of big data analysis method and system based on block chain
CN109165224A (en) * 2018-08-24 2019-01-08 东北大学 A kind of indexing means being directed to keyword key on block chain database
US20200374105A1 (en) * 2019-05-22 2020-11-26 Salesforce.Com, Inc. System or method to implement consensus on read on distributed ledger/blockchain
CN111209336A (en) * 2019-12-30 2020-05-29 广州博士信息技术研究院有限公司 Data distribution method and device based on block chain and server

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
KUN HAO等: "On efficient top-k transaction path query processing in blockchain database", 《DATA&KNOWLEDGE ENGINEERING》, vol. 141, pages 1 - 7 *
贺扬: "海量小文件的快速检索技术研究与实现", 《中国优秀硕士学位论文全文数据库 信息科技辑》, pages 138 - 5169 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113360504A (en) * 2021-06-22 2021-09-07 东北大学 Connection query optimization method based on multi-block chain environment
CN113360504B (en) * 2021-06-22 2023-08-15 东北大学 Connection query optimization method based on multi-block chain environment

Also Published As

Publication number Publication date
CN112966001B (en) 2023-08-04

Similar Documents

Publication Publication Date Title
CN110471995B (en) Cross-domain information sharing exchange data model modeling method
CN108600321A (en) A kind of diagram data storage method and system based on distributed memory cloud
CN110674154B (en) Spark-based method for inserting, updating and deleting data in Hive
WO2023050556A1 (en) Smart contract consensus algorithm
CN113407681B (en) Energy industry public data model construction method
CN113438084A (en) Green power source tracing method and system based on R-PBFT consensus algorithm and timestamp
Jia et al. Se-chain: A scalable storage and efficient retrieval model for blockchain
CN114186694A (en) Efficient, safe and low-communication longitudinal federal learning method
CN112966001A (en) BCTkPQ query method based on block chain
CN109918369A (en) Date storage method and device
CN112598510B (en) Resource data processing method and device
WO2022037102A1 (en) Multi-party collaboration-oriented method for service value conflict detection and resolution of stakeholders
CN108173899B (en) Information processing method and device of block chain
CN113918857A (en) Three-level cache acceleration method for improving performance of distributed WEB application system
CN103995886A (en) Multidimensional product design knowledge pushing frame and construction method
CN107291764A (en) A kind of big data exchange method and device, system
US20230336368A1 (en) Block chain-based data processing method and related apparatus
RU2324974C1 (en) System of interaction automatic control system databases
CN111562990B (en) Lightweight serverless computing method based on message
CN107506473A (en) A kind of big data search method based on cloud computing
CN106096824B (en) A kind of main distribution integrative graph resource share method
CN109960750A (en) A kind of parallel figure division methods based on label probability of spreading
CN113360504B (en) Connection query optimization method based on multi-block chain environment
CN113496349B (en) Block chain learning archive and credit factor construction method based on AI interactive consensus
CN112950063B (en) Regional energy complementation method and device

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