Subscription data processing method and device and electronic equipment
By recording part of the subscription information in each subscription block and cached it to the target database, the problems of high storage pressure and long response time caused by storing full subscription information in a single block are solved, and more efficient subscription data management is achieved.
Patent Information
- Application Number
- CN202411706833.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-26
- Publication Date
- 2025-03-14
- Estimated Expiration
- 2044-11-26
AI Technical Summary
In the prior art, storing full amount of subscription information through a single block leads to high storage pressure, long response time, and it is difficult to effectively manage a large amount of subscription data.
Part of the subscription information in the full subscription information is recorded in each subscription block, and the extraction results are cached to the target database to store the data in key-value pairs.
It reduces the storage space occupancy rate of a single block, improves the management efficiency of subscription data, reduces CPU and memory consumption, and improves the system's response speed.
Smart Images

Figure CN119622032A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of blockchain, and in particular to a method, device and electronic device for processing subscription data. Background Art
[0002] Currently, subscription management is usually based on a complete list of subscription data, and is mostly an off-blockchain behavior that lacks credibility.
[0003] In the related technology, to realize subscription management on the blockchain, a subscription block type definition is provided to record the full subscription data list. However, when the subscriber data entries reach tens of thousands or even millions, the subscription list data will be very large, and the size of the subscription block is usually limited. Although it can be circumvented by compressing the data, since the subscription block stores the compressed full subscription information, once the subscription information needs to be extracted, the subscription block needs to be decompressed, which consumes CPU (central processing unit) and memory, and the time and space costs are relatively high. It also needs to be compressed when saving, which also consumes a lot of CPU and time. When the subscription data records increase, the response time will also become longer and longer, which is particularly easy to become a system bottleneck.
[0004] To address the above-mentioned problems, no effective solution has been proposed yet. Summary of the invention
[0005] The embodiments of the present invention provide a method, device and electronic device for processing subscription data, so as to at least solve the technical problem in the related art that a single block is used to store all subscription information, but the effect of storing all subscription information in a single block is poor.
[0006] According to one aspect of an embodiment of the present invention, a method for processing subscription data is provided, comprising: obtaining a subscription block storing subscription information, wherein the subscription block comprises: a block for recording part of the subscription information in the full amount of subscription information, the subscription information comprising: a subscription rule for a first subscriber to subscribe to specified information; extracting the subscription information in the subscription block to obtain an extraction result; caching the extraction result to a target database, wherein the target database comprises: a database storing data in the form of key-value pairs.
[0007] Furthermore, extracting the subscription information in the subscription block to obtain an extraction result includes: extracting target information in the subscription information in the subscription block to obtain the extraction result, wherein the target information includes at least one of the following: a certificate of the first subscriber, an account identifier associated with the subscription block, an identifier of a subscription topic, a subscription status, a transaction identifier, and a block height of the subscription block, wherein the subscription status is used to indicate whether the first subscriber has the subscription authority to subscribe to the specified information.
[0008] Furthermore, caching the extraction result to the target database includes: extracting the identifier of the first subscriber from the certificate of the first subscriber to obtain a first subscription identifier; calculating the hash value of the certificate of the first subscriber to obtain a first hash value; and based on the subscription status, caching the first subscription identifier, the first hash value and the extraction result to the target database.
[0009] Further, based on the subscription status, the first subscription identifier, the first hash value and the extraction result are cached to the target database, including: when the subscription status indicates that the first subscriber has the subscription authority for the specified information, the first subscription identifier, the first hash value and the extraction result are converted into a key-value pair to obtain a target key-value pair, and the target key-value pair is cached to the target database, wherein the first hash value is recorded in the key of the target key-value pair, and the first subscription identifier is recorded in the value of the target key-value pair; when the subscription status indicates that the first subscriber does not have the subscription authority for the specified information, it is prohibited to cache the first subscription identifier, the first hash value and the extraction result to the target database.
[0010] Furthermore, before obtaining the subscription block storing the subscription information, it includes: obtaining the subscription information, and packaging the subscription information into a transaction in the blockchain to obtain a target transaction; sending the target transaction to an endorsement node for signature to obtain a signed target transaction; sending the signed target transaction to a consensus node to generate the subscription block, wherein the consensus node is used to package the signed target transaction into a block.
[0011] Furthermore, after sending the signed target transaction to the consensus node and generating the subscription block, it also includes: using the consensus node to reach a consensus on the subscription block to obtain a consensus result; when the consensus result indicates that the consensus on the subscription block is successful, storing the subscription block in the disk of the consensus node, and broadcasting the subscription block to the accounting node, so that the accounting node stores the subscription block in the disk of the accounting node.
[0012] Furthermore, after caching the extraction result to the target database, it also includes: receiving a subscription request, and extracting the certificate of the subscriber in the subscription request to obtain the certificate of the second subscriber; extracting the identifier of the second subscriber from the certificate of the second subscriber to obtain a second subscription identifier; calculating the hash value of the certificate of the second subscriber to obtain a second hash value; based on the second subscription identifier and the second hash value, using the target database to determine whether the second subscriber has the subscription authority for the specified information to obtain a determination result; based on the determination result, determining whether the second subscriber is allowed to subscribe to the specified information.
[0013] Furthermore, after caching the extraction results to the target database, it also includes: loading the key-value pairs to be verified in the target database, wherein the key-value pairs to be verified include: key-value pairs associated with the subscription information waiting for validity verification; based on the subscription information in the target block, performing validity verification on the key-value pairs to be verified to obtain a verification result, wherein the target block includes: a block for recording the subscription information associated with the key value to be verified.
[0014] According to another aspect of an embodiment of the present invention, a subscription data processing device is also provided, including: an acquisition unit, used to acquire a subscription block storing subscription information, wherein the subscription block includes: a block for recording part of the subscription information in the full amount of subscription information, and the subscription information includes: a subscription rule for a first subscriber to subscribe to specified information; an extraction unit, used to extract the subscription information in the subscription block to obtain an extraction result; and a cache unit, used to cache the extraction result to a target database, wherein the target database includes: a database that stores data in the form of key-value pairs.
[0015] Furthermore, the extraction unit includes: a first extraction sub-unit, used to extract the target information in the subscription information in the subscription block to obtain the extraction result, wherein the target information includes at least one of the following: a certificate of the first subscriber, a ledger identifier associated with the subscription block, an identifier of a subscription topic, a subscription status, a transaction identifier, and a block height of the subscription block, and the subscription status is used to indicate whether the first subscriber has the subscription authority to subscribe to the specified information.
[0016] Furthermore, the cache unit includes: an extraction subunit, used to extract the identifier of the first subscriber from the certificate of the first subscriber to obtain a first subscription identifier; a calculation subunit, used to calculate the hash value of the certificate of the first subscriber to obtain a first hash value; and a cache subunit, used to cache the first subscription identifier, the first hash value and the extraction result to the target database based on the subscription status.
[0017] Further, the cache sub-unit includes: a conversion module, which is used to convert the first subscription identifier, the first hash value and the extraction result into a key-value pair when the subscription status indicates that the first subscriber has the subscription authority for the specified information, obtain a target key-value pair, and cache the target key-value pair to the target database, wherein the first hash value is recorded in the key of the target key-value pair and the first subscription identifier is recorded in the value of the target key-value pair; and a processing module, which is used to prohibit caching the first subscription identifier, the first hash value and the extraction result to the target database when the subscription status indicates that the first subscriber does not have the subscription authority for the specified information.
[0018] Furthermore, the subscription data processing device also includes: a first processing unit, used to obtain the subscription information before obtaining the subscription block storing the subscription information, and package the subscription information into a transaction in the blockchain to obtain a target transaction; a signing unit, used to send the target transaction to an endorsement node for signing to obtain a signed target transaction; a sending unit, used to send the signed target transaction to a consensus node to generate the subscription block, wherein the consensus node is used to package the signed target transaction into a block.
[0019] Furthermore, the subscription data processing device also includes: a consensus unit, which is used to send the signed target transaction to the consensus node, generate the subscription block, and then use the consensus node to consensus the subscription block to obtain a consensus result; a second processing unit, which is used to store the subscription block in the disk of the consensus node when the consensus result indicates that the consensus on the subscription block is successful, and broadcast the subscription block to the accounting node, so that the accounting node stores the subscription block in the disk of the accounting node.
[0020] Furthermore, the subscription data processing device also includes: a receiving unit, which is used to receive a subscription request after caching the extraction result to the target database, and extract the subscriber's certificate in the subscription request to obtain the certificate of the second subscriber; a third processing unit, which is used to extract the second subscriber's identifier from the second subscriber's certificate to obtain the second subscription identifier; a calculation unit, which is used to calculate the hash value of the second subscriber's certificate to obtain the second hash value; a judgment unit, which is used to judge whether the second subscriber has the subscription authority for the specified information based on the second subscription identifier and the second hash value using the target database to obtain a judgment result; and a determination unit, which is used to determine whether the second subscriber is allowed to subscribe to the specified information based on the judgment result.
[0021] Furthermore, the subscription data processing device also includes: a loading unit, which is used to load the key-value pairs to be verified in the target database after caching the extraction results to the target database, wherein the key-value pairs to be verified include: key-value pairs associated with the subscription information waiting for validity verification; a verification unit, which is used to perform validity verification on the key-value pairs to be verified based on the subscription information in the target block to obtain a verification result, wherein the target block includes: a block for recording the subscription information associated with the key value to be verified.
[0022] According to another aspect of an embodiment of the present invention, there is also provided an electronic device, comprising: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to execute any one of the above-mentioned methods for processing subscription data by executing the executable instructions.
[0023] According to another aspect of an embodiment of the present invention, a computer-readable storage medium is provided, which stores a computer program, wherein when the computer program is running, the device where the computer-readable storage medium is located is controlled to execute any one of the above-mentioned methods for processing subscription data.
[0024] In the present invention, a subscription block for storing subscription information is obtained, wherein the subscription block includes: a block for recording part of the subscription information in the full amount of subscription information, and the subscription information includes: a subscription rule for the first subscriber to subscribe to the specified information; the subscription information is extracted in the subscription block to obtain the extraction result; the extraction result is cached to the target database, wherein the target database includes: a database that stores data in the form of key-value pairs. This solves the technical problem in the related art that the full amount of subscription information is stored in a single block, and the effect of storing the full amount of subscription information in a single block is not good. In the present invention, part of the subscription information in the full amount of subscription information is recorded in each subscription block, and the subscription information in the subscription block is cached to the target database, avoiding the situation in the related art that the full amount of subscription information is stored in a single block, and the storage pressure of the single block is large, thereby achieving the technical effect of reducing the storage space occupancy rate of a single block. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:
[0026] Figure 1 is a flowchart of an optional method for processing subscription data according to an embodiment of the present invention;
[0027] Figure 2 is a flowchart of another optional method for processing subscription data according to an embodiment of the present invention;
[0028] Figure 3 is a schematic diagram of an optional subscription data processing device according to an embodiment of the present invention;
[0029] Figure 4 is a schematic diagram of an electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0030] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0031] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0032] It should be noted that the user information (including but not limited to user device information, user personal information, etc.), collected information and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, storage, use, processing, transmission, provision, disclosure and application of the relevant data comply with the relevant laws, regulations and standards of the relevant regions, take necessary confidentiality measures, do not violate public order and good morals, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0033] For the convenience of description, some terms or nouns involved in the embodiments of the present invention are explained below.
[0034] Subscription block: a block used to record subscription records (or subscription information). This type of block can record one or more subscription information.
[0035] Subscription chaincode: The system chaincode responsible for processing the subscription block. It is responsible for verifying the validity of the subscription block, extracting the subscription information therein, and saving the subscription information in the form of key:value (key-value pairs) to the namespace of the world state database.
[0036] Namespace: An independent storage area in the world state database, whose parent path is named by the joint expression of the ledger name and the smart contract name.
[0037] Subscription management: The module responsible for processing subscription requests. It can extract the ledger and certificate information from the subscription request, and query its subscription record from the world state database. If the record exists, the subscription is allowed, otherwise the subscription is rejected.
[0038] World State Database: A key-value database used to quickly save or access a database.
[0039] Embodiment 1
[0040] According to an embodiment of the present invention, a method embodiment of an optional method for processing subscription data is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0041] Figure 1 is a flowchart of an optional method for processing subscription data according to an embodiment of the present invention. Figure 1 As shown, the method comprises the following steps:
[0042] Step S101, obtaining a subscription block storing subscription information, wherein the subscription block includes: a block for recording part of the subscription information in the full amount of subscription information, and the subscription information includes: a subscription rule for a first subscriber to subscribe to designated information.
[0043] The subscription block can be used to record one or more subscription information. The subscription information can include: subscription rules (e.g., subscription permissions) for the subscriber to subscribe to the specified information. The specified information can include account data in the blockchain. The first subscriber can be a node in the blockchain.
[0044] In this embodiment, after a subscription record (corresponding to subscription information) is generated, a new subscription block can be opened to save the subscription record in the subscription block. One or several subscription records can be saved each time, and the subscription block can be saved to the hard disk of the subscription block after blockchain consensus.
[0045] In this embodiment, the subscription block records one or several days of subscription information, and there is no need to record the full amount of subscription information (or subscription records) in the blockchain, and there is no need to aggregate all subscription information in one block, which avoids full redundant storage when the subscription information changes, and reduces the storage volume of the subscription block. There is no need to decompress or compress the subscription information, which has lower time complexity and space complexity.
[0046] Step S102, extracting subscription information from the subscription block to obtain an extraction result.
[0047] The above-mentioned extraction result may include: subscription information extracted from the subscription block. In this embodiment, key information in the subscription information may be extracted from the subscription block through the subscription chain code to obtain the extraction result.
[0048] Step S103, caching the extraction result to a target database, wherein the target database includes: a database storing data in the form of key-value pairs.
[0049] The above-mentioned target database may include: a database storing data in the form of key-value pairs, and the type of the target database may be a world state database. In this embodiment, the extraction result may be cached in the target database, avoiding the situation that the related technology stores the full amount of subscription information in blocks, which has high storage costs, and adopts the method of compressing the full amount of subscription information and storing it in blocks, which has high time costs for storing and accessing subscription information.
[0050] In this embodiment, through the above steps, part of the subscription information in the full subscription information is recorded in each subscription block, and the subscription information in the subscription block is cached in the target database, thereby avoiding the situation in the related art where the full subscription information is stored in a single block and the storage pressure of the single block is large, thereby achieving the technical effect of reducing the storage space occupancy rate of a single block. In addition, the technical problem in the related art where the full subscription information is stored in a single block and the effect of storing the full subscription information in a single block is poor is solved.
[0051] Optionally, extracting subscription information in the subscription block to obtain an extraction result includes: extracting target information in the subscription information in the subscription block to obtain an extraction result, wherein the target information includes at least one of the following: a certificate of the first subscriber, a ledger identifier associated with the subscription block, an identifier of the subscription topic, a subscription status, a transaction identifier, and a block height of the subscription block, wherein the subscription status is used to indicate whether the first subscriber has subscription authority to subscribe to the specified information.
[0052] In this embodiment, all subscription settings (corresponding to subscription information) can be extracted from the subscription block through the subscription chain code, the subscription settings can be traversed, and cert (subscriber's certificate), channel (ledger name of the subscription block (corresponding to the account identifier)), subject (name of the subscription subject (corresponding to the identifier of the subscription subject)), subscribe (subscription status), txid (transaction identifier), and height (block height) information can be extracted.
[0053] When a new subscription block is created and goes through the consensus process, the subscription chaincode can be called, whose task is to parse the subscription block on the blockchain and extract key information from it. This key information includes:
[0054] The first subscriber's certificate (cert): The certificate is proof of the subscriber's identity, which usually contains the subscriber's public key and other identity-related information. The purpose of extracting the certificate is to verify the legitimacy of the subscriber's identity and ensure that only authenticated subscribers can access specific data;
[0055] The ledger ID (channel) associated with the subscription block: The ledger ID is a unique identifier for a specific blockchain ledger, which is used to distinguish different ledgers and helps to accurately locate and process subscription information in a multi-ledger environment;
[0056] Identification of the subscription topic (subject): Each subscriber may be interested in different topics or types of data in the ledger. The identification of the subscription topic is used to clarify the data range that the subscriber is interested in, which is convenient for subsequent subscription control and information push; subscription status (subscribe), where the subscription status marks whether the subscriber has the subscription permission for specific information, whether it is true or false. This is the key information to determine whether the subscription request is accepted;
[0057] Transaction ID (txid): The transaction ID is a unique identifier for blockchain transactions, which can be used to trace and verify the integrity of transactions. When processing subscription information, the transaction ID can ensure the accuracy and immutability of subscription configuration;
[0058] Block height of the subscription block: The block height is the location of the block in the blockchain, reflecting the order and time of the block. When verifying the validity of subscription information, the block height is a very important parameter because it can help determine whether the information is up to date and whether the blockchain state on which the information depends is correct.
[0059] By extracting key information (corresponding to target information) from the subscription information in the subscription block, it is convenient to store the subscription information in the world state database, avoiding the situation where all subscription information is stored in the database, which occupies a large amount of storage space.
[0060] Optionally, caching the extraction results to the target database includes: extracting the first subscriber's identifier from the first subscriber's certificate to obtain a first subscription identifier; calculating the hash value of the first subscriber's certificate to obtain a first hash value; and based on the subscription status, caching the first subscription identifier, the first hash value and the extraction results to the target database.
[0061] In this embodiment, the first subscription identifier can be extracted from the certificate of the first subscriber. For example, in the certificate of the first subscriber, the certificate data can be parsed to extract the identification information of the subscriber. Usually, this identification information is the cn (common name, user name, i.e., the identifier of the subscriber) in the certificate, but in complex scenarios, it may include other identification information, such as an email address, an organizational unit name, etc. After the cn or composite identification information is extracted, it becomes the first subscription identifier. Assigning a unique identifier to each subscriber can facilitate the rapid location and management of subscriber information in subscription processing and permission verification.
[0062] In an optional manner, when multiple identifiers exist, a composite key generation strategy can also be designed, such as combining cn with other identification attributes to form a more complex unique key to accommodate a wider range of identification needs. In order to enhance the flexibility of the system, an identifier resolution rule library can be set up to dynamically resolve and generate the first subscription identifier based on different certificate structures and requirements.
[0063] In this embodiment, the hash value of the certificate of the first subscriber can also be calculated. For example, a secure hash algorithm (such as SHA-256) can be used to calculate the hash value of the first subscriber certificate. The generated first hash value is irreversible and unique, ensuring that even if the original certificate data changes, the hash value will also change accordingly, thereby ensuring the integrity and security of the data. Through the hash operation, the certificate is converted into a short fixed-length hash value as an auxiliary key for storing and retrieving subscriber information in the database, which can reduce the time and space complexity of database operations.
[0064] In an optional approach, the hash value can be recalculated periodically and compared with the hash value stored in the target database to detect whether the information in the database has been tampered with or accidentally modified. It is also possible to consider using hash chain technology to link the hash values of multiple certificates to enhance data security and traceability.
[0065] In this embodiment, the first subscription identifier, the first hash value and the extraction result can also be cached to the target database based on the subscription status. For example, key-value pair data can be formed based on the extracted first subscription identifier and the calculated first hash value, combined with the subscription status and other extraction results (such as ledger identifier, subscription topic identifier, transaction identifier, block height).
[0066] Use a specific key structure, for example, / channel / <channel> / subcc / subject / <subject> / <cert-hash>, cache the data in the target database (i.e., the world state database). If the subscription status is true, create or update the record; if the subscription status is false, delete the corresponding record (if the target database does not originally have the record, it can be treated as an invalid deletion): Storing key subscription information in the world state database facilitates quick retrieval and verification of the subscriber's permission status, improving the efficiency of subscription processing.
[0067] In an optional example, when caching information, version control information such as timestamps or version numbers can be attached to facilitate historical queries and rollbacks in future data changes. Considering database performance, database sharding or distributed database strategies can also be used to distribute and store data based on ledger identifiers or subject identifiers, reducing the storage pressure of a single node and improving overall read and write speeds. When storing sensitive information (such as certificate details), the data can be encrypted so that even if the database is illegally accessed, the data content will not be directly leaked, thereby improving data security.
[0068] By caching key information in the subscription information into the target database, the subscription information can be efficiently managed at a lower time and space cost, and subscription configuration management can be achieved in a large-scale subscriber environment while ensuring the security and integrity of the data.
[0069] Optionally, based on the subscription status, the first subscription identifier, the first hash value and the extraction result are cached to the target database, including: when the subscription status indicates that the first subscriber has the subscription authority for the specified information, the first subscription identifier, the first hash value and the extraction result are converted into a key-value pair to obtain a target key-value pair, and the target key-value pair is cached to the target database, wherein the first hash value is recorded in the key of the target key-value pair, and the first subscription identifier is recorded in the value of the target key-value pair; when the subscription status indicates that the first subscriber does not have the subscription authority for the specified information, it is prohibited to cache the first subscription identifier, the first hash value and the extraction result to the target database.
[0070] For example, if subscribe is true (i.e., the subscription state indicates that the first subscriber has the subscription permission for the specified information), the subscription information can be recorded in the target database (e.g., the world state database). The key is / channel / <channel> / subcc / subject / <subject> / <cert-hash>, the value content format is {"cn": <cn>,txid: <txid>,height: <height>}.
[0071] If subscribe is false (that is, the subscription status indicates that the first subscriber does not have the subscription permission for the specified information), the corresponding key of the subscription information can be deleted from the target database. The key is / channel / <channel> / subcc / subject / <subject> / <cert-hash>, where if the target database does not originally store the record, it can be treated as an invalid deletion.
[0072] By caching the key information in the subscription information in the form of key-value pairs in the target database, the subscription information can be managed efficiently with low time and space costs.
[0073] Optionally, before obtaining the subscription block storing the subscription information, the process includes: obtaining the subscription information, and packaging the subscription information into a transaction in the blockchain to obtain a target transaction; sending the target transaction to an endorsement node for signature to obtain a signed target transaction; sending the signed target transaction to a consensus node to generate a subscription block, wherein the consensus node is used to package the signed target transaction into a block.
[0074] For example, obtaining subscription information: Subscription information usually includes the subscriber certificate, ledger identifier, subscription topic identifier, subscription status, and other metadata that may be involved. This information can come from the request submitted directly by the subscriber or the system configuration management. Once the subscription information is obtained, it can be converted into the format of a blockchain transaction. The target transaction can also contain information about the transaction type to indicate that this is a subscription type transaction so that subsequent endorsement and consensus processing can correctly identify and process it.
[0075] In this embodiment, the target transaction can be sent to the endorsement node for signing: After the target transaction is sent to the endorsement node, the endorsement node can perform a preliminary verification of the validity of the transaction and can also sign the transaction using the private key of the endorsement node. The signing process can provide a trust basis for subsequent consensus and ensure the credibility of the source and content of the transaction. Signature algorithm selection: The signature algorithm of the endorsement node can select a highly secure and widely accepted algorithm. In addition, for the convenience of verification, the type of signature algorithm can be recorded.
[0076] After the signature is completed, the signed target transaction can be sent to the consensus node to be packaged as a subscription block. For example, the signed target transaction can be sent to the consensus node, and the consensus node will further verify it, including the format of the transaction, the validity of the signature, and ensuring that the transaction does not conflict with the current state of the ledger. If the transaction passes the verification of the consensus node, the signed target transaction can be added to a block and become part of the subscription block. In an optional example, the consensus node can generate blocks according to the consensus algorithm of the blockchain. For subscription transactions, the consensus node can generate a subscription block. The generated subscription block will be broadcast to other nodes in the network, and these nodes can also verify the validity of the block, including verifying the signature of the transaction in the block, the correctness of the transaction content, and the format of the block. After all nodes have verified it, it can be determined that the subscription block will be considered legal and permanently stored in the blockchain ledger.
[0077] In this embodiment, by creating a subscription block, efficient and reliable support can be provided for subscription configuration management.
[0078] Optionally, after sending the signed target transaction to the consensus node and generating the subscription block, it also includes: using the consensus node to reach a consensus on the subscription block to obtain a consensus result; when the consensus result indicates that the consensus on the subscription block is successful, the subscription block is stored in the disk of the consensus node, and the subscription block is broadcast to the accounting node, so that the accounting node stores the subscription block in the disk of the accounting node.
[0079] The consensus of consensus nodes can be a key mechanism in the blockchain to ensure that all nodes agree on the state of the ledger. After the consensus node receives the signed target transaction sent by the admin (administrator, such as a user with advanced permissions) of organization A and packages these transactions into a subscription block, the consensus node can start the consensus process. During the consensus process, the consensus node can interact with other nodes in the blockchain to verify the validity of the transaction and ensure that the new block does not conflict with the existing ledger state.
[0080] Once the consensus node completes the consensus and confirms the validity of the subscription block, it will then feed back the consensus result to the system. If the consensus result indicates that the subscription block is successfully agreed upon, the consensus node will store the subscription block in its local disk to persist the new block. At the same time, the consensus node can also broadcast this new block to all accounting nodes in the network to ensure that all nodes can synchronize the new block, thereby maintaining the consistency of the ledger.
[0081] In an optional example, after the consensus node broadcasts the subscription block to the accounting nodes, these accounting nodes can also verify after receiving the new block to ensure the integrity and correctness of the block. If the verification is successful, the accounting node will store the subscription block to its local disk and update its own ledger status, which improves the reliability of subscription information storage.
[0082] Optionally, after caching the extraction result to the target database, it also includes: receiving a subscription request, and extracting the certificate of the subscriber in the subscription request to obtain the certificate of the second subscriber; extracting the identifier of the second subscriber from the certificate of the second subscriber to obtain a second subscription identifier; calculating the hash value of the certificate of the second subscriber to obtain a second hash value; based on the second subscription identifier and the second hash value, using the target database to determine whether the second subscriber has the subscription authority for the specified information to obtain a determination result; based on the determination result, determining whether the second subscriber is allowed to subscribe to the specified information.
[0083] For example, a block subscription request can be initiated through an accounting node or a consensus node. After a node of the blockchain receives the subscription request, it can extract the channel subject cert information in the request information and the user name cn (corresponding to the second subscription identifier) in the cert (corresponding to the certificate of the second subscriber). In this embodiment, the hash256 value cert-hash (corresponding to the second hash value) of the cert can be calculated, which can be obtained through key: / channel / <channel> / subcc / subject / <subject> / <cert-hash>Query the key in the world state database. If the key does not exist (i.e. the second subscriber does not have the subscription permission for the specified information), the subscription can be rejected. If the key exists (i.e. the subscriber has the subscription permission), the public key verification signature can be taken out from the cert. If the signature is valid, the subscription is allowed, otherwise the subscription is rejected.
[0084] For example, when a system (e.g., a node in a blockchain) receives a subscription request, the request may come from any entity that wishes to subscribe to specific data in a blockchain ledger, such as organization B. The request may typically include key information such as proof of the subscriber's identity (certificate), the ledger identifier of the subscription block (channel), and the subscription subject identifier (subject). The system can first extract the certificate information of the second subscriber from the subscription request. This certificate is proof of the subscriber's identity and contains the public key and other data used to verify the subscriber's identity. Certificate extraction is the basis for the system to determine the subscriber's permissions, ensuring the accuracy and security of subsequent processing. From the second subscriber's certificate, the system will parse out its unique identifier (such as the user name cn), which can be used for subsequent database queries to determine whether the subscriber has the right to subscribe to specific information.
[0085] To further improve processing efficiency and security, the system can calculate the hash value of the second subscriber's certificate. Using a secure hash algorithm such as SHA-256, a hash value of fixed length can be generated. The system can query the target database using the second subscription identifier and the second hash value to determine whether the second subscriber has obtained the subscription permission for the specified information (e.g., ledger data). The query key value can be / channel / <channel> / subcc / subject / <subject> / <cert-hash>,in, <cert-hash>Corresponding to the second hash value.
[0086] If the query result exists, the target database may have recorded the subscription information of the second subscriber, and the subscription status may be checked to see if it is true. If it is, it means that the second subscriber has the right to subscribe; if not, it means that the right has been revoked. If the query result does not exist: it can be determined that the target database does not record the subscription information of the second subscriber, and the subscription request may be rejected.
[0087] Based on the target database, the legitimacy of subscription requests can be determined efficiently and accurately, ensuring that only subscribers with legal authority can access specific information, thus protecting the integrity and security of blockchain ledger data.
[0088] Optionally, after caching the extraction results to the target database, it also includes: loading the key-value pairs to be verified in the target database, wherein the key-value pairs to be verified include: the key-value pairs associated with the subscription information waiting for validity verification; based on the subscription information in the target block, performing validity verification on the key-value pairs to be verified to obtain a verification result, wherein the target block includes: a block for recording the subscription information associated with the key value to be verified.
[0089] In this embodiment, the validity of the subscription information may also be verified, including the following steps:
[0090] Step 1: You can load a subscription information in the target database. In the subscription information, the key is / channel / <channel> / subcc / subject / <subject> / <cert-hash>,value is {"cn": <cn>,txid: <txid>,height: <height>}(corresponding to the key-value pair to be checked).
[0091] Step 2: Extract the block (target block) by height and verify the validity of the block.
[0092] Step 3: Extract the subscription information in the target block according to txid, extract the subject and cert information, and calculate the cert-hash.
[0093] Step 4: Compare the cert-hash and subject values in step 1 and step 3 to see if they are equal. If they are equal, they are valid; otherwise, they are invalid.
[0094] Through this embodiment, subscription information can be quickly recorded in the subscription block, and the subscription information can be cached in the world state database. For a subscription request, its subscription information settings can be quickly located and the validity of the configuration can be verified. There is no need to aggregate all subscription information in one block, which avoids full redundant storage when recording changes and reduces the storage volume of the subscription block. There is no need to decompress or compress the subscription, which has lower time complexity and space complexity, ensuring that the subscription information can still be quickly edited and efficient subscription management can be performed when there are many subscription items. In the world state database, only the hash value of the certificate is stored, saving storage space. The linkage mechanism between the subscription block and the world state database ensures that the blockchain engine can quickly determine whether the subscriber's subscription request is legal, thereby improving the judgment efficiency.
[0095] Embodiment 2
[0096] Figure 2 is a flowchart of another optional method for processing subscription data according to an embodiment of the present invention. Figure 2 As shown, in this embodiment, based on the fine-grained "subscription block (referred to as subscription block)", the subscription chain code is linked to the "world state database" to establish a subscriber record list for rapid storage and retrieval of subscription information, thereby achieving efficient subscription control. The processing process includes subscription record setting, subscription control, and effective verification of subscription records (i.e., subscription information), as follows:
[0097] Subscription record setting: You can open a new subscription block and save the subscription record on the block. You can save one or several subscription records at a time, and save the block to the hard disk after blockchain consensus. This logic is applicable to subscription record creation and subscription record editing.
[0098] Subscription world state database generation: When the subscription block is saved, the subscription chain code can extract the subscription record in the subscription block and cache the key information (corresponding to the target information in Example 1) in the world state database. This logic is applicable to subscription record creation and subscription record editing.
[0099] Subscription control: When a subscriber subscribes, the subscription control module checks the world state database to see if the subscriber has the subscription rights for the relevant data. If so, the subscription is allowed; otherwise, the subscription is rejected.
[0100] Validity verification of subscription records: For subscription records in the world state data, the subscription records can be retrieved from the block for verification by extracting the block height and transaction ID corresponding to the subscription records.
[0101] Assuming that the current production side is organization A and the consumption side is organization B, the processing of subscription information may include the following steps:
[0102] 1.1. Account subscription record settings:
[0103] (1) The admin of organization A packages a set of subscription settings (corresponding to subscription information) into a transaction.
[0104] (2) The admin of organization A sends the transaction to the endorsing node, which endorses the transaction and obtains the signed transaction (corresponding to the signed target transaction in Example 1).
[0105] (3) Organization A receives the signed transaction and sends it to the consensus node.
[0106] (4) The consensus node receives the signed transaction, generates the subscription information into a separate block, obtains the subscription block, and reaches consensus.
[0107] (5) After consensus is successful, the consensus node saves the subscription block to the consensus node's disk and broadcasts the subscription block to the accounting node.
[0108] (6) The accounting node receives the subscription block and records it to the disk of the accounting node.
[0109] Step 1.2 Subscribe to the world state database generation:
[0110] (1) The consensus node or accounting node receives the subscription block and saves it to disk.
[0111] (2) The consensus node or accounting node recognizes that the block type is a subscription block and calls the subscription chaincode.
[0112] (3) The subscription chaincode extracts all subscription settings from the subscription block.
[0113] (4) The accounting node traverses the subscription setting record and extracts the cert, channel, subject, subscribe, txid, and height information.
[0114] (5) Extract the user name cn from cert and calculate the subscriber’s certificate hash256 value cert-hash.
[0115] (6) If subscribe is true, record the subscription record in the world state database. The key is / channel / <channel> / subcc / subject / <subject> / <cert-hash>, the value content format is {"cn": <cn>,txid: <txid>,height: <height>}.
[0116] (7) If subscribe is false, delete the corresponding key of the subscription record from the world state database. The key is / channel / <channel> / subcc / subject / <subject> / <cert-hash>.
[0117] 1.3 Subscription Management:
[0118] (1) Organization B initiates a block subscription request through the accounting node.
[0119] (2) The node receives the subscription request and extracts the channel subject cert information in the request information.
[0120] (3) Extract the user name cn from cert and calculate the hash256 value cert-hash of cert.
[0121] (4) Through key: / channel / <channel> / subcc / subject / <subject> / <cert-hash>Query the world state database for this key.
[0122] (5) If the key does not exist, the subscription is rejected.
[0123] (6) If the key exists, the public key can be taken from the cert to verify the signature. If the signature is valid, the subscription is allowed; otherwise, the subscription is rejected.
[0124] 1.4 Subscription record validity check:
[0125] (1) Load a subscription record in the world state database, key is / channel / <channel> / subcc / sub ject / <subject> / <cert-hash>,value is {"cn": <cn>,txid: <txid>,height: <height>}.
[0126] (2) Extract blocks by height and verify the validity of the blocks.
[0127] (3) Extract the subscription information in the block according to the txid, extract the subject and cert information, and calculate the cert-hash.
[0128] (4) Compare the cert-hash and subject values in step (1) and step (3) to see if they are equal. If they are equal, it is valid; otherwise, it is invalid.
[0129] Through this embodiment, subscription information can be quickly recorded in the subscription block, and the subscription information can be cached in the world state database. For a subscription request, its subscription information settings can be quickly located and the validity of the configuration can be verified. There is no need to aggregate all subscription information in one block, which avoids full redundant storage when recording changes and reduces the storage volume of the subscription block. There is no need to decompress or compress the subscription, which has lower time complexity and space complexity, ensuring that the subscription information can still be quickly edited and efficient subscription management can be performed when there are many subscription items. In the world state database, only the hash value of the certificate is stored, saving storage space. The linkage mechanism between the subscription block and the world state database ensures that the blockchain engine can quickly determine whether the subscriber's subscription request is legal, thereby improving the judgment efficiency.
[0130] Embodiment 3
[0131] Embodiment 3 of the present invention provides an optional device for processing subscription data, and each implementation unit in the processing device corresponds to each implementation step in Embodiment 1.
[0132] Figure 3 is a schematic diagram of an optional subscription data processing device according to an embodiment of the present invention, such as Figure 3 As shown, it includes: an acquisition unit 31, an extraction unit 32 and a cache unit 33.
[0133] The acquisition unit 31 is used to acquire a subscription block storing subscription information, wherein the subscription block includes: a block for recording part of the subscription information in the full amount of subscription information, and the subscription information includes: a subscription rule for the first subscriber to subscribe to the specified information;
[0134] An extraction unit 32 is used to extract subscription information from the subscription block and obtain an extraction result;
[0135] The cache unit 33 is used to cache the extraction result to a target database, wherein the target database includes: a database storing data in the form of key-value pairs.
[0136] In the processing device for subscription data provided in the third embodiment of the present invention, the subscription block storing subscription information can be obtained by the acquisition unit 31, wherein the subscription block includes: a block for recording part of the subscription information in the full amount of subscription information, the subscription information includes: a subscription rule for the first subscriber to subscribe to the specified information, the subscription information is extracted in the subscription block by the extraction unit 32, and the extraction result is obtained, and the extraction result is cached to the target database by the cache unit 33, wherein the target database includes: a database storing data in the form of key-value pairs. Thus, the technical problem that the full amount of subscription information is stored in a single block in the related art, and the effect of storing the full amount of subscription information in a single block is not good is solved. In this embodiment, part of the subscription information in the full amount of subscription information is recorded in each subscription block, and the subscription information in the subscription block is cached to the target database, avoiding the situation in the related art that the full amount of subscription information is stored in a single block, and the storage pressure of a single block is large, thereby achieving the technical effect of reducing the storage space occupancy rate of a single block.
[0137] Optionally, in the subscription data processing device provided in Example 3 of the present invention, the extraction unit includes: a first extraction sub-unit, used to extract target information in the subscription information in the subscription block to obtain an extraction result, wherein the target information includes at least one of the following: a certificate of the first subscriber, a ledger identifier associated with the subscription block, an identifier of the subscription topic, a subscription status, a transaction identifier, and a block height of the subscription block, and the subscription status is used to indicate whether the first subscriber has the subscription authority to subscribe to the specified information.
[0138] Optionally, in the subscription data processing device provided in Example 3 of the present invention, the cache unit includes: an extraction sub-unit, used to extract the identifier of the first subscriber from the certificate of the first subscriber to obtain a first subscription identifier; a calculation sub-unit, used to calculate the hash value of the certificate of the first subscriber to obtain a first hash value; and a cache sub-unit, used to cache the first subscription identifier, the first hash value and the extraction result to the target database based on the subscription status.
[0139] Optionally, in the subscription data processing device provided in Example 3 of the present invention, the caching sub-unit includes: a conversion module, which is used to convert the first subscription identifier, the first hash value and the extraction result into a key-value pair when the subscription status indicates that the first subscriber has the subscription authority for the specified information, obtain a target key-value pair, and cache the target key-value pair in a target database, wherein the first hash value is recorded in the key of the target key-value pair, and the first subscription identifier is recorded in the value of the target key-value pair; and a processing module, which is used to prohibit caching the first subscription identifier, the first hash value and the extraction result in the target database when the subscription status indicates that the first subscriber does not have the subscription authority for the specified information.
[0140] Optionally, in the subscription data processing device provided in Embodiment 3 of the present invention, the subscription data processing device also includes: a first processing unit, used to obtain the subscription information before obtaining the subscription block storing the subscription information, and package the subscription information as a transaction in the blockchain to obtain a target transaction; a signing unit, used to send the target transaction to the endorsement node for signing to obtain the signed target transaction; a sending unit, used to send the signed target transaction to the consensus node to generate a subscription block, wherein the consensus node is used to package the signed target transaction into a block.
[0141] Optionally, in the subscription data processing device provided in Embodiment 3 of the present invention, the subscription data processing device further includes: a consensus unit, which is used to send the signed target transaction to the consensus node, generate the subscription block, and then use the consensus node to reach a consensus on the subscription block to obtain a consensus result; and a second processing unit, which is used to store the subscription block in the disk of the consensus node when the consensus result indicates that the consensus on the subscription block is successful, and broadcast the subscription block to the accounting node, so that the accounting node stores the subscription block in the disk of the accounting node.
[0142] Optionally, in the subscription data processing device provided in Example 3 of the present invention, the subscription data processing device also includes: a receiving unit, used to receive a subscription request after caching the extraction result to the target database, and extract the subscriber's certificate in the subscription request to obtain the certificate of the second subscriber; a third processing unit, used to extract the second subscriber's identifier from the second subscriber's certificate to obtain a second subscription identifier; a calculation unit, used to calculate the hash value of the second subscriber's certificate to obtain a second hash value; a judgment unit, used to judge whether the second subscriber has the subscription authority for the specified information based on the second subscription identifier and the second hash value using the target database to obtain a judgment result; and a determination unit, used to determine whether the second subscriber is allowed to subscribe to the specified information based on the judgment result.
[0143] Optionally, in the subscription data processing device provided in Example 3 of the present invention, the subscription data processing device also includes: a loading unit, used to load the key-value pairs to be verified in the target database after caching the extraction results to the target database, wherein the key-value pairs to be verified include: key-value pairs associated with the subscription information waiting for validity verification; a verification unit, used to perform validity verification on the key-value pairs to be verified based on the subscription information in the target block, and obtain a verification result, wherein the target block includes: a block for recording the subscription information associated with the key value to be verified.
[0144] The above-mentioned subscription data processing device may also include a processor and a memory. The above-mentioned acquisition unit 31, extraction unit 32 and cache unit 33 are all stored in the memory as program units, and the processor executes the above-mentioned program units stored in the memory to realize corresponding functions.
[0145] The processor includes a kernel, which retrieves the corresponding program unit from the memory. One or more kernels can be set, and the kernel parameters are adjusted to record part of the subscription information in each subscription block, and the subscription information in the subscription block is cached to the target database, thereby avoiding the situation in the related technology where the full amount of subscription information is stored in a single block, and the storage pressure of a single block is large, thereby achieving the technical effect of reducing the storage space occupancy rate of a single block.
[0146] The above-mentioned memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM, and the memory includes at least one storage chip.
[0147] According to another aspect of an embodiment of the present invention, there is also provided an electronic device, comprising: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to execute any one of the above-mentioned methods for processing subscription data by executing the executable instructions.
[0148] According to another aspect of an embodiment of the present invention, a computer-readable storage medium is provided, which stores a computer program, wherein when the computer program is running, the device where the computer-readable storage medium is located is controlled to execute any one of the above-mentioned methods for processing subscription data.
[0149] Figure 4 is a schematic diagram of an electronic device according to an embodiment of the present invention, such as Figure 4 As shown, an embodiment of the present invention provides an electronic device 40, which includes a processor, a memory, and a program stored in the memory and executable on the processor, and implements any one of the above-mentioned methods for processing subscription data when the processor executes the program.
[0150] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.
[0151] In the above embodiments of the present invention, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0152] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units can be a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.
[0153] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0154] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0155] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, RandomAccess Memory), mobile hard disk, magnetic disk or optical disk and other media that can store program codes.
[0156] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.< / height> < / txid> < / cn> < / subject> < / channel> < / subject> < / channel> < / subject> < / channel> < / height> < / txid> < / cn> < / subject> < / channel> < / height> < / txid> < / cn> < / subject> < / channel> < / subject> < / channel> < / subject> < / channel> < / subject> < / channel> < / height> < / txid> < / cn> < / subject> < / channel> < / subject> < / channel>
Claims
1. A method for processing subscription data, characterized in that: include: Acquire a subscription block storing subscription information, wherein the subscription block includes: a block for recording part of the subscription information in the full amount of subscription information, and the subscription information includes: a subscription rule for the first subscriber to subscribe to the specified information; Extract the subscription information in the subscription block to obtain an extraction result; The extraction result is cached in a target database, wherein the target database comprises: a database storing data in the form of key-value pairs.
2. The processing method according to claim 1, characterized in that: Extracting the subscription information in the subscription block to obtain an extraction result includes: Extracting target information from the subscription information in the subscription block to obtain the extraction result, wherein the target information includes at least one of the following: a certificate of the first subscriber, a ledger identifier associated with the subscription block, an identifier of a subscription topic, a subscription status, a transaction identifier, and a block height of the subscription block, wherein the subscription status is used to indicate whether the first subscriber has subscription authority to subscribe to the specified information.
3. The processing method according to claim 2, characterized in that: Caching the extraction result to a target database includes: Extracting the identifier of the first subscriber from the certificate of the first subscriber to obtain a first subscription identifier; Calculating a hash value of the certificate of the first subscriber to obtain a first hash value; Based on the subscription state, the first subscription identifier, the first hash value, and the extraction result are cached in the target database.
4. The processing method according to claim 3, characterized in that: Based on the subscription state, caching the first subscription identifier, the first hash value, and the extraction result to the target database includes: In a case where the subscription status indicates that the first subscriber has the subscription permission for the specified information, converting the first subscription identifier, the first hash value, and the extraction result into a key-value pair to obtain a target key-value pair, and caching the target key-value pair in the target database, wherein the first hash value is recorded in the key of the target key-value pair, and the first subscription identifier is recorded in the value of the target key-value pair; When the subscription status indicates that the first subscriber does not have the subscription authority for the designated information, caching the first subscription identifier, the first hash value, and the extraction result to the target database is prohibited.
5. The processing method according to claim 1, characterized in that: Before getting the subscription block that stores subscription information, include: Obtaining the subscription information, and packaging the subscription information into a transaction in the blockchain to obtain a target transaction; Send the target transaction to the endorsing node for signing to obtain the signed target transaction; The signed target transaction is sent to a consensus node to generate the subscription block, wherein the consensus node is used to package the signed target transaction into a block.
6. The processing method according to claim 5, characterized in that: After sending the signed target transaction to the consensus node and generating the subscription block, it also includes: Using the consensus node to reach consensus on the subscription block to obtain a consensus result; When the consensus result indicates that the consensus on the subscription block is successful, the subscription block is stored in the disk of the consensus node, and the subscription block is broadcast to the accounting node so that the accounting node stores the subscription block in the disk of the accounting node.
7. The processing method according to claim 1, characterized in that: After caching the extraction result in the target database, the method further includes: Receiving a subscription request, and extracting a certificate of a subscriber in the subscription request to obtain a certificate of a second subscriber; Extracting the identifier of the second subscriber from the certificate of the second subscriber to obtain a second subscription identifier; Calculating a hash value of the certificate of the second subscriber to obtain a second hash value; Based on the second subscription identifier and the second hash value, using the target database to determine whether the second subscriber has the subscription authority for the specified information, and obtaining a determination result; Based on the judgment result, it is determined whether the second subscriber is allowed to subscribe to the designated information.
8. The processing method according to claim 1, characterized in that: After caching the extraction result in the target database, the method further includes: Loading the key-value pairs to be verified in the target database, wherein the key-value pairs to be verified include: key-value pairs associated with subscription information waiting for validity verification; Based on the subscription information in the target block, the validity of the key-value pair to be verified is verified to obtain a verification result, wherein the target block includes: a block for recording the subscription information associated with the key-value to be verified.
9. A subscription data processing device, characterized in that: include: An acquisition unit is used to acquire a subscription block storing subscription information, wherein the subscription block includes: a block for recording part of the subscription information in the full amount of subscription information, and the subscription information includes: a subscription rule for the first subscriber to subscribe to the specified information; An extraction unit, configured to extract the subscription information from the subscription block to obtain an extraction result; A cache unit is used to cache the extraction result to a target database, wherein the target database includes: a database storing data in the form of key-value pairs.
10. An electronic device, characterized in that: It includes one or more processors and a memory, wherein the memory is used to store one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the subscription data processing method described in any one of claims 1 to 8.
Citation Information
Patent Citations
Information subscription method and device of block chain, server and storage medium
CN112671878A
Communication method and device of block chain system, equipment and storage medium
CN114257593A
Block chain-based subscription data transmission method and device, equipment and storage medium
CN114640464A
Data processing method and device, storage medium and electronic equipment
CN115344614A
Block chain data processing method and device, electronic equipment and storage medium
CN118740851A