WO2021232804A1 - 一种区块链数据索引的方法和区块链数据的存储方法 - Google Patents

一种区块链数据索引的方法和区块链数据的存储方法 Download PDF

Info

Publication number
WO2021232804A1
WO2021232804A1 PCT/CN2020/140251 CN2020140251W WO2021232804A1 WO 2021232804 A1 WO2021232804 A1 WO 2021232804A1 CN 2020140251 W CN2020140251 W CN 2020140251W WO 2021232804 A1 WO2021232804 A1 WO 2021232804A1
Authority
WO
WIPO (PCT)
Prior art keywords
transaction
index
query
note
data
Prior art date
Application number
PCT/CN2020/140251
Other languages
English (en)
French (fr)
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 EP20936141.9A priority Critical patent/EP4155966A4/en
Priority to JP2022515743A priority patent/JP7407912B2/ja
Publication of WO2021232804A1 publication Critical patent/WO2021232804A1/zh
Priority to US17/897,735 priority patent/US20220414090A1/en

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/22Indexing; Data structures therefor; Storage structures
    • G06F16/2228Indexing structures
    • G06F16/2272Management thereof
    • 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/23Updating
    • G06F16/2379Updates performed during online database operations; commit processing
    • 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/23Updating
    • G06F16/2365Ensuring data consistency and integrity
    • 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
    • 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/2453Query optimisation
    • 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
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/38Payment protocols; Details thereof
    • G06Q20/389Keeping log of transactions for guaranteeing non-repudiation of a transaction

Definitions

  • This application belongs to the field of blockchain technology, and in particular relates to a method for indexing blockchain data and a method for storing blockchain data.
  • some existing solutions include two: 1. Deploy a relational database outside the chain to synchronize data on the blockchain in real time, and structured storage of the data synchronized from the blockchain. 2. Use relational databases as the storage architecture of the underlying blockchain system. The former data synchronization efficiency is low, real-time performance is not strong, additional redundant storage overhead is added, and the query from the off-chain database is already out of the blockchain, and the data is not reliable. The latter structured blockchain block data and transaction data and stored them in a relational database. For the existing Key-Value-based storage architecture, the cost of transformation is high and the performance is not as good as NoSQL.
  • the transaction is a key issue that needs to be paid attention to when blockchain is widely used in traceability scenarios.
  • the purpose of this application is to provide a method for indexing blockchain data and a method for storing blockchain data in response to the deficiencies of the prior art.
  • the block chain client generates a block chain transaction and sends it to the verification node;
  • the block chain transaction includes the transaction sender, the transaction receiver, the transaction generation time, the transaction note and the transaction note index;
  • the transaction note The data type of the index is a number, a character string, or an array; the array is composed of at least one of a number and a character string, and the elements in the array are ordered;
  • the verification node receives the transaction sent in step (1), and executes the block after the block is generated by consensus, and then extracts the key transaction information of each transaction in the block to form a key transaction information list and build a layer of index data
  • the one-level index data includes a block number and a list of key transaction information
  • the key transaction information includes the transaction sender, the transaction receiver, the transaction generation time, the transaction note index, and the location of the transaction in the block;
  • the verification node persists the block generated in step (2) to the block file, and persists the layer of index data constructed in step (2) to the index database;
  • the client sends a query request to the verification node, including query conditions and retrieval modes;
  • the query conditions are composed of one or more of the designated transaction sender, transaction receiver, transaction generation time, and transaction note index;
  • the retrieval modes include multiple conditions and queries, multiple conditions or queries, sequential accurate query based on transaction note index, non-sequential accurate query based on transaction note index, and non-sequential matching query based on transaction note index;
  • the verification node obtains the block number corresponding to the transaction key information that meets the query conditions and the transaction in the block from the index database obtained in step (3) The position inside, query the block file obtained in step (3) to get the complete transaction, and return it to the client.
  • the retrieval mode is selected from the group consisting of a sequential accurate query based on the transaction note index, a non-sequential accurate query based on the transaction note index, or a non-sequential accurate query based on the transaction note index. Matching queries in order; when the query conditions are other conditions, the retrieval mode is selected from multiple conditions and queries or multiple conditions or queries.
  • the multiple conditions and queries are all items of transaction key information of a certain transaction retrieved by the verification node from the index database that meet the query conditions; the multiple conditions or queries are certain items retrieved by the verification node from the index database.
  • the transaction key information of a transaction meets at least one of the query conditions; among them, the transaction sender, transaction receiver, or transaction generation time in the transaction key information of a transaction is the same as the transaction sender, transaction receiver or transaction sender specified in the query conditions.
  • the transaction generation time when the transaction generation time is the same, it means that the transaction key information of the transaction meets the corresponding item in the query condition; when the transaction note index specified in the query condition is an array, the transaction note index and query in the transaction key information of a transaction When the elements of the transaction note index specified in the condition and their sequence are the same, it means that the transaction key information of the transaction meets the item in the query condition; when the transaction note index specified in the query condition is not an array, the transaction key of a transaction When the transaction note index in the information is the same as the number or string of the transaction note index specified in the query condition, it means that the key transaction information of the transaction meets the item in the query condition.
  • the sequential accurate query based on the transaction note index is the transaction note index in the transaction key information of a certain transaction retrieved from the index database by the verification node and the elements of the transaction note index specified in the query condition and their order The same;
  • the non-sequential precise query based on the transaction note index is that the transaction note index in the transaction key information of a certain transaction retrieved from the index database by the verification node is the same as the element of the transaction note index specified in the query condition;
  • the non-sequential matching query based on the transaction note index is that the transaction note index in the transaction key information of a certain transaction retrieved from the index database by the verification node includes at least one element of the transaction note index specified in the query condition.
  • a native database index is created for a certain field in the first-level index data in the index database obtained in step (3) as the second-level index, and the verification node persists the first-level index data constructed by the new transaction to the index database. , Automatically update the second-level index.
  • the second-level index is a full index or a partial index;
  • the full index refers to the creation of a native database index for a certain field of each index data in the index database;
  • the partial index refers to the index of the first-level index data
  • select part of the first-level index data in the index database to create the native database index of a certain field that is, when creating a partial index, add a filter expression to specify which one-level index data to establish a second-level index, which Some one-level index data does not establish a two-level index.
  • transaction note is any transaction-related data customized by the blockchain client
  • transaction note index is any transaction-related index customized by the blockchain client.
  • the character string does not exceed 1024 bits.
  • the block file supports Key-Value query;
  • the index database adopts a non-relational database that supports SQL-like queries.
  • a storage method of blockchain data is applied to a verification node, and the storage method includes:
  • Obtain a blockchain transaction including a transaction sender, a transaction receiver, transaction generation time, transaction notes, and transaction notes index;
  • the block is executed after the block is generated by the consensus production block
  • the key transaction information includes the transaction sender, transaction receiver, transaction generation time, transaction note index, and transaction status Location within the block;
  • This application expands the process of blockchain data storage, stores the blockchain index data in an independent index database and guarantees the atomicity of multi-database transactions, and establishes a way to customize business information in the transaction note field, and then through the self-definition Define the transaction note index field to associate the relationship between the transaction and the business information, and finally obtain the data index mechanism of the complete transaction based on the key information of the transaction. Since it is not necessary to re-traverse and analyze the blocks on the blockchain, it can quickly index to specific transactions, which greatly improves the efficiency of blockchain transaction backtracking. At the same time, because the data comes from the blockchain ledger instead of the blockchain. The external database ensures the reliability of the data and lays the cornerstone for the backtracking of transaction data.
  • FIG. 1 is a schematic flowchart of a method for indexing blockchain data according to an embodiment of the present application
  • FIG. 2 is a schematic diagram of a layer index data structure in a method for indexing blockchain data provided by an embodiment of the present application
  • FIG. 3 is a schematic diagram of data flow in a method for indexing blockchain data provided by an embodiment of the present application
  • Fig. 4 is a block chain-based cross-bank transfer business system architecture diagram provided by an embodiment of the present application.
  • a method for indexing blockchain data includes the following steps:
  • the blockchain client generates a blockchain transaction and sends it to the verification node.
  • the blockchain transaction includes transaction participants, transaction generation time, transaction note information, and transaction note index information.
  • Transaction participants include transaction senders and transaction receivers.
  • the transaction note information field and the transaction note index information field are an extension of the existing transaction data structure of this application.
  • the transaction note information field is any business-related data customized by the client, such as deposit certificate hash, product information, copyright information, and so on.
  • the transaction note index information field is any business-related index information customized by the client, and its data type is a number, a string (not more than 1024 bits) or an array; the array is composed of at least one of a number and a string , Which means that the blockchain transaction has multiple transaction note index information, and the elements (numbers, strings) in the array do not exceed 30.
  • the index information can have a corresponding relationship with the transaction note information field, or there may be no corresponding relationship. It all depends on how the client is defined. According to the transaction note index information field, you can quickly locate a specific one or more transactions, so as to obtain the complete business data defined in the transaction.
  • the client can use the characteristics of the blockchain to flexibly develop the applications they want.
  • the verification node receives the transaction sent in step S1, and executes the block after the consensus generation block is generated; then the key information of each transaction in the block is extracted according to the block data and transaction data, and a layer of index data is constructed.
  • the index data of the first layer is based on a block, and includes two fields of a block number and a key transaction information list.
  • Each transaction in the transaction key information list includes transaction participants, transaction generation time, transaction note index information, and transaction location information in the block.
  • the verification node persists the block generated in step S2 to a block file, and persists the index data constructed in step S2 to an index database.
  • one layer of index data and corresponding blocks are stored in different databases of the same verification node.
  • the block is stored in a block file that supports Key-Value query, where Key is the block number and Value is the block details; the block file only supports obtaining block details based on the block number, and then based on the block number And the position of the transaction in the block to get the transaction details.
  • the first-level index data is stored in an index database, which is a non-relational database that supports SQL-like queries, such as MongoDB.
  • the first-level index data is only the key information of the transaction, which is stored in the index database, and the complete detailed information of the transaction and the transaction note information are stored in the block file, which effectively avoids excessive redundant storage of the index database.
  • the data insertion of the index database and the block file has transaction atomicity.
  • the transaction atomicity means that each time a node generates a block, a data insertion transaction will be generated.
  • the insertion of multiple databases needs to ensure transaction atomicity, or all databases
  • the new data is inserted successfully, or no new data is inserted. If the block is successfully written to the block file, but the index database data insertion fails, the block file is rolled back. If the index database successfully inserts the index data, but the block file write fails, the index database is rolled back. Therefore, as long as the node generates and stores a new block, it can be considered that the corresponding index data will be generated and stored in the index database.
  • the verification node when the client sends a query request to the verification node, the verification node obtains transactions that meet the query conditions from the index database in step S3 according to the query conditions sent by the client, and obtains the block number of the exchange. And the location information of the transaction in the block, and then query the block file in step S3 with O(1) time complexity to obtain the complete transaction based on the block number and the location information of the transaction in the block, and return it to the client.
  • the query request includes query conditions and retrieval modes.
  • the query conditions are composed of any one or more of the transaction sender, transaction receiver, transaction generation time, and transaction note index information conditions; wherein, when the transaction note index information is an array, the numbers or strings in it have corresponding order.
  • the retrieval mode includes multiple conditions and queries, multiple conditions or queries, sequential accurate query based on transaction note index information, non-sequential accurate query based on transaction note index information, and non-sequential matching query based on transaction note index information.
  • the query condition is only transaction note index information and it is an array
  • the retrieval mode can be selected from sequential accurate query based on transaction note index information, non-sequential accurate query based on transaction note index information, or non-sequential matching based on transaction note index information Query; when the query conditions are other conditions, the retrieval mode can be selected from multiple conditions and queries or multiple conditions or queries.
  • the multi-condition and query means that the verification node retrieves transactions whose transaction information fully meets the query conditions from the index database; that is, when the query conditions include the transaction sender, transaction receiver, or transaction generation time, correspondingly retrieved transaction information
  • the value of the transaction sender field, transaction receiver field, and transaction generation time field in the transaction sender field, transaction receiver field, and transaction generation time field specified by the query conditions are equal to the values of the transaction sender, transaction receiver, and transaction generation time specified by the query condition;
  • the transaction note index field in the retrieved transaction information is equal to the transaction note index value specified by the query condition.
  • the transaction note index value specified in the query condition is an array
  • the transaction note index field of the retrieved transaction information The value is also an array, and the element value and element order in the array are exactly the same as the array specified by the query condition.
  • the multi-condition or query is that the verification node retrieves the transaction information from the index database partially or completely meets the same query condition; that is, the retrieved transaction information meets at least one of the query conditions, and only when the retrieved transaction information When the specified value and sequence of the transaction note index information condition are included, the transaction information is considered to meet the transaction note index information condition in the query condition.
  • the sequential and accurate query based on the transaction note index information is that the verification node retrieves from the index database the transaction whose transaction note index field is exactly equal to the transaction note index field specified by the query condition; when the transaction note index information specified in the query condition is data
  • the transaction note index field in the transaction retrieved from the index database must be an array, and the elements and sequence of the array are exactly equal to the value and sequence specified by the transaction note index field specified by the query condition.
  • the non-sequential accurate query based on the transaction note index information is that the verification node retrieves from the index database the transaction in which the transaction note index field contains all transaction note index information specified by the query condition; in this retrieval mode, the transaction specified by the query condition
  • the data type of the note index information must be an array, and the transaction note index field in the transaction retrieved from the index database must be an array and contain all the values in the transaction note index information array specified by the query conditions. The order of the values in the array is not relevant. Require.
  • the non-sequential matching query based on the transaction note index information is that the verification node retrieves from the index database the transaction in which the transaction note index field contains part or all of the transaction note index information specified by the query condition; in this retrieval mode, the query condition
  • the data type of the specified transaction note index information must be an array.
  • the transaction note index field in the transaction retrieved from the index database is an array or non-array, as long as it contains or equals any value in the query condition array. If the retrieved transaction note index field is an array and the array contains multiple values specified in the transaction note index information array specified by multiple query conditions, no matter whether the order of these values in the array is consistent with the query condition array, it will be regarded as Transactions that meet the query conditions.
  • the retrieval efficiency of the index database will be affected by the amount of data; in order to further speed up the data retrieval efficiency, when the query condition usage rate is high and the query efficiency is low, the block in the first index of the index database Create an index in one of the fields such as number, transaction participant, transaction generation time, transaction note index information, etc., that is, a two-tier index to improve the efficiency of index database query. If the verification node creates a two-level index, in step S3, when the first-level index data is persisted to the index database, the second-level index of the index database is automatically updated.
  • the two-level index refers to a native database index created for a certain field in a first-level index in the index database, and its purpose is to accelerate the efficiency of data query in the index database.
  • There are multiple decentralized applications running in the blockchain network and the usage rate of query conditions of blockchain nodes often depends on different application scenarios on the blockchain, and the transaction structure generated by different application scenarios is the same. Assume that there are multiple decentralized applications (DApps) running on the blockchain. Among them, DApp A has a greater need for querying complete transaction details based on transaction annotation index information. The query condition is relatively high. In order to improve Dapp A’s The query efficiency under query conditions generally creates a two-level index on the transaction note index field in the index database. However, for other DApps, the usage rate of the query conditions is not large, and transactions related to these DApps will also generate corresponding two-level index data, which wastes node storage space.
  • the two-level index needs to be divided into a full index and a partial index.
  • the all indexes refer to creating a native database index for a certain field of all one-level indexes in the index database.
  • the partial index refers to the creation of a native database index for a certain field of a partial first-level index in the index database through a filter expression, that is, when a second-level index is created, a filter expression is added to specify which field of the first-level index is created Two-level index, which do not create a two-level index. Part of the index can reduce storage pressure and reduce the performance loss caused by creating and updating the second-tier index.
  • the account address includes an internal account address and an external account address.
  • the internal account address refers to the account address for ordinary transfers
  • the external account address refers to the contract address.
  • the transaction recipient in the transaction structure can be Internal account address or external account address. Therefore, an external account address can be initialized for each DApp, and then different DApps can be distinguished by the address of the transaction receiver.
  • an external account address can be initialized for each DApp, and then different DApps can be distinguished by the address of the transaction receiver.
  • the party address is the DApp A address. In this way, the node can only create a two-level index for transactions whose transaction recipient address is the DApp A address, and not create a two-level index for other transactions.
  • FIG. 4 Exemplarily, a blockchain-based inter-bank transfer business system.
  • the overall system architecture is shown in Figure 4.
  • Banks A and B respectively deploy two blockchain verification nodes and each have their own business systems.
  • an inter-bank transfer flow includes the sender initiates a transfer application, and then Bank A and Bank B approve the application.
  • the approval content is to verify whether the user account is legal and whether the account is frozen, and Whether the balance is sufficient, the transfer and deduction will be made after the approval is passed.
  • the transfer flow is composed of multiple steps, and each step corresponds to a blockchain transaction to record the status of the transfer flow.
  • the business system needs to query the status of the transfer flow to know whether the user's cross-bank transfer is successful.
  • a music copyright information tracking system based on blockchain can easily realize the openness, transparency and infringement traceability of music copyright information through the technology provided in this application.
  • the song owner publishes the copyright information of the song on the blockchain.
  • the copyright information of the song includes the lyricist, composer, singer, copyright owner, etc. If the song user uses the song to obtain commercial revenue and is not in the copyright owner Inside, it can be considered that the user has infringement.
  • a blockchain transaction is generated to record the latest copyright information.
  • the copyright information of the song is defined in the transaction note field
  • the hash of the song audio file is defined in the transaction note index field
  • the query request composed of the pattern obtains the qualified blockchain transaction data from the verification node, and then obtains the detailed song copyright information defined in the transaction note field.
  • EXTRA Transaction note field
  • EXTRA_ID transaction note index field
  • the query condition is ⁇ "EXTRA_ID”: 123 ⁇ or ⁇ "EXTRA_ID”: "abc" ⁇ , an error is returned. Because in this search mode, the query condition must be an array type.
  • the query condition is ⁇ "EXTRA_ID”: 123 ⁇ or ⁇ "EXTRA_ID”: "abc" ⁇ , an error is returned. Because in this search mode, the query condition must be an array type.
  • the embodiment of the present application also provides a storage method of blockchain data.
  • the storage method is applied to the verification node, and the storage method includes the following steps:
  • Step S101 Obtain a blockchain transaction.
  • the blockchain transaction includes the transaction sender, transaction receiver, transaction generation time, transaction notes, and transaction note index.
  • the blockchain transaction can be generated by the blockchain client and sent to the verification node.
  • the data type of the transaction note index is a number, a string or an array; the array is composed of at least one of a number and a string, and the elements in the array are ordered.
  • the elements in the array do not exceed 30, and the string does not exceed 1024 bits.
  • the transaction note is any transaction-related data customized by the blockchain client that sends the blockchain transaction
  • the transaction note index is any transaction-related data customized by the blockchain client that sends the blockchain transaction Related indexes.
  • Step S102 According to the blockchain transaction, the consensus production block generates the block and executes the block.
  • the verification node After the verification node receives the blockchain transaction, it generates a block through its own consensus production block, and executes the block.
  • step S103 the block number of the block is obtained, and the key transaction information of each transaction in the block is extracted.
  • the key information list is generated based on the key information of each transaction in the block.
  • the key information of each transaction in the key information list includes the transaction sender, transaction receiver, transaction generation time, transaction note index, and transaction in the block. Location within.
  • step S104 a layer of index data is constructed according to the key transaction information and the block number.
  • the first-level index data is based on the block, and one unit includes the block number and the key transaction information list (that is, the key transaction information of each transaction).
  • a layer of index data based on key transaction information and block numbers, it also includes:
  • the target field in the first-level index data For the target field in the first-level index data, create a second-level index.
  • the second-level index is automatically updated, and the target field is a field in the first-level index data.
  • the second-level index refers to a native database index created for a field in the first-level index in the index database, and its purpose is to speed up the efficiency of data query in the index database.
  • decentralized applications running in the blockchain network
  • DApps decentralized applications
  • DApp A has a greater demand for querying complete transaction details based on transaction annotation index information.
  • the query condition is relatively high.
  • Dapp A The query efficiency under query conditions generally creates a two-level index on the transaction note index field in the index database.
  • the usage rate of the query conditions is not large, and transactions related to these DApps will also generate corresponding two-level index data, which wastes node storage space.
  • the second-level index is a full index or a partial index
  • a full index refers to creating a native database index for a certain field of each first-level index data in the index database
  • a partial index refers to a certain field of the first-level index data, Select part of the first-level index data in the index database to create a native database index for a certain field, that is, when creating a partial index, add a filter expression to specify which one-level index data to build a second-level index and which one-level index The data does not establish a two-level index.
  • the account address includes an internal account address and an external account address.
  • the internal account address refers to the account address for ordinary transfers, and the external account address refers to the contract address.
  • the transaction recipient in the transaction structure can be Internal account address or external account address. Therefore, an external account address can be initialized for each DApp, and then different DApps can be distinguished by the address of the transaction receiver.
  • Step S105 Persist one layer of index data to the index database.
  • the index data of one layer and the corresponding block are stored in different databases of the same verification node.
  • the first-level index data is stored in the index database, which is a non-relational database that supports SQL-like queries, such as MongoDB.
  • the first-level index data is only the key information of the transaction, which is stored in the index database, and the complete detailed information of the transaction and the transaction note information are stored in the block file, which effectively avoids excessive redundant storage of the index database.
  • Step S106 Persist the block to the block file.
  • the block is stored in a block file that supports Key-Value query, where Key is the block number and Value is the block details; the block file only supports obtaining block details based on the block number, and then based on the block number And the position of the transaction in the block to get the transaction details.
  • the data insertion of index database and block file has transaction atomicity.
  • Transaction atomicity means that every time a node generates a block, a data insertion transaction will be generated.
  • the insertion of multiple databases needs to ensure transaction atomicity, or all databases are successful Insert new data, or do not insert new data. If the block is successfully written to the block file, but the index database data insertion fails, the block file is rolled back. If the index database successfully inserts the index data, but the block file write fails, the index database is rolled back. Therefore, as long as the node generates and stores a new block, it can be considered that the corresponding index data will be generated and stored in the index database.
  • the storage method further includes:
  • the retrieval mode in the query request obtain the block number corresponding to the transaction key information that meets the query conditions in the query request and the location of the transaction in the block from the index database;
  • the complete transaction can be obtained from the block file.
  • the query request includes query conditions and retrieval modes.
  • the query conditions are composed of any one or more of the transaction sender, transaction receiver, transaction generation time, and transaction note index information conditions; among them, when the transaction note index information is an array, The numbers or strings have a corresponding order.
  • the retrieval mode can be selected from the orderly accurate query based on the transaction note index, the non-sequential accurate query based on the transaction note index, or the non-sequential accurate query based on the transaction note index. Match the query in order; when the query conditions are other conditions, the retrieval mode can be selected from multiple conditions and queries or multiple conditions or queries.
  • multiple conditions and queries are all items of transaction key information of a transaction retrieved by the verification node from the index database that meet the query conditions; multiple conditions or queries are a certain transaction retrieved by the verification node from the index database
  • the key transaction information meets at least one of the query conditions; among them, the transaction sender, transaction receiver or transaction generation time in the transaction key information of a transaction is the same as the transaction sender, transaction receiver or transaction generation specified in the query conditions When the time is the same, it means that the transaction key information of the transaction meets the corresponding item in the query condition; when the transaction note index specified in the query condition is an array, the transaction note index in the transaction key information of a certain transaction is in the query condition When the elements of the specified transaction note index and their sequence are the same, it means that the transaction key information of the transaction meets the item in the query condition; when the transaction note index specified in the query condition is not an array, the transaction key information of a certain transaction When the transaction note index of is the same as the number or string of the transaction note index specified in the query condition, it means
  • multi-conditions and queries are all items where the key transaction information of a certain transaction retrieved by the verification node from the index database meets the query conditions, that is, multi-conditions and queries are all items that the verification node retrieves from the index database and the transaction information fully meets the query conditions.
  • the query conditions include the transaction sender, transaction receiver, or transaction generation time
  • the transaction sender field, transaction receiver field, and transaction generation time field in the retrieved transaction information are equal to the query conditions specified
  • the query condition includes the transaction note index information condition
  • the transaction note index field in the retrieved transaction information is equal to the transaction note index value specified by the query condition
  • the transaction note index field value of the retrieved transaction information is also an array, and the element value and element order in the array are exactly the same as the array specified by the query condition .
  • Multi-condition or query means that the key transaction information of a certain transaction retrieved by the verification node from the index database meets at least one of the query conditions, that is, multi-condition or query means that the verification node retrieves the transaction information from the index database partially or completely.
  • the retrieved transaction information meets at least one of the query conditions. Only when the retrieved transaction information includes the specified value and sequence of the transaction note index information condition, the transaction information is considered to meet the query conditions.
  • Transaction note index information conditions are examples of the transaction information of retrieved by the verification node from the index database meets at least one of the query conditions.
  • the orderly accurate query based on the transaction note index is the transaction note index in the transaction key information of a transaction retrieved from the index database by the verification node and the elements and order of the transaction note index specified in the query condition Same; non-sequential accurate query based on transaction note index is the transaction note index in the transaction key information of a transaction retrieved from the index database by the verification node and the elements of the transaction note index specified in the query condition are the same; based on transaction notes
  • the non-sequential matching query of the index is that the transaction note index in the transaction key information of a certain transaction retrieved from the index database by the verification node includes at least one element of the transaction note index specified in the query condition.
  • the orderly accurate query based on the transaction note index is for the verification node to retrieve from the index database the transaction whose transaction note index field is exactly equal to the transaction note index field specified by the query condition; when the data type of the transaction note index information specified in the query condition When it is an array, the transaction note index field in the transaction retrieved from the index database must be an array, and the elements and sequence of the array are exactly equal to the value and sequence specified by the transaction note index field specified by the query condition.
  • the non-sequential accurate query based on the transaction note index is for the verification node to retrieve the transaction note index field from the index database that contains all transaction note index information specified by the query condition; in this search mode, the transaction note index information specified by the query condition
  • the data type of must be an array, and the transaction note index field in the transaction retrieved by the index database must be an array and contain all the values in the transaction note index information array specified by the query conditions. There is no requirement for the order of the values in the array.
  • the non-sequential matching query based on the transaction note index is the verification node retrieves from the index database the transaction that contains part or all of the transaction note index information specified by the query condition in the transaction note index field; in this search mode, the transaction specified by the query condition
  • the data type of the note index information must be an array.
  • the transaction note index field in the transaction retrieved from the index database is an array or non-array, as long as it contains or equals any value in the query condition array. If the retrieved transaction note index field is an array and the array contains multiple values specified in the transaction note index information array specified by multiple query conditions, no matter whether the order of these values in the array is consistent with the query condition array, it will be regarded as Transactions that meet the query conditions.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • General Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Computational Linguistics (AREA)
  • Business, Economics & Management (AREA)
  • Computer Security & Cryptography (AREA)
  • Accounting & Taxation (AREA)
  • Finance (AREA)
  • Strategic Management (AREA)
  • General Business, Economics & Management (AREA)
  • Computing Systems (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

一种区块链数据索引的方法和区块链数据的存储方法。该方法首先持久化区块到区块文件,持久化一层索引数据到索引数据库,然后根据查询条件获取符合的交易位置,最后从区块文件得到完整交易。该方法通过扩展区块链数据存储的处理过程,将区块链索引数据存储在独立索引数据库中且保证多数据库事务原子性,建立了一种将业务信息自定义在交易附注字段,然后通过自定义交易附注索引字段来关联交易与业务信息的联系,最后基于交易关键信息从而获取完整交易的数据索引机制;由于无需对区块链上的区块进行重新遍历和解析就能快速索引到具体交易,极大地提高了区块链交易回溯的效率,同时又保证了数据可靠性,为交易数据回溯奠定基石。

Description

一种区块链数据索引的方法和区块链数据的存储方法
本申请要求于2020年05月18日提交的、申请号为202010419364.9、发明名称为“一种区块链数据索引的方法”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请属于区块链技术领域,尤其涉及一种区块链数据索引的方法和区块链数据的存储方法。
背景技术
随着区块链技术的快速发展和普及,区块链的技术研究及其衍生应用也呈现出爆发式的增长。区块链数据不可篡改、数据可验证以及数据可追溯的特点,使其成为实现智慧政务、智慧医疗、慈善追踪和存证溯源的核心前沿技术。现有区块链***一般采用Key-Value型数据库存储引擎以及文件存储的混合存储架构,对于区块与交易这种连续型数据存储在文件,其它数据存储在Key-Value型NoSQL数据库。因此,对于数据的检索,只能基于Key值进行粗粒度查询,无法针对Value的结构化数据进行检索。比如,想要查询某个账户下面的所有交易,则必须遍历整个区块链,以区块号为Key得到对应的Value,反序列化区块的内容,然后筛选出交易发送方和交易接收方都为指定账户的交易。这种查询方法效率极低,不具备可用性。再比如,用户想要筛选出与某个业务应用相关的交易,只能根据交易接收方(也即合约地址)来过滤,无法根据业务数据来过滤,对用户来说,直观性不够强。
为了解决这个问题,现有的一些解决方案包括两个:1.在链外部署关系型数据库实时同步区块链上的数据,将从区块链上同步过来的数据进行结构化存储。2.使用关系型数据库作为底层区块链***的存储架构。前者数据同步效率较低、实时性不强、增加了额外冗余存储开销,并且从链外数据库进行查询已然脱离了区块链,数据不具备可靠性。后者将区块链区块数据、交易数据结构化,存储到关系型数据库中,对于现有基于Key-Value型的存储架构来说改造成本较高且性能表现不如NoSQL。
技术问题
如何扩展现有存储架构,在尽最大努力减少额外冗余存储开销、减少对***吞吐量影响的基础上,使得现有区块链***支持基于Value的查询,甚至支持快速检索与某个业务相关的交易,是区块链广泛应用于溯源场景需要关注的重点问题。本申请的目的在于针对现有技术的不足,提供一种区块链数据索引的方法和区块链数据的存储方法。
技术解决方案
本申请的目的是通过以下技术方案来实现的:一种区块链数据索引的方法,包括以下步骤:
(1)区块链客户端生成一笔区块链交易发送给验证节点;所述区块链交易包括交易发送方、交易接收方、交易生成时间、交易附注和交易附注索引;所述交易附注索引的数据类型为数字、字符串或者数组;所述数组由数字、字符串中至少一种组成,数组中的元素是有序的;
(2)验证节点接收到步骤(1)发送的交易,共识产块生成区块后执行区块,然后提取区块中每条交易的交易关键信息,组成交易关键信息列表,构建一层索引数据;所述一层索引数据包括区块号和交易关键信息列表;所述交易关键信息包括交易发送方、交易接收方、交易生成时间、交易附注索引、交易在区块内的位置;
(3)验证节点持久化步骤(2)生成的区块到区块文件,持久化步骤(2)构建的一层索引数据到索引数据库;
(4)客户端向验证节点发送查询请求,包括查询条件和检索模式;所述查询条件由指定的交易发送方、交易接收方、交易生成时间、交易附注索引中的一个或多个组成;所述检索模式包括多条件与查询、多条件或查询、基于交易附注索引的按序精准查询、基于交易附注索引的非按序精准查询和基于交易附注索引的非按序匹配查询;
(5)验证节点根据步骤(4)中客户端发送的查询请求中的检索模式,从步骤(3)得到的索引数据库里获取符合查询条件的交易关键信息对应的区块号和交易在区块内的位置,从步骤(3)得到的区块文件里查询得到完整交易,返回给客户端。
进一步地,当查询条件只有交易附注索引且为指定的数组时,所述检索模式选自基于交易附注索引的按序精准查询、基于交易附注索引的非按序精准查询或基于交易附注索引的非按序匹配查询;当查询条件为其它情况时,所述检索模式选自多条件与查询或多条件或查询。
进一步地,所述多条件与查询为验证节点从索引数据库里检索得到的某条交易的交易关键信息符合查询条件的所有项;所述多条件或查询为验证节点从索引数据库里检索得到的某条交易的交易关键信息符合查询条件中至少一项;其中,某条交易的交易关键信息中的交易发送方、交易接收方或交易生成时间与查询条件中指定的交易发送方、交易接收方或交易生成时间相同时,表示该条交易的交易关键信息符合查询条件中对应的一项;当查询条件中指定的交易附注索引为数组时,某条交易的交易关键信息中的交易附注索引与查询条件中指定的交易附注索引的元素及其顺序相同时,表示该条交易的交易关键信息符合查询条件中的该项;当查询条件中指定的交易附注索引不是数组时,某条交易的交易关键信息中的交易附注索引与查询条件中指定的交易附注索引的数字或字符串相同时,表示该条交易的交易关键信息符合查询条件中的该项。
进一步地,所述基于交易附注索引的按序精准查询为验证节点从索引数据库里检索得到的某条交易的交易关键信息中的交易附注索引与查询条件中指定的交易附注索引的元素及其顺序相同;所述基于交易附注索引的非按序精准查询为验证节点从索引数据库里检索得到的某条交易的交易关键信息中的交易附注索引与查询条件中指定的交易附注索引的元素相同;所述基于交易附注索引的非按序匹配查询为验证节点从索引数据库里检索得到的某条交易的交易关键信息中的交易附注索引包括至少一个查询条件中指定的交易附注索引的元素。
进一步地,进一步对步骤(3)得到的索引数据库中的一层索引数据中的某个字段创建原生数据库索引作为二层索引,验证节点将新交易构建的一层索引数据持久化到索引数据库时,自动更新二层索引。
进一步地,所述二层索引为全部索引或部分索引;所述全部索引指为索引数据库内每个一层索引数据的某个字段创建原生数据库索引;所述部分索引指针对一层索引数据的某个字段,选择索引数据库内部分一层索引数据来创建其某个字段的原生数据库索引,即创建部分索引的时候,添加过滤表达式来指定对哪一些一层索引数据建立二层索引,哪一些一层索引数据不建立二层索引。
进一步地,所述交易附注为区块链客户端自定义的任何与交易相关的数据;所述交易附注索引为区块链客户端自定义的任何与交易相关的索引。
进一步地,所述数组中的元素不超过30个。
进一步地,所述字符串不超过1024位。
进一步地,所述区块文件支持Key-Value型查询;所述索引数据库采用支持类SQL查询的非关系型数据库。
一种区块链数据的存储方法,所述存储方法应用于验证节点,所述存储方法包括:
获取区块链交易,所述区块链交易包括交易发送方、交易接收方、交易生成时间、交易附注和交易附注索引;
根据所述区块链交易,共识产块生成区块后执行所述区块;
获取所述区块的区块号,并提取出所述区块内每条交易的交易关键信息,所述交易关键信息包括交易发送方、交易接收方、交易生成时间、交易附注索引、交易在区块内的位置;
根据所述交易关键信息和所述区块号,构建一层索引数据;
将所述一层索引数据持久化到索引数据库;
将所述区块持久化到区块文件。
有益效果
本申请通过扩展区块链数据存储的处理过程,将区块链索引数据存储在独立索引数据库中且保证多数据库事务原子性,建立了一种将业务信息自定义在交易附注字段,然后通过自定义交易附注索引字段来关联交易与业务信息的联系,最后基于交易关键信息从而获取完整交易的数据索引机制。由于无需对区块链上的区块进行重新遍历和解析就能快速索引到具体交易,极大地提高了区块链交易回溯的效率,同时因为数据源于区块链账本而不是区块链之外的数据库,又保证了数据可靠性,为交易数据回溯奠定基石。
附图说明
为了更清楚地说明本申请的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单的介绍。显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其它附图。
图1是本申请实施例提供的一种区块链数据索引的方法的流程示意图;
图2是本申请实施例提供的一种区块链数据索引的方法中一层索引数据结构示意图;
图3是本申请实施例提供的一种区块链数据索引的方法中数据流向示意图;
图4是本申请实施例提供的一种基于区块链的跨行转账业务***架构图。
本发明的实施方式
下面根据附图和具体实施例详细描述本申请,本申请的目的和效果将变得更加明显。
实施例1
一种区块链数据索引的方法,具体的如图1所示,包括如下步骤:
S1,区块链客户端生成一笔区块链交易发送给验证节点。
所述区块链交易包括交易参与方、交易生成时间、交易附注信息和交易附注索引信息,交易参与方包括交易发送方和交易接收方。其中,交易附注信息字段和交易附注索引信息字段,是本申请对现有交易数据结构的扩展。
所述交易附注信息字段为由客户端自定义的任何与业务相关的数据,比如存证哈希、商品信息、版权信息等。
所述交易附注索引信息字段为客户端自定义的任何与业务相关的索引信息,其数据类型为数字、字符串(不超过1024位)或者数组;所述数组由数字、字符串中至少一个组成,表示区块链交易拥有多个交易附注索引信息,数组中的元素(数字、字符串)不超过30个,该索引信息可以与交易附注信息字段存在对应关系,也可以不存在对应关系,这完全取决于客户端是如何定义的。根据交易附注索引信息字段可以快速定位到具体某一条或多条交易,从而得到交易里定义的完整业务数据,比如根据交易附注索引字段里定义的商品ID得到定义在交易附注字段里的商品详情、根据交易附注索引字段里定义的商品ID以及商品增删改查操作码得到定义在交易附注字段里的操作详情、根据交易附注索引字段存储的上一次业务操作关联的交易哈希来追溯前一笔交易,等等。这两个字段的内容完全由客户端自由定义,节点不必关心其内容是什么,只需要限制这两个字段的大小防止DDoS攻击。通过这种设计,客户端可以运用区块链的特性,灵活开发自己想要的应用。
S2,验证节点接收到步骤S1发送的交易,共识产块生成区块后执行区块;然后根据区块数据和交易数据提取出区块内每条交易的关键信息,构建一层索引数据。
如图2所示,所述一层索引数据以区块为单位,包括区块号和交易关键信息列表两个字段。所述交易关键信息列表里的每一条交易均包括交易参与方、交易生成时间、交易附注索引信息、交易在区块内的位置信息。
S3,验证节点持久化步骤S2生成的区块到区块文件,持久化步骤S2构建的一层索引数据到索引数据库。
如图3所示,一层索引数据与对应的区块存储在同一验证节点的不同数据库里。所述区块存储在支持Key-Value型查询的区块文件里,其中Key为区块号,Value为区块详情;区块文件只支持根据区块号得到区块详情,进而根据区块号以及交易在区块内的位置得到交易详情。所述一层索引数据存储在索引数据库,索引数据库为支持类SQL查询的非关系型数据库,比如MongoDB。一层索引数据仅仅为交易关键信息,被存储在索引数据库,而交易的完整的详细信息及交易附注信息存储在区块文件中,这有效避免了索引数据库过多的冗余存储。
索引数据库与区块文件的数据***具备事务原子性,所述事务原子性指的是节点每生成一个区块,会产生一个数据***事务,多个数据库的***需要保证事务原子性,要么所有数据库都成功***新数据,要么都不***新数据。如果区块成功写入到区块文件,而索引数据库数据***失败,则区块文件进行回滚。如果索引数据库成功***索引数据,而区块文件写入失败,则索引数据库进行回滚。因此,只要节点生成并存储了一个新区块,就可以认为会生成对应的索引数据存储在索引数据库里。
S4,如图3所示,客户端向验证节点发送查询请求时,验证节点根据客户端发送的查询条件,从步骤S3的索引数据库里获取符合查询条件的交易,得到该交易所在区块号以及交易在区块内的位置信息,再根据区块号和交易在区块内的位置信息从步骤S3的区块文件里以O(1)时间复杂度查询得到完整交易,返回给客户端。
所述查询请求包括查询条件和检索模式。
所述查询条件由交易发送方、交易接收方、交易生成时间、交易附注索引信息条件中的任意一个或者多个组成;其中,交易附注索引信息为数组时,其中的数字或字符串有相应的顺序。
所述检索模式包括多条件与查询、多条件或查询、基于交易附注索引信息的按序精准查询、基于交易附注索引信息的非按序精准查询和基于交易附注索引信息的非按序匹配查询。当查询条件只有交易附注索引信息且为数组时,检索模式选自基于交易附注索引信息的按序精准查询、基于交易附注索引信息的非按序精准查询或基于交易附注索引信息的非按序匹配查询;当查询条件为其它情况时,检索模式选自多条件与查询或多条件或查询。
所述多条件与查询为验证节点从索引数据库里检索出交易信息完全符合查询条件的交易;即当查询条件包括交易发送方、交易接收方或交易生成时间时,对应地,检索出的交易信息中的交易发送方字段、交易接收方字段和交易生成时间字段的值等于查询条件指定的交易发送方、交易接收方和交易生成时间的值;当查询条件包括交易附注索引信息条件时,对应地,检索出的交易信息中的交易附注索引字段等于查询条件指定的交易附注索引值,对应地,如果查询条件里指定的交易附注索引值为一个数组,则检索出的交易信息的交易附注索引字段值也为一个数组,且数组里元素值及元素顺序与查询条件指定的数组完全一致。
所述多条件或查询为验证节点从索引数据库里检索出交易信息部分或完全符合相同查询条件的交易;即检索出的交易信息至少符合查询条件中的一项,其中仅当检索出的交易信息包括交易附注索引信息条件的指定值及其顺序时,认为该交易信息符合查询条件中的交易附注索引信息条件。
所述基于交易附注索引信息的按序精准查询为验证节点从索引数据库里检索出交易附注索引字段完全等于查询条件指定的交易附注索引字段的交易;当查询条件里指定的交易附注索引信息的数据类型为数组时,则要求索引数据库检索出来的交易中的交易附注索引字段必须为一个数组,且数组的元素和顺序完全等于查询条件指定的交易附注索引字段指定的值和顺序。
所述基于交易附注索引信息的非按序精准查询为验证节点从索引数据库里检索出交易附注索引字段包含查询条件指定的全部交易附注索引信息的交易;这种检索模式下,查询条件指定的交易附注索引信息的数据类型必须为数组,要求索引数据库检索出来的交易中的交易附注索引字段必须为一个数组且包含查询条件指定的交易附注索引信息数组里的所有值,对数组里值的顺序无要求。
所述基于交易附注索引信息的非按序匹配查询为验证节点从索引数据库里检索出交易附注索引字段包含部分或全部的查询条件指定的交易附注索引信息的交易;这种检索模式下,查询条件指定的交易附注索引信息的数据类型必须为数组,索引数据库检索出来的交易中的交易附注索引字段为数组或者非数组,只要包含或等于查询条件数组里的任意值即可。如果检索到的交易附注索引字段为数组且数组里包含多个查询条件指定的交易附注索引信息数组里指定的多个值,不管这些值在数组里的顺序是否与查询条件数组一致,都认为是符合查询条件的交易。
随着数据量的剧增,索引数据库的检索效率将受到数据量的影响;为了进一步加快数据检索效率,当查询条件使用率较高且查询效率低下时,对索引数据库一层索引中的区块号、交易参与方、交易生成时间、交易附注索引信息等字段中的某个字段创建索引,即二层索引来提高索引数据库查询效率。如果验证节点创建了二层索引,则步骤S3持久化一层索引数据到索引数据库的时候,自动更新索引数据库的二层索引。
所述二层索引指为索引数据库内一层索引中的某个字段创建的原生数据库索引,其目的是加快索引数据库内数据查询效率。区块链网络里运行着多个去中心化应用,往往区块链节点查询条件使用率取决于区块链之上的不同应用场景,而不同应用场景生成的交易结构都是一样的。假设,区块链上运行了多个去中心化应用(DApp),其中,DApp A对根据交易附注索引信息查询完整交易详情的需求比较大,该查询条件使用率比较高,为了提升Dapp A该查询条件下的查询效率,一般会对索引数据库内的交易附注索引字段创建二层索引。但是,对于其他DApp来说,对该查询条件的使用率并不大,而与这些DApp相关的交易也会生成对应的二层索引数据,浪费了节点存储空间。
因此,所述二层索引需要分为全部索引和部分索引。所述全部索引指为索引数据库内全部一层索引的某个字段创建原生数据库索引。所述部分索引指通过过滤表达式来为索引数据库内部分一层索引的某个字段创建原生数据库索引,即创建二层索引的时候,添加过滤表达式来指定对哪些一层索引的该字段建立二层索引,哪些不建立二层索引。部分索引可以降低存储压力,减少创建二层索引、更新二层索引带来的性能损耗。在区块链的交易结构里,账户地址有内部账户地址和外部账户地址,内部账户地址指的是普通转账的账户地址,外部账户地址指的是合约地址,交易结构里的交易接收方可以为内部账户地址或外部账户地址。因此,可以为每个DApp初始化一个外部账户地址,然后通过交易接收方地址来区分不同的DApp。为了进一步说明,继续以前文提到的例子为例,我们可以为DApp A创建部分索引来提高其根据交易附注索引信息查询完整交易详情的查询效率,并指定该部分索引的过滤表达式:交易接收方地址为DApp A地址。通过这种做法,可以使得节点只为交易接收方地址为DApp A地址的交易创建二层索引,而对其他交易不创建二层索引。
具体的,为了便于读者进一步理解一种区块链数据索引方法所带来的收益效果,下面将举例子来详细介绍一种区块链数据索引方法。
示例性的,一个基于区块链的跨行转账业务***,***总体架构如图4所示,银行A和B分别部署了两个区块链验证节点,并且都有各自的业务***。
假设银行A的用户转账给银行B的用户,一笔跨行转账流水包括发出方发起转账申请,然后由银行A和银行B对该申请进行审批,审批内容为验证用户账户是否合法、账户是否冻结以及余额是否足够,审批通过以后才进行转账扣款。由此可见,转账流水是由多个步骤组成,每个步骤都对应一笔区块链交易用于记录转账流水的状态。业务***需要查询转账流水的状态才能得知用户跨行转账是否成功。在这种业务背景下,就需要有一个转账流水ID来作为每次转账的唯一标识,并且能够使用转账流水ID作为查询条件,从验证节点查询得到与该转账流水相关的区块链交易。因此,需要将转账流水ID定义在交易附注索引字段,然后通过由包括交易附注索引信息的查询条件和基于交易附注索引的按序精准查询检索模式组成的查询请求,从验证节点查询得到需要的区块链交易数据。
示例性的,一个基于区块链的音乐版权信息追踪***,通过本申请提供的技术很容易实现音乐版权信息的公开透明性、侵权可追踪性。比如,歌曲所有者将歌曲版权信息发布到区块链上,歌曲版权信息包括作词者、作曲者、演唱者、版权所有者等等,如果歌曲使用者利用该歌曲获取商业收益且不在版权所有者里面,则可认为该使用者存在侵权。每一次歌曲版权的变更都对应生成一笔区块链交易用于记录最新版权信息。在这种业务背景下,歌曲版权信息定义在交易附注字段,歌曲音频文件哈希定义在交易附注索引字段,然后通过由包括交易附注索引信息的查询条件和基于交易附注索引的按序精准查询检索模式组成的查询请求,从验证节点查询得到符合条件的区块链交易数据,进而得到定义在交易附注字段的详细歌曲版权信息。
示例性的,下面列举基于交易附注索引信息的按序精准查询、基于交易附注索引信息的非按序精准查询和基于交易附注索引信息的非按序匹配查询这三种检索模式的查询例子,来促进读者对这类检索模式的理解,进而开发出期望的基于区块链的业务***。
假设将交易附注字段命名为“EXTRA”,将交易附注索引字段命名为“EXTRA_ID”,进一步地,假设现在区块链上存在EXTRA_ID分别为 [123, "abc"]、["abc", 123]、[123, "efg", "abc"]、[123]、["abc"]、123、"abc"的7笔交易。
当检索模式为基于交易附注索引信息的按序精准查询时:
如果查询条件为{ "EXTRA_ID": [123] },则符合查询条件的 EXTRA_ID 只有一个: [123]。
如果查询条件为{ "EXTRA_ID": "abc" },则符合查询条件的 EXTRA_ID 只有一个: "abc"。
如果查询条件为{ "EXTRA_ID": [123, "abc"] },则符合查询条件的 EXTRA_ID 只有一个: [123, "abc"]。
当检索模式为基于交易附注索引信息的非按序精准查询时:
如果查询条件为 { "EXTRA_ID": 123 } 或者{ "EXTRA_ID": "abc" },则返回错误。因为这种检索模式下,查询条件必须为数组类型。
如果查询条件为 { "EXTRA_ID": [123] },则符合查询条件的 EXTRA_ID有四个:[123, "abc"]、["abc", 123]、[123, "efg", "abc"]、[123]。
如果查询条件为{ "EXTRA_ID": [123, "abc"] },则符合查询条件的 EXTRA_ID有三个:[123, "abc"]、["abc", 123]、[123, "efg", "abc"]。
当检索模式为基于交易附注索引信息的非按序匹配查询时:
如果查询条件为 { "EXTRA_ID": 123 } 或者{ "EXTRA_ID": "abc" },则返回错误。因为这种检索模式下,查询条件必须为数组类型。
如果查询条件为{ "EXTRA_ID":  [123] },则符合查询条件的 EXTRA_ID有五个:[123, "abc"]、["abc", 123]、[123, "efg", "abc"]、[123]、123。
如果查询条件为{ "EXTRA_ID":  [123, "abc"] },则所有 EXTRA_ID都符合查询条件,即:[123, "abc"]、["abc", 123]、[123, "efg", "abc"]、[123]、["abc"]、123、"abc"。
实施例2
本申请的实施例还提供一种区块链数据的存储方法,存储方法应用于验证节点,该存储方法包括以下步骤:
步骤S101,获取区块链交易。
其中,区块链交易包括交易发送方、交易接收方、交易生成时间、交易附注和交易附注索引,该区块链交易可以由区块链客户端生成并发送给验证节点。
可选的是,交易附注索引的数据类型为数字、字符串或者数组;数组由数字、字符串中至少一种组成,数组中的元素是有序的。
其中,数组中的元素不超过30个,字符串不超过1024位。
可选的是,交易附注为发送区块链交易的区块链客户端自定义的任何与交易相关的数据;交易附注索引为发送区块链交易的区块链客户端自定义的任何与交易相关的索引。
步骤S102,根据区块链交易,共识产块生成区块后执行区块。
其中,验证节点接收到区块链交易后,通过自身的共识产块生成区块,并执行该区块。
步骤S103,获取区块的区块号,并提取出区块内每条交易的交易关键信息。
其中,根据区块内每条交易的交易关键信息生成关键信息列表,关键信息列表中每条交易的交易关键信息包括交易发送方、交易接收方、交易生成时间、交易附注索引、交易在区块内的位置。
步骤S104,根据交易关键信息和区块号,构建一层索引数据。
其中,一层索引数据以区块为单位,一个单位包括区块号和交易关键信息列表(即每条交易的交易关键信息)。
可选的是,在根据交易关键信息和区块号,构建一层索引数据之后,还包括:
针对一层索引数据中目标字段,创建二层索引,在将新的交易构建的一层索引数据持久化到索引数据库时,自动更新二层索引,目标字段为一层索引数据中的某个字段。
其中,二层索引指为索引数据库内一层索引中的某个字段创建的原生数据库索引,其目的是加快索引数据库内数据查询效率。区块链网络里运行着多个去中心化应用,往往区块链节点查询条件使用率取决于区块链之上的不同应用场景,而不同应用场景生成的交易结构都是一样的。假设,区块链上运行了多个去中心化应用(DApp),其中,DApp A对根据交易附注索引信息查询完整交易详情的需求比较大,该查询条件使用率比较高,为了提升Dapp A该查询条件下的查询效率,一般会对索引数据库内的交易附注索引字段创建二层索引。但是,对于其他DApp来说,对该查询条件的使用率并不大,而与这些DApp相关的交易也会生成对应的二层索引数据,浪费了节点存储空间。
可选的是,二层索引为全部索引或部分索引;全部索引指为索引数据库内每个一层索引数据的某个字段创建原生数据库索引;部分索引指针对一层索引数据的某个字段,选择索引数据库内部分一层索引数据来创建其某个字段的原生数据库索引,即创建部分索引的时候,添加过滤表达式来指定对哪一些一层索引数据建立二层索引,哪一些一层索引数据不建立二层索引。
其中,部分索引可以降低存储压力,减少创建二层索引、更新二层索引带来的性能损耗。在区块链的交易结构里,账户地址有内部账户地址和外部账户地址,内部账户地址指的是普通转账的账户地址,外部账户地址指的是合约地址,交易结构里的交易接收方可以为内部账户地址或外部账户地址。因此,可以为每个DApp初始化一个外部账户地址,然后通过交易接收方地址来区分不同的DApp。为了进一步说明,继续以前文提到的例子为例,我们可以为DApp A创建部分索引来提高其根据交易附注索引信息查询完整交易详情的查询效率,并指定该部分索引的过滤表达式:交易接收方地址为DApp A地址。通过这种做法,可以使得节点只为交易接收方地址为DApp A地址的交易创建二层索引,而对其他交易不创建二层索引。
步骤S105,将一层索引数据持久化到索引数据库。
其中,一层索引数据与对应的区块存储在同一验证节点的不同数据库里。一层索引数据存储在索引数据库,索引数据库为支持类SQL查询的非关系型数据库,比如MongoDB。一层索引数据仅仅为交易关键信息,被存储在索引数据库,而交易的完整的详细信息及交易附注信息存储在区块文件中,这有效避免了索引数据库过多的冗余存储。
步骤S106,将区块持久化到区块文件。
其中,区块存储在支持Key-Value型查询的区块文件里,其中Key为区块号,Value为区块详情;区块文件只支持根据区块号得到区块详情,进而根据区块号以及交易在区块内的位置得到交易详情。
索引数据库与区块文件的数据***具备事务原子性,事务原子性指的是节点每生成一个区块,会产生一个数据***事务,多个数据库的***需要保证事务原子性,要么所有数据库都成功***新数据,要么都不***新数据。如果区块成功写入到区块文件,而索引数据库数据***失败,则区块文件进行回滚。如果索引数据库成功***索引数据,而区块文件写入失败,则索引数据库进行回滚。因此,只要节点生成并存储了一个新区块,就可以认为会生成对应的索引数据存储在索引数据库里。
可选的是,该存储方法还包括:
获取区块链客户端发送的查询请求;
根据查询请求中的检索模式,从索引数据库中,获取符合查询请求中查询条件的交易关键信息对应的区块号和交易在区块内的位置;
根据区块号和位置,从区块文件里查询得到完整交易。
其中,查询请求包括查询条件和检索模式,查询条件由交易发送方、交易接收方、交易生成时间、交易附注索引信息条件中的任意一个或者多个组成;其中,交易附注索引信息为数组时,其中的数字或字符串有相应的顺序。
可选的是,当查询条件只有交易附注索引且为指定的数组时,检索模式选自基于交易附注索引的按序精准查询、基于交易附注索引的非按序精准查询或基于交易附注索引的非按序匹配查询;当查询条件为其它情况时,检索模式选自多条件与查询或者多条件或查询。
可选的是,多条件与查询为验证节点从索引数据库里检索得到的某条交易的交易关键信息符合查询条件的所有项;多条件或查询为验证节点从索引数据库里检索得到的某条交易的交易关键信息符合查询条件中至少一项;其中,某条交易的交易关键信息中的交易发送方、交易接收方或交易生成时间与查询条件中指定的交易发送方、交易接收方或交易生成时间相同时,表示该条交易的交易关键信息符合查询条件中对应的一项;当查询条件中指定的交易附注索引为数组时,某条交易的交易关键信息中的交易附注索引与查询条件中指定的交易附注索引的元素及其顺序相同时,表示该条交易的交易关键信息符合查询条件中的该项;当查询条件中指定的交易附注索引不是数组时,某条交易的交易关键信息中的交易附注索引与查询条件中指定的交易附注索引的数字或字符串相同时,表示该条交易的交易关键信息符合查询条件中的该项。
其中,多条件与查询为验证节点从索引数据库里检索得到的某条交易的交易关键信息符合查询条件的所有项,即多条件与查询为验证节点从索引数据库里检索出交易信息完全符合查询条件的交易,当查询条件包括交易发送方、交易接收方或交易生成时间时,对应地,检索出的交易信息中的交易发送方字段、交易接收方字段和交易生成时间字段的值等于查询条件指定的交易发送方、交易接收方和交易生成时间的值;当查询条件包括交易附注索引信息条件时,对应地,检索出的交易信息中的交易附注索引字段等于查询条件指定的交易附注索引值,对应地,如果查询条件里指定的交易附注索引值为一个数组,则检索出的交易信息的交易附注索引字段值也为一个数组,且数组里元素值及元素顺序与查询条件指定的数组完全一致。
多条件或查询为验证节点从索引数据库里检索得到的某条交易的交易关键信息符合查询条件中至少一项,即多条件或查询为验证节点从索引数据库里检索出交易信息部分或完全符合相同查询条件的交易,检索出的交易信息至少符合查询条件中的一项,其中仅当检索出的交易信息包括交易附注索引信息条件的指定值及其顺序时,认为该交易信息符合查询条件中的交易附注索引信息条件。
可选的是,基于交易附注索引的按序精准查询为验证节点从索引数据库里检索得到的某条交易的交易关键信息中的交易附注索引与查询条件中指定的交易附注索引的元素及其顺序相同;基于交易附注索引的非按序精准查询为验证节点从索引数据库里检索得到的某条交易的交易关键信息中的交易附注索引与查询条件中指定的交易附注索引的元素相同;基于交易附注索引的非按序匹配查询为验证节点从索引数据库里检索得到的某条交易的交易关键信息中的交易附注索引包括至少一个查询条件中指定的交易附注索引的元素。
其中,基于交易附注索引的按序精准查询为验证节点从索引数据库里检索出交易附注索引字段完全等于查询条件指定的交易附注索引字段的交易;当查询条件里指定的交易附注索引信息的数据类型为数组时,则要求索引数据库检索出来的交易中的交易附注索引字段必须为一个数组,且数组的元素和顺序完全等于查询条件指定的交易附注索引字段指定的值和顺序。
基于交易附注索引的非按序精准查询为验证节点从索引数据库里检索出交易附注索引字段包含查询条件指定的全部交易附注索引信息的交易;这种检索模式下,查询条件指定的交易附注索引信息的数据类型必须为数组,要求索引数据库检索出来的交易中的交易附注索引字段必须为一个数组且包含查询条件指定的交易附注索引信息数组里的所有值,对数组里值的顺序无要求。
基于交易附注索引的非按序匹配查询为验证节点从索引数据库里检索出交易附注索引字段包含部分或全部的查询条件指定的交易附注索引信息的交易;这种检索模式下,查询条件指定的交易附注索引信息的数据类型必须为数组,索引数据库检索出来的交易中的交易附注索引字段为数组或者非数组,只要包含或等于查询条件数组里的任意值即可。如果检索到的交易附注索引字段为数组且数组里包含多个查询条件指定的交易附注索引信息数组里指定的多个值,不管这些值在数组里的顺序是否与查询条件数组一致,都认为是符合查询条件的交易。
以上实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本申请各实施例技术方案的精神和范围,均应包含在本申请的保护范围之内。

Claims (20)

  1. 一种区块链数据索引的方法,其特征在于,包括以下步骤:
    (1)区块链客户端生成一笔区块链交易发送给验证节点;所述区块链交易包括交易发送方、交易接收方、交易生成时间、交易附注和交易附注索引;所述交易附注索引的数据类型为数字、字符串或者数组;所述数组由数字、字符串中至少一种组成,数组中的元素是有序的;
    (2)验证节点接收到步骤(1)发送的交易,共识产块生成区块后执行区块,然后提取区块中每条交易的交易关键信息,组成交易关键信息列表,构建一层索引数据;所述一层索引数据包括区块号和交易关键信息列表;所述交易关键信息包括交易发送方、交易接收方、交易生成时间、交易附注索引、交易在区块内的位置;
    (3)验证节点持久化步骤(2)生成的区块到区块文件,持久化步骤(2)构建的一层索引数据到索引数据库;
    (4)客户端向验证节点发送查询请求,包括查询条件和检索模式;所述查询条件由指定的交易发送方、交易接收方、交易生成时间、交易附注索引中的一个或多个组成;所述检索模式包括多条件与查询、多条件或查询、基于交易附注索引的按序精准查询、基于交易附注索引的非按序精准查询和基于交易附注索引的非按序匹配查询;
    (5)验证节点根据步骤(4)中客户端发送的查询请求中的检索模式,从步骤(3)得到的索引数据库里获取符合查询条件的交易关键信息对应的区块号和交易在区块内的位置,从步骤(3)得到的区块文件里查询得到完整交易,返回给客户端。
  2. 根据权利要求1所述区块链数据索引的方法,其特征在于,当查询条件只有交易附注索引且为指定的数组时,所述检索模式选自基于交易附注索引的按序精准查询、基于交易附注索引的非按序精准查询或基于交易附注索引的非按序匹配查询;当查询条件为其它情况时,所述检索模式选自多条件与查询或多条件或查询。
  3. 根据权利要求2所述区块链数据索引的方法,其特征在于,所述多条件与查询为验证节点从索引数据库里检索得到的某条交易的交易关键信息符合查询条件的所有项;所述多条件或查询为验证节点从索引数据库里检索得到的某条交易的交易关键信息符合查询条件中至少一项;其中,某条交易的交易关键信息中的交易发送方、交易接收方或交易生成时间与查询条件中指定的交易发送方、交易接收方或交易生成时间相同时,表示该条交易的交易关键信息符合查询条件中对应的一项;当查询条件中指定的交易附注索引为数组时,某条交易的交易关键信息中的交易附注索引与查询条件中指定的交易附注索引的元素及其顺序相同时,表示该条交易的交易关键信息符合查询条件中的该项;当查询条件中指定的交易附注索引不是数组时,某条交易的交易关键信息中的交易附注索引与查询条件中指定的交易附注索引的数字或字符串相同时,表示该条交易的交易关键信息符合查询条件中的该项。
  4. 根据权利要求2所述区块链数据索引的方法,其特征在于,所述基于交易附注索引的按序精准查询为验证节点从索引数据库里检索得到的某条交易的交易关键信息中的交易附注索引与查询条件中指定的交易附注索引的元素及其顺序相同;所述基于交易附注索引的非按序精准查询为验证节点从索引数据库里检索得到的某条交易的交易关键信息中的交易附注索引与查询条件中指定的交易附注索引的元素相同;所述基于交易附注索引的非按序匹配查询为验证节点从索引数据库里检索得到的某条交易的交易关键信息中的交易附注索引包括至少一个查询条件中指定的交易附注索引的元素。
  5. 根据权利要求1所述区块链数据索引的方法,其特征在于,进一步对步骤(3)得到的索引数据库中的一层索引数据中的某个字段创建原生数据库索引作为二层索引,验证节点将新交易构建的一层索引数据持久化到索引数据库时,自动更新二层索引。
  6. 根据权利要求5所述区块链数据索引的方法,其特征在于,所述二层索引为全部索引或部分索引;所述全部索引指为索引数据库内每个一层索引数据的某个字段创建原生数据库索引;所述部分索引指针对一层索引数据的某个字段,选择索引数据库内部分一层索引数据来创建其某个字段的原生数据库索引,即创建部分索引的时候,添加过滤表达式来指定对哪一些一层索引数据建立二层索引,哪一些一层索引数据不建立二层索引。
  7. 根据权利要求1所述区块链数据索引的方法,其特征在于,所述交易附注为区块链客户端自定义的任何与交易相关的数据;所述交易附注索引为区块链客户端自定义的任何与交易相关的索引。
  8. 根据权利要求1所述区块链数据索引的方法,其特征在于,所述数组中的元素不超过30个。
  9. 根据权利要求1所述区块链数据索引的方法,其特征在于,所述字符串不超过1024位。
  10. 根据权利要求1所述区块链数据索引的方法,其特征在于,所述区块文件支持Key-Value型查询;所述索引数据库采用支持类SQL查询的非关系型数据库。
  11. 一种区块链数据的存储方法,其特征在于,所述存储方法应用于验证节点,所述存储方法包括:
    获取区块链交易,所述区块链交易包括交易发送方、交易接收方、交易生成时间、交易附注和交易附注索引;
    根据所述区块链交易,共识产块生成区块后执行所述区块;
    获取所述区块的区块号,并提取出所述区块内每条交易的交易关键信息,所述交易关键信息包括交易发送方、交易接收方、交易生成时间、交易附注索引、交易在区块内的位置;
    根据所述交易关键信息和所述区块号,构建一层索引数据;
    将所述一层索引数据持久化到索引数据库;
    将所述区块持久化到区块文件。
  12. 根据权利要求11所述的存储方法,其特征在于,在所述根据所述交易关键信息和所述区块号,构建一层索引数据之后,还包括:
    针对所述一层索引数据中目标字段,创建二层索引,在将新的交易构建的一层索引数据持久化到索引数据库时,自动更新二层索引,所述目标字段为所述一层索引数据中的某个字段。
  13. 根据权利要求12所述的存储方法,其特征在于,所述二层索引为全部索引或部分索引;
    所述全部索引指为所述索引数据库内每个一层索引数据的某个字段创建原生数据库索引;
    所述部分索引指针对一层索引数据的某个字段,选择所述索引数据库内部分一层索引数据来创建其某个字段的原生数据库索引,即创建部分索引的时候,添加过滤表达式来指定对哪一些一层索引数据建立二层索引,哪一些一层索引数据不建立二层索引。
  14. 根据权利要求11所述的存储方法,其特征在于,所述存储方法还包括:
    获取区块链客户端发送的查询请求;
    根据所述查询请求中的检索模式,从所述索引数据库中,获取符合所述查询请求中查询条件的交易关键信息对应的区块号和交易在区块内的位置;
    根据所述区块号和所述位置,从所述区块文件里查询得到完整交易。
  15. 根据权利要求14所述的存储方法,其特征在于,当所述查询条件只有交易附注索引且为指定的数组时,所述检索模式选自基于所述交易附注索引的按序精准查询、基于所述交易附注索引的非按序精准查询或基于所述交易附注索引的非按序匹配查询;当查询条件为其它情况时,所述检索模式选自多条件与查询或者多条件或查询。
  16. 根据权利要求15所述的存储方法,其特征在于,所述多条件与查询为验证节点从所述索引数据库里检索得到的某条交易的交易关键信息符合查询条件的所有项;
    所述多条件或查询为验证节点从所述索引数据库里检索得到的某条交易的交易关键信息符合查询条件中至少一项;
    其中,某条交易的交易关键信息中的交易发送方、交易接收方或交易生成时间与查询条件中指定的交易发送方、交易接收方或交易生成时间相同时,表示该条交易的交易关键信息符合查询条件中对应的一项;
    当查询条件中指定的交易附注索引为数组时,某条交易的交易关键信息中的交易附注索引与查询条件中指定的交易附注索引的元素及其顺序相同时,表示该条交易的交易关键信息符合查询条件中的该项;
    当查询条件中指定的交易附注索引不是数组时,某条交易的交易关键信息中的交易附注索引与查询条件中指定的交易附注索引的数字或字符串相同时,表示该条交易的交易关键信息符合查询条件中的该项。
  17. 根据权利要求15所述的存储方法,其特征在于,所述基于所述交易附注索引的按序精准查询为验证节点从所述索引数据库里检索得到的某条交易的交易关键信息中的交易附注索引与查询条件中指定的交易附注索引的元素及其顺序相同;
    所述基于交易附注索引的非按序精准查询为验证节点从所述索引数据库里检索得到的某条交易的交易关键信息中的交易附注索引与查询条件中指定的交易附注索引的元素相同;
    所述基于交易附注索引的非按序匹配查询为验证节点从所述索引数据库里检索得到的某条交易的交易关键信息中的交易附注索引包括至少一个查询条件中指定的交易附注索引的元素。
  18. 根据权利要求11所述的存储方法,其特征在于,所述交易附注索引的数据类型为数字、字符串或者数组;所述数组由数字、字符串中至少一种组成,数组中的元素是有序的。
  19. 根据权利要求18所述的存储方法,其特征在于,所述交易附注为发送所述区块链交易的区块链客户端自定义的任何与交易相关的数据;所述交易附注索引为发送所述区块链交易的区块链客户端自定义的任何与交易相关的索引。
  20. 根据权利要求11所述的存储方法,其特征在于,所述区块文件支持Key-Value型查询;所述索引数据库采用支持类SQL查询的非关系型数据库。
PCT/CN2020/140251 2020-05-18 2020-12-28 一种区块链数据索引的方法和区块链数据的存储方法 WO2021232804A1 (zh)

Priority Applications (3)

Application Number Priority Date Filing Date Title
EP20936141.9A EP4155966A4 (en) 2020-05-18 2020-12-28 METHODS OF INDEXING BLOCKCHAIN DATA AND METHODS OF STORING BLOCKCHAIN DATA
JP2022515743A JP7407912B2 (ja) 2020-05-18 2020-12-28 ブロックチェーンデータをインデックスする方法およびブロックチェーンデータを格納する方法
US17/897,735 US20220414090A1 (en) 2020-05-18 2022-08-29 Blockchain data index method, blockchain data storage method and device

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202010419364.9A CN111339106B (zh) 2020-05-18 2020-05-18 一种区块链数据索引的方法
CN202010419364.9 2020-05-18

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US17/897,735 Continuation-In-Part US20220414090A1 (en) 2020-05-18 2022-08-29 Blockchain data index method, blockchain data storage method and device

Publications (1)

Publication Number Publication Date
WO2021232804A1 true WO2021232804A1 (zh) 2021-11-25

Family

ID=71186479

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/140251 WO2021232804A1 (zh) 2020-05-18 2020-12-28 一种区块链数据索引的方法和区块链数据的存储方法

Country Status (5)

Country Link
US (1) US20220414090A1 (zh)
EP (1) EP4155966A4 (zh)
JP (1) JP7407912B2 (zh)
CN (1) CN111339106B (zh)
WO (1) WO2021232804A1 (zh)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115408474A (zh) * 2022-11-03 2022-11-29 青岛理工大学 面向多源数据库的区块链海量数据存证***及存证方法
CN116595024A (zh) * 2023-07-17 2023-08-15 中博信息技术研究院有限公司 一种海量数据区块链应用的处理方法及装置

Families Citing this family (15)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111339106B (zh) * 2020-05-18 2020-08-28 杭州趣链科技有限公司 一种区块链数据索引的方法
CN111782656B (zh) * 2020-06-30 2024-04-12 京东科技信息技术有限公司 数据读写方法及装置
CN112035466B (zh) * 2020-07-29 2024-04-19 北京智融云河科技有限公司 一种区块链查询外置索引开发框架
CN112087439B (zh) * 2020-09-02 2022-05-17 杭州趣链科技有限公司 区块链交易查询方法、***、计算机设备和存储介质
CN114372051A (zh) * 2020-10-16 2022-04-19 华为技术有限公司 一种数据处理***、基于区块链的数据处理方法及设备
CN112966126B (zh) * 2021-02-26 2021-09-17 南京审计大学 一种面向海量非结构化数据内容可查询可追溯的高可靠知识库构建方法
CN113064901A (zh) * 2021-04-06 2021-07-02 北京瑞卓喜投科技发展有限公司 在链上合约中形成数据微型索引的方法、装置和电子设备
CN113342832B (zh) * 2021-08-04 2021-11-02 北京快立方科技有限公司 一种数据库索引方法
CN113627937A (zh) * 2021-08-24 2021-11-09 上海点融信息科技有限责任公司 一种区块存储方法、装置、设备和存储介质
CN113821549B (zh) * 2021-09-23 2023-08-08 广东科学技术职业学院 一种基于云存储的区块链数据检索***及方法
CN113902442A (zh) * 2021-10-13 2022-01-07 中国银行股份有限公司 基于区块链的捐款业务处理方法及装置
CN114020737B (zh) * 2021-10-20 2024-06-18 大连理工江苏研究院有限公司 一种区块链数据高效可信索引方法
CN114338719A (zh) * 2021-12-27 2022-04-12 杭州趣链科技有限公司 基于联盟链的证据处理方法、装置及电子设备
CN114896280B (zh) * 2022-03-22 2024-06-18 杭州未名信科科技有限公司 一种数据查询方法和***
CN115687276A (zh) * 2022-11-18 2023-02-03 抖音视界有限公司 一种文件处理方法、装置、电子设备及存储介质

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107239954A (zh) * 2017-06-07 2017-10-10 北京汇通金财信息科技有限公司 一种提高区块产生速度的方法及装置
CN108170857A (zh) * 2018-01-22 2018-06-15 广州市中智软件开发有限公司 一种电子证照跨域互联服务的建立方法和调用方法
CN108897758A (zh) * 2018-05-15 2018-11-27 深圳市网心科技有限公司 一种区块链交易查询方法、装置、***和存储介质
US20190095585A1 (en) * 2017-09-27 2019-03-28 International Business Machines Corporation Blockchain based proactive chromosomal determination
CN110750541A (zh) * 2019-10-18 2020-02-04 天津理工大学 一种基于区块链的数据存储索引***及方法
CN111339106A (zh) * 2020-05-18 2020-06-26 杭州趣链科技有限公司 一种区块链数据索引的方法

Family Cites Families (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2001236358A (ja) * 2000-02-23 2001-08-31 Ricoh Co Ltd 文書検索方法および装置
JP5444302B2 (ja) * 2011-09-30 2014-03-19 株式会社東芝 データベース要求処理装置及びプログラム
JP6898548B2 (ja) * 2017-02-15 2021-07-07 富士通株式会社 承認システム、承認方法および承認プログラム
CN111917864B (zh) * 2017-02-22 2023-08-22 创新先进技术有限公司 一种业务校验的方法及装置
US20180268504A1 (en) * 2017-03-15 2018-09-20 Factom Indexing Mortgage Documents via Blockchains
CN110612697B (zh) * 2017-05-09 2023-11-07 埃森哲环球解决方案有限公司 用于高效信息检索的数据存储层索引的方法和***
US11281644B2 (en) * 2017-07-28 2022-03-22 Hitachi, Ltd. Blockchain logging of data from multiple systems
KR101893729B1 (ko) * 2018-03-28 2018-10-04 주식회사 마크로젠 복수의 블록체인에 기반한 데이터 공유 방법
JP2020057221A (ja) * 2018-10-02 2020-04-09 株式会社ユナイテッドスマイルズ 情報処理方法、情報処理装置及びプログラム
CN110022298B (zh) * 2019-03-04 2021-04-06 创新先进技术有限公司 基于区块链的证据验证的方法、装置、电子设备
CN111104386B (zh) * 2019-11-04 2023-09-01 京东科技信息技术有限公司 一种文件存储方法、终端及存储介质
CN110874365B (zh) * 2019-11-20 2023-11-17 深圳市迅雷网络技术有限公司 一种信息查询方法及其相关设备

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107239954A (zh) * 2017-06-07 2017-10-10 北京汇通金财信息科技有限公司 一种提高区块产生速度的方法及装置
US20190095585A1 (en) * 2017-09-27 2019-03-28 International Business Machines Corporation Blockchain based proactive chromosomal determination
CN108170857A (zh) * 2018-01-22 2018-06-15 广州市中智软件开发有限公司 一种电子证照跨域互联服务的建立方法和调用方法
CN108897758A (zh) * 2018-05-15 2018-11-27 深圳市网心科技有限公司 一种区块链交易查询方法、装置、***和存储介质
CN110750541A (zh) * 2019-10-18 2020-02-04 天津理工大学 一种基于区块链的数据存储索引***及方法
CN111339106A (zh) * 2020-05-18 2020-06-26 杭州趣链科技有限公司 一种区块链数据索引的方法

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
See also references of EP4155966A4

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115408474A (zh) * 2022-11-03 2022-11-29 青岛理工大学 面向多源数据库的区块链海量数据存证***及存证方法
CN115408474B (zh) * 2022-11-03 2023-01-24 青岛理工大学 面向多源数据库的区块链海量数据存证***及存证方法
CN116595024A (zh) * 2023-07-17 2023-08-15 中博信息技术研究院有限公司 一种海量数据区块链应用的处理方法及装置
CN116595024B (zh) * 2023-07-17 2023-09-26 中博信息技术研究院有限公司 一种海量数据区块链应用的处理方法及装置

Also Published As

Publication number Publication date
US20220414090A1 (en) 2022-12-29
JP7407912B2 (ja) 2024-01-04
JP2022547956A (ja) 2022-11-16
EP4155966A4 (en) 2024-06-12
CN111339106A (zh) 2020-06-26
CN111339106B (zh) 2020-08-28
EP4155966A1 (en) 2023-03-29

Similar Documents

Publication Publication Date Title
WO2021232804A1 (zh) 一种区块链数据索引的方法和区块链数据的存储方法
CN109165224B (zh) 一种在区块链数据库上针对关键字key的索引方法
CN110471795B (zh) 区块链状态数据恢复方法及装置、电子设备
US7702640B1 (en) Stratified unbalanced trees for indexing of data items within a computer system
US20220132213A1 (en) Hybrid Blockchains and Streamchains Using Non-Crypto Hashes for Securing Audio-, Video-, Image-, and Speech-Based Transactions and Contracts
US20210382899A1 (en) Dual-stack architecture that integrates relational database with blockchain
US11720688B2 (en) Secure initiation and transfer of a cryptographic database and/or a cryptographic unit
CN113329031A (zh) 一种区块的状态树的生成方法及装置
CN111597015B (zh) 事务处理方法、装置、计算机设备及存储介质
US10963854B2 (en) Blockchain-based electronic bill reimbursement method, apparatus, and electronic device
CN102890678A (zh) 一种基于格雷编码的分布式数据布局方法及查询方法
CN113421160B (zh) 一种基于区块链的交易追踪溯源方法
CN112286963A (zh) 一种区块链终端数据可信查询***及其实现方法
CN113259478B (zh) 在区块链***中执行交易的方法、装置及区块链***
WO2021227319A1 (zh) 一种工程协作区块链数据结构及应用方法
CN112579261A (zh) 退出跨片事务的方法和***、主链节点和目标分片节点
CN109558453A (zh) 一种区块链数据网络化存储和移存的方法
CN107451177B (zh) 针对增加区块的单个勘误的区块链的查询方法及***
CN112261160B (zh) 包含分片的区块链***中退出跨片事务的方法及***
CN110928923A (zh) 一种基于区块链的数据存储方法及***
CN102193979B (zh) 图形数据库非联机事务中查询数据的控制方法
Pi et al. xFabLedger: Extensible Ledger Storage for Hyperledger Fabric
Qing et al. Blockchain interoperability mechanism
CN116663053A (zh) 一种支持丰富检索的区块链高效可验证查询方法
Kong et al. WST+ iMPT: A High-performance Incremental Verification World State Model for Massive Accounts

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20936141

Country of ref document: EP

Kind code of ref document: A1

ENP Entry into the national phase

Ref document number: 2022515743

Country of ref document: JP

Kind code of ref document: A

NENP Non-entry into the national phase

Ref country code: DE

ENP Entry into the national phase

Ref document number: 2020936141

Country of ref document: EP

Effective date: 20221219