Blockchain-based rule updating method, electronic device, and storage medium
By determining the preset strategies and priorities of rule data in the blockchain and combining them with a verification mechanism, the problem of low efficiency in updating rule data in the blockchain is solved, and more efficient and accurate rule data updates are achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SHENZHEN FULIAN FUGUI PRECISION INDUSTRY CO LTD
- Filing Date
- 2021-08-02
- Publication Date
- 2026-06-02
AI Technical Summary
Current technologies for updating rule data in blockchain are relatively inefficient.
By obtaining the rule data corresponding to the rule update request, it is determined whether it conforms to the preset rule strategy, the priority is determined, and the verification is performed based on the priority and the blockchain verification mechanism. If the verification result is correct, the rule data in the blockchain is updated.
This improves the accuracy and efficiency of rule data updates and ensures the security and reliability of the update process.
Smart Images

Figure CN115701607B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of blockchain technology, and in particular to a blockchain-based rule update method, electronic device, and storage medium. Background Technology
[0002] A blockchain is a shared database where data or information is stored, possessing characteristics such as "unforgeable," "fully traceable," "transparent," and "collectively maintained." Based on these characteristics, blockchain is commonly used for data storage, such as storing rule data. However, updating rule data stored in a blockchain using current technologies is often inefficient. Summary of the Invention
[0003] In view of this, the main objective of this application is to provide a blockchain-based rule update method, electronic device, and computer storage medium, aiming to solve the problem of how to improve the efficiency of updating rule data in blockchain.
[0004] The first aspect of this application provides a blockchain-based rule update method, applied to a blockchain, the blockchain-based rule update method comprising:
[0005] In response to a rule update request initiated by a blockchain node, obtain the rule data corresponding to the rule update request;
[0006] Determine whether the rule data conforms to the preset rule strategy;
[0007] If the rule data conforms to the preset rule strategy, the priority corresponding to the rule data is determined;
[0008] The rule data is verified based on its priority and the blockchain verification mechanism.
[0009] If the verification result of the rule data is correct, the rule data stored in each blockchain node in the blockchain is updated according to the rule data.
[0010] According to an optional embodiment of this application, the blockchain includes endorsement nodes, and the step of determining whether the rule data conforms to a preset rule strategy includes:
[0011] Obtain the verification information corresponding to the rule data;
[0012] The endorsement node is controlled to verify the verification information and determine whether the rule data conforms to the preset rule strategy.
[0013] According to an optional embodiment of this application, the verification information includes signature information and submitting user information, and controlling the endorsement node to verify the verification information and determine whether the rule data conforms to the preset rule strategy includes:
[0014] Control the endorsement node to verify the signature information;
[0015] If the signature information passes verification, the endorsement node is controlled to verify the submitted user information;
[0016] If the submitted user information passes verification, it is determined that the rule data conforms to the preset rule policy;
[0017] If the signature information fails verification or the submitted user information fails verification, it is determined that the rule data does not conform to the preset rule policy.
[0018] According to an optional embodiment of this application, the method further includes:
[0019] Obtain the blockchain access request sent by the node, and obtain the node data corresponding to the node based on the blockchain access request;
[0020] Based on the node data, determine whether the node meets the standards for accessing the blockchain;
[0021] If the node meets the criteria for accessing the blockchain, the rule data stored in the node is updated according to the rule data.
[0022] According to an optional embodiment of this application, the method further includes:
[0023] If the node does not meet the standards for accessing the blockchain, a corresponding rejection message will be generated according to the preset prompting rules.
[0024] According to an optional embodiment of this application, determining the priority corresponding to the rule data includes:
[0025] Obtain the request message corresponding to the rule update request;
[0026] Obtain the message segmentation identifier corresponding to the request message from the configuration tag library;
[0027] The request message is segmented based on the message segmentation identifier to obtain an identifier fragment;
[0028] The priority of the rule data is determined based on the identifier database and the identifier fragment.
[0029] According to an optional embodiment of this application, the blockchain uses asymmetric encryption technology to encrypt the rule data.
[0030] According to an optional embodiment of this application, the blockchain utilizes timestamp technology to load time data for each rule data update.
[0031] A second aspect of this application provides an electronic device, the electronic device comprising:
[0032] Memory for storing at least one instruction;
[0033] A processor for implementing the blockchain-based rule update method as described above when executing the at least one instruction.
[0034] A third aspect of this application provides a computer-readable storage medium storing at least one instruction that, when executed by a processor, implements the blockchain-based rule update method described above.
[0035] As can be seen from the above technical solutions, this embodiment obtains the rule data corresponding to the rule update request; determines whether the rule data conforms to a preset rule strategy; if the rule data conforms to the preset rule strategy, determines the priority corresponding to the rule data; verifies the rule data based on the priority corresponding to the rule data and the blockchain verification mechanism; if the verification result of the rule data is correct, updates the rule data stored in each blockchain node in the blockchain according to the rule data. This embodiment can improve the accuracy of rule data updates through multiple judgments, and improve the efficiency of rule data updates by determining the priority corresponding to the rule data and verifying the rule data based on the priority. This embodiment can improve the efficiency and accuracy of updating rule data. Attached Figure Description
[0036] Figure 1 A schematic flowchart illustrating a blockchain-based rule update method provided in this application embodiment;
[0037] Figure 2 A schematic diagram of a blockchain network framework provided for an embodiment of this application;
[0038] Figure 3 This is a schematic block diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0039] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0040] The schematic flowchart shown in the attached diagram is for illustrative purposes only and does not necessarily include all content and operations / steps, nor does it necessarily have to be executed in the described order. For example, some operations / steps can be broken down, combined, or partially merged, so the actual execution order may change depending on the actual situation.
[0041] This application provides a blockchain-based rule update method, an electronic device, and a computer-readable storage medium.
[0042] The following detailed description of some embodiments of this application is provided in conjunction with the accompanying drawings. Unless otherwise specified, the following embodiments and features can be combined with each other.
[0043] Please see Figure 1 , Figure 1 This is a schematic flowchart illustrating a blockchain-based rule update method provided in an embodiment of this application. The blockchain-based rule update method is applied to a blockchain. Figure 1 As shown, the blockchain-based rule update method specifically includes steps S11 to S15. Depending on different needs, the order of the steps in this schematic flowchart can be changed, and some can be omitted.
[0044] Step S11: In response to the rule update request initiated by the blockchain node, obtain the rule data corresponding to the rule update request.
[0045] For example, when a user changes a preset rule on a terminal device, the blockchain node corresponding to that terminal device generates a rule update request. The rule update request includes data showing the user's changes to the preset rule, such as rule data. The terminal device may include electronic devices such as mobile phones, tablets, desktop computers, laptops, handheld computers, notebook computers, super mobile personal computers, netbooks, etc. Changes to the preset rule may include adding, deleting, and / or modifying it.
[0046] Step S12: Determine whether the rule data conforms to the preset rule strategy.
[0047] If the rule data corresponding to the rule update request conforms to the preset rule strategy, the rule data is valid and can be updated on the rule data previously stored in the blockchain; if the rule data corresponding to the rule update request does not conform to the preset rule strategy, the rule data is invalid and cannot be updated on the rule data previously stored in the blockchain.
[0048] For example, it is determined whether the rule data has verification information. When the verification information conforms to the preset rule strategy, it is determined that the rule data conforms to the preset rule strategy. When the verification information does not conform to the preset rule strategy, it is determined that the rule data does not conform to the preset rule strategy.
[0049] Alternatively, determine whether the submitter of the rule data has the authority to modify the rule; if the submitter of the rule data does not have the authority to modify the rule.
[0050] In some embodiments of this application, the blockchain includes endorsement nodes, and determining whether the rule data conforms to a preset rule strategy includes:
[0051] Obtain the verification information corresponding to the rule data;
[0052] The endorsement node is controlled to verify the verification information and determine whether the rule data conforms to the preset rule strategy.
[0053] Endorsing nodes may include peer nodes in the Hyperledger Framework Fabric 1.0 architecture. These nodes are used to determine whether the rule data conforms to a preset rule policy. For example, verification information corresponding to the rule data can be obtained, and the endorsing nodes can be controlled to verify the rule data based on this verification information, such as verifying the legality of the rule data.
[0054] In some embodiments of this application, the verification information includes signature information and submitting user information, and controlling the endorsement node to verify the verification information and determine whether the rule data conforms to a preset rule strategy includes:
[0055] Control the endorsement node to verify the signature information;
[0056] If the signature information passes verification, the endorsement node is controlled to verify the submitted user information;
[0057] If the submitted user information passes verification, it is determined that the rule data conforms to the preset rule policy;
[0058] If the signature information fails verification or the submitted user information fails verification, it is determined that the rule data does not conform to the preset rule policy.
[0059] The signature information is used to verify whether the content of the rule data is legal, and the submitting user information is used to verify whether the user who submitted the rule data has the authority to modify the rule data.
[0060] For example, if the signature information passes verification, the rule data submitted by the user is determined to be valid; if the signature information fails verification, the rule data submitted by the user is determined to be invalid. If the rule data submitted by the user is valid, the submitting user information corresponding to the user who submitted the rule data is verified; when the submitting user information passes verification, it is determined that the user has the authority to modify the rule data, and the rule data is valid; when the submitting user information fails verification, it is determined that the user does not have the authority to modify the rule data, and the rule data is invalid.
[0061] Step S13: If the rule data conforms to the preset rule strategy, determine the priority corresponding to the rule data.
[0062] Different rule data have different priorities. Rule data with higher priority is updated first, followed by rule data with lower priority.
[0063] For example, the priority of the acquired rule data can be determined by controlling the Order node. Alternatively, the Order node can be controlled to sort the rule data according to its priority.
[0064] For example, such as Figure 2 As shown, Figure 2 This is a schematic diagram of a blockchain network framework provided in this application embodiment. The blockchain network may include multiple organizations, such as organization1, organization2, etc. Each organization may include multiple peer nodes. Peer nodes can be used to verify the acquired rule data. The rule data verified by the peer nodes can be transmitted to the sorting module through a preset channel. The sorting module can interact with the system channel. The sorting module may include multiple order nodes, which can be used to sort the rule data.
[0065] In some embodiments of this application, determining the priority corresponding to the rule data includes:
[0066] Obtain the request message corresponding to the rule update request;
[0067] Obtain the message segmentation identifier corresponding to the request message from the configuration tag library;
[0068] The request message is segmented based on the message segmentation identifier to obtain an identifier fragment;
[0069] The priority of the rule data is determined based on the identifier database and the identifier fragment.
[0070] For example, a pre-configured tag library is set up, which stores message segmentation identifiers corresponding to various message segments, such as message segmentation identifiers corresponding to identification segments. The message segmentation identifiers are used to identify the position where the message is segmented. Based on the position of the message segmentation identifiers, the request message corresponding to the rule update request is segmented to obtain identification segments, which include data information corresponding to the rule data.
[0071] Based on the identifier database and the identifier fragments, the priority corresponding to the rule data is determined. For example, an identifier database can be pre-set, which includes a mapping relationship between identifier fragments and priorities, such as identifier fragment A corresponding to priority level one and identifier fragment B corresponding to priority level two.
[0072] Step S14: Verify the rule data based on the priority corresponding to the rule data and the blockchain verification mechanism.
[0073] For example, peer nodes are controlled to verify the correctness of rule data based on the blockchain verification mechanism and the priority order of the rule data. For instance, rule data with higher priority is verified first, followed by rule data with lower priority. If a peer node verifies that a rule data is correct, the peer node is controlled to propagate the rule data to neighboring nodes. If a peer node verifies that a rule data is invalid, the peer node is controlled to discard the rule data and not forward it to neighboring nodes, so as not to waste computing resources.
[0074] Peer nodes verify rule data according to various verification protocols pre-established based on blockchain applications, such as the transaction format, transaction data structure, format syntax structure, input and output, and the correctness of digital signatures.
[0075] Step S15: If the verification result of the rule data is correct, update the rule data stored in each blockchain node in the blockchain according to the rule data.
[0076] For example, if all rule data is verified to be correct, the controlling peer node places this rule data in a transaction pool. After the previous block is confirmed, the controlling peer node selects transactions from the transaction pool in a certain priority order to calculate the Merkle root, and updates the rule data stored in each blockchain node in the original blockchain with the verified rule data based on the Merkle root.
[0077] In some embodiments of this application, the method further includes:
[0078] Obtain the blockchain access request sent by the node, and obtain the node data corresponding to the node based on the blockchain access request;
[0079] Based on the node data, determine whether the node meets the standards for accessing the blockchain;
[0080] If the node meets the criteria for accessing the blockchain, the rule data stored in the node is updated according to the rule data.
[0081] For example, if a blockchain access request is received from a node, the node data corresponding to the node is obtained, and based on the node data, it is determined whether the node meets the standards for accessing the blockchain; if the node meets the standards for accessing the blockchain, the rule data stored in the node is updated according to the rule data.
[0082] For example, when a new node wants to join the blockchain network, the system receives an application request from that node and determines whether to join. If it decides not to join, the node information is discarded. If it decides to join, the node information is verified. If the node information passes verification, the system obtains the rule data corresponding to the blockchain network and updates the rule data stored in the node based on this rule data.
[0083] In some embodiments of this application, the method further includes:
[0084] If the node does not meet the standards for accessing the blockchain, a corresponding rejection message will be generated according to the preset prompting rules.
[0085] By generating appropriate rejection messages, users are prevented from repeatedly submitting requests to join nodes, thus avoiding unnecessary waste of resources.
[0086] In some embodiments of this application, the blockchain uses asymmetric encryption technology to encrypt transaction records, thereby ensuring the security and reliability of rule data and improving the efficiency of rule updates.
[0087] In some embodiments of this application, the blockchain utilizes timestamp technology to load time data with each rule data update, thereby ensuring the plasticity and verifiability of the rule data and improving the efficiency of rule updates.
[0088] The blockchain-based rule update method provided in the above embodiments obtains the rule data corresponding to the rule update request; determines whether the rule data conforms to a preset rule strategy; if the rule data conforms to the preset rule strategy, determines the priority corresponding to the rule data; verifies the rule data based on the priority corresponding to the rule data and the blockchain verification mechanism; if the verification result of the rule data is correct, updates the rule data stored in each blockchain node in the blockchain according to the rule data. This embodiment can improve the accuracy of rule data updates by making multiple judgments, and improve the efficiency of rule data updates by determining the priority corresponding to the rule data and verifying the rule data based on the priority. This embodiment can improve the efficiency and accuracy of updating rule data.
[0089] Please see Figure 3 , Figure 3 This is a schematic block diagram of an electronic device provided in an embodiment of this application. The electronic device 30 can be a server or a terminal device.
[0090] The network in which the electronic device 30 is located includes, but is not limited to, the Internet, wide area network, metropolitan area network, local area network, and virtual private network (VPN).
[0091] like Figure 3 As shown, the electronic device 30 includes a communication interface 301, a memory 302, a processor 303, an input / output (I / O) interface 304, and a bus 305. The processor 303 is coupled to the communication interface 301, the memory 302, and the I / O interface 304 via the bus 305.
[0092] The communication interface 301 is used for communication. The communication interface 301 can be an existing interface on the electronic device 30, or it can be a newly created interface on the electronic device 30. The communication interface 301 can be a network interface, such as a Wireless Local Area Network (WLAN) interface, a cellular network communication interface, or a combination thereof.
[0093] The memory 302 can be used to store operating systems and computer programs. For example, the memory 302 stores the program corresponding to the blockchain-based rule update method described above.
[0094] It should be understood that the memory 302 may include a program storage area and a data storage area. The program storage area may be used to store the operating system, applications required by at least one method (such as a blockchain-based rule update method), etc.; the data storage area may store data created based on the use of the electronic device 30, etc. Furthermore, the memory 302 may include volatile memory, and may also include non-volatile memory, such as hard disks, RAM, plug-in hard disks, smart media cards (SMC), secure digital (SD) cards, flash cards, at least one disk storage device, flash memory device, or other storage devices.
[0095] Processor 303 provides computing and control capabilities to support the operation of the entire computer device. For example, processor 303 is used to execute computer programs stored in memory 302 to implement the steps in the blockchain-based rule update method described above.
[0096] It should be understood that processor 303 is a Central Processing Unit (CPU), but it can also be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among these, a general-purpose processor can be a microprocessor or any conventional processor.
[0097] I / O interface 304 is used to provide a channel for user input or output. For example, I / O interface 304 can be used to connect various input and output devices (mouse, keyboard or 3D touch device, etc.) and displays, so that users can enter information or visualize information.
[0098] Bus 305 is used at least to provide a channel for communication between communication interface 301, memory 302, processor 303 and I / O interface 304 in electronic device 30.
[0099] Those skilled in the art will understand that Figure 3 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0100] In one embodiment, when processor 303 executes a computer program stored in memory 302 to implement a blockchain-based rule update method, it performs the following steps:
[0101] In response to a rule update request initiated by a blockchain node, obtain the rule data corresponding to the rule update request;
[0102] Determine whether the rule data conforms to the preset rule strategy;
[0103] If the rule data conforms to the preset rule strategy, the priority corresponding to the rule data is determined;
[0104] The rule data is verified based on its priority and the blockchain verification mechanism.
[0105] If the verification result of the rule data is correct, the rule data stored in each blockchain node in the blockchain is updated according to the rule data.
[0106] Specifically, the specific implementation method of the processor 303 for the above instructions can be referred to the description of the relevant steps in the aforementioned embodiment of the blockchain-based rule update method, and will not be repeated here.
[0107] This application also provides a computer-readable storage medium storing a computer program, the computer program including program instructions, and the method implemented when the program instructions are executed can refer to the various embodiments of the blockchain-based rule update method of this application.
[0108] The computer-readable storage medium can be an internal storage unit of the electronic device described in the foregoing embodiments, such as a hard disk or memory of the electronic device. Alternatively, the computer-readable storage medium can be an external storage device of the electronic device, such as a plug-in hard disk, smart media card (SMC), secure digital card (SD), flash card, etc., equipped on the electronic device.
[0109] Furthermore, the computer-readable storage medium may primarily include a program storage area and a data storage area, wherein the program storage area may store the operating system, at least one application program required for a function, etc.; and the data storage area may store data created based on the use of the electronic device, etc.
[0110] The electronic device and computer-readable storage medium provided in the foregoing embodiments acquire rule data corresponding to the rule update request; determine whether the rule data conforms to a preset rule strategy; if the rule data conforms to the preset rule strategy, determine the priority corresponding to the rule data; verify the rule data based on the priority corresponding to the rule data and the blockchain verification mechanism; if the verification result of the rule data is correct, update the rule data stored in each blockchain node in the blockchain according to the rule data. This embodiment can improve the accuracy of rule data updates by making multiple judgments, and at the same time, by determining the priority corresponding to the rule data and verifying the rule data based on the priority, the efficiency of rule data updates can be improved. This embodiment can improve the efficiency and accuracy of updating rule data.
[0111] It should also be understood that the terminology used in this specification is for the purpose of describing particular embodiments only and is not intended to limit the scope of the application. As used in this specification and the appended claims, the singular forms “a,” “an,” and “the” are intended to include the plural forms unless the context clearly indicates otherwise.
[0112] It should also be understood that the term "and / or" as used in this specification and the appended claims refers to any combination and all possible combinations of one or more of the associated listed items, and includes such combinations. It should be noted that, herein, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or system. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or system that includes that element.
[0113] The sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments. The above descriptions are merely specific implementations of this application, but the scope of protection of this application is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in this application, and these modifications or substitutions should all be covered within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A rule update method based on blockchain, applied to blockchain, characterized in that, The blockchain-based rule update method includes: In response to a rule update request initiated by a blockchain node, obtain the rule data corresponding to the rule update request; Determine whether the rule data conforms to the preset rule strategy; If the rule data conforms to a preset rule strategy, the priority corresponding to the rule data is determined, including: obtaining the request message corresponding to the rule update request; obtaining the message segmentation identifier corresponding to the request message from the configuration tag library; segmenting the request message based on the message segmentation identifier to obtain an identifier fragment; and determining the priority corresponding to the rule data based on the identifier database and the identifier fragment. The rule data is verified based on its priority and the blockchain verification mechanism. If the verification result of the rule data is correct, the rule data stored in each blockchain node in the blockchain is updated according to the rule data, including: controlling the peer node to put the rule data in the transaction pool; after confirming the previous block, controlling the peer node to select transactions from the transaction pool according to priority; calculating the Merkle root; and updating the rule data stored in each blockchain node in the original blockchain according to the verified rule data.
2. The rule update method based on blockchain according to claim 1, characterized in that, The blockchain includes endorsement nodes, and determining whether the rule data conforms to a preset rule strategy includes: Obtain the verification information corresponding to the rule data; The endorsement node is controlled to verify the verification information and determine whether the rule data conforms to the preset rule strategy.
3. The rule update method based on blockchain according to claim 2, characterized in that, The verification information includes signature information and submitting user information. Controlling the endorsement node to verify the verification information and determining whether the rule data conforms to a preset rule strategy includes: Control the endorsement node to verify the signature information; If the signature information passes verification, the endorsement node is controlled to verify the submitted user information; If the submitted user information passes verification, it is determined that the rule data conforms to the preset rule policy; If the signature information fails verification or the submitted user information fails verification, it is determined that the rule data does not conform to the preset rule policy.
4. The rule update method based on blockchain according to claim 1, characterized in that, The method further includes: Obtain the blockchain access request sent by the node, and obtain the node data corresponding to the node based on the blockchain access request; Based on the node data, determine whether the node meets the standards for accessing the blockchain; If the node meets the criteria for accessing the blockchain, the rule data stored in the node is updated according to the rule data.
5. The rule update method based on blockchain according to claim 4, characterized in that, The method further includes: If the node does not meet the standards for accessing the blockchain, a corresponding rejection message will be generated according to the preset prompting rules.
6. The blockchain-based rule update method according to any one of claims 1 to 5, characterized in that, The blockchain uses asymmetric encryption technology to encrypt the rule data.
7. The blockchain-based rule update method according to any one of claims 1 to 5, characterized in that, The blockchain uses timestamp technology to load time data for each rule data update.
8. An electronic device, characterized in that, The electronic device includes a memory and a processor; The memory is used to store at least one instruction; The processor is used to implement the blockchain-based rule update method as described in any one of claims 1 to 7 when executing the at least one instruction.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores at least one instruction, which, when executed by a processor, implements the blockchain-based rule update method as described in any one of claims 1 to 7.