Method and device for determining block chain consensus bookkeeping node, equipment and medium
By calculating the gradient weight in the blockchain system to determine the consensus accounting node, it solves the problem of wasting computing resources caused by meaningless calculations in the blockchain system and improves resource utilization.
Patent Information
- Application Number
- CN202311523251.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-15
- Publication Date
- 2024-10-18
AI Technical Summary
In the process of generating block consensus in the existing blockchain system, nodes compete for accounting rights, resulting in meaningless calculations and a waste of computing resources.
By receiving the client's transaction request, it sends the model algorithm to the blockchain node, calculates the gradient weight, and determines the node with the highest gradient weight as the consensus accounting node to improve the utilization of computing resources.
Converting meaningless calculation processes into meaningful gradient calculations effectively solves the problem of waste of computing resources and improves the utilization of computing resources.
Smart Images

Figure CN118796935A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of big data technology, and in particular, relates to a method, device, equipment and medium for determining a blockchain consensus accounting node. Background Art
[0002] With the deepening development of scientific and technological revolution and industrial transformation, computing power has become the core productivity of the information society. How to effectively improve the utilization rate of computing power resources has become a technical problem that needs to be solved urgently.
[0003] In the process of generating block consensus in the existing blockchain system, different blockchain nodes compete for accounting rights and need to calculate a math problem every ten minutes, so that the blockchain node that calculates the result first will be used as the consensus accounting node to generate blocks. However, this calculation process is meaningless, and it is only calculated to obtain accounting rights, without applying limited computing resources to meaningful calculation processes, resulting in a waste of computing resources. Summary of the invention
[0004] The embodiments of the present application provide a method, apparatus, device and medium for determining a blockchain consensus accounting node, which can improve the utilization rate of computing resources.
[0005] In a first aspect, an embodiment of the present application provides a method for determining a blockchain consensus accounting node, and the method for determining a blockchain consensus accounting node includes: receiving a transaction request sent by a client; when the transaction request is verified, sending a model algorithm to each blockchain node; obtaining the gradient calculated by each blockchain node according to the model algorithm; calculating the gradient weight of each blockchain node according to the gradient calculated by each blockchain node; and determining the blockchain node with the highest gradient weight as the consensus accounting node of the blockchain.
[0006] According to the implementation method of the first aspect of the present application, after the blockchain node with the highest gradient weight is determined as the consensus accounting node of the blockchain, the method for determining the blockchain consensus accounting node also includes: obtaining block information of the consensus accounting node; and generating a first block in the blockchain based on the block information.
[0007] According to any of the aforementioned implementations of the first aspect of the present application, generating a first block in the blockchain based on the block information includes: performing a hash operation on the block information based on a preset hash algorithm to obtain a hash value corresponding to a block identifier of the first block; generating the first block in the blockchain based on the block identifier of the first block.
[0008] According to any of the aforementioned embodiments of the first aspect of the present application, the gradient includes multiple gradient vectors, and the gradient weight of each blockchain node is calculated according to the gradients calculated respectively for each blockchain node, including: calculating the mean of each gradient vector according to the multiple gradient vectors calculated respectively for each blockchain node; calculating the standard deviation of each gradient vector according to the multiple gradient vectors calculated respectively for each blockchain node and the mean of each gradient vector; calculating the discrete coefficient of each gradient vector of each blockchain node according to the mean and the standard deviation; and calculating the gradient weight of each blockchain node according to the discrete coefficient.
[0009] According to any of the aforementioned implementations of the first aspect of the present application, before calculating the gradient weight of each blockchain node based on the discrete coefficient, the method for determining the blockchain consensus accounting node also includes: normalizing the discrete coefficient.
[0010] According to any of the aforementioned implementations of the first aspect of the present application, the gradient weight of each blockchain node is calculated according to the discrete coefficient, including: calculating the gradient weight of each blockchain node according to the normalized discrete coefficient.
[0011] According to any of the aforementioned implementations of the first aspect of the present application, the gradient weight of each blockchain node is calculated based on the normalized discrete coefficient, including: calculating the first weight of each gradient vector of each blockchain node based on the normalized discrete coefficient; and determining the mean of the first weight of each gradient vector of each blockchain node as the gradient weight of each blockchain node.
[0012] According to any of the aforementioned embodiments of the first aspect of the present application, the first weight of each gradient vector of each blockchain node is calculated according to the normalized discrete coefficient, including: calculating the sum of the discrete coefficients of each gradient vector according to the normalized discrete coefficient; calculating the proportion of the discrete coefficient of each gradient vector of each blockchain node to the sum of the discrete coefficients corresponding to the gradient vectors according to the sum of the discrete coefficients of each gradient vector; and determining the proportion as the first weight of each gradient vector of each blockchain node.
[0013] In the second aspect, an embodiment of the present application provides a device for determining a blockchain consensus accounting node, and the device for determining a blockchain consensus accounting node includes: a receiving module, used to receive a transaction request sent by a client; a sending module, used to send a model algorithm to each blockchain node when the transaction request is verified; an acquisition module, used to obtain the gradient calculated by each blockchain node according to the model algorithm; a calculation module, used to calculate the gradient weight of each blockchain node according to the gradient calculated by each blockchain node; a determination module, used to determine the blockchain node with the highest gradient weight as the consensus accounting node of the blockchain.
[0014] In a third aspect, an embodiment of the present application provides an electronic device, comprising: a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein when the computer program is executed by the processor, the steps of the method for determining a blockchain consensus accounting node as provided in the first aspect are implemented.
[0015] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the method for determining a blockchain consensus accounting node as provided in the first aspect are implemented.
[0016] The method, device, equipment and medium for determining the consensus accounting node of the blockchain provided by the embodiment of the present application are based on the consensus algorithm of blockchain and federated learning. When the transaction request sent by the client is verified, the model algorithm is sent to each blockchain node. Each blockchain node calculates its own gradient according to the model algorithm, and then calculates its own gradient weight according to the gradient of each blockchain node, and then determines the blockchain node with the highest gradient weight as the consensus accounting node of the blockchain. Through the embodiment of the present application, in the process of generating block consensus, the existing meaningless calculation process can be converted into a meaningful calculation process for calculating the corresponding gradient of the blockchain node, thereby effectively solving the problem of waste of computing power resources and improving the utilization rate of computing power resources. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] In order to more clearly illustrate the technical solution of the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0018] Figure 1 It is a flowchart of a method for determining a blockchain consensus accounting node provided by an embodiment of the present application;
[0019] Figure 2 It is a structural diagram of a blockchain and federated learning hybrid distributed storage computing architecture provided in an embodiment of the present application;
[0020] Figure 3 It is a flowchart of another method for determining a blockchain consensus accounting node provided by an embodiment of the present application;
[0021] Figure 4 It is a structural schematic diagram of a device for determining a blockchain consensus accounting node provided in an embodiment of the present application;
[0022] Figure 5 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0023] The features and exemplary embodiments of various aspects of the present application will be described in detail below. In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are only intended to explain the present application, rather than to limit the present application. For those skilled in the art, the present application can be implemented without the need for some of these specific details. The following description of the embodiments is only to provide a better understanding of the present application by illustrating the examples of the present application.
[0024] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the statement "include..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0025] It should be understood that the term "and / or" used in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the associated objects before and after are in an "or" relationship.
[0026] It is obvious to those skilled in the art that various modifications and changes can be made in the present application without departing from the spirit or scope of the present application. Therefore, the present application is intended to cover modifications and changes of the present application that fall within the scope of the corresponding claims (technical solutions for protection) and their equivalents. It should be noted that the implementation methods provided in the embodiments of the present application can be combined with each other without contradiction.
[0027] Before describing the technical solutions provided by the embodiments of the present application, in order to facilitate the understanding of the embodiments of the present application, the present application first specifically describes the problems existing in the prior art:
[0028] Blockchain is a distributed shared ledger and database with the characteristics of decentralization, immutability, full traceability, traceability, collective maintenance, openness and transparency. However, the blockchain system also has the problem of low consensus efficiency and is not suitable for real-time transaction scenarios. In the process of generating block consensus, different blockchain nodes compete for accounting rights. All blockchain nodes need to calculate a math problem every ten minutes. The blockchain node that calculates the result first can be used as the consensus accounting node. However, this calculation process is meaningless. It is only calculated to obtain accounting rights, and the limited computing resources are not applied to meaningful calculation processes, resulting in a waste of computing resources.
[0029] In order to solve the problems of the prior art, the embodiments of the present application provide a method, device, equipment and medium for determining a blockchain consensus accounting node.
[0030] The following first introduces the method for determining the blockchain consensus accounting node provided in the embodiment of the present application.
[0031] Figure 1 Schematic diagram of a method for determining a blockchain consensus accounting node provided by an embodiment of the present application. Figure 1 As shown, the method may include the following steps S101 to S105.
[0032] S101. Receive a transaction request sent by a client.
[0033] S102. When the transaction request is verified, the model algorithm is sent to each blockchain node.
[0034] S103. Obtain the gradient calculated by each blockchain node according to the model algorithm.
[0035] S104. Calculate the gradient weight of each blockchain node according to the gradient calculated by each blockchain node.
[0036] S105. Determine the blockchain node with the highest gradient weight as the consensus accounting node of the blockchain.
[0037] The specific implementation of the above steps will be described in detail below.
[0038] The method for determining the blockchain consensus accounting node provided in the embodiment of the present application is based on the consensus algorithm of blockchain and federated learning. When the transaction request sent by the client is verified, the model algorithm is sent to each blockchain node. Each blockchain node calculates its own gradient according to the model algorithm, and then calculates its own gradient weight according to the gradient of each blockchain node, and then determines the blockchain node with the highest gradient weight as the consensus accounting node of the blockchain. Through the embodiment of the present application, in the process of generating block consensus, the existing meaningless calculation process can be converted into a meaningful calculation process of calculating the corresponding gradient of the blockchain node, thereby effectively solving the problem of waste of computing power resources and improving the utilization rate of computing power resources.
[0039] Combination Figure 1 and Figure 2 As shown, optionally, the embodiment of the present application combines the advantages of blockchain in preventing data tampering and the advantages of federated learning in ensuring data privacy and security. In the case where both technologies require distributed computing nodes with collaborative willingness and consensus, and the goal is to increase mutual trust between nodes, the following is constructed. Figure 2 The blockchain and federated learning hybrid distributed storage computing architecture shown.
[0040] like Figure 2 As shown in the figure, in the hybrid distributed storage computing architecture of blockchain and federated learning, the data owner and blockchain node of federated learning can be used as a node, which can be used for both the storage of blockchain ledger data and the gradient calculation of federated learning. For example, the data owner's data can be bank data, operator data, Internet data, etc. The data of each data owner is only visible to itself, and the data between the data owner and the model summary node is invisible. Among them, the model summary node can be used to send the model algorithm to the data owner of each blockchain node, and receive the gradients calculated by each data owner according to the model algorithm.
[0041] In S101, since the blockchain is a distributed shared ledger and database, if a transaction occurs between user A and user B, the client will send a transaction request to the blockchain system, that is, initiate a bookkeeping request to the blockchain system, and any blockchain node in the blockchain system will receive the transaction request.
[0042] In S102, the blockchain node that receives the transaction request will broadcast the transaction request to the adjacent blockchain nodes, and then the adjacent blockchain nodes will broadcast it to other blockchain nodes in the blockchain system until the transaction request spreads to the entire blockchain network. When each blockchain node receives a transaction request, it will first verify the transaction request. If the verification is passed, it will be forwarded, otherwise the transaction request will be discarded to ensure that invalid transactions will not be propagated in large quantities in the blockchain network. If the transaction request is verified at each blockchain node, the model aggregation node in the blockchain and federated learning hybrid distributed storage computing architecture will then issue the model algorithm to the data owner of each blockchain node.
[0043] Exemplarily, the verification content of the transaction request may include whether the syntax and data structure of the transaction are correct, whether the transaction value is empty, whether the transaction value exceeds the upper limit of the block, whether the user signature is correct, whether the transaction already exists in the transaction pool or blockchain, and whether the transaction transfer value is less than or equal to the user account balance. If the transaction request that needs to be verified meets any of the following, the verification fails and is deemed to be an invalid transaction: syntax and data structure errors, transaction value is empty, transaction value exceeds the upper limit of the block, user signature error, the transaction already exists in the transaction pool or blockchain (i.e. there is a risk of double payment), and the transaction transfer value is greater than the user account balance.
[0044] In S103, the data owner of each blockchain node uses local data to train the model according to the model algorithm issued by the model summary node, and sends the calculated gradient of the model data to the model summary node. Since the gradient belongs to the intermediate calculation result rather than the original data, sending the calculated gradient to the model summary node can ensure joint modeling based on the gradient sent by each data owner without exposing the original data.
[0045] In S104, the model summary node calculates the gradient weight of each blockchain node based on the gradients calculated by each blockchain node.
[0046] Exemplarily, the gradient obtained by the model summary node may include multiple gradient vectors, and the gradients calculated by all blockchain nodes respectively can be represented by matrix A:
[0047]
[0048] Where n represents the number of blockchain nodes, m represents the number of gradient vectors included in each gradient, and the specific meaning of each element in matrix A is shown in Table 1 below.
[0049] Table 1
[0050] Serial number Blockchain Node Gradient Vector 1 Gradient Vector 2 …… Gradient vector m 1 Blockchain Node 1 <![CDATA[a 11 ]]> <![CDATA[a 12 ]]> …… <![CDATA[a 1m ]]> 2 Blockchain Node 2 <![CDATA[a 21 ]]> <![CDATA[a 22 ]]> …… <![CDATA[a 2m ]]> …… …… …… …… …… …… n Blockchain Node n <![CDATA[a n1 ]]> <![CDATA[a n2 ]]> …… <![CDATA[a nm ]]>
[0051] As an implementation method of S104, S104 may specifically include: calculating the mean of each gradient vector according to multiple gradient vectors calculated by each blockchain node; calculating the standard deviation of each gradient vector according to multiple gradient vectors calculated by each blockchain node and the mean of each gradient vector; calculating the discrete coefficient of each gradient vector of each blockchain node according to the mean and the standard deviation; and calculating the gradient weight of each blockchain node according to the discrete coefficient.
[0052] Optionally, according to the following formula (2), the mean value of each gradient vector E = {E1, E2, ..., E m}:
[0053]
[0054] Among them, E j represents the mean value of the jth gradient vector, a kj Represents the element in the k-th row and j-th column of matrix A, that is, the value of the j-th gradient vector of the k-th blockchain node.
[0055] According to the following formula (3), the standard deviation of each gradient vector σ={σ1,σ2,……,σ m}:
[0056]
[0057] Among them, σ j represents the standard deviation of the j-th gradient vector.
[0058] According to the following formula (4), the discrete coefficient of each gradient vector of each blockchain node can be calculated to obtain a matrix λ composed of the discrete coefficients of each gradient vector of each blockchain node:
[0059]
[0060]
[0061] Among them, λ ij Represents the element in the i-th row and j-th column of the matrix λ, that is, the discrete coefficient of the j-th gradient vector of the i-th blockchain node.
[0062] As another implementation of the method for determining the blockchain consensus accounting nodes of the present application, before calculating the gradient weight of each blockchain node based on the discrete coefficient, the method for determining the blockchain consensus accounting nodes also includes: normalizing the discrete coefficient.
[0063] Optionally, according to the following formula (6), each discrete coefficient in the matrix λ is normalized to obtain a normalized matrix γ:
[0064]
[0065]
[0066] Among them, γ ij Represents the ij After normalization, the discrete coefficient, max(λ j ) represents the maximum value of the j-th column element in the matrix λ, min(λ j ) is the minimum value of the j-th column element in the matrix λ.
[0067] By normalizing the discrete coefficients, all discrete coefficients can be mapped to the same coordinate system. The higher the normalized discrete coefficient, the farther the gradient corresponding to the discrete coefficient is from the central gradient, the lower the data accuracy, and the lower the weight assigned to it during calculation; the lower the normalized discrete coefficient, the closer the gradient corresponding to the discrete coefficient is to the central gradient, the higher the data accuracy, and the higher the weight assigned to it during calculation.
[0068] In some embodiments, optionally, the gradient weight of each blockchain node is calculated according to the discrete coefficient, which may specifically include: calculating the gradient weight of each blockchain node according to the normalized discrete coefficient.
[0069] In some embodiments, optionally, the gradient weight of each blockchain node is calculated according to the normalized discrete coefficient, which may specifically include: calculating the first weight of each gradient vector of each blockchain node according to the normalized discrete coefficient; and determining the mean of the first weight of each gradient vector of each blockchain node as the gradient weight of each blockchain node.
[0070] In some embodiments, optionally, the first weight of each gradient vector of each blockchain node is calculated according to the normalized discrete coefficient, including: calculating the sum of the discrete coefficients of each gradient vector according to the normalized discrete coefficients; calculating the proportion of the discrete coefficient of each gradient vector of each blockchain node to the sum of the discrete coefficients corresponding to the gradient vector according to the sum of the discrete coefficients of each gradient vector; and determining the proportion as the first weight of each gradient vector of each blockchain node.
[0071] Alternatively, the gradient weight of each blockchain node can be calculated according to the following formula (8):
[0072]
[0073] Among them, w i represents the gradient weight of the ith blockchain node, represents the sum of the discrete coefficients of the jth gradient vector, It represents the ratio of the discrete coefficient of the jth gradient vector of the i-th blockchain node to the sum of the discrete coefficients of the jth gradient vector, that is, the first weight of the jth gradient vector of the i-th blockchain node. Represents the sum of the first weights of the m gradient vectors of the i-th blockchain node.
[0074] In S105, the higher the gradient weight, the closer the gradient is to the central gradient and the higher the data accuracy. Therefore, the blockchain node with the highest gradient weight can be used as the consensus accounting node of the blockchain to initiate consensus and participate in the generation of blocks.
[0075] As another implementation method of determining the consensus accounting node of the blockchain in this application, Figure 3 As shown, after step S105, the method for determining the blockchain consensus accounting node may further include the following steps S301 and S302.
[0076] S301. Obtain the block information of the consensus accounting node.
[0077] Exemplarily, as shown in Table 2 below, the block information of the consensus accounting node may include block size, block version number, parent block identifier, Merkle tree root identifier, block creation time, node identifier of the consensus accounting node, and the number of transactions in the block. This embodiment of the application is not limited to this.
[0078] Table 2
[0079]
[0080] S302. Generate a first block in the blockchain according to the block information.
[0081] As an implementation method of S302, S302 may specifically include: performing a hash operation on the block information based on a preset hash algorithm to obtain a hash value corresponding to the block identifier of the first block; and generating the first block in the blockchain according to the block identifier of the first block.
[0082] Exemplarily, the calculation formula of the hash operation can be: block identifier of the first block = hash (block size, block version number, parent block identifier, Merkle tree root identifier, block creation time, node identifier of the consensus accounting node, number of transactions in the block). Through the above calculation formula, the block identifier of the first block to be generated can be obtained, and then the first block is generated in the blockchain according to the block identifier of the first block, and the newly generated first block will also be synchronized to other blockchain nodes.
[0083] Based on the method for determining a blockchain consensus accounting node provided in the above embodiment, the present application also provides a specific implementation of a device for determining a blockchain consensus accounting node. Please refer to the following embodiment.
[0084] like Figure 4 As shown, the blockchain consensus accounting node determination device 400 provided in the embodiment of the present application includes the following modules:
[0085] Receiving module 401, used to receive a transaction request sent by a client;
[0086] A sending module 402 is used to send the model algorithm to each blockchain node when the transaction request is verified;
[0087] An acquisition module 403 is used to obtain the gradients calculated by each blockchain node according to the model algorithm;
[0088] A calculation module 404, used to calculate the gradient weight of each blockchain node according to the gradient calculated by each blockchain node;
[0089] The determination module 405 is used to determine the blockchain node with the highest gradient weight as the consensus accounting node of the blockchain.
[0090] The device for determining the consensus accounting node of the blockchain provided by the embodiment of the present application is based on the consensus algorithm of blockchain and federated learning. When the transaction request sent by the client is verified, the model algorithm is sent to each blockchain node. Each blockchain node calculates its own gradient according to the model algorithm, and then calculates its own gradient weight according to the gradient of each blockchain node, and then determines the blockchain node with the highest gradient weight as the consensus accounting node of the blockchain. Through the embodiment of the present application, in the process of generating block consensus, the existing meaningless calculation process can be converted into a meaningful calculation process of calculating the corresponding gradient of the blockchain node, thereby effectively solving the problem of waste of computing power resources and improving the utilization rate of computing power resources.
[0091] In some embodiments, the above-mentioned blockchain consensus accounting node determination device 400 may also include: a generation module, used to obtain block information of the consensus accounting node; and generate a first block in the blockchain according to the block information.
[0092] In some embodiments, the above-mentioned generation module is specifically used to perform a hash operation on the block information based on a preset hash algorithm to obtain a hash value corresponding to the block identifier of the first block; and generate the first block in the blockchain according to the block identifier of the first block.
[0093] In some embodiments, the calculation module 404 is specifically used to calculate the mean of each gradient vector according to the multiple gradient vectors calculated by each blockchain node; calculate the standard deviation of each gradient vector according to the multiple gradient vectors calculated by each blockchain node and the mean of each gradient vector; calculate the discrete coefficient of each gradient vector of each blockchain node according to the mean and the standard deviation; calculate the gradient weight of each blockchain node according to the discrete coefficient.
[0094] In some embodiments, the above-mentioned blockchain consensus accounting node determination device 400 may also include: a normalization processing module for normalizing the discrete coefficient.
[0095] In some embodiments, the calculation module 404 may also be used to calculate the gradient weight of each blockchain node according to the normalized discrete coefficient.
[0096] In some embodiments, the calculation module 404 may also be used to calculate the first weight of each gradient vector of each blockchain node according to the normalized discrete coefficient; and determine the mean of the first weight of each gradient vector of each blockchain node as the gradient weight of each blockchain node.
[0097] In some embodiments, the above-mentioned calculation module 404 can also be used to calculate the sum of the discrete coefficients of each gradient vector according to the normalized discrete coefficients; calculate the proportion of the discrete coefficient of each gradient vector of each blockchain node to the sum of the discrete coefficients corresponding to the gradient vector according to the sum of the discrete coefficients of each gradient vector; and determine the proportion as the first weight of each gradient vector of each blockchain node.
[0098] Figure 4 Each module in the device shown has the function of realizing Figure 1 The functions of each step in the process can achieve the corresponding technical effects, which will not be described in detail here for the sake of brevity.
[0099] Based on the method for determining the blockchain consensus accounting node provided in the above embodiment, the present application also provides a specific implementation of the electronic device. Please refer to the following embodiment.
[0100] Figure 5 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application.
[0101] The electronic device may include a processor 501 and a memory 502 storing computer program instructions.
[0102] Specifically, the processor 501 may include a central processing unit (CPU), or an application specific integrated circuit (ASIC), or may be configured to implement one or more integrated circuits of the embodiments of the present application.
[0103] The memory 502 may include a large capacity memory for data or instructions. By way of example and not limitation, the memory 502 may include a hard disk drive (HDD), a floppy disk drive, a flash memory, an optical disk, a magneto-optical disk, a magnetic tape, or a universal serial bus (USB) drive or a combination of two or more of these. In one example, the memory 502 may include a removable or non-removable (or fixed) medium, or the memory 502 is a non-volatile solid-state memory. The memory 502 may be inside or outside the integrated gateway disaster recovery device.
[0104] In one example, the memory 502 may be a read-only memory (ROM). In one example, the ROM may be a mask-programmed ROM, a programmable ROM (PROM), an erasable PROM (EPROM), an electrically erasable PROM (EEPROM), an electrically rewritable ROM (EAROM), or a flash memory, or a combination of two or more of these.
[0105] The memory 502 may include a read-only memory (ROM), a random access memory (RAM), a magnetic disk storage medium device, an optical storage medium device, a flash memory device, an electrical, optical or other physical / tangible memory storage device. Thus, typically, the memory includes one or more tangible (non-transitory) computer-readable storage media (e.g., a memory device) encoded with software including computer-executable instructions, and when the software is executed (e.g., by one or more processors), it is operable to perform the operations described with reference to the method according to an aspect of the present application.
[0106] The processor 501 reads and executes the computer program instructions stored in the memory 502 to implement Figure 1 The method / steps S101 to S105 in the embodiment shown in the figure are achieved Figure 1 The corresponding technical effects achieved by executing the methods / steps in the examples shown are not repeated here for the sake of brevity.
[0107] In one example, the electronic device may further include a communication interface 503 and a bus 510. Figure 5As shown, the processor 501, the memory 502, and the communication interface 503 are connected via a bus 510 and communicate with each other.
[0108] The communication interface 503 is mainly used to implement communication between various modules, devices, units and / or equipment in the embodiments of the present application.
[0109] Bus 510 includes hardware, software or both, and the parts of electronic equipment are coupled to each other. For example, but not limitation, bus may include accelerated graphics port (Accelerated Graphics Port, AGP) or other graphics bus, enhanced industry standard architecture (Extended Industry Standard Architecture, EISA) bus, front side bus (Front Side Bus, FSB), Hyper Transport (Hyper Transport, HT) interconnection, industry standard architecture (Industry Standard Architecture, ISA) bus, infinite bandwidth interconnection, low pin count (LPC) bus, memory bus, micro channel architecture (MCA) bus, peripheral component interconnection (PCI) bus, PCI-Express (PCI-X) bus, serial advanced technology attachment (SATA) bus, video electronics standard association local (VLB) bus or other suitable bus or two or more of these combinations. In appropriate cases, bus 510 may include one or more buses. Although the present application embodiment describes and shows a specific bus, the application considers any suitable bus or interconnection.
[0110] In addition, in combination with the method for determining the blockchain consensus accounting node in the above embodiment, the embodiment of the present application may provide a computer-readable storage medium for implementation. The computer-readable storage medium stores computer program instructions; when the computer program instructions are executed by the processor, any method for determining the blockchain consensus accounting node in the above embodiment is implemented. Examples of computer-readable storage media include non-transitory computer-readable storage media, such as electronic circuits, semiconductor memory devices, ROM, random access memory, flash memory, erasable ROM (EROM), floppy disks, CD-ROMs, optical disks, and hard disks.
[0111] It should be clear that the present application is not limited to the specific configuration and processing described above and shown in the figures. For the sake of simplicity, a detailed description of the known method is omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of the present application is not limited to the specific steps described and shown, and those skilled in the art can make various changes, modifications and additions, or change the order between the steps after understanding the spirit of the present application.
[0112] The functional blocks shown in the above-described block diagram can be implemented as hardware, software, firmware or a combination thereof. When implemented in hardware, it can be, for example, an electronic circuit, an application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), appropriate firmware, plug-in, function card, etc. When implemented in software, the elements of the present application are programs or code segments used to perform the required tasks. The program or code segment can be stored in a machine-readable medium, or transmitted on a transmission medium or communication link by a data signal carried in a carrier. "Machine-readable medium" may include any medium capable of storing or transmitting information. Examples of machine-readable media include electronic circuits, semiconductor memory devices, ROM, flash memory, erasable ROM (EROM), floppy disks, CD-ROMs, optical disks, hard disks, optical fiber media, radio frequency (Radio Frequency, RF) links, etc. The code segment can be downloaded via a computer network such as the Internet, an intranet, etc.
[0113] It should also be noted that the exemplary embodiments mentioned in this application describe some methods or systems based on a series of steps or devices. However, this application is not limited to the order of the above steps, that is, the steps can be performed in the order mentioned in the embodiment, or in a different order from the embodiment, or several steps can be performed simultaneously.
[0114] The above reference is according to the method of the embodiment of the present application, the flow chart of the device (system) and the computer program product and / or the block diagram described various aspects of the present application.It should be understood that each square box in the flow chart and / or the block diagram and the combination of each square box in the flow chart and / or the block diagram can be realized by computer program instructions.These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer or other programmable data processing device to produce a machine so that these instructions executed by the processor of the computer or other programmable data processing device enable the realization of the function / action specified in one or more square boxes of the flow chart and / or the block diagram.Such a processor can be but is not limited to a general-purpose processor, a special-purpose processor, a special application processor or a field programmable logic circuit.It can also be understood that each square box in the block diagram and / or the flow chart and the combination of the square boxes in the block diagram and / or the flow chart can also be realized by the dedicated hardware that performs the specified function or action, or can be realized by the combination of dedicated hardware and computer instructions.
[0115] The above is only a specific implementation of the present application. Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working processes of the systems, modules and units described above can refer to the corresponding processes in the aforementioned method embodiments, and will not be repeated here. It should be understood that the protection scope of the present application is not limited to this. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed in this application, and these modifications or replacements should be included in the protection scope of this application.
Claims
1. A method for determining blockchain consensus accounting nodes, It is characterized in that The method comprises: Receive transaction requests sent by the client; When the transaction request is verified, the model algorithm is sent to each blockchain node; Obtain the gradient calculated by each blockchain node according to the model algorithm; Calculate the gradient weight of each blockchain node based on the gradient calculated by each blockchain node; The blockchain node with the highest gradient weight is determined as the consensus accounting node of the blockchain.
2. The method according to claim 1, It is characterized in that After determining the blockchain node with the highest gradient weight as the consensus accounting node of the blockchain, the method further includes: Obtaining the block information of the consensus accounting node; According to the block information, a first block is generated in the blockchain.
3. The method according to claim 2, It is characterized in that Generating a first block in the blockchain according to the block information includes: Performing a hash operation on the block information based on a preset hash algorithm to obtain a hash value corresponding to the block identifier of the first block; A first block is generated in the blockchain according to the block identifier of the first block.
4. The method according to claim 1, It is characterized in that The gradient includes multiple gradient vectors, and the gradient weight of each blockchain node is calculated according to the gradient calculated for each blockchain node, including: According to the multiple gradient vectors calculated by each blockchain node, the mean of each gradient vector is calculated; Based on the multiple gradient vectors calculated by each blockchain node and the mean of each gradient vector, the standard deviation of each gradient vector is calculated; Calculate the discrete coefficient of each gradient vector of each blockchain node according to the mean and the standard deviation; According to the discrete coefficient, the gradient weight of each blockchain node is calculated.
5. The method according to claim 4, It is characterized in that Before calculating the gradient weight of each blockchain node according to the discrete coefficient, the method further includes: normalizing the discrete coefficient; Calculating the gradient weight of each blockchain node according to the discrete coefficient includes: According to the normalized discrete coefficient, the gradient weight of each blockchain node is calculated.
6. The method according to claim 5, It is characterized in that The calculation of the gradient weight of each blockchain node according to the normalized discrete coefficient includes: According to the normalized discrete coefficient, the first weight of each gradient vector of each blockchain node is calculated; The mean of the first weight of each gradient vector of each blockchain node is determined as the gradient weight of each blockchain node.
7. The method according to claim 6, It is characterized in that The step of calculating the first weight of each gradient vector of each blockchain node according to the normalized discrete coefficient includes: According to the normalized discrete coefficients, the sum of the discrete coefficients of each gradient vector is calculated; According to the sum of the discrete coefficients of each gradient vector, calculate the proportion of the discrete coefficient of each gradient vector of each blockchain node to the sum of the discrete coefficients corresponding to the gradient vector; The proportion is determined as a first weight of each gradient vector of each blockchain node.
8. A device for determining a blockchain consensus accounting node, It is characterized in that The device comprises: The receiving module is used to receive the transaction request sent by the client; A sending module, used to send the model algorithm to each blockchain node when the transaction request is verified; An acquisition module, used to obtain the gradients calculated by each blockchain node according to the model algorithm; A calculation module, used to calculate the gradient weight of each blockchain node according to the gradient calculated by each blockchain node; The determination module is used to determine the blockchain node with the highest gradient weight as the consensus accounting node of the blockchain.
9. An electronic device, It is characterized in that The electronic device includes: a processor, a memory, and a computer program stored in the memory and executable on the processor. When the computer program is executed by the processor, the steps of the method for determining a blockchain consensus accounting node as described in any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores a computer program, and when the computer program is executed by the processor, the steps of the method for determining the blockchain consensus accounting node as described in any one of claims 1 to 7 are implemented.
