CN114490781B - Block chain data processing method and device - Google Patents

Block chain data processing method and device Download PDF

Info

Publication number
CN114490781B
CN114490781B CN202210335417.8A CN202210335417A CN114490781B CN 114490781 B CN114490781 B CN 114490781B CN 202210335417 A CN202210335417 A CN 202210335417A CN 114490781 B CN114490781 B CN 114490781B
Authority
CN
China
Prior art keywords
account
query
query object
cache
data
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202210335417.8A
Other languages
Chinese (zh)
Other versions
CN114490781A (en
Inventor
刘东坡
张波
李志平
张志亮
郭世杰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China Academy of Information and Communications Technology CAICT
Original Assignee
China Academy of Information and Communications Technology CAICT
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 China Academy of Information and Communications Technology CAICT filed Critical China Academy of Information and Communications Technology CAICT
Priority to CN202210335417.8A priority Critical patent/CN114490781B/en
Publication of CN114490781A publication Critical patent/CN114490781A/en
Application granted granted Critical
Publication of CN114490781B publication Critical patent/CN114490781B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2455Query execution
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/23Updating
    • 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/24Querying
    • G06F16/245Query processing
    • G06F16/2455Query execution
    • G06F16/24552Database cache management

Landscapes

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

Abstract

The embodiment of the disclosure discloses a processing method and a device for block chain data, wherein the processing method comprises the following steps: when a query request is received, detecting whether a query object is data on a link or not, wherein the query request comprises a requesting user and the query object; if the query object is the data on the link, detecting whether the query object is account data; if the query object is account data, searching the query object in an account cache; if the query object is not found in the account cache, searching the query object on a block chain node through a network protocol stack; and if the query object is found on the block chain node, feeding a query result back to the requesting user, and storing the query object in the account cache. The data processing efficiency of the block nodes can be improved.

Description

Block chain data processing method and device
Technical Field
The present disclosure relates to the field of block chain technologies, and in particular, to a method and an apparatus for processing block chain data.
Background
The block chain technology utilizes a block chain type data structure to verify and store data, utilizes a distributed node consensus algorithm to generate and update data, and utilizes a cryptography mode to ensure the safety of data transmission and access.
Currently, when storing data, a blockchain node usually processes the data through a network protocol stack. The manner in which data is processed through the network protocol stack may result in frequent hardware interrupts and may be time consuming. How to improve the data processing efficiency of the block nodes is an urgent problem to be solved.
Disclosure of Invention
The embodiment of the disclosure provides a method and a device for processing block chain data, so as to improve the data processing efficiency of block nodes.
In a first aspect of the embodiments of the present disclosure, a method for processing block chain data is provided, including:
when receiving a query request, detecting whether a query object is data on a chain, wherein the query request comprises a request user and the query object;
if the query object is the data on the link, detecting whether the query object is account data;
if the query object is account data, searching the query object in an account cache;
if the query object is not found in the account cache, searching the query object on a block chain node through a network protocol stack;
and if the query object is found on the block chain node, feeding a query result back to the requesting user, and storing the query object in the account cache.
According to an embodiment of the present disclosure, after the detecting whether the query object is account data if the query object is the on-chain data, the method further includes:
if the query object is not the account data, detecting whether the query object is transaction data;
if the query object is transaction data, searching the query object in the transaction cache;
if the query object is not found in the transaction cache, searching the query object on a block chain node through a network protocol stack;
and if the query object is found on the blockchain node, feeding back a query result to the requesting user, and storing the query object in the transaction cache.
According to an embodiment of the present disclosure, after searching the query object in the account cache if the query object is account data, the method further includes:
and if the query object is searched in the account cache, feeding back a query result to the requesting user.
According to an embodiment of the present disclosure, after searching the query object in the transaction cache if the query object is transaction data, the method further includes:
and if the query object is searched in the transaction cache, feeding back a query result to the requesting user.
According to an embodiment of the present disclosure, further comprising:
updating the account cache using least recently used LRU.
According to an embodiment of the present disclosure, further comprising:
and updating the transaction buffer by using a first-in first-out (FIFO) mode.
According to an embodiment of the present disclosure, after the searching the query object on a blockchain node through a network protocol stack if the query object is not found in the transaction cache, the method further includes:
and if the query object is not found in the block chain, feeding back query failure information to the requesting user.
In a second aspect of the embodiments of the present disclosure, there is provided an apparatus for processing block chain data, including:
the system comprises a chain data detection module, a chain data detection module and a chain data detection module, wherein the chain data detection module is used for detecting whether a query object is chain data or not when receiving a query request, and the query request comprises a request user and the query object;
the account data detection module is used for detecting whether the query object is account data or not if the query object is the data on the link;
the account cache query module is used for searching the query object in the account cache if the query object is account data;
the block chain data query module is used for searching the query object on a block chain node through a network protocol stack if the query object is not searched in the account cache;
and the feedback updating module is used for feeding back a query result to the requesting user and storing the query object into the account cache if the query object is found on the block chain node.
According to an embodiment of the present disclosure, further comprising:
the transaction data detection module is used for detecting whether the query object is transaction data or not if the query object is not account data;
the transaction cache query module is used for searching the query object in the transaction cache if the query object is transaction data;
the block chain data query module is further configured to search the query object on a block chain node through a network protocol stack if the query object is not found in the transaction cache; the feedback updating module is further configured to feed back a query result to the requesting user and store the query object in the transaction cache if the query object is found on the blockchain node.
According to an embodiment of the present disclosure, the feedback update module is further configured to feed back a query result to the requesting user if the query object is found in the account cache.
According to an embodiment of the present disclosure, the feedback update module is further configured to feed back a query result to the requesting user if the query object is found in the transaction cache.
According to an embodiment of the present disclosure, further comprising:
and the account cache updating module is used for updating the account cache in a least recently used LRU mode.
According to an embodiment of the present disclosure, further comprising:
and the transaction cache updating module is used for updating the transaction cache in a first-in first-out (FIFO) mode.
According to an embodiment of the present disclosure, the feedback updating module is further configured to feed back query failure information to the requesting user if the query object is not found on the blockchain.
In a third aspect of the embodiments of the present disclosure, there is provided an electronic device, including:
a memory for storing a computer program;
a processor, configured to execute the computer program stored in the memory, and when the computer program is executed, implement the method for processing blockchain data according to the first aspect.
In a fourth aspect of the embodiments of the present disclosure, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the computer program implements the processing method of the blockchain data according to the first aspect.
According to the method and the device for processing the block chain data, when a block chain link point receives an inquiry request, whether an inquiry object is data on a chain or not is detected. When the query object is detected to be the data on the chain, whether the query object is the account data is further detected. And when the query object is detected to be account data, searching in an account cache for storing the account data. And if the query object is not queried in the account cache, searching on the block chain through a network protocol stack. If the query object is found on the block chain node, inquiring the result from the requesting user and storing the query object in the account cache. The account data is stored in the account cache, when the query request is received, the query can be performed from the account cache, and compared with a query mode through a network protocol stack, the method is short in time consumption and high in efficiency. In addition, when the query object is not queried in the account cache, the query object is searched on the block chain through the network protocol stack, if the query object is found on the block chain node, the query object is represented to be queried for the first time or to be queried after being stored in the block chain for a long time, and at the moment, the query object is stored in the account cache.
The technical solution of the present disclosure is further described in detail by the accompanying drawings and examples.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments of the disclosure and together with the description, serve to explain the principles of the disclosure.
The present disclosure may be more clearly understood from the following detailed description, taken with reference to the accompanying drawings, in which:
fig. 1 is a flowchart illustrating a method for processing blockchain data according to an embodiment of the present disclosure;
FIG. 2 is a flow chart illustrating a method for processing blockchain data in an example of the present disclosure;
FIG. 3 is a block diagram of a device for processing blockchain data according to an embodiment of the present disclosure;
fig. 4 is a block diagram of an electronic device in an embodiment of the present disclosure.
Detailed Description
Various exemplary embodiments of the present disclosure will now be described in detail with reference to the accompanying drawings. It should be noted that: the relative arrangement of the components and steps, the numerical expressions, and numerical values set forth in these embodiments do not limit the scope of the present disclosure unless specifically stated otherwise.
It will be understood by those of skill in the art that the terms "first," "second," and the like in the embodiments of the present disclosure are used merely to distinguish one element from another, and are not intended to imply any particular technical meaning, nor is the necessary logical order between them.
It is also understood that in embodiments of the present disclosure, "a plurality" may refer to two or more than two, and "at least one" may refer to one, two or more than two.
It is also to be understood that any reference to any component, data, or structure in the embodiments of the present disclosure may be generally understood as one or more, unless explicitly defined otherwise or indicated to the contrary hereinafter.
In addition, the term "and/or" in the present disclosure is only one kind of association relationship describing the association object, and indicates that three relationships may exist, for example, a and/or B, may indicate: a exists alone, A and B exist simultaneously, and B exists alone. In addition, the character "/" in the present disclosure generally indicates that the former and latter associated objects are in an "or" relationship.
It should also be understood that the description of the embodiments in the present disclosure emphasizes the differences between the embodiments, and the same or similar parts may be referred to each other, and are not repeated for brevity.
Meanwhile, it should be understood that the sizes of the respective portions shown in the drawings are not drawn in an actual proportional relationship for the convenience of description.
The following description of at least one exemplary embodiment is merely illustrative in nature and is in no way intended to limit the disclosure, its application, or uses.
Techniques, methods, and apparatus known to one of ordinary skill in the relevant art may not be discussed in detail but are intended to be part of the specification where appropriate.
It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, further discussion thereof is not required in subsequent figures.
The disclosed embodiments may be applied to electronic devices such as terminal devices, computer systems, servers, etc., which are operational with numerous other general purpose or special purpose computing system environments or configurations. Examples of well known terminal devices, computing systems, environments, and/or configurations that may be suitable for use with electronic devices, such as terminal devices, computer systems, servers, and the like, include, but are not limited to: personal computer systems, server computer systems, thin clients, thick clients, hand-held or laptop devices, microprocessor-based systems, set-top boxes, programmable consumer electronics, networked personal computers, minicomputer systems, mainframe computer systems, distributed cloud computing environments that include any of the above, and the like.
Electronic devices such as terminal devices, computer systems, servers, etc. may be described in the general context of computer system-executable instructions, such as program modules, being executed by a computer system. Generally, program modules may include routines, programs, objects, components, logic, data structures, etc. that perform particular tasks or implement particular abstract data types. The computer system/server may be practiced in distributed cloud computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed cloud computing environment, program modules may be located in both local and remote computer system storage media including memory storage devices.
Fig. 1 is a flowchart illustrating a processing method of blockchain data according to an embodiment of the disclosure. As shown in fig. 1, a method for processing block chain data according to an embodiment of the present disclosure includes:
s1: when a query request is received, whether a query object is data on a chain is detected. Wherein the query request comprises a requesting user and a query object.
The blockchain node provides a data storage interface and a data query interface. The requesting user may be a user who has completed registration at a block link point, and the user may send a query request through the data query interface after logging in on the block chain. When the block link node receives the data query request, the identity information of the requesting user can be obtained, so that the requesting user is identified, and a query object in the data query request can be analyzed.
S2: and if the query object is the data on the link, detecting whether the query object is the account data.
The blockchain link point first detects whether the query object is data on the chain (i.e., data on the blockchain). When the query object is detected to be the data on the link, the object type in the query request can be obtained, and whether the query object is the account data or not is detected based on the object type. The object types may include, for example: account data type, transaction data type, and other data types.
S3: and if the query object is account data, searching the query object in the account cache. The account cache can store and update account data according to a preset cache strategy.
S4: and if the query object is not found in the account cache, searching the query object on the block chain node through a network protocol stack.
In one example of the present disclosure, the block link node points may be for a data query module, and may employ a multi-layer structure including a physical layer, a data link layer, a network layer, a transport layer, and an application layer. Wherein the physical layer is used to establish, maintain and cancel physical connections. Physical layer devices such as: a repeater and a hub. The data link layer is used for establishing, revoking, identifying logical links and link multiplexing, and error checking functions on the physical layer, and is addressed by using a hardware address or a physical address of the receiving system. Data link layer devices such as: bridge, switch, network card. The network layer is used for routing between different network systems based on network layer addresses (e.g., IP addresses). Network layer devices such as: a router. The transport layer is used to identify a specific application (port number) using an addressing mechanism. The application layer is used to provide an interface between the web service and the user application. A network protocol stack is disposed between the network layer and the application layer and may be in communication with the account cache and the transaction cache. And when the query object is not found in the account cache, searching in the user storage space on the block chain through a network protocol stack.
S5: and if the query object is found on the block link point, feeding back a query result to the requesting user, and storing the query object in the account cache.
In this embodiment, the account data is stored in the account cache, and when the query request is received, the query can be performed from the account cache, which is short in time consumption and high in efficiency compared with a query mode from a network protocol stack to a link node. In addition, when the query object is not queried in the account cache, the query object is searched on the block chain through the network protocol stack, if the query object is found on a block chain node, the query object is represented to be queried for the first time, or the query object is queried after being stored in the block chain for a long time (for example, the query object is updated and removed from the account cache after being stored in the account cache), and at the moment, the query object is stored in the account cache.
In an embodiment of the present disclosure, after step S2, the method further includes:
if the query object is not the account data, whether the query object is the transaction data is detected.
And if the query object is transaction data, searching the query object in the transaction cache. The transaction cache can store and update transaction data according to a preset cache strategy.
If the query object is not found in the transaction cache, searching the query object on the block chain node through a network protocol stack; if the query object is found on the block link point, the query result is fed back to the requesting user, and the query object is stored in the transaction cache.
In this embodiment, when an inquiry request is received, the transaction cache can be searched, which is less time-consuming and more efficient than an inquiry method using a network protocol stack. In addition, when the query object is not queried in the transaction cache, the query object is searched on the block chain through the network protocol stack, if the query object is found on a block chain node, the query object is represented to be queried for the first time, or the query object is queried after being stored in the block chain for a long time (for example, the query object is updated and removed from the transaction cache after being stored in the transaction cache), and at the moment, the query object is stored in the transaction cache.
In an embodiment of the present disclosure, after step S3, the method further includes: and if the query object is searched in the account cache, feeding back a query result to the requesting user.
In this embodiment, if the query object is found in the account cache, the query result is directly fed back to the requesting user, and the query is not required to be found on the block chain through a network protocol stack, which is high in efficiency.
In an embodiment of the present disclosure, after the query object is searched in the transaction cache if the query object is transaction data, the query result is fed back to the requesting user if the query object is searched in the transaction cache.
In this embodiment, if the query object is found in the transaction cache, the query result is directly fed back to the requesting user, and the query is not required to be found on the blockchain through a network protocol stack, which is high in efficiency.
In an embodiment of the present disclosure, the method for processing blockchain data further includes: the account cache is updated using Least Recently Used (LRU).
In this embodiment, the query of the account by the blockchain is generally divided into a hot account and a non-hot account. The hot account is generally an external account which is active on the chain, or a contract account of a star contract on the chain, and such an account may have a large number of inquiry requests in a short time and needs to be guaranteed to be always in an account cache. And non-hotspot accounts are usually not active on the chain, the query amount is small, the accounts do not need to be always stored in the cache, and the cache needs to be preferentially eliminated when the cache reaches the upper limit. Therefore, in this embodiment, an LRU cache policy is adopted for account caches, each cache is updated when being inserted or used for the first time, and when the cache is full, the cache with the longest time is automatically deleted, so that it can be ensured that the hotspot account is always in a mixed village, and the query performance is ensured.
In an embodiment of the present disclosure, the method for processing blockchain data further includes: the transaction buffer is updated using a First In First Out (FIFO) manner.
In this embodiment, because the query of the transaction in the blockchain generally queries the transaction result according to the transaction hash value after the transaction is completed, and the queried frequency difference of different transactions is small, the embodiment adopts the FIFO buffer policy, and when the buffer space is insufficient, the record that is put into the buffer at the earliest is preferentially deleted.
In an embodiment of the present disclosure, after step S4, the method further includes: and if the query object is not found in the block chain, feeding back query failure information to the requesting user.
In this embodiment, when the query object is not found in the block chain, the query failure information is fed back to the requesting user in time, so that the user is prevented from querying the result for a long time, and the user experience is good.
In an embodiment of the present disclosure, the method for processing blockchain data further includes: setting a weighted value for the target account according to the account type; setting a heat value according to the query quantity of the target account in a preset time period; and updating the account cache according to the weight value and the heat value of the account in the account cache, wherein the account in the account cache comprises a target account.
Specifically, a basic weight value may be set according to an account type (e.g., a personal account and a company account), a weight value adjusting parameter may be set according to an associated account number of an account (e.g., a main company account is associated with accounts of N sub-companies, and a main card account is associated with M sub-card accounts), and a final weight value may be determined based on the basic weight value and the weight value adjusting parameter, and the final weight value may be used as a weight value of each account in the account cache.
A first heat value may be set according to the number of queries in the last P first time periods of the account (for example, the first time period is one month), a second heat value may be set according to the number of queries in the last Q second time periods of the account (for example, the second time period is one year), and a final heat value may be determined according to the first heat value and the second heat value, and may be used as the heat value of each account in the account cache.
And taking the product value of the weight value and the heat value of each account as the basis of a cache strategy, namely removing the account data with a smaller product value when the cache space of the account is insufficient.
In this embodiment, the account cache is updated according to the weight value and the hot value of the account data in the account cache, so that the probability of querying the account data can be increased, and further, the query feedback rate of the user can be increased.
In order to further understand the present disclosure, the processing method of the blockchain data of the present disclosure is explained by the following examples.
Fig. 2 is a flowchart illustrating a processing method of blockchain data according to an example of the present disclosure. As shown in fig. 2, the processing flow of the blockchain data includes:
a user invokes a Software Development Kit (SDK) to initiate a web request to query data on a chain.
And the cache component of the block chain node intercepts a flow packet of a cache chain query interface port at a kernel driving side in a linux kernel mode in a callback injection mode, then analyzes the flow packet, judges whether the flow packet is a normal query flow packet according to the type of the flow packet, if so, discards the request packet into a cache module, otherwise, discards the flow packet back to a kernel network protocol stack, and processes the flow packet by a request forwarding cache issuing module. And judging whether the flow packet is the query flow packet or not according to the flag bit of the flow packet. Wherein the judgment condition comprises that the numerical value of the query bit is 1; the judgment condition also comprises the size of the flow packet within the standard flow range; 32 bytes to 64 bytes are normal traffic, the account address is 64 bytes, and the transaction hash is 32 bytes.
The inside of the cache module is divided into two types of account cache and transaction cache according to different characteristics of data on a chain, and different cache types adopt different cache strategies. The cache structure adopts a cache to store data by adopting a Hash table, and can quickly extract needed data according to a Hash value. The Hash algorithm can adopt a Bob Jenkins quick Hash algorithm, and the Hash value is a 32-bit unsigned integer value. The cache contains two cache entries organized in a Hash structure: the account information includes the balance of the user and the contract code (code for trading on the blockchain) of the user, and the account address is provided when the user inquires about the contract. The transaction information includes: the input and output of the transaction, the execution result of the transaction, and the signature of the transaction initiator.
The query of the blockchain to the account is generally divided into a hot account and a non-hot account. The hot account is generally an external account which is active on the chain, or a contract account of a star contract on the chain, and such an account may have a large number of query requests in a short time and needs to be guaranteed to be in the cache all the time. And non-hotspot accounts are generally not active on the chain, so that the query quantity is not large, the accounts do not need to be stored in the cache all the time, and the cache needs to be eliminated preferentially when the cache reaches the upper limit. Therefore, according to the scheme, an LRU (least recent used) caching strategy is adopted for the account caches, each cache is updated in time when being inserted or used for the first time, and the cache with the longest time is automatically deleted when the cache is full, so that the hot spot accounts are always in a mixed village, and the query performance is guaranteed.
The inquiry of the transaction on the block chain is generally to inquire the transaction result according to the transaction hash after the transaction is finished, and the inquiry frequency of different transactions is not very different, so the scheme adopts a First In First Out (FIFO) cache strategy, and when the cache space is insufficient, the record which is firstly put into the cache is preferentially deleted.
After obtaining the query flow package, the cache module confirms whether the query is account query or transaction query according to the query type, then the query result is sent to the corresponding cache structure, if the query result is obtained, the result is returned to the kernel driver, the result is finally returned to the SDK through the network card and the optical fiber, meanwhile, if the query type is account data, the time of the cache record is updated to the current time, then the record is updated to the cache structure, if the query result is not obtained, the cache module throws the request flow package back to the kernel network protocol stack, and the request flow package is forwarded to the request forwarding cache issuing module through the network protocol stack.
The request forwarding cache issuing module is a program of an application layer and mainly has two functions: firstly, when the cache module has no cache hit, the query request is forwarded to the request forwarding cache issuing module, and then the request forwarding cache issuing module forwards the query request to the block link node to query the result; and secondly, when the block link point returns the result, the request forwarding cache issuing module needs to judge whether the result needs to be put into the cache according to a cache validity check strategy, if so, the result is issued to the cache module through a netlink technology, and if not, the result is directly returned.
The cache validity check strategy mainly checks the size of a cache data packet, the memory resource of a kernel is precious, for an extremely individual account or transaction, a single record is too large and is not suitable for being stored in the kernel cache, and when the cache validity check strategy judges that the record is too large, the data is abandoned for caching.
Fig. 3 is a block diagram of a device for processing blockchain data according to an embodiment of the present disclosure. As shown in fig. 3, the apparatus for processing blockchain data includes:
the system comprises a chain data detection module 100, configured to detect whether a query object is chain data when receiving a query request, where the query request includes a requesting user and the query object;
an account data detection module 200, configured to detect whether the query object is account data if the query object is linked data;
the account cache query module 300 is configured to search the query object in the account cache if the query object is account data;
a block chain data query module 400, configured to search the query object on a block chain node through a network protocol stack if the query object is not found in the account cache;
a feedback updating module 500, configured to feed back a query result to the requesting user if the query object is found on the blockchain node, and store the query object in the account cache.
In an embodiment of the present disclosure, the apparatus for processing block chain data further includes:
the transaction data detection module is used for detecting whether the query object is transaction data or not if the query object is not account data;
the transaction cache query module is used for searching the query object in the transaction cache if the query object is transaction data;
wherein, the blockchain data query module 400 is further configured to search the query object on a blockchain node through a network protocol stack if the query object is not found in the transaction cache; the feedback updating module 500 is further configured to feed back a query result to the requesting user and store the query object in the transaction cache if the query object is found on the blockchain node.
According to an embodiment of the present disclosure, the feedback updating module 500 is further configured to feed back a query result to the requesting user if the query object is found in the account cache.
According to an embodiment of the present disclosure, the feedback update module 500 is further configured to feed back a query result to the requesting user if the query object is found in the transaction cache.
According to an embodiment of the present disclosure, the apparatus for processing blockchain data further includes:
and the account cache updating module is used for updating the account cache in a least recently used LRU mode.
According to an embodiment of the present disclosure, the apparatus for processing blockchain data further includes:
and the transaction cache updating module is used for updating the transaction cache in a first-in first-out (FIFO) mode.
According to an embodiment of the present disclosure, the feedback updating module 500 is further configured to feed back query failure information to the requesting user if the query object is not found in the block chain.
It should be noted that, the specific implementation of the processing apparatus for blockchain data in the embodiment of the present disclosure is similar to the specific implementation of the processing method for blockchain data in the embodiment of the present disclosure, and specific reference is specifically made to the description of the processing method portion for blockchain data, and details are not repeated for reducing redundancy.
In addition, an embodiment of the present disclosure further provides an electronic device, including:
a memory for storing a computer program;
a processor, configured to execute the computer program stored in the memory, and when the computer program is executed, implement the processing method of the blockchain data according to any of the embodiments of the disclosure.
Fig. 4 is a block diagram of an electronic device in an embodiment of the disclosure. Next, an electronic apparatus according to an embodiment of the present disclosure is described with reference to fig. 4. The electronic device may be either or both of the first device and the second device, or a stand-alone device separate from them, which stand-alone device may communicate with the first device and the second device to receive the acquired input signals therefrom.
As shown in fig. 4, the electronic device includes one or more processors and memory.
The processor may be a Central Processing Unit (CPU) or other form of processing unit having data processing capabilities and/or instruction execution capabilities, and may control other components in the electronic device to perform desired functions.
The memory may include one or more computer program products that may include various forms of computer-readable storage media, such as volatile memory and/or non-volatile memory. The volatile memory may include, for example, Random Access Memory (RAM), cache memory (cache), and/or the like. The non-volatile memory may include, for example, Read Only Memory (ROM), hard disk, flash memory, etc. One or more computer program instructions may be stored on the computer-readable storage medium and executed by a processor to implement the processing methods of blockchain data of the various embodiments of the present disclosure described above and/or other desired functions.
In one example, the electronic device may further include: an input device and an output device, which are interconnected by a bus system and/or other form of connection mechanism (not shown).
The input device may also include, for example, a keyboard, a mouse, and the like.
The output device may output various information including the determined distance information, direction information, and the like to the outside. The output devices may include, for example, a display, speakers, a printer, and a communication network and remote output devices connected thereto, among others.
Of course, for simplicity, only some of the components of the electronic device relevant to the present disclosure are shown in fig. 4, omitting components such as buses, input/output interfaces, and the like. In addition, the electronic device may include any other suitable components, depending on the particular application.
In addition to the above methods and apparatus, embodiments of the present disclosure may also be a computer program product comprising computer program instructions which, when executed by a processor, cause the processor to perform the steps in the method of processing blockchain data according to the various embodiments of the present disclosure described in the above section of this specification.
The computer program product may write program code for carrying out operations for embodiments of the present disclosure in any combination of one or more programming languages, including an object oriented programming language such as Java, C + + or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computing device, partly on the user's device, as a stand-alone software package, partly on the user's computing device and partly on a remote computing device, or entirely on the remote computing device or server.
Furthermore, embodiments of the present disclosure may also be a computer-readable storage medium having stored thereon computer program instructions that, when executed by a processor, cause the processor to perform the steps in the method of processing blockchain data according to the various embodiments of the present disclosure described in the above section of the present specification.
The computer readable storage medium may take any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may include, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples (a non-exhaustive list) of the readable storage medium include: an electrical connection having one or more wires, a portable disk, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
Those of ordinary skill in the art will understand that: all or part of the steps for implementing the method embodiments may be implemented by hardware related to program instructions, and the program may be stored in a computer readable storage medium, and when executed, the program performs the steps including the method embodiments; and the aforementioned storage medium includes: various media that can store program codes, such as ROM, RAM, magnetic or optical disks.
The basic principles of the present disclosure have been described above in connection with specific embodiments, but it should be noted that advantages, effects, and the like, mentioned in the present disclosure are only examples and not limitations, and should not be considered essential to the various embodiments of the present disclosure. Furthermore, the foregoing disclosure of specific details is for the purpose of illustration and description and is not intended to be limiting, since the disclosure will be described in detail with reference to specific details.
In the present specification, the embodiments are described in a progressive manner, and each embodiment focuses on differences from other embodiments, and the same or similar parts in each embodiment are referred to each other. For the system embodiment, since it basically corresponds to the method embodiment, the description is relatively simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
The block diagrams of devices, apparatuses, systems referred to in this disclosure are only given as illustrative examples and are not intended to require or imply that the connections, arrangements, configurations, etc. must be made in the manner shown in the block diagrams. These devices, apparatuses, devices, systems may be connected, arranged, configured in any manner, as will be appreciated by those skilled in the art. Words such as "including," "comprising," "having," and the like are open-ended words that mean "including, but not limited to," and are used interchangeably therewith. The words "or" and "as used herein mean, and are used interchangeably with, the word" and/or, "unless the context clearly dictates otherwise. The word "such as" is used herein to mean, and is used interchangeably with, the phrase "such as but not limited to".
The methods and apparatus of the present disclosure may be implemented in a number of ways. For example, the methods and apparatus of the present disclosure may be implemented by software, hardware, firmware, or any combination of software, hardware, and firmware. The above-described order for the steps of the method is for illustration only, and the steps of the method of the present disclosure are not limited to the order specifically described above unless specifically stated otherwise. Further, in some embodiments, the present disclosure may also be embodied as programs recorded in a recording medium, the programs including machine-readable instructions for implementing the methods according to the present disclosure. Thus, the present disclosure also covers a recording medium storing a program for executing the method according to the present disclosure.
It is also noted that in the devices, apparatuses, and methods of the present disclosure, each component or step can be decomposed and/or recombined. Such decomposition and/or recombination should be considered as equivalents of the present disclosure.
The previous description of the disclosed aspects is provided to enable any person skilled in the art to make or use the present disclosure. Various modifications to these aspects will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other aspects without departing from the scope of the disclosure. Thus, the present disclosure is not intended to be limited to the aspects shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
The foregoing description has been presented for purposes of illustration and description. Furthermore, this description is not intended to limit embodiments of the disclosure to the form disclosed herein. While a number of example aspects and embodiments have been discussed above, those of skill in the art will recognize that at least one of certain variations, modifications, alterations, additions and sub-combinations thereof will fall within the scope of the present disclosure.

Claims (9)

1. A method for processing block chain data, comprising:
when a query request is received, detecting whether a query object is data on a link or not, wherein the query request comprises a requesting user and the query object;
if the query object is the data on the link, detecting the object type of the query object, and determining whether the query object is account data according to the object type;
if the query object is account data, searching the query object in an account cache;
if the query object is not found in the account cache, searching the query object on a block chain node through a network protocol stack;
if the query object is found on the block chain node, feeding back a query result to the requesting user, and storing the query object in the account cache;
setting a basic weight value for a target account according to an account type, setting a weight value adjusting parameter according to the number of associated accounts of the target account, and determining the weight value of the target account based on the basic weight value and the weight adjusting parameter;
setting a heat value according to the query quantity of the target account in a preset time period;
and updating the account cache according to the weight value and the hot value of the account in the account cache, wherein the account in the account cache comprises the target account.
2. The method of claim 1, wherein after detecting whether the query object is account data if the query object is on-chain data, the method further comprises:
if the query object is not the account data, detecting whether the query object is transaction data or not;
if the query object is transaction data, searching the query object in a transaction cache;
if the query object is not found in the transaction cache, searching the query object on a block chain node through a network protocol stack;
and if the query object is found on the blockchain node, feeding back a query result to the requesting user, and storing the query object in the transaction cache.
3. The method for processing blockchain data according to claim 1, wherein after searching for the query object in the account cache if the query object is account data, further comprising:
and if the query object is searched in the account cache, feeding back a query result to the requesting user.
4. The method of claim 2, wherein after searching for the query object in the transaction cache if the query object is transaction data, further comprising:
and if the query object is searched in the transaction cache, feeding back a query result to the requesting user.
5. The method for processing blockchain data according to claim 2 or 4, further comprising:
and updating the transaction buffer by using a first-in first-out (FIFO) mode.
6. The method as claimed in claim 2, wherein after searching for the query object on a blockchain node through a network protocol stack if the query object is not found in the transaction cache, the method further comprises:
and if the query object is not found in the block chain, feeding back query failure information to the requesting user.
7. An apparatus for processing block chain data, comprising:
the system comprises a chain data detection module, a chain data detection module and a chain data detection module, wherein the chain data detection module is used for detecting whether a query object is chain data or not when receiving a query request, and the query request comprises a request user and the query object;
the account data detection module is used for detecting the object type of the query object if the query object is the on-link data, and determining whether the query object is the account data or not according to the object type;
the account cache query module is used for searching the query object in the account cache if the query object is account data;
the block chain data query module is used for searching the query object on a block chain node through a network protocol stack if the query object is not searched in the account cache;
a feedback updating module, configured to feed back a query result to the requesting user if the query object is found on the block link node, and store the query object in the account cache;
the account cache updating module is used for setting a basic weight value for a target account according to the account type, setting a weight value adjusting parameter according to the number of the associated accounts of the target account, and determining the weight value of the target account based on the basic weight value and the weight adjusting parameter; setting a heat value according to the query quantity of the target account in a preset time period; and updating the account cache according to the weight value and the heat value of the account in the account cache, wherein the account in the account cache comprises the target account.
8. An electronic device, comprising:
a memory for storing a computer program;
a processor for executing the computer program stored in the memory, wherein the computer program, when executed, implements the method for processing blockchain data according to any of the claims 1 to 6.
9. A computer-readable storage medium, on which a computer program is stored, wherein the computer program, when executed by a processor, implements the method for processing blockchain data according to any one of claims 1 to 6.
CN202210335417.8A 2022-04-01 2022-04-01 Block chain data processing method and device Active CN114490781B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210335417.8A CN114490781B (en) 2022-04-01 2022-04-01 Block chain data processing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210335417.8A CN114490781B (en) 2022-04-01 2022-04-01 Block chain data processing method and device

Publications (2)

Publication Number Publication Date
CN114490781A CN114490781A (en) 2022-05-13
CN114490781B true CN114490781B (en) 2022-07-22

Family

ID=81488976

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210335417.8A Active CN114490781B (en) 2022-04-01 2022-04-01 Block chain data processing method and device

Country Status (1)

Country Link
CN (1) CN114490781B (en)

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103905923A (en) * 2014-03-20 2014-07-02 深圳市同洲电子股份有限公司 Content caching method and device
CN104217019A (en) * 2014-09-25 2014-12-17 中国人民解放军信息工程大学 Content inquiry method and device based on multiple stages of cache modules
CN106161569A (en) * 2015-04-24 2016-11-23 华为软件技术有限公司 The recommendation of Web content, buffer replacing method and equipment
CN108647357A (en) * 2018-05-17 2018-10-12 阿里巴巴集团控股有限公司 The method and device of data query
CN109447811A (en) * 2018-12-07 2019-03-08 深圳市智税链科技有限公司 Method, accounting nodes and the medium of Transaction Information are inquired in block chain network
CN109523385A (en) * 2018-12-07 2019-03-26 深圳市智税链科技有限公司 Method, accounting nodes and the medium of Transaction Information are inquired in block chain network
CN111901432A (en) * 2020-07-31 2020-11-06 广东尚恒智汇科技发展有限公司 Block chain-based safety data exchange method
CN112269647A (en) * 2020-10-26 2021-01-26 广州华多网络科技有限公司 Node scheduling, switching and coordinating method and corresponding device, equipment and medium thereof
CN112286997A (en) * 2020-11-25 2021-01-29 平安数字信息科技(深圳)有限公司 Salary data query method based on distributed deployment and related equipment

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP3524337B2 (en) * 1997-07-25 2004-05-10 キヤノン株式会社 Bus management device and control device for multifunction device having the same
CN109255255B (en) * 2018-10-22 2021-06-04 北京锐安科技有限公司 Data processing method, device, equipment and storage medium based on block chain
CN109741060B (en) * 2018-12-29 2021-01-22 北京金山安全软件有限公司 Information inquiry system, method, device, electronic equipment and storage medium
US20200233855A1 (en) * 2019-01-21 2020-07-23 saf.ai Methods For Self-Aware, Self-Healing, And Self-Defending Data
CN114003662A (en) * 2021-11-12 2022-02-01 国网河南省电力公司信息通信公司 Block chain performance optimization mechanism based on cache strategy
CN114116898A (en) * 2021-11-19 2022-03-01 中国电信股份有限公司 Method, apparatus, and storage medium for content acquisition at edge clouds

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103905923A (en) * 2014-03-20 2014-07-02 深圳市同洲电子股份有限公司 Content caching method and device
CN104217019A (en) * 2014-09-25 2014-12-17 中国人民解放军信息工程大学 Content inquiry method and device based on multiple stages of cache modules
CN106161569A (en) * 2015-04-24 2016-11-23 华为软件技术有限公司 The recommendation of Web content, buffer replacing method and equipment
CN108647357A (en) * 2018-05-17 2018-10-12 阿里巴巴集团控股有限公司 The method and device of data query
CN109447811A (en) * 2018-12-07 2019-03-08 深圳市智税链科技有限公司 Method, accounting nodes and the medium of Transaction Information are inquired in block chain network
CN109523385A (en) * 2018-12-07 2019-03-26 深圳市智税链科技有限公司 Method, accounting nodes and the medium of Transaction Information are inquired in block chain network
CN111901432A (en) * 2020-07-31 2020-11-06 广东尚恒智汇科技发展有限公司 Block chain-based safety data exchange method
CN112269647A (en) * 2020-10-26 2021-01-26 广州华多网络科技有限公司 Node scheduling, switching and coordinating method and corresponding device, equipment and medium thereof
CN112286997A (en) * 2020-11-25 2021-01-29 平安数字信息科技(深圳)有限公司 Salary data query method based on distributed deployment and related equipment

Non-Patent Citations (4)

* Cited by examiner, † Cited by third party
Title
"基于北斗RDSS的核辐射监测应急通讯方法";王廷银 等;《计算机系统应用》;20191215;第28卷(第12期);248-252 *
"大规模无线通信网络移动边缘计算和缓存研究";黄永明 等;《通信学报》;20210422;第42卷(第04期);44-61 *
"存储容量可扩展区块链系统的高效查询模型";贾大宇 等;《软件学报》;20190406;第30卷(第09期);2655-2670 *
Sankari Subbiah ; Sathya Mala ; Senthil Nayagam."Job starvation avoidance with alleviation of data skewness in Big Data infrastructure".《017 2nd International Conference on Computing and Communications Technologies (ICCCT)》.2017,137-142. *

Also Published As

Publication number Publication date
CN114490781A (en) 2022-05-13

Similar Documents

Publication Publication Date Title
EP2985970B1 (en) Probabilistic lazy-forwarding technique without validation in a content centric network
CN107317879B (en) A kind of distribution method and system of user's request
CN105282215B (en) Reputation based policies for forwarding and responding to interests through a content centric network
US20040205048A1 (en) Systems and methods for requesting and receiving database change notifications
JP2002269062A (en) Device and method for routing transaction according to requested service level
CN105407128B (en) Interest keeping method and system on intermediate router in CCN
US8910269B2 (en) System, method, and computer program product for preventing communication of unwanted network traffic by holding only a last portion of the network traffic
US10630589B2 (en) Resource management system
US9832125B2 (en) Congestion notification system
US20050232291A1 (en) Mechanism for validating the message format for message channels
US10462057B1 (en) Shaping network traffic using throttling decisions
US8688484B2 (en) Method and system for managing computer resource in system
CN113259479A (en) Data processing method and equipment
CN106856456B (en) Processing method and system for cache cluster service
JP5462263B2 (en) Stochastic dynamic router-server mesh routing
CN114490781B (en) Block chain data processing method and device
CN109981460B (en) Service-oriented converged network, calculation and storage integrated method and device
EP2433222B1 (en) System for locating computing devices
US6879999B2 (en) Processing of requests for static objects in a network server
JP4222065B2 (en) Data access method and information system in information system
US7206855B1 (en) System and method for exchanging information across a computer network at variable transmission rates
JP2017123040A (en) Server device, distribution file system, distribution file system control method, and program
CN115412490B (en) Packet reflection system
CN109088913A (en) The method and load-balanced server of request data
US20220046022A1 (en) Distributed evaluation list updating

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant