CN113806357A - Transaction storage and query method based on centralized block chain type account book - Google Patents

Transaction storage and query method based on centralized block chain type account book Download PDF

Info

Publication number
CN113806357A
CN113806357A CN202011105223.6A CN202011105223A CN113806357A CN 113806357 A CN113806357 A CN 113806357A CN 202011105223 A CN202011105223 A CN 202011105223A CN 113806357 A CN113806357 A CN 113806357A
Authority
CN
China
Prior art keywords
transaction
business
keyword
service
transaction identifier
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.)
Pending
Application number
CN202011105223.6A
Other languages
Chinese (zh)
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.)
Alipay Hangzhou Information Technology Co Ltd
Original Assignee
Alipay Hangzhou Information Technology Co Ltd
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 Alipay Hangzhou Information Technology Co Ltd filed Critical Alipay Hangzhou Information Technology Co Ltd
Priority to CN202011105223.6A priority Critical patent/CN113806357A/en
Publication of CN113806357A publication Critical patent/CN113806357A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • G06F16/2228Indexing 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/24Querying
    • G06F16/242Query formulation
    • G06F16/243Natural language query formulation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2455Query execution
    • G06F16/24552Database cache management
    • 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/2458Special types of queries, e.g. statistical queries, fuzzy queries or distributed queries
    • G06F16/2471Distributed queries
    • 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
    • G06Q30/00Commerce
    • G06Q30/06Buying, selling or leasing transactions
    • G06Q30/0601Electronic shopping [e-shopping]
    • G06Q30/0633Lists, e.g. purchase orders, compilation or processing
    • G06Q30/0635Processing of requisition or of purchase orders
    • 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
    • G06Q40/00Finance; Insurance; Tax strategies; Processing of corporate or income taxes
    • G06Q40/04Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange

Abstract

A transaction storage and query method based on a centralized block chain type account book is disclosed. The business key words can be appointed in the business transaction submitted to the database server by the user, and are used for marking the business type related to the business transaction. Besides maintaining a centralized block chain type account book, the database server side also maintains a cache space corresponding to each business keyword in a cache, and also maintains a unified index table for recording index information related to business transactions.

Description

Transaction storage and query method based on centralized block chain type account book
Technical Field
The embodiment of the specification relates to the technical field of information, in particular to a transaction storage and query method based on a centralized block chain type account book.
Background
The centralized block chain type ledger is different from a decentralized block chain type ledger (for example, a block chain maintained in a distributed manner by each node in a block chain network), and refers to a local database maintained by a centralized database server. The centralized block chain Ledger is also sometimes referred to as a Ledger Data Base (Ledger DB).
The centralized block chain type account book is a novel storage scheme obtained by improving on the basis of a block chain storage scheme, and can solve the problems of low throughput, long response time and the like of block chain storage. The service object of the centralized block chain type account book is usually an enterprise-level user, the user generally registers an account at a database server, business data generated by self business is packaged into business transaction through the account, the business transaction is submitted to the database server, and after the database server accepts the business transaction, a plurality of business transactions are packaged into data blocks based on certain blocking conditions and written into the centralized block chain type account book for storage.
Because the database server usually packages batch business transactions into data blocks according to the acceptance sequence of the business transactions, the data blocks are written into an account book, and the data server usually accepts the transactions submitted by a plurality of users; therefore, even if the same user, the business transactions that are continuously submitted to the database server are not stored in a centralized manner, but are scattered in different positions and different data blocks in the same data block, which is not beneficial to query the business transactions.
Disclosure of Invention
The embodiment of the application aims to solve the problem that the efficiency of inquiring and trading is not high in the existing centralized block chain type account book storage mode.
In order to solve the above technical problem, the embodiment of the present application is implemented as follows:
according to the 1 st aspect of the embodiments of the present specification, there is provided a transaction storage method based on a centralized block chain ledger, which is applied to a database server, where the database server maintains the centralized block chain ledger, and the method includes:
accepting a business transaction submitted by a user account; the business transaction carries at least one business keyword;
storing the business transaction into a centralized block chain type account book, and acquiring a transaction identifier of the business transaction as a first transaction identifier; the first transaction identification is used for uniquely identifying the business transaction in a centralized block chain type account book;
aiming at each business keyword carried by the business transaction, if the business keyword appears for the first time, creating a cache space corresponding to the business keyword, writing the first transaction identification into the cache space corresponding to the business keyword, and writing the business keyword and the first transaction identification into a unified index table in a corresponding relation form;
if the business keyword does not appear for the first time, acquiring a transaction identifier from a cache space corresponding to the business keyword to serve as a second transaction identifier, writing the business keyword, the first transaction identifier and the second transaction identifier into the unified index table in a corresponding relation mode, and updating the second transaction identifier in the cache space corresponding to the business keyword into the first transaction identifier.
According to the 2 nd aspect of the embodiments of the present specification, there is provided a transaction query method based on the transaction storage method of the 1 st aspect, applied to a database server, the transaction query method including:
receiving an inquiry request sent by a user account, and determining at least one service keyword appointed by the inquiry request and a transaction serial number to be inquired corresponding to each appointed service keyword;
and aiming at each business keyword appointed by the query request, acquiring a transaction identifier from a cache space corresponding to the business keyword, and querying the business transaction of the transaction serial number to be queried corresponding to the business keyword according to the acquired transaction identifier and the unified index table.
According to the 3 rd aspect of the embodiments of the present specification, there is provided a transaction storage apparatus based on a centralized block chain ledger, which is applied to a database server, where the database server maintains the centralized block chain ledger, and the apparatus includes:
the acceptance module accepts business transaction submitted by a user account; the business transaction carries at least one business keyword;
the storage module is used for storing the business transaction into a centralized block chain type account book and acquiring a transaction identifier of the business transaction as a first transaction identifier; the first transaction identification is used for uniquely identifying the business transaction in a centralized block chain type account book;
the first processing module is used for establishing a cache space corresponding to each service keyword carried by the service transaction if the service keyword appears for the first time, writing the first transaction identifier into the cache space corresponding to the service keyword, and writing the service keyword and the first transaction identifier into a unified index table in a corresponding relation form;
and the second processing module is used for acquiring a transaction identifier from the cache space corresponding to the service keyword as a second transaction identifier if the service keyword does not appear for the first time, writing the service keyword, the first transaction identifier and the second transaction identifier into the unified index table in a corresponding relation mode, and updating the second transaction identifier in the cache space corresponding to the service keyword into the first transaction identifier.
According to the 4 th aspect of the embodiments of the present specification, there is provided a transaction query device based on the transaction storage method of the 1 st aspect, which is applied to a database server, the device including:
the receiving module is used for receiving a query request sent by a user account and determining at least one service keyword appointed by the query request and a transaction serial number to be queried corresponding to each appointed service keyword;
and the query module is used for acquiring a transaction identifier from a cache space corresponding to each service keyword specified by the query request, and querying the service transaction of the transaction serial number to be queried corresponding to the service keyword according to the acquired transaction identifier and the unified index table.
Through the scheme provided in the embodiment of the specification, the business key words can be specified in the business transaction submitted to the database server by the user and are used for marking the business type related to the business transaction. Besides maintaining a centralized block chain type account book, the database server side also maintains a cache space corresponding to each business keyword in a cache, and also maintains a unified index table for recording index information related to business transactions.
Specifically, a database server side obtains a first transaction identifier of the current business transaction, then, for each business keyword in the current business transaction, if the business keyword appears for the first time, a cache space corresponding to the business keyword is created, the first transaction identifier is written into the cache space corresponding to the business keyword, and the business keyword and the first transaction identifier are written into a unified index table in a corresponding relation mode; if the business keyword does not appear for the first time, acquiring a transaction identifier from a cache space corresponding to the business keyword to be used as a second transaction identifier, writing the business keyword, the first transaction identifier and the second transaction identifier into the unified index table in a corresponding relation mode, and updating the second transaction identifier in the cache space corresponding to the business keyword into the first transaction identifier.
When business transaction needs to be inquired, the business transaction can be inquired by utilizing the transaction identification in the cache space corresponding to the business keyword and the unified index table according to the business keyword appointed by the inquiry request and the serial number of the transaction to be inquired corresponding to the business keyword.
Through one or more embodiments of the present description, efficient querying of business transactions deposited into a centralized block-chained ledger may be achieved.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of embodiments of the invention.
In addition, any one of the embodiments in the present specification is not required to achieve all of the effects described above.
Drawings
In order to more clearly illustrate the embodiments of the present specification or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments described in the embodiments of the present specification, and other drawings can be obtained by those skilled in the art according to the drawings.
FIG. 1 is a schematic diagram of a data storage system based on a centralized block chain ledger provided herein;
fig. 2 is a schematic flowchart of a transaction storage method based on a centralized block chain ledger according to an embodiment of the present specification;
fig. 3 is a schematic flowchart of a transaction query method based on a centralized block chain ledger according to an embodiment of the present specification;
fig. 4 is a schematic structural diagram of a transaction storage device based on a centralized block chain ledger provided in an embodiment of the present specification;
fig. 5 is a schematic structural diagram of a transaction inquiry apparatus provided in an embodiment of the present specification;
fig. 6 is a schematic structural diagram of an apparatus for configuring a method according to an embodiment of the present disclosure.
Detailed Description
Fig. 1 is a schematic diagram of a data storage system based on a centralized block chain ledger provided in the present specification. As shown in fig. 1, the data storage system includes a centralized database server and a plurality of clients. The database server is responsible for maintaining a centralized block chain type account book, each client corresponds to one enterprise-level user (mechanism), and each enterprise-level user is further connected with one or more individual users.
For example, the takeout platform and the e-commerce platform are respectively used as users to register on the database server to obtain user accounts, and install clients provided by the database server on own equipment to log in the user accounts in the clients, so that the takeout platform and the e-commerce platform have the capability of performing data interaction with the database server.
And the take-out platform and the e-commerce platform are respectively connected with a large number of individual users. After a certain individual user purchases a piece of takeout food by using a takeout client installed on a mobile phone of the individual user, equipment of a takeout platform generates a takeout order record (namely business data generated by the takeout platform based on business), the takeout platform encapsulates the order record into a transaction (similar to a block chain, the transaction is a special data structure suitable for storing a centralized block chain type account book) through a user account registered at a database server by the individual user, and submits the transaction to the database server so that the database server encapsulates the transaction into a database and writes the database into the centralized block chain type account book for storage. Similarly, each e-commerce order generated based on the e-commerce business is packaged into a transaction by the e-commerce platform and submitted to the database server.
For convenience of description, the user described hereinafter refers to an enterprise-level user served by the database server, and the user account described hereinafter refers to an account registered by the enterprise-level user at the database server.
In addition, a business keyword carried by a business transaction stored in the centralized block chain type account book is explained. The service keyword refers to a service keyword allocated to service data when a user needs to store the service data generated based on the user's own service. For example, the user may be an e-commerce platform, the business data generated by the user may be a commodity order, and different business keywords may be available for commodity orders of different commodity types. For example, the service keyword corresponding to the digital commodity order may be a number, and the service keyword corresponding to the food order may be two, namely, a food and a consumable.
And the database server stores the business transaction which is provided with the business data and the business keywords and submitted by the user into the centralized block chain type account book.
Because the database server needs to pack a batch of transactions into data blocks to be written into the account book, the data server usually accepts transactions submitted by a plurality of users, and even the same user usually submits business transactions with different business keywords continuously, the business transactions stored in the account book are not organized well and are convenient to refer. By using the business key words, the database server can subsequently screen all business transactions corresponding to the business key words from the book by taking a certain business key word as a clue (true).
Under the existing storage mode based on the centralized block chain type account book, because a database server side usually packs batch business transactions into data blocks according to the acceptance sequence of the business transactions and writes the data blocks into the account book, the data server side usually accepts the transactions submitted by a plurality of users; therefore, even if the same user, the business transactions that are continuously submitted to the database server are not stored in a centralized manner, but are scattered in different positions and different data blocks in the same data block, which is not beneficial to query the business transactions.
One feasible idea is that a dedicated index table is set for each business keyword, the database server side acquires at least one business key carried by each business transaction when storing the business transaction into an account book, and writes a transaction identifier of the business transaction into the index table corresponding to each business keyword related to the business transaction. Therefore, the subsequent database server can perform business transaction query in the special index table according to the business key words specified by the user, obtain the transaction identification of the business transaction, and directly position the business transaction in the account book.
However, the foregoing method has a disadvantage that the number of service keywords is large in practice, and if a dedicated index table is set for each service keyword, the database server consumes too many resources for maintaining a large number of index tables.
In one or more embodiments of the present disclosure, in addition to maintaining the centralized block chain type ledger, the database server may also maintain a cache space corresponding to each business keyword in the cache, and further maintain a unified index table for recording index information related to business transactions. Specifically, a database server side obtains a first transaction identifier of the current business transaction, then, for each business keyword in the current business transaction, if the business keyword appears for the first time, a cache space corresponding to the business keyword is created, the first transaction identifier is written into the cache space corresponding to the business keyword, and the business keyword and the first transaction identifier are written into a unified index table in a corresponding relation mode; if the business keyword does not appear for the first time, acquiring a transaction identifier from a cache space corresponding to the business keyword to be used as a second transaction identifier, writing the business keyword, the first transaction identifier and the second transaction identifier into the unified index table in a corresponding relation mode, and updating the second transaction identifier in the cache space corresponding to the business keyword into the first transaction identifier.
When business transaction needs to be inquired, the business transaction can be inquired by utilizing the transaction identification in the cache space corresponding to the business keyword and the unified index table according to the business keyword appointed by the inquiry request and the serial number of the transaction to be inquired corresponding to the business keyword. Therefore, efficient query of business transactions stored in the centralized block chain type account book can be achieved.
In order to make those skilled in the art better understand the technical solutions in the embodiments of the present specification, the technical solutions in the embodiments of the present specification will be described in detail below with reference to the drawings in the embodiments of the present specification, and it is obvious that the described embodiments are only a part of the embodiments of the present specification, and not all the embodiments. All other embodiments that can be derived by one of ordinary skill in the art from the embodiments given herein are intended to be within the scope of protection.
The technical solutions provided by the embodiments of the present description are described in detail below with reference to the accompanying drawings.
Fig. 2 is a schematic flowchart of a transaction storage method based on a centralized block chain ledger provided in an embodiment of the present specification, including the following steps:
s200: and accepting the business transaction submitted by the user account.
The main execution body of the method flow shown in fig. 2 is a centralized database server. It should be noted that, in the embodiment of this specification, the database server may not only accept the business transaction submitted by the user account, but also accept other types of transactions submitted by the user account, such as an authorization operation transaction.
The service transaction refers to a transaction for storing service data generated by a user based on own service. Therefore, generally speaking, the service keyword is carried in the service transaction. It is understood that the emphasis in this specification is on how to store business transactions and query business transactions, and no specific expansion is made for non-business transactions.
In this embodiment, only one user may be registered on the database server, or more than one user may be registered. Different users are isolated in service, so generally speaking, service keywords carried by service transactions submitted by different users to the database server are different.
For convenience of description, the method flow shown in fig. 2 is for any business transaction submitted to the database server side by any user account.
S202: and storing the business transaction into a centralized block chain type account book, and acquiring a transaction identifier of the business transaction as a first transaction identifier.
In embodiments of the present specification, a transaction identifier refers to data that uniquely identifies a transaction in a centralized blockchain ledger. The centralized block chain type account book can support the function of configuring the unique identifier for each business transaction and the function of inquiring the corresponding business transaction according to the unique identifier.
If the centralized block chain type account book does not support the function of configuring the unique identifier for each business transaction, the storage position information of each business transaction in the account book can be used as the transaction identifier. The transaction storage location information includes: the data block sequence number of the data block where the traffic is located and the offset (offset) of the traffic in the data block.
S204: and aiming at each service keyword carried by the service transaction, if the service keyword appears for the first time, creating a cache space corresponding to the service keyword, writing the first transaction identifier into the cache space corresponding to the service keyword, and writing the service keyword and the first transaction identifier into a unified index table in a corresponding relation mode.
S206: if the business keyword does not appear for the first time, acquiring a transaction identifier from a cache space corresponding to the business keyword to serve as a second transaction identifier, writing the business keyword, the first transaction identifier and the second transaction identifier into the unified index table in a corresponding relation mode, and updating the second transaction identifier in the cache space corresponding to the business keyword into the first transaction identifier.
One or more service keywords may be carried in the service transaction. For convenience of description, steps S204 to S206 are only for one service keyword.
The first occurrence of the service keyword means that the database server extracts the service keyword for the first time, the service keyword is not extracted before the database server, and a cache space corresponding to the service keyword is not created in a cache.
The purpose of creating the cache space corresponding to each service keyword is to cache the transaction identifier of the latest stored service transaction under each service keyword, and for the currently processed service transaction, the transaction identifier of the current service transaction and the transaction identifier read from the cache can be stored in the unified index table after establishing a corresponding relationship, so that although a large amount of service transaction index information corresponding to different service keywords is stored in the unified index table, which seems to be messy, the transaction identifier of each service transaction under a certain service keyword can be traced back one by one forward according to the transaction identifier of the latest stored service transaction under the service keyword.
In this context, the first transaction identifier refers to a transaction identifier of a currently stored transaction, which is a transaction stored most recently under a service keyword related to the currently stored transaction. Therefore, it is necessary to ensure that the transaction identifier of the service transaction to be stored currently is updated in the cache space corresponding to the service keyword.
In this embodiment of the present specification, since the unified index table records the service transaction index information under all the service keywords, the service keywords may be added to each index record to identify which index information corresponds to the service keyword. It is understood that in the unified index table, "business keyword + first transaction identification" may be used as a primary key. The following table 1 is a unified index table exemplarily given by an embodiment of the present specification.
Figure BDA0002726728660000091
TABLE 1
Fig. 3 is a schematic flowchart of a transaction query method based on a centralized block chain ledger, provided by an embodiment of the present specification, including:
s300: receiving an inquiry request sent by a user account, and determining at least one service keyword appointed by the inquiry request and a transaction serial number to be inquired corresponding to each appointed service keyword.
The execution subject of the method shown in fig. 3 is a database server.
In practical application, a user can select to assign at least one service keyword and at least one transaction serial number to be queried to the database server. For example, the user may specify the business keyword "clothes order" and the transaction number 5, 15 to be queried through the query request, indicating that the 5 th and 15 th (storage order of the database server side) business transactions related to the clothes order are to be queried.
Specifically, the user may specify a continuous transaction number interval to be queried. For example, the user may specify the business keyword "clothes order" and the serial number range (5, 15) through the query request, indicating that the 5 th to 15 th (storage order of the database server side) business transactions related to the clothes order are to be queried.
Of course, the user may also request to query all business transactions under a certain business keyword.
S302: and aiming at each service keyword specified by the query request, acquiring a transaction identifier from a cache space corresponding to the service keyword.
The transaction id obtained in step S302 refers to the transaction id of the latest stored service transaction related to each service keyword.
S304: and inquiring the service transaction of the transaction serial number to be inquired corresponding to the service key word according to the acquired transaction identification and the unified index table.
Based on the foregoing description of the flow of the storage method shown in fig. 2, it can be understood that step S304 is specifically performed as follows: firstly, positioning an index record corresponding to the business keyword and the acquired transaction identifier in a unified index table, and then reading the transaction identifier of the last business transaction; then, the index record corresponding to the business keyword and the read transaction identifier of the last business transaction is positioned again, and the transaction identifier of the last business transaction is continuously read until the business transaction corresponding to each transaction serial number to be inquired corresponding to the business keyword is positioned. Therefore, the database server side can obtain the transaction identification of each business transaction to be inquired so as to inquire the business transactions from the centralized block chain type account book and return the business transactions to the user.
Furthermore, the query request may specifically be a query transaction. In this case, the database server also needs to write the query transaction into the centralized block chain type account book, which is equivalent to performing evidence storage on the query record of the user.
In addition, in practical application, if there are other service transactions with too much interval between a service transaction under a certain service keyword that a user wants to query and a latest service transaction under the service keyword, the database server traces back the last service transaction one by one with too low efficiency based on the unified index table.
Therefore, in the method flow shown in fig. 2, for each business keyword, based on the unified index table, other business transactions whose ledger sequence is located before the business transaction corresponding to the second transaction identifier are determined under the business keyword, and the transaction identifiers corresponding to the determined other business transactions are used as third transaction identifiers. Then, the service key word, the first transaction identifier, the second transaction identifier and the third transaction identifier are written into the unified index table in a corresponding relationship form.
In this way, when business transaction inquiry is carried out, the business transaction can be traced forward in a jumping manner from the latest business transaction without tracing forward one by one from the latest business transaction, so that the efficiency is higher. For example, if the user wants to search for the 5 th transaction under a certain business keyword, and there are already 100 transactions under the business keyword, the database server can jump from the 100 th transaction to the 90 th transaction, and further jump to the 60 th transaction, the 40 th transaction, the 10 th transaction and the 5 th transaction based on the unified index table.
The present specification illustratively provides an algorithm for determining a third transaction identification, comprising:
assuming that the serial number of the current business transaction is X, determining a binary form X 'of the transaction serial number of the current business transaction, determining a digit N of which the X' is continuously 0 from the last digit to the front, and determining transaction identifiers of other business transactions which are separated from the current business transaction by N business transactions as third transaction identifiers.
For example, if N is 0, the third transaction identification is not determined; and if N is 2, determining that the transaction identifier of other service transactions separated from the current service transaction by 2 service transactions is a third transaction identifier.
Table 2 below is another unified index table exemplarily given by the embodiments of the present specification.
Figure BDA0002726728660000111
Figure BDA0002726728660000121
TABLE 2
Fig. 4 is a schematic structural diagram of a transaction storage apparatus based on a centralized block chain ledger, which is applied to a database server, where the database server maintains the centralized block chain ledger, and the apparatus includes:
the accepting module 401 accepts a business transaction submitted by a user account; the business transaction carries at least one business keyword;
the storage module 402 stores the business transaction into a centralized block chain type account book, and acquires a transaction identifier of the business transaction as a first transaction identifier; the first transaction identification is used for uniquely identifying the business transaction in a centralized block chain type account book;
a first processing module 403, configured to, for each service keyword carried in the service transaction, if the service keyword appears for the first time, create a cache space corresponding to the service keyword, write the first transaction identifier into the cache space corresponding to the service keyword, and write the service keyword and the first transaction identifier into a unified index table in a corresponding relationship;
if the service keyword does not appear for the first time, the second processing module 404 obtains a transaction identifier from the cache space corresponding to the service keyword, and uses the transaction identifier as a second transaction identifier, writes the service keyword, the first transaction identifier, and the second transaction identifier into the unified index table in a corresponding relationship, and updates the second transaction identifier in the cache space corresponding to the service keyword to the first transaction identifier.
The first transaction identification is transaction storage position information of the business transaction in a centralized block chain type account book; the transaction storage location information includes: and the data block sequence number of the data block where the service transaction is located and the offset of the service transaction in the data block.
The second processing module 404, before writing the service keyword, the first transaction identifier, and the second transaction identifier into the unified index table in a corresponding relationship form, determines, based on the unified index table, other service transactions in which an order of a stored ledger is located before a service transaction corresponding to the second transaction identifier under the service keyword, and takes transaction identifiers corresponding to the determined other service transactions as third transaction identifiers; and writing the service key word, the first transaction identifier, the second transaction identifier and the third transaction identifier into the unified index table in a corresponding relationship form.
Fig. 5 is a schematic structural diagram of a transaction query device provided in an embodiment of the present disclosure, which is applied to a database server, and the transaction query device includes:
the receiving module 501 receives a query request sent by a user account, and determines at least one service keyword specified by the query request and a transaction serial number to be queried corresponding to each specified service keyword;
the query module 502 is configured to, for each service keyword specified by the query request, obtain a transaction identifier from a cache space corresponding to the service keyword, and query a service transaction of a transaction sequence number to be queried corresponding to the service keyword according to the obtained transaction identifier and the unified index table.
The query request is a query transaction;
the device further comprises:
a writing module 503, writing the query transaction into a centralized block chain type ledger.
Embodiments of the present specification also provide a computer device, which at least includes a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor implements the method shown in fig. 2 or 3 when executing the program.
Fig. 6 is a schematic diagram illustrating a more specific hardware structure of a computing device according to an embodiment of the present disclosure, where the computing device may include: a processor 1010, a memory 1020, an input/output interface 1030, a communication interface 1040, and a bus 1050. Wherein the processor 1010, memory 1020, input/output interface 1030, and communication interface 1040 are communicatively coupled to each other within the device via bus 1050.
The processor 1010 may be implemented by a general-purpose CPU (Central Processing Unit), a microprocessor, an Application Specific Integrated Circuit (ASIC), or one or more Integrated circuits, and is configured to execute related programs to implement the technical solutions provided in the embodiments of the present disclosure.
The Memory 1020 may be implemented in the form of a ROM (Read Only Memory), a RAM (Random Access Memory), a static storage device, a dynamic storage device, or the like. The memory 1020 may store an operating system and other application programs, and when the technical solution provided by the embodiments of the present specification is implemented by software or firmware, the relevant program codes are stored in the memory 1020 and called to be executed by the processor 1010.
The input/output interface 1030 is used for connecting an input/output module to input and output information. The i/o module may be configured as a component in a device (not shown) or may be external to the device to provide a corresponding function. The input devices may include a keyboard, a mouse, a touch screen, a microphone, various sensors, etc., and the output devices may include a display, a speaker, a vibrator, an indicator light, etc.
The communication interface 1040 is used for connecting a communication module (not shown in the drawings) to implement communication interaction between the present apparatus and other apparatuses. The communication module can realize communication in a wired mode (such as USB, network cable and the like) and also can realize communication in a wireless mode (such as mobile network, WIFI, Bluetooth and the like).
Bus 1050 includes a path that transfers information between various components of the device, such as processor 1010, memory 1020, input/output interface 1030, and communication interface 1040.
It should be noted that although the above-mentioned device only shows the processor 1010, the memory 1020, the input/output interface 1030, the communication interface 1040 and the bus 1050, in a specific implementation, the device may also include other components necessary for normal operation. In addition, those skilled in the art will appreciate that the above-described apparatus may also include only those components necessary to implement the embodiments of the present description, and not necessarily all of the components shown in the figures.
Embodiments of the present description also provide a computer-readable storage medium on which a computer program is stored, where the computer program is executed by a processor to implement the method shown in fig. 2 or fig. 3.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
From the above description of the embodiments, it is clear to those skilled in the art that the embodiments of the present disclosure can be implemented by software plus necessary general hardware platform. Based on such understanding, the technical solutions of the embodiments of the present specification may be essentially or partially implemented in the form of a software product, which may be stored in a storage medium, such as a ROM/RAM, a magnetic disk, an optical disk, etc., and includes several instructions for enabling a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the methods described in the embodiments or some parts of the embodiments of the present specification.
The systems, methods, modules or units described in the above embodiments may be implemented by a computer chip or an entity, or by a product with certain functions. A typical implementation device is a computer, which may take the form of a personal computer, laptop computer, cellular telephone, camera phone, smart phone, personal digital assistant, media player, navigation device, email messaging device, game console, tablet computer, wearable device, or a combination of any of these devices.
The embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, as for the method embodiment, since it is substantially similar to the method embodiment, it is relatively simple to describe, and reference may be made to the partial description of the method embodiment for relevant points. The above-described method embodiments are merely illustrative, wherein the modules described as separate components may or may not be physically separate, and the functions of the modules may be implemented in one or more software and/or hardware when implementing the embodiments of the present specification. And part or all of the modules can be selected according to actual needs to achieve the purpose of the scheme of the embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
The foregoing is only a specific embodiment of the embodiments of the present disclosure, and it should be noted that, for those skilled in the art, a plurality of modifications and decorations can be made without departing from the principle of the embodiments of the present disclosure, and these modifications and decorations should also be regarded as the protection scope of the embodiments of the present disclosure.

Claims (13)

1. A transaction storage method based on a centralized block chain type account book is applied to a database server, the database server maintains the centralized block chain type account book, and the method comprises the following steps:
accepting a business transaction submitted by a user account; the business transaction carries at least one business keyword;
storing the business transaction into a centralized block chain type account book, and acquiring a transaction identifier of the business transaction as a first transaction identifier;
aiming at each business keyword carried by the business transaction, acquiring a transaction identifier of the last business transaction containing the business keyword from a cache space corresponding to the business keyword to serve as a second transaction identifier;
writing the service key word, the first transaction identification and the second transaction identification into a unified index table in a corresponding relationship mode, and updating the second transaction identification in the cache space corresponding to the service key word into the first transaction identification.
2. The method of claim 1, the first transaction identification storing location information for transactions in a centralized blockchain ledger for the business transaction; the transaction storage location information includes: and the data block sequence number of the data block where the service transaction is located and the offset of the service transaction in the data block.
3. The method of claim 1, further comprising:
if the cache space corresponding to the business keyword does not exist, the cache space corresponding to the business keyword is created, the first transaction identifier is written into the cache space corresponding to the business keyword, and the business keyword and the first transaction identifier are written into the unified index table in a corresponding relation mode.
4. The method of claim 1, before writing the service keyword, the first transaction identifier, and the second transaction identifier into a unified index table in a corresponding relationship, the method further comprising:
based on the unified index table, determining other business transactions of which the stored book sequence is positioned before the business transaction corresponding to the second transaction identifier under the business keyword, and taking the transaction identifiers corresponding to the determined other business transactions as third transaction identifiers;
writing the service keyword, the first transaction identifier and the second transaction identifier into a unified index table in a corresponding relationship form, specifically comprising:
and writing the service key word, the first transaction identifier, the second transaction identifier and the third transaction identifier into the unified index table in a corresponding relationship form.
5. A transaction query method based on the transaction storage method of any one of claims 1 to 4, applied to a database server side, the transaction query method comprising:
receiving an inquiry request sent by a user account, and determining at least one service keyword appointed by the inquiry request and a transaction serial number to be inquired corresponding to each appointed service keyword;
and aiming at each business keyword appointed by the query request, acquiring a transaction identifier from a cache space corresponding to the business keyword, and querying the business transaction of the transaction serial number to be queried corresponding to the business keyword according to the acquired transaction identifier and the unified index table.
6. The transaction query method of claim 5, the query request being a query transaction;
the transaction query method further comprises the following steps:
and writing the query transaction into a centralized block chain type account book.
7. A transaction storage device based on centralized block chain type account book is applied to a database server side, the database server side maintains the centralized block chain type account book, and the device comprises:
the acceptance module accepts business transaction submitted by a user account; the business transaction carries at least one business keyword;
the storage module is used for storing the business transaction into a centralized block chain type account book and acquiring a transaction identifier of the business transaction as a first transaction identifier;
the first processing module is used for acquiring a transaction identifier of the last service transaction containing the service keyword from a cache space corresponding to the service keyword as a second transaction identifier aiming at each service keyword carried by the service transaction; writing the service key word, the first transaction identification and the second transaction identification into a unified index table in a corresponding relationship mode, and updating the second transaction identification in the cache space corresponding to the service key word into the first transaction identification.
8. The apparatus of claim 7, the first transaction identification to store location information for transactions in a centralized blockchain ledger for the business transaction; the transaction storage location information includes: and the data block sequence number of the data block where the service transaction is located and the offset of the service transaction in the data block.
9. The apparatus of claim 7, further comprising:
and the second processing module is used for creating the cache space corresponding to the business keyword if the cache space corresponding to the business keyword does not exist, writing the first transaction identifier into the cache space corresponding to the business keyword, and writing the business keyword and the first transaction identifier into the unified index table in a corresponding relation mode.
10. The apparatus according to claim 7, wherein the second processing module, before writing the business keyword, the first transaction identifier, and the second transaction identifier into the unified index table in a corresponding relationship, determines, based on the unified index table, other business transactions whose ledger is sequentially located before the business transaction corresponding to the second transaction identifier, and takes the transaction identifier corresponding to the determined other business transactions as a third transaction identifier; and writing the service key word, the first transaction identifier, the second transaction identifier and the third transaction identifier into the unified index table in a corresponding relationship form.
11. A transaction inquiry device based on the transaction storage method of any one of claims 1 to 4, which is applied to a database server side, and comprises:
the receiving module is used for receiving a query request sent by a user account and determining at least one service keyword appointed by the query request and a transaction serial number to be queried corresponding to each appointed service keyword;
and the query module is used for acquiring a transaction identifier from a cache space corresponding to each service keyword specified by the query request, and querying the service transaction of the transaction serial number to be queried corresponding to the service keyword according to the acquired transaction identifier and the unified index table.
12. The apparatus of claim 11, the query request is a query transaction;
the device further comprises:
and the writing module writes the inquiry transaction into a centralized block chain type account book.
13. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the method of any of claims 1 to 6 when executing the program.
CN202011105223.6A 2020-06-15 2020-06-15 Transaction storage and query method based on centralized block chain type account book Pending CN113806357A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011105223.6A CN113806357A (en) 2020-06-15 2020-06-15 Transaction storage and query method based on centralized block chain type account book

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202010544109.7A CN111444198B (en) 2020-06-15 2020-06-15 Transaction storage and query method based on centralized block chain type account book
CN202011105223.6A CN113806357A (en) 2020-06-15 2020-06-15 Transaction storage and query method based on centralized block chain type account book

Related Parent Applications (1)

Application Number Title Priority Date Filing Date
CN202010544109.7A Division CN111444198B (en) 2020-06-15 2020-06-15 Transaction storage and query method based on centralized block chain type account book

Publications (1)

Publication Number Publication Date
CN113806357A true CN113806357A (en) 2021-12-17

Family

ID=71650365

Family Applications (2)

Application Number Title Priority Date Filing Date
CN202010544109.7A Active CN111444198B (en) 2020-06-15 2020-06-15 Transaction storage and query method based on centralized block chain type account book
CN202011105223.6A Pending CN113806357A (en) 2020-06-15 2020-06-15 Transaction storage and query method based on centralized block chain type account book

Family Applications Before (1)

Application Number Title Priority Date Filing Date
CN202010544109.7A Active CN111444198B (en) 2020-06-15 2020-06-15 Transaction storage and query method based on centralized block chain type account book

Country Status (1)

Country Link
CN (2) CN111444198B (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109086413A (en) * 2018-08-03 2018-12-25 上海点融信息科技有限责任公司 For searching for the method, equipment and readable storage medium storing program for executing of block chain data
CN109766707A (en) * 2019-01-17 2019-05-17 南方科技大学 Data processing method, device, equipment and medium based on block chain
WO2019221893A1 (en) * 2018-05-15 2019-11-21 Microsoft Technology Licensing, Llc Secure dataset management
KR20190130189A (en) * 2018-04-18 2019-11-22 김현준 A System of Providing Mobile Barter Transaction Service Based on Block Chain Technology, Big Data Analysis and AI
CN110825737A (en) * 2019-10-18 2020-02-21 支付宝(杭州)信息技术有限公司 Index creation and data query method, device and equipment
CN110942392A (en) * 2019-12-10 2020-03-31 中国建设银行股份有限公司 Service data processing method, device, equipment and medium

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104462141B (en) * 2013-09-24 2018-05-22 中国移动通信集团重庆有限公司 Method, system and the storage engines device of a kind of data storage and inquiry
WO2016183549A1 (en) * 2015-05-14 2016-11-17 Walleye Software, LLC Dynamic join processing using real time merged notification listener
US11036923B2 (en) * 2017-10-10 2021-06-15 P3 Data Systems, Inc. Structured document creation and processing, dynamic data storage and reporting system
CN110704432A (en) * 2019-09-20 2020-01-17 贝壳技术有限公司 Data index establishing method and device, readable storage medium and electronic equipment

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20190130189A (en) * 2018-04-18 2019-11-22 김현준 A System of Providing Mobile Barter Transaction Service Based on Block Chain Technology, Big Data Analysis and AI
WO2019221893A1 (en) * 2018-05-15 2019-11-21 Microsoft Technology Licensing, Llc Secure dataset management
CN109086413A (en) * 2018-08-03 2018-12-25 上海点融信息科技有限责任公司 For searching for the method, equipment and readable storage medium storing program for executing of block chain data
CN109766707A (en) * 2019-01-17 2019-05-17 南方科技大学 Data processing method, device, equipment and medium based on block chain
CN110825737A (en) * 2019-10-18 2020-02-21 支付宝(杭州)信息技术有限公司 Index creation and data query method, device and equipment
CN110942392A (en) * 2019-12-10 2020-03-31 中国建设银行股份有限公司 Service data processing method, device, equipment and medium

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
林子雨;杨冬青;王腾蛟;张东站;: "基于关系数据库的关键词查询", 软件学报, no. 10, 15 October 2010 (2010-10-15) *
王继业;高灵超;董爱强;郭少勇;陈晖;魏欣;: "基于区块链的数据安全共享网络体系研究", 计算机研究与发展, no. 04, 15 April 2017 (2017-04-15) *
蔡维德;郁莲;袁波;邓佑权;李琪;郭斌;: "面向大数据的区块链在清算系统中的应用", 大数据, no. 01, 15 January 2018 (2018-01-15) *

Also Published As

Publication number Publication date
CN111444198A (en) 2020-07-24
CN111444198B (en) 2020-09-25

Similar Documents

Publication Publication Date Title
TWI743458B (en) Method, device and system for parallel execution of blockchain transactions
CN109145025B (en) Multi-data-source integrated data query method and device and service server
CN108173706B (en) Service marking method, device and equipment under multi-service system
CN108599973B (en) Log association method, device and equipment
CN110032598B (en) Method and device for updating field and electronic equipment
CN108932286B (en) Data query method and device
CN111352902A (en) Log processing method and device, terminal equipment and storage medium
CN109359118B (en) Data writing method and device
CN110162512B (en) Log retrieval method, device and storage medium
CN110750530B (en) Service system and data checking method thereof
CN109345392B (en) Method and system for issuing programming question, issuing solution code and checking solution code
CN111506580B (en) Transaction storage method based on centralized block chain type account book
CN111459948B (en) Transaction integrity verification method based on centralized block chain type account book
CN107798135A (en) Paging query method and device and electronic equipment
CN111444216A (en) Data block deleting method based on centralized block chain type account book
CN111784468A (en) Account association method and device and electronic equipment
CN111464319B (en) Transaction storage and signature verification method based on centralized block chain type account book
CN111444198B (en) Transaction storage and query method based on centralized block chain type account book
CN110019538B (en) Data table switching method and device
CN108804625B (en) LSM tree optimization method and device and computer equipment
CN109656805B (en) Method and device for generating code link for business analysis and business server
CN111506613A (en) Method, system, device and equipment for querying incidence relation of data record
CN108920563B (en) Database switching method and device
CN113761400A (en) Access request forwarding method, device and equipment
CN112364030B (en) Business derivative record storage method based on credible account book database

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