[go: up one dir, main page]

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.)
Expired - Fee Related
Application number
CN202110216456.1A
Other languages
Chinese (zh)
Other versions
CN112966001A (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
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; 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 OR CALCULATING; 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 OR CALCULATING; 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查询方法A blockchain-based BCTkPQ query method

技术领域technical field

本发明涉及路径查询技术领域,尤其涉及一种基于区块链的BCTkPQ查询方法。The invention relates to the technical field of path query, in particular to a blockchain-based BCTkPQ query method.

背景技术Background technique

目前,区块链作为加密货币系统的基石,已经受到了业界和学术界的高度关注。区块链已经成功应用于各种现实场景,如物联网、智慧医疗、供应链、数据库架构、数据服务外包等。区块链可以被看作是由互相不完全信任的节点通过共识协议维护的分布式数据库。根据不同的场景,区块链可以根据具体的业务逻辑,设计具体的交易模型。其中,常见的交易模型是基于金融交易的,用来表示银行或金融机构之间的转账信息。显然,在金融交易场景下,区块链可以安全并完整地存储用户的金融账单和日常转账记录。所有的交易数据蕴含着有用的信息和知识,表达了用户在不同场景下的商业偏好,可以用来提高数据分析、数据安全、推荐系统等应用服务的质量。因此,多样化查询处理的需求越来越大。At present, blockchain, as the cornerstone of the cryptocurrency system, has received high attention from the industry and academia. Blockchain has been successfully applied in various real-world scenarios, such as Internet of Things, smart medical care, supply chain, database architecture, data service outsourcing, etc. A blockchain can be viewed as a distributed database maintained through a consensus protocol by nodes that do not fully trust each other. According to different scenarios, the blockchain can design specific transaction models based on specific business logic. Among them, the common transaction model is based on financial transactions and is used to represent transfer information between banks or financial institutions. Obviously, in the financial transaction scenario, the blockchain can safely and completely store the user's financial bills and daily transfer records. All transaction data contains useful information and knowledge, expresses the business preferences of users in different scenarios, and can be used to improve the quality of application services such as data analysis, data security, and recommendation systems. Therefore, there is an increasing need for diverse query processing.

传统的查询方法是将查询请求发送到维护完整块和事务的完整节点,并通过遍历整条区块链的所有区块,获取符合条件的事务。显然,这种解决方案的效率是过低的,无法满足大量的查询需求。低效的主要原因是,整个节点需要遍历存储在本地存储中的所有区块链数据,从而导致过高的计算工作负载。The traditional query method is to send query requests to complete nodes that maintain complete blocks and transactions, and obtain eligible transactions by traversing all blocks of the entire blockchain. Obviously, the efficiency of this solution is too low to meet a large number of query requirements. The main reason for the inefficiency is that the entire node needs to traverse all blockchain data stored in local storage, resulting in excessive computational workload.

发明内容Contents of the invention

针对上述现有技术的不足,本发明提供一种基于区块链的BCTkPQ查询方法。对于区块链中的top-k交易路径查询(Blockchaintop-kPathQuery,BCTkPQ),即返回给定查询路径p中满足指定条件的前k个事务。Aiming at the deficiencies of the above-mentioned prior art, the present invention provides a BCTkPQ query method based on blockchain. For the top-k transaction path query (Blockchaintop-kPathQuery, BCTkPQ) in the blockchain, it returns the top k transactions that meet the specified conditions in the given query path p.

为解决上述技术问题,本发明所采取的技术方案是:一种基于区块链的BCTkPQ查询方法,包括如下步骤:In order to solve the problems of the technologies described above, the technical solution adopted by the present invention is: a BCTkPQ query method based on blockchain, comprising the steps of:

步骤1:构建协作查询框架CQM(Collaborative QueryModel)包含三个关键部分,即应用程序编程接口API、由一组协作对等点CP(CollaborativePeer)维护的协作网络CN(CollaborativeNetwork)和存储原始交易数据的区块链BC(BlockChain);其中API包含分发器和响应器;Step 1: Build a collaborative query framework CQM (Collaborative QueryModel) consists of three key parts, namely the application programming interface API, the collaborative network CN (Collaborative Network) maintained by a group of collaborative peers CP (CollaborativePeer) and the storage of raw transaction data Blockchain BC (BlockChain); where the API includes distributors and responders;

步骤2:构造来源-目的地S-D(Source-Destination)索引,构造每个事务中的业务逻辑关系,过程如下:Step 2: Construct the source-destination S-D (Source-Destination) index, construct the business logic relationship in each transaction, the process is as follows:

步骤2.1:初始化三个集合<S,D,E>,用于存储每个事务的逻辑;Step 2.1: Initialize three collections <S, D, E> to store the logic of each transaction;

步骤2.2:定义Tx为区块链上的事务,按照一般的账户间的财务转移操作,定义Tx结构为,Tx={ID,TxHash,from,to,O},其中ID表示Tx的序列号,TxHash表示Tx的哈希值,<from,to>字段是表示Tx传输操作的业务逻辑,称为事务路径p,O为事务其余属性,当区块链事务Tx具有m个属性时,O为{attr1,attr2,……,attrm},attr为某一个属性;Step 2.2: Define T x as a transaction on the blockchain. According to the general financial transfer operation between accounts, define the structure of T x as, T x = {ID, T x Hash, from, to, O}, where ID represents The serial number of T x , T x Hash indicates the hash value of T x , the <from, to> field is the business logic of the T x transmission operation, which is called the transaction path p, and O is the remaining attributes of the transaction. When the blockchain transaction When T x has m attributes, O is {attr 1 , attr 2 ,...,attr m }, and attr is a certain attribute;

步骤2.3:遍历区块链上所有事务,将Tx的from字段和to字段分别添加到S集合和D集合中;Step 2.3: traverse all transactions on the blockchain, and add the from field and to field of T x to the S collection and the D collection respectively;

步骤2.4:将当前事务的路径保存到E集合中,即p→<from,to>。Step 2.4: Save the path of the current transaction into the E set, that is, p→<from,to>.

步骤3:在S-D索引的基础上,根据用户发送的查询请求<p,k,W,O>,构造路径-得分P-SC(Path-Score)索引,建立路径和事务分数间的映射关系,P-SC索引与S-D索引构成一个二级索引;其中,p为事务路径,O为事务其余属性集合,W为权重集合,k为查询得分最高的前k个事务。具体过程如下:Step 3: On the basis of the S-D index, according to the query request <p,k,W,O> sent by the user, construct the path-score P-SC (Path-Score) index, and establish the mapping relationship between the path and the transaction score, P-SC index and S-D index constitute a secondary index; where p is the transaction path, O is the set of other attributes of the transaction, W is the set of weights, and k is the top k transactions with the highest query scores. The specific process is as follows:

步骤3.1:获取S-D索引的E集合中新增的路径piStep 3.1: Obtain the newly added path p i in the E collection of the SD index;

步骤3.2:当获取的pi在P-SC索引中不存在时,创建一个新的包bucket*来存储该路径pi,即pi→<Txi>添加到bucket*中;Step 3.2: When the obtained p i does not exist in the P-SC index, create a new package bucket * to store the path p i , that is, add p i →<Txi > to the bucket * ;

步骤3.3:当获取的pi在P-SC索引中存在时,获取对应的bucket,存储pi对应的Txi到bucket中。Step 3.3: When the obtained p i exists in the P-SC index, obtain the corresponding bucket, and store the Txi corresponding to p i in the bucket.

步骤4:获取查询结果,用户发送查询请求<p,k,W,O>,获取路径为p→<from*,to*>的事务中属性O上权重W的得分最高的前k个事务,过程如下:Step 4: Obtain the query result, the user sends a query request <p,k,W,O>, and obtains the top k transactions with the highest weight W on attribute O among the transactions whose path is p→<from * , to * >, The process is as follows:

步骤4.1:用户通过CQM的分发器将请求<p,k,W,O>广播到所有CP;Step 4.1: The user broadcasts the request <p,k,W,O> to all CPs through the CQM distributor;

步骤4.2:每个CP在本地P-SC索引中获取所有包含p→<from*,to*>的包bucket,根据查询条件中的权重集合W,计算其事务分数scoreiStep 4.2: Each CP obtains all package buckets containing p→<from * , to * > in the local P-SC index, and calculates its transaction score score i according to the weight set W in the query condition;

所述事务分数scorei的计算方法如下:The calculation method of the transaction score score i is as follows:

Fs(Tx)=∑attri×wi F s (T x )=∑attr i ×w i

其中,Fs(Tx)为事务分数scorei,attri为事务Tx的第i个属性,wi≥0是查询条件中权重集合W的第i个值,是对应属性attri的权重。Among them, F s (T x ) is the score i of the transaction, attri i is the i-th attribute of the transaction T x , w i ≥ 0 is the i-th value of the weight set W in the query condition, and is the weight of the corresponding attribute attri .

步骤4.3:根据事务score按照从大到小排序,将bucket中得分最高的前k个区块链事务添加到结果集合resultSet中;Step 4.3: Sorting from largest to smallest according to the transaction score, adding the top k blockchain transactions with the highest scores in the bucket to the result set resultSet;

步骤4.4:为resultSet计算摘要digest,并将digest广播给其他CP;Step 4.4: Calculate the digest digest for the resultSet, and broadcast the digest to other CPs;

步骤4.5:当收到的digest全部相同且数量超过了给定阈值(一般阈值设定为所有CP数量的三分之二),返回resultSet,终止当前计算并等待下一次调用。Step 4.5: When the received digests are all the same and the number exceeds the given threshold (the general threshold is set to two-thirds of the number of all CPs), return resultSet, terminate the current calculation and wait for the next call.

采用上述技术方案所产生的有益效果在于:The beneficial effects produced by adopting the above-mentioned technical scheme are:

1、本发明提供的方法基于协作查询模型CQM来处理BCTkPQ问题的方法,能够实现基于区块链的BCTkPQ快速查询。1. The method provided by the present invention is based on the cooperative query model CQM to deal with the BCTkPQ problem, which can realize the BCTkPQ fast query based on the block chain.

2、本发明查询方法构建了基于P-SC索引与S-D索引的一个二级索引,基于二级索引的多样化查询方法相比传统的查询方法将提升查询效率,而且会减少,由于整个节点需要遍历存储在本地存储中的所有区块链数据,从而导致过高的计算工作负载。基于CQM模型和二级索引,能够实现基于区块链的BCTkPQ快速查询,查询效率会随着CP节点数和用户数的增加而提升。2. The query method of the present invention 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 will improve the query efficiency and reduce it. Because the entire node needs Traverse all blockchain data stored in local storage, resulting in excessive computational workload. Based on the CQM model and the secondary index, fast BCTkPQ queries based on the blockchain can be realized, and the query efficiency will increase with the increase in the number of CP nodes and users.

附图说明Description of drawings

图1为本发明实施例中协作查询框架的结构示意图;FIG. 1 is a schematic structural diagram of a collaborative query framework in an embodiment of the present invention;

图2为本发明实施例中构建S-D索引的流程图;Fig. 2 is the flowchart of constructing S-D index in the embodiment of the present invention;

图3为本发明实施例中构建P-SC索引的流程图;Fig. 3 is the flowchart of constructing P-SC index in the embodiment of the present invention;

图4为本发明实施例中二级索引的结构示意图;FIG. 4 is a schematic structural diagram of a secondary index in an embodiment of the present invention;

图5为本发明实施例中查询过程的流程图。Fig. 5 is a flow chart of the query process in the embodiment of the present invention.

具体实施方式Detailed ways

下面结合附图和实施例,对本发明的具体实施方式作进一步详细描述。以下实施例用于说明本发明,但不用来限制本发明的范围。The specific implementation manners of the present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. The following examples are used to illustrate the present invention, but are not intended to limit the scope of the present invention.

本实施例中采用3个用户SU={U1,U2,U3},五个节点CP={P1,P2,…,P5},以及100条数据进行实验,每条数据格式为Tx={ID,TxHash,from,to,money}。本实施例中一种基于区块链的BCTkPQ查询方法如下所述:In this embodiment, three users S U = {U 1 , U 2 , U 3 }, five nodes CP = {P 1 , P 2 ,..., P 5 }, and 100 pieces of data are used for experiments, and each piece of data The format is T x = {ID, T x Hash, from, to, money}. In this embodiment, a BCTkPQ query method based on blockchain is as follows:

步骤1:构建协作查询框架(Collaborative QueryModel,CQM),结构如图1所示,包含三个关键部分,即应用程序编程接口(API),由一组协作对等点(CollaborativePeer,CP)维护的协作网络(CollaborativeNetwork,CN)和存储原始交易数据的区块链(BlockChain,BC);其中API包含分发器和响应器;Step 1: Build a collaborative query framework (Collaborative QueryModel, CQM), the structure is shown in Figure 1, including three key parts, namely the application programming interface (API), maintained by a group of collaborative peers (CollaborativePeer, CP) A collaborative network (CollaborativeNetwork, CN) and a blockchain (BlockChain, BC) that stores raw transaction data; where the API includes distributors and responders;

CQM的执行流程简述为:首先,查询请求通过API中的分发器(dispatcher)广播到所有CP。然后,所有CP同步响应查询请求,每个CP包含三个模块,即解析器,索引器和执行器。这些模块可以通过只读方式访问BC,这意味着所有模块都可以读取存储在区块链中的数据对象并创建索引以在本地完成查询请求。最后,CN处理完查询请求后,并通过API中的响应器(responder)将结果返回。The execution process of CQM is briefly described as follows: First, the query request is broadcast to all CPs through the dispatcher in the API. Then, all CPs respond to query requests synchronously, and each CP contains three modules, namely, parser, indexer, and executor. These modules can access BC in a read-only manner, which means that all modules can read data objects stored in the blockchain and create indexes to fulfill query requests locally. Finally, CN returns the result through the responder in the API after processing the query request.

步骤2:构造来源-目的地(Source-Destination,S-D)索引,构造每个事务中的业务逻辑关系,流程如图2所示;Step 2: Construct a source-destination (Source-Destination, S-D) index, and construct the business logic relationship in each transaction, the process is shown in Figure 2;

步骤2.1:初始化三个集合<S,D,E>,存储每个事务的逻辑;Step 2.1: Initialize three collections <S, D, E> to store the logic of each transaction;

步骤2.2:定义Tx为区块链上的事务,按照一般的账户间的财务转移操作,定义Tx结构为,Tx={ID,TxHash,from,to,O},其中ID表示Tx的序列号,TxHash表示Tx的哈希值,<from,to>字段是表示Tx传输操作的业务逻辑,称为事务路径p,O为事务其余属性,当区块链事务Tx具有m个属性时,O为{attr1,attr2,……,attrm},attr为某一个属性;Step 2.2: Define T x as a transaction on the blockchain. According to the general financial transfer operation between accounts, define the structure of T x as, T x = {ID, T x Hash, from, to, O}, where ID represents The serial number of T x , T x Hash indicates the hash value of T x , the <from, to> field is the business logic of the T x transmission operation, called the transaction path p, and O is the remaining attributes of the transaction. When the blockchain transaction When T x has m attributes, O is {attr 1 , attr 2 ,...,attr m }, and attr is a certain attribute;

本实施例中,事务其余属性只有一个,为money;In this embodiment, there is only one other attribute of the transaction, which is money;

步骤2.3:遍历链上所有事务,将Tx的from字段和to字段分别添加到S集合和D集合中,如图3所示,从100条数据中提取from字段S={U1,U1,U2,U2,U3,U1···},从100条数据中提取to字段D={U2,U3,U1,U3,U1,U3···};Step 2.3: Traverse all transactions on the chain, add the from field and to field of T x to the S collection and the D collection respectively, as shown in Figure 3, extract the from field S={U 1 , U 1 from 100 pieces of data , U 2 , U 2 , U 3 , U 1 }, extract the to field D from 100 pieces of data = {U 2 , U 3 , U 1 , U 3 , U 1 , U 3 };

步骤2.4:将当前事务之间的映射关系保存为E集合中,即p→<from,to>,100条数据中构建E={<U1,U2>,<U1,U3>,<U2,U1>,<U2,U3>,<U3,U1>···},结构如图4左侧所示;Step 2.4: Save the mapping relationship between the current transactions as the E set, that is, p→<from,to>, construct E={<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 Figure 4;

步骤3:在S-D索引的基础上,根据用户发送查询请求<p,k,W,O>,模拟查询<<U1,U3>,2,1,money>,构造路径-得分(Path-Score,P-SC)索引,建立路径和事务分数的映射,流程如图3所示,P-SC索引与S-D索引构成一个二级索引,结构如图4所示;Step 3: Based on the SD index, according to the query request <p,k,W,O> sent by the user, simulate the query <<U 1 ,U 3 >,2,1,money>, and construct the path-score (Path- Score, P-SC) index, establishes the mapping of path and transaction score, the process is shown in Figure 3, the P-SC index and SD index form a secondary index, and the structure is shown in Figure 4;

步骤3.1:获取S-D索引的E集合中新增的路径piStep 3.1: Obtain the newly added path p i in the E collection of the SD index;

步骤3.2:当获取的pi在P-SC索引中不存在时,例如Tx3路径p3=<U2,U1>在P-SC中不存在时,创建一个新的包bucket*来存储该路径pi=<U2,U1>,即pi→<Tx3>添加到bucket*中;Step 3.2: When the obtained p i does not exist in the P-SC index, for example, when the T x3 path p 3 =<U 2 , U 1 > does not exist in the P-SC, create a new package bucket * to store The path p i =<U 2 , U 1 >, that is, p i →<Tx 3 > is added to the bucket * ;

步骤3.3:当获取的pi在P-SC索引中存在时,例如Tx6路径p6=<U1,U3>在P-SC中存在时获取对应的bucket,存储p6对应的Tx6到bucket中;Step 3.3: When the obtained p i exists in the P-SC index, for example, if the T x6 path p 6 =<U 1 , U 3 > exists in the P-SC, obtain the corresponding bucket and store the Tx 6 corresponding to p 6 into the bucket;

步骤4:获取查询结果,用户发送查询请求<p,k,W,O>=<<U1,U3>,2,1,money>,获取路径为p→<from*,to*>=<U1,U3>的事务中数据对象O=money上权重W=1的得分最高的前k=2个事务,如图5所示;Step 4: Obtain the query result, the user sends a query request <p,k,W,O>=<<U 1 ,U 3 >,2,1,money>, and the obtaining path is p→<from * ,to * >= Among the transactions of <U 1 , U 3 >, the top k=2 transactions with the highest score of weight W=1 on the data object O=money, as shown in Figure 5;

步骤4.1:用户通过CQM的分发器将请求<p,k,W,O>=<<U1,U3>,2,1,money>广播到所有CP={P1,P2,…,P5};Step 4.1: The user broadcasts the request <p,k,W,O>=<<U 1 ,U 3 >,2,1,money> to all CPs={P 1 ,P 2 ,…, P 5 };

步骤4.2:每个CP在本地P-SC索引中获取所有包含p→<from*,to*>=<U1,U3>的bucket,根据查询条件中的权重集合W,计算其事务分数scorei。事务分数scorei为Fx(Tx),Fx(Tx)=∑attri×wi。其中,attri为事务Tx的第i个属性,wi≥0是查询条件中权重集合W的第i个值,是对应属性attri的权重。Step 4.2: Each CP obtains all buckets containing p→<from * ,to * >=<U 1 ,U 3 > in the local P-SC index, and calculates its transaction score score according to the weight set W in the query condition i . The transaction score score i is F x (T x ), F x (T x )=∑attr i ×w i . Among them, attri i is the i-th attribute of the transaction T x , w i ≥ 0 is the i-th value of the weight set W in the query condition, which is the weight of the corresponding attribute attri .

本实施例中,W只包含一个属性money,其权重为1,因此E集合中事务Txi,scorei=Fs(Txi)=moneyi×1;In this embodiment, W contains only one attribute money, and its weight is 1, so the transaction T xi in the E set, score i =F s (T xi )=money i ×1;

步骤4.3:根据score按照从大到小排序,将bucket中得分最高的2个事务添加到结果集合resultSet中, Step 4.3: Sort from largest to smallest according to score, and add the 2 highest-scoring transactions in the bucket to the result set resultSet,

步骤4.4:为resultSet计算摘要digest,并将digest广播给其他CP;Step 4.4: Calculate the digest digest for the resultSet, and broadcast the digest to other CPs;

步骤4.5:当收到的digest全部相同且数量超过了给定阈值,所有CP数量的三分之二时,返回resultSet,终止当前计算并等待下一次调用。Step 4.5: When the received digests are all the same and the number exceeds the given threshold, which is two-thirds of the number of all CPs, return resultSet, terminate the current calculation and wait 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 Expired - Fee Related 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 Expired - Fee Related 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
CN112714032B (en) Wireless network protocol knowledge graph construction and analysis method, system, device and medium
CN100531055C (en) Data synchronous system and its method
US6470333B1 (en) Knowledge extraction system and method
WO2021083239A1 (en) Graph data query method and apparatus, and device and storage medium
CN110110006A (en) Data managing method and Related product
Liang et al. Express supervision system based on NodeJS and MongoDB
CN103279543B (en) Path mode inquiring system for massive image data
CN111813955A (en) A Service Clustering Method Based on Knowledge Graph Representation Learning
CN106055652A (en) Method and system for database matching based on patterns and examples
CN112598510B (en) Resource data processing method and device
CN113378223B (en) K-anonymous data processing method and system based on double coding and cluster mapping
WO2022188646A1 (en) Graph data processing method and apparatus, and device, storage medium and program product
CN102402606B (en) High-efficiency text data mining method
CN112966001B (en) BCTkPQ query method based on blockchain
CN115098759A (en) Method for realizing API rapid retrieval management by using label technology
CN112749167A (en) Method and device for determining broken link data and nonvolatile storage medium
CN110119396A (en) Data managing method and Related product
CN107291875B (en) Method and system for metadata organization and management based on metadata graph
CN105677478A (en) Method and apparatus for resources management
CN103942249A (en) Information service scheduling system based on body collective semantic matching
CN110119427A (en) Data managing method and Related product
CN110297842A (en) A kind of data comparison method, device, terminal and storage medium
CN111562990B (en) Lightweight serverless computing method based on message
CN113360504B (en) Connection query optimization method based on multi-block chain environment
CN114647701A (en) Load balancing method and device for distributed database, electronic equipment and medium

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
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20230804

CF01 Termination of patent right due to non-payment of annual fee