CN112966001B - BCTkPQ query method based on blockchain - Google Patents

BCTkPQ query method based on blockchain Download PDF

Info

Publication number
CN112966001B
CN112966001B CN202110216456.1A CN202110216456A CN112966001B CN 112966001 B CN112966001 B CN 112966001B CN 202110216456 A CN202110216456 A CN 202110216456A CN 112966001 B CN112966001 B CN 112966001B
Authority
CN
China
Prior art keywords
transaction
index
query
path
blockchain
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
CN202110216456.1A
Other languages
Chinese (zh)
Other versions
CN112966001A (en
Inventor
寇凯淇
信俊昌
王之琼
Original Assignee
东北大学
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 东北大学 filed Critical 东北大学
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

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: constructing a collaborative query framework (CQM); step 2: constructing a source-destination S-D index, and constructing a business logic relationship in each transaction; step 3: constructing a path-score P-SC index according to a query request sent by a user on the basis of the S-D index, 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; step 4: the top k transactions with the highest score of the weight W on attribute O in the transaction of path p in the query request are obtained. The invention can realize BCTkPQ rapid query based on the block chain based on the CQM model and the secondary index, and the query efficiency can be improved along with the increase of the number of CP nodes and the number of users.

Description

BCTkPQ query method based on blockchain
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 great deal of attention from the industry and academia as a basis for cryptocurrency systems. Blockchains have been successfully applied to a variety of real-world scenarios such as internet of things, smart medicine, supply chains, database architecture, data service outsourcing, and the like. Blockchains can be viewed as a distributed database maintained by nodes that are not fully trusted with each other through a consensus protocol. According to different scenarios, the blockchain may design a specific transaction model according to specific business logic. Among them, a common transaction model is based on financial transactions, and is used to represent transfer information between banks or financial institutions. Obviously, in a financial transaction scenario, the blockchain may securely and completely store the user's financial bill and daily transfer records. All transaction data contains useful information and knowledge, expresses 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, the need for diversified query processing is increasing.
The traditional query method is to send a query request to a complete node maintaining the complete block and the transaction, and acquire the transaction meeting the condition by traversing all blocks of the entire blockchain. Clearly, the efficiency of this solution is too low to meet a large number of query requirements. The main reason for inefficiency is that the entire node needs to traverse all of the blockchain data stored in the local store, resulting in excessive 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 top-k transaction path queries (blockchain-kPathQuery, BCTkPQ) in the blockchain, the first k transactions in a given query path p that satisfy the specified condition are returned.
In order to solve the technical problems, the invention adopts the following technical scheme: a BCTkPQ query method based on a block chain comprises the following steps:
step 1: constructing the collaboration query framework CQM (Collaborative QueryModel) includes three key parts, namely an application programming interface API, a collaboration network CN (CollaborativeNetwork) maintained by a set of collaboration peers CP (CollaborativePeer), and a blockchain BC (BlockChain) storing raw transaction data; wherein the API comprises a dispatcher and a responder;
step 2: a Source-Destination S-D (Source-Destination) index is constructed, and business logic relationships in each transaction are constructed as follows:
step 2.1: initializing three sets < S, D, E > for storing logic for each transaction;
step 2.2: definition T x For transactions on a blockchain, T is defined in accordance with a general inter-account financial transfer operation x The structure is T x ={ID,T x Hash, from, to, O }, where ID represents T x Sequence number T of (1) x Hash represents T x Is used to determine the hash value of (c),<from,to>the field is a representation T x The business logic of the transfer operation, called transaction path p, O is the rest of the attribute of the transaction, when the block chain transaction T x When m attributes are present, O is { attr 1 ,attr 2 ,……,attr m Attr is a certain attribute;
step 2.3: traversing all transactions on the blockchain, T x The from field and the to field of (a) 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 >.
Step 3: constructing a Path-Score P-SC (Path-Score) index on the basis of the S-D index according to query requests < 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; where p is the transaction path, O is the rest attribute set of the transaction, W is the weight set, and k is the top k transactions with highest query scores. The specific process is as follows:
step 3.1: obtaining newly added path p in E set of S-D index i
Step 3.2: when p is obtained i Creating a new packet bucket when not present in the P-SC index * To store the path p i I.e. p i →<Tx i >Added to socket * In (a) and (b);
step 3.3: when p is obtained i When the P-SC index exists, the corresponding socket is acquired, and P is stored i Corresponding Tx i Into the socket.
Step 4: acquiring a query result, and sending a query request by a user<p,k,W,O>The acquisition path is p →<from * ,to * >The top k transactions with the highest score for weight W on attribute O of (c) are as follows:
step 4.1: the user broadcasts the request < p, k, W, O > to all CPs through the distributor of the CQM;
step 4.2: each CP obtains all the contained P-in the local P-SC index<from * ,to * >According to the weight set W in the query condition, calculating the transaction score of the packet socket i
The transaction score i The calculation method of (2) is as follows:
F s (T x )=∑attr i ×w i
wherein F is s (T x ) Score for transaction i ,attr i For transaction T x Is the ith attribute, w i 0 is the ith value of the weight set W in the query condition, is the corresponding attribute attr i Is a weight of (2).
Step 4.3: according to the transaction score, the first k blockchain transactions with the highest scores in the bucket are added into a result set according to the sequence from big to small;
step 4.4: calculating abstract digest for the result set, and broadcasting the digest to other CPs;
step 4.5: when the received digees are all the same and the number exceeds a given threshold (typically the threshold is set to two thirds of the number of all CPs), a resultSet is returned, the current calculation is terminated and the next call is awaited.
The beneficial effects of adopting above-mentioned technical scheme to produce lie in:
1. the method for processing the BCTkPQ problem based on the collaborative query model CQM can realize the BCTkPQ rapid 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, and compared with the traditional query method, the diversified query method based on the secondary index improves the query efficiency and reduces the cost, and the whole node needs to traverse all the block chain data stored in the local storage, thereby causing excessive calculation workload. Based on the CQM model and the secondary index, BCTkPQ quick query based on the blockchain 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 diagram of a collaborative query framework in an embodiment of the present invention;
FIG. 2 is a flow chart of constructing an S-D index in an embodiment of the invention;
FIG. 3 is a flow chart of constructing a P-SC index in an embodiment of the present invention;
FIG. 4 is a schematic diagram of a secondary index structure 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 describes in further detail the embodiments of the present invention with reference to the drawings and examples. The following examples are illustrative of the invention and are not intended to limit the scope of the invention.
In this embodiment, 3 users S are used U ={U 1 ,U 2 ,U 3 Five nodes cp= { P } 1 ,P 2 ,…,P 5 Experiments were performed on 100 data, each in the format T x ={ID,T x Hash, from, to, money). The BCTkPQ query method based on the blockchain in this embodiment is as follows:
step 1: constructing a Collaborative query framework (CQM), the structure of which is shown in fig. 1, and which includes three key parts, namely an Application Programming Interface (API), a collaboration network (CollaborativeNetwork, CN) maintained by a set of collaboration peers (CollaborativePeer, CP), and a Blockchain (BC) storing raw transaction data; wherein the API comprises a dispatcher and a responder;
the execution flow of the CQM is briefly described as follows: first, a query request is broadcast to all CPs through a distributor (dispatcher) in the API. Then, all CPs synchronously respond to the query request, and each CP contains three modules, namely, a parser, an indexer, and an executor. These modules can access the BC in a read-only manner, meaning that all modules can read the data objects stored in the blockchain and create an index to fulfill the query request locally. Finally, after the CN processes the query request, the result is returned through a responder (responder) in the API.
Step 2: constructing a Source-Destination (S-D) index, constructing a business logic relationship in each transaction, and the flow is shown in FIG. 2;
step 2.1: initializing three sets < S, D, E >, storing logic for each transaction;
step 2.2: definition T x For transactions on a blockchain, T is defined in accordance with a general inter-account financial transfer operation x The structure is T x ={ID,T x Hash, from, to, O }, where ID represents T x Sequence number T of (1) x Hash represents T x Is used to determine the hash value of (c),<from,to>the field is a representation T x The business logic of the transfer operation, called transaction path p, O is the rest of the attribute of the transaction, when the block chain transaction T x When m attributes are present, O is { attr 1 ,attr 2 ,……,attr m Attr is a certain attribute;
in this embodiment, only one of the other attributes of the transaction is money;
step 2.3: traversing all transactions on the chain, T x The from field and the to field of (f) 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 data 1 ,U 1 ,U 2 ,U 2 ,U 3 ,U 1 Extracting to field d= { U from 100 pieces of data 2 ,U 3 ,U 1 ,U 3 ,U 1 ,U 3 ···};
Step 2.4: storing the mapping relation between the current transactions as E set, i.e. p →<from,to>E= { is constructed in 100 pieces of data<U 1 ,U 2 >,<U 1 ,U 3 >,<U 2 ,U 1 >,<U 2 ,U 3 >,<U 3 ,U 1 >The structure is shown on the left side of the figure 4;
step 3: based on the S-D index, sending a query request according to the user<p,k,W,O>Simulation query<<U 1 ,U 3 >,2,1,money>Constructing a Path-Score (P-SC) index, establishing a mapping of the Path and the transaction Score, wherein the flow is shown in fig. 3, and 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 index i
Step 3.2: when p is obtained i In the absence of P-SC index, e.g. T x3 Path p 3 =<U 2 ,U 1 >Creating a new packet socket when not present in the P-SC * To store the path p i =<U 2 ,U 1 >I.e. p i →<Tx 3 >Added to socket * In (a) and (b);
step 3.3: when p is obtained i When present in the P-SC index, e.g. T x6 Path p 6 =<U 1 ,U 3 >When the P-SC exists, the corresponding socket is acquired, and P is stored 6 Corresponding Tx 6 Into a socket;
step 4: acquiring a query result, and sending a query request by a user<p,k,W,O>=<<U 1 ,U 3 >,2,1,money>The acquisition path is p →<from * ,to * >=<U 1 ,U 3 >The top k=2 transactions with highest score for weight w=1 on data object o=money, as shown in fig. 5;
step 4.1: the user requests through the distributor of CQM<p,k,W,O>=<<U 1 ,U 3 >,2,1,money>Broadcast to all cp= { P 1 ,P 2 ,…,P 5 };
Step 4.2: each CP obtains all the contained P-in the local P-SC index<from * ,to * >=<U 1 ,U 3 >According to the weight set W in the query condition, calculating the transaction score of the bucket i . Transaction score i Is F x (T x ),F x (T x )=∑attr i ×w i . Wherein attr i For transaction T x Is the ith attribute, w i 0 is the ith value of the weight set W in the query condition, is the corresponding attribute attr i Is a weight of (2).
In this embodiment, W contains only one attribute money, and its weight is 1, so transaction T in E set xi ,score i =F s (T xi )=money i ×1;
Step 4.3: adding the 2 transactions with the highest scores in the bucket to a result set according to the score in order from big to small,
step 4.4: calculating abstract digest for the result set, and broadcasting the digest to other CPs;
step 4.5: when the received digest is all the same and the number exceeds the given threshold, returning to the resultSet, terminating the current calculation and waiting for the next call.

Claims (3)

1. The BCTkPQ query method based on the blockchain is characterized by comprising the following steps of:
step 1: constructing a collaborative query framework CQM comprising three key parts, namely an application programming interface API, a collaboration network CN maintained by a set of collaboration peers CP, and a blockchain BC storing raw transaction data; wherein the API comprises a dispatcher and a responder;
step 2: constructing a source-destination S-D index, and constructing a business logic relationship in each transaction;
the specific process is as follows:
step 2.1: initializing three sets < S, D, E > for storing logic for each transaction;
step 2.2: definition T x For transactions on a blockchain, T is defined in accordance with a general inter-account financial transfer operation x The structure is T x ={ID,T x Hash, from, to, O }, where ID represents T x Sequence number T of (1) x Hash represents T x Is used to determine the hash value of (c),<from,to>the field is a representation T x The business logic of the transfer operation, called transaction path p, O is the rest of the attribute of the transaction, when the block chain transaction T x When m attributes are present, O is { attr 1 ,attr 2 ,……,attr m Attr is a certain attribute;
step 2.3: traversing all transactions on the blockchain, T x The from field and the to field of (a) are added to the S set and the D set, respectively;
step 2.4: saving the path of the current transaction into the E set, namely p & gtfwdarw < from, to >;
step 3: constructing a path-score P-SC index according to query requests < P, k, W and O > sent by a user on the basis of the S-D index, 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 the rest attribute set of the transaction, W is a weight set, and k is the first k transactions with highest query scores;
the specific process is as follows:
step 3.1: obtaining newly added path p in E set of S-D index i
Step 3.2: when p is obtained i Creating a new packet bucket when not present in the P-SC index * To store the path p i I.e. p i →<Tx i >Added to socket * In (a) and (b);
step 3.3: when p is obtained i When the P-SC index exists, the corresponding socket is acquired, and P is stored i Corresponding Tx i Into a socket;
step 4: acquiring a query result, and sending a query request by a user<p,k,W,O>The acquisition path is p →<from * ,to * >The top k transactions with the highest scoring for weight W on attribute O.
2. The BCTkPQ query method based on blockchain 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 the CQM;
step 4.2: each CP obtains all the contained P-in the local P-SC index<from * ,to * >According to the weight set W in the query condition, calculating the transaction score of the packet socket i
Step 4.3: according to the transaction score, the first k blockchain transactions with the highest scores in the bucket are added into a result set according to the sequence from big to small;
step 4.4: calculating abstract digest for the result set, and broadcasting the digest to other CPs;
step 4.5: and when the received digees are all the same and the number exceeds a given threshold value, returning to a resultSet, terminating the current calculation and waiting for the next call.
3. The BCTkPQ query method based on blockchain of claim 2, wherein the transaction score i The calculation method of (2) is as follows:
F s (T x )=∑attr i ×w i
wherein F is s (T x ) Score for transaction i ,attr i For transaction T x Is the ith attribute, w i 0 is the ith value of the weight set W in the query condition, is the corresponding attribute attr i Is a weight of (2).
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 CN112966001A (en) 2021-06-15
CN112966001B true 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)

Families Citing this family (1)

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

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
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

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9009206B1 (en) * 2012-11-20 2015-04-14 Netapp, Inc. Method and system for optimizing traversal and storage of directory entries of a storage volume
US11469886B2 (en) * 2019-05-22 2022-10-11 Salesforce.Com, Inc. System or method to implement record level access on metadata driven blockchain using shared secrets and consensus on read

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
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

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
海量小文件的快速检索技术研究与实现;贺扬;《中国优秀硕士学位论文全文数据库 信息科技辑》;I138-5169 *

Also Published As

Publication number Publication date
CN112966001A (en) 2021-06-15

Similar Documents

Publication Publication Date Title
CN110674154B (en) Spark-based method for inserting, updating and deleting data in Hive
CN110471995B (en) Cross-domain information sharing exchange data model modeling method
US20120317142A1 (en) Systmen and method for data management in large data networks
CN112308157A (en) Decision tree-oriented transverse federated learning method
CN112506925A (en) Data retrieval system and method based on block chain
Jia et al. Se-chain: A scalable storage and efficient retrieval model for blockchain
CN112966001B (en) BCTkPQ query method based on blockchain
CN106055652A (en) Method and system for database matching based on patterns and examples
WO2022037102A1 (en) Multi-party collaboration-oriented method for service value conflict detection and resolution of stakeholders
CN104965846B (en) Visual human&#39;s method for building up in MapReduce platform
CN102521356A (en) Regular expression matching equipment and method on basis of deterministic finite automaton
CN112598510B (en) Resource data processing method and device
CN108170701A (en) The information processing method and device of block chain
Papapanagiotou et al. RONTO: Relational to ontology schema matching
CN110119396A (en) Data managing method and Related product
CN108173899A (en) The information processing method and device of block chain
CN112749167A (en) Method and device for determining broken link data and nonvolatile storage medium
CN117350845A (en) Enterprise credit risk assessment method based on cascade hypergraph neural network
CN115239442B (en) Method and system for popularizing internet financial products and storage medium
CN109491768A (en) A kind of distributed transaction method for dynamically processing and system based on subtransaction stream
CN111723129B (en) Report generation method, report generation device and electronic equipment
CN113626657A (en) Method for discovering densely connected sub-networks by multi-value attribute graph structure
CN113360504B (en) Connection query optimization method based on multi-block chain environment
CN106096824A (en) A kind of main distribution integrative graph resource share method
Ma et al. EFL: elastic federated learning on non-IID data

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