WO2023109040A1 - Alliance chain block generation method and apparatus, electronic device, and medium - Google Patents

Alliance chain block generation method and apparatus, electronic device, and medium Download PDF

Info

Publication number
WO2023109040A1
WO2023109040A1 PCT/CN2022/098136 CN2022098136W WO2023109040A1 WO 2023109040 A1 WO2023109040 A1 WO 2023109040A1 CN 2022098136 W CN2022098136 W CN 2022098136W WO 2023109040 A1 WO2023109040 A1 WO 2023109040A1
Authority
WO
WIPO (PCT)
Prior art keywords
empty
block
alliance chain
consortium
chain
Prior art date
Application number
PCT/CN2022/098136
Other languages
French (fr)
Chinese (zh)
Inventor
陈敏
Original Assignee
达闼科技(北京)有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 达闼科技(北京)有限公司 filed Critical 达闼科技(北京)有限公司
Publication of WO2023109040A1 publication Critical patent/WO2023109040A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/23Updating
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor

Definitions

  • the present application relates to the technical field of blockchain, in particular to a method, device, electronic equipment and medium for consortium chain block generation.
  • Blockchain technology uses block chain data structure to verify and store data, uses distributed node consensus algorithm to generate and update data, uses cryptography to ensure the security of data transmission and access, and utilizes intelligence composed of automated script codes.
  • a new distributed infrastructure and computing paradigm that uses contracts to program and manipulate data.
  • the form of alliance chain is more and more widely used in various enterprises and organizations.
  • the block generation cycle of the blockchain is usually reduced.
  • the block generation cycle is, for example, 1 second, that is, a block is generated every 1 second.
  • the transaction volume in the consortium chain is not particularly large, or the transaction time is relatively fixed, so a large number of empty blocks will be generated, and the generation of a large number of empty blocks will not only waste computing power, but also waste a lot of storage space.
  • Various aspects of the present application provide a method, device, electronic device and medium for consortium chain block generation, which are used to reduce the waste of computing power generated by generating a large number of empty blocks and save storage space.
  • the embodiment of the present application provides a method for generating a block of a consortium chain, which is applied to the first consortium chain node in the consortium chain network.
  • the current block generation period arrives, generate an empty block and broadcast the empty block to the alliance chain network for each alliance chain node in the alliance chain network to verify the validity of the empty block and send the empty block when the empty block is valid
  • the empty block is added to the alliance chain; when the empty block is added to the alliance chain, the number of empty blocks that appear consecutively after the last non-empty block on the alliance chain is obtained as the first number; if the first If the quantity is equal to the preset quantity threshold, and no transaction data is received in the next block generation period, it is forbidden to generate new empty blocks when the next block generation period arrives.
  • the embodiment of the present application also provides a consortium chain block generation device, including: a processing module, used to generate an empty block when the current block generation period arrives if the first consortium chain node does not receive transaction data within the current block generation period. block, and broadcast the empty block to the alliance chain network for each alliance chain node in the alliance chain network to verify the validity of the empty block and add the empty block to the alliance chain when the empty block is valid;
  • the acquisition module is used to obtain the number of empty blocks that appear consecutively after the last non-empty block on the alliance chain when the empty block is added to the alliance chain, as the first number;
  • the processing module is also used if The first number is equal to the preset number threshold, and no transaction data is received within the next block generation cycle, then the generation of new empty blocks is prohibited when the next block generation cycle arrives.
  • the embodiment of the present application also provides an electronic device, including: a memory and a processor; the memory is used to store a computer program; the processor is coupled to the memory, and is used to execute the computer program to execute the consortium chain block generation method.
  • the embodiment of the present application also provides a computer-readable storage medium storing a computer program, and when the computer program is executed by a processor, the processor is caused to realize the consortium chain block generation method.
  • any consortium chain node if any consortium chain node does not receive transaction data within the current block generation cycle, it will generate an empty block when the current block generation cycle arrives, and broadcast the empty block to the consortium chain network, In order to add the empty block to the alliance chain when the alliance chain network verifies that the generated empty block is valid. After the empty block is added to the consortium chain, count the number of consecutive empty blocks that appear after the last non-empty block on the consortium chain. If the number of empty blocks that appear consecutively after the last non-empty block on the consortium chain is large, and no transaction data is received in the next block generation cycle, it is forbidden to generate new blocks when the next block generation cycle arrives. Empty block.
  • empty blocks are generated on the consortium chain to ensure the security of the consortium chain, and the number of consecutive empty blocks appearing on the consortium chain is limited to limit the high-frequency generation of empty blocks, thereby reducing the generation of a large number of Empty blocks waste computing power, save storage space, and realize efficient and safe control of the number of empty blocks on the alliance chain.
  • Fig. 1 is an architecture diagram of a consortium chain network provided by an exemplary embodiment of the present application
  • Fig. 2 is a schematic flow diagram of a method for producing blocks in an alliance chain provided by an exemplary embodiment of the present application
  • Fig. 3 is a diagram of an application scenario applicable to the alliance chain block generation method provided by an exemplary embodiment of the present application
  • Fig. 4 is another application scenario diagram applicable to the consortium chain block generation method provided by an exemplary embodiment of the present application.
  • Fig. 5 is a schematic structural diagram of a consortium chain block generation device provided by an exemplary embodiment of the present application.
  • Fig. 6 is a schematic structural diagram of an electronic device provided by an exemplary embodiment of the present application.
  • the embodiment of this application provides a method, device, electronic equipment and medium for consortium chain block generation.
  • any consortium chain node does not receive transaction data within the current block generation cycle, then When the current block generation period arrives, generate an empty block and broadcast the empty block to the alliance chain network, so that the empty block can be added to the alliance chain when the alliance chain network verifies that the generated empty block is valid superior.
  • empty block After the empty block is added to the consortium chain, count the number of consecutive empty blocks that appear after the last non-empty block on the consortium chain. If the number of empty blocks that appear consecutively after the last non-empty block on the consortium chain is large, and no transaction data is received in the next block generation cycle, it is forbidden to generate new blocks when the next block generation cycle arrives. Empty block. As a result, empty blocks are generated on the consortium chain to ensure the security of the consortium chain, and the number of consecutive empty blocks appearing on the consortium chain is limited to limit the high-frequency generation of empty blocks, thereby reducing the generation of a large number of Empty blocks waste computing power, save storage space, and realize efficient and safe control of the number of empty blocks on the alliance chain.
  • Fig. 1 is an architecture diagram of a consortium chain network provided by an exemplary embodiment of the present application.
  • the consortium chain network may include a plurality of consortium chain nodes 10, and all consortium chain nodes 10 jointly form a consortium chain network.
  • the alliance chain node 10 can be a terminal device 20 or a server, and the status of each alliance chain node 10 in the alliance chain network is equal, and each alliance chain node 10 jointly maintains an alliance chain 30 .
  • the alliance user 40 can initiate a transaction request to the alliance chain node 10 in the alliance chain network through the terminal device 20, and submit the transaction data.
  • the alliance chain node 10 performs corresponding data processing on the transaction data, such as requesting other alliance chain Nodes 10 perform consensus processing on transaction data, generate blocks, store on chain, and so on.
  • the alliance users 40 include but are not limited to institutional users, enterprise users or individual users who jointly participate in the management of the alliance chain 30 .
  • the terminal device may be hardware or software.
  • the terminal device is, for example, a mobile phone, a tablet computer, a desktop computer, a wearable smart device, a smart home device, and the like.
  • the terminal device is software, it can be installed in the hardware devices listed above.
  • the terminal device is, for example, multiple software modules or a single software module, which is not limited in this embodiment of the present application.
  • Servers can be hardware or software.
  • the server is hardware, the server is a single server or a distributed server cluster composed of multiple servers.
  • the server is software, it may be multiple software modules or a single software module, which is not limited in this embodiment of the present application.
  • consortium chain nodes 10 terminal devices 20 and consortium users 40 in FIG. 1 are only illustrative. In practical applications, any number of alliance chain nodes 10, terminal devices 20 and alliance users 40 are deployed according to actual needs.
  • Fig. 2 is a schematic flow chart of a method for generating blocks in an alliance chain provided by an exemplary embodiment of the present application. Referring to Figure 2, the method may include the following steps:
  • the consortium chain block generation method provided in this embodiment can be executed by any consortium chain node 10 in the consortium chain network.
  • any consortium chain node 10 is referred to as the first consortium chain node.
  • the alliance chain network can set the block generation cycle according to the actual application requirements, for example, the block generation cycle is 1 second. If the first consortium chain node receives transaction data within the current block generation cycle, it will package the transaction data to generate a non-empty block when the current block generation cycle arrives, and broadcast it to the consortium chain network for the consortium chain Each alliance chain node 10 in the network verifies the validity of the non-empty block and adds the non-empty block to the alliance chain 30 when the non-empty block is valid.
  • the first alliance chain node If the first alliance chain node does not receive transaction data within the current block generation cycle, it will generate an empty block when the current block generation cycle arrives, and broadcast it to the alliance chain network for all alliance chains in the alliance chain network
  • the 30 nodes verify the validity of the empty block and add the empty block to the alliance chain 30 when the empty block is valid.
  • each consortium chain 30 nodes in the consortium chain network may verify the validity of empty blocks.
  • each alliance chain 30 nodes may generate empty blocks and broadcast them to the alliance chain network.
  • each alliance chain 30 node takes the empty block with the highest difficulty value as an effective empty block based on the consensus protocol and adds the effective empty block to the alliance chain 30, that is, the effective empty block is processed. winding. Among them, the corresponding difficulty value is recorded in the empty block.
  • a non-empty block is generated based on the transaction data when the transaction data submitted by the alliance user 40 is received, and an empty block is generated when the transaction data submitted by the alliance user 40 is not received.
  • a block containing transaction data is generated based on the transaction data when the transaction data submitted by the alliance user 40 is received, and an empty block is generated when the transaction data submitted by the alliance user 40 is not received.
  • empty blocks are generated on the consortium chain 30 to ensure the security of the consortium chain 30, and the number of consecutive empty blocks on the consortium chain 30 is limited to limit the high-frequency generation of empty blocks , thereby reducing the waste of computing power generated by generating a large number of empty blocks and saving storage space. Therefore, it is understandable that even in low-frequency transaction scenarios, as time goes by, the number of empty blocks that appear consecutively after the last non-empty block on the consortium chain 30 will not be many. In addition, limiting the number of consecutive empty blocks on the consortium chain 30 does not affect the consortium chain 30 can set a smaller block generation period to ensure that the consortium chain 30 has higher transaction execution efficiency and throughput.
  • the number of consecutive empty blocks appearing after the last non-empty block on the consortium chain 30 is counted.
  • the number of empty blocks that appear consecutively after the last non-empty block on the consortium chain 30 is taken as the first number. If the first number is less than or equal to the preset number threshold, it means that the number of empty blocks that appear consecutively after the last non-empty block on the consortium chain 30 is small, and if no transaction data is received in the next block generation cycle , then continue to generate new empty blocks when the next block generation cycle arrives.
  • the preset quantity threshold is set according to actual application requirements.
  • the alliance chain network has not received the transaction data submitted by the alliance user 40 for a long time, it will not generate empty blocks on the alliance chain 30 without limit, but the last block on the alliance chain 30
  • the number of consecutive empty blocks following a non-empty block is at most a preset number threshold.
  • the consortium chain 30 is limited to a maximum of 6 consecutive empty blocks.
  • an alliance chain node 10 receives the transaction data Tx0 and transaction data Tx1 submitted by the alliance user 40, and broadcasts to the alliance chain network, and the alliance chain network will effectively include the transaction data Tx0 and the non-empty blocks of the transaction data Tx1 are added to the alliance chain 30.
  • the entire consortium chain network did not receive new transaction data submitted by consortium user 40.
  • an empty block is generated every 1 second and added to the alliance chain 30 until six empty blocks are continuously added to the alliance chain 30.
  • each alliance chain node 10 stops generating empty blocks. blocks and continue to add new empty blocks on the consortium chain 30.
  • another consortium chain node 10 receives the transaction data Tx2 and broadcasts it to the consortium chain network, and the consortium chain network will add valid non-empty blocks including transaction data Tx2 to the consortium Chain 30 on. It can be seen from this that in the low-frequency transaction scenario where alliance users 40 only submit two transaction requests within one hour, although the block generation period is 1 second, only 6 empty blocks are generated on the alliance chain 30, greatly It greatly reduces the number of generated empty blocks and saves computing power and storage space.
  • any alliance chain node does not receive transaction data within the current block generation cycle, when the current block generation cycle arrives, an empty block is generated and the empty block is broadcast to
  • the consortium chain network if the consortium chain network verifies that the generated empty block is valid, the empty block will be added to the consortium chain. After the empty block is added to the consortium chain, count the number of consecutive empty blocks that appear after the last non-empty block on the consortium chain. If the number of empty blocks that appear consecutively after the last non-empty block on the consortium chain is large, and no transaction data is received in the next block generation cycle, it is forbidden to generate new blocks when the next block generation cycle arrives. Empty block.
  • empty blocks are generated on the consortium chain to ensure the security of the consortium chain, and the number of consecutive empty blocks on the consortium chain is limited to limit the high-frequency generation of empty blocks, thereby reducing the generation of a large number of Empty blocks waste computing power, save storage space, and realize efficient and safe control of the number of empty blocks on the alliance chain.
  • an implementation process of generating an empty block is: to determine whether the current time is within the preset transaction time period; if so, when the current block generation cycle arrives, an empty block is generated. If not, when the current block generation period arrives, refuse to generate an empty block.
  • the computing power of each consortium chain node 10 may be the same or different. It should be understood that the higher the computing power, the greater the processing capability of the consortium chain node 10. Further optionally, in order to efficiently and safely control the number of empty blocks on the alliance chain 30, the alliance chain node 10 with larger computing power can be selected to generate empty blocks. Based on this, when the current block generation period arrives, an implementation process of generating an empty block is: when the block generation period arrives, the first consortium chain node judges whether its current computing power is greater than or equal to the preset computing power value; , an empty block is generated. If not, when the current block generation period arrives, refuse to generate an empty block.
  • an implementation process of generating an empty block is: when the current block generation period arrives, determine the alliance whose current computing power is not less than the preset computing power value in the alliance chain network Chain nodes 10 and their number, as the second number; if the second number is greater than or equal to the specified number, select a specified number of alliance chain nodes 10 from the alliance chain nodes 10 whose current computing power is greater than or equal to the preset computing power value, And send the first notification to the specified number of alliance chain nodes 10 to notify the specified number of alliance chain nodes 10 to generate an empty block.
  • the second number is less than the specified number, then subtract the second number from the specified number to obtain the third number, and select the third number of alliance chain nodes 10 from the alliance chain nodes 10 whose current computing power is less than the preset computing power value;
  • the second number of alliance chain nodes 10 and the third number of alliance chain nodes 10 send a second notification to notify the second number of alliance chain nodes 10 and the third number of alliance chain nodes 10 to generate an empty block.
  • the specified number is set according to the actual application requirements. It is required that the number of alliance chain nodes 10 participating in the generation of empty blocks reaches the specified number, and the alliance chain nodes 10 with high computing power are selected to participate in the generation of empty blocks, which can ensure efficient block generation in the alliance chain. 30 consecutively generate multiple empty blocks.
  • the alliance chain network is a decentralized network, and the status of each alliance chain node 10 in the alliance chain network is equal.
  • Any consortium chain node 10 can send the first notification or the second notification, and execute the empty block generation task after receiving the first notification or the second notification. That is to say, the first notification or the second notification that the first consortium chain node can send to the second consortium chain node 10, or the first notification or the second notification that the second consortium chain node 10 can send to the first consortium chain node .
  • the second consortium chain node 10 is other consortium chain nodes 10 not including the first consortium chain node in the consortium chain network.
  • an implementation process of generating an empty block is to receive the first block sent by the second alliance chain node 10 in the alliance chain network. notification or the second notification, and generate an empty block according to the first notification or the second notification; wherein, the first notification is that the second consortium chain node 10 recognizes that the current computing power in the consortium chain network is not less than the preset computing power value
  • the second notification is that the second consortium chain node 10 recognizes that the consortium chain node 10 whose current computing power is less than the preset computing power value in the consortium chain network Sent if the quantity is less than the specified quantity.
  • the first consortium chain node can perform the empty block generation task taking into account the transaction time period and computing power. Therefore, as an example, when the current block generation period arrives, an implementation process of generating an empty block is: to determine whether the current time is in the preset transaction time period; if the current time is in the preset transaction time period, When the block generation period arrives, the first consortium chain node judges whether its current computing power is greater than or equal to the preset computing power value; if its current computing power is greater than or equal to the preset computing power value, an empty block will be generated. If the current time is not in the preset transaction time period, or if the current time is in the preset transaction time period and its current computing power is less than the preset computing power value, it will refuse to generate an empty block when the current block generation period arrives.
  • the first consortium chain node can perform an empty block generation task taking into account the transaction period, computing power, and the number of consortium chain nodes 10. Therefore, as an example, when the current block generation period arrives, an implementation process of generating an empty block is: to determine whether the current time is in the preset transaction time period; if the current time is in the preset transaction time period, When the block generation period arrives, determine the alliance chain nodes 10 and their number whose current calculation power is not less than the preset calculation power value in the alliance chain network as the second number; if the second number is greater than or equal to the specified number, then start from the current calculation Select a specified number of alliance chain nodes 10 from the alliance chain nodes 10 whose force is greater than or equal to the preset computing power value, and send the first notification to the specified number of alliance chain nodes 10 to notify the specified number of alliance chain nodes 10 to generate an empty area piece.
  • the second number is less than the specified number, then subtract the second number from the specified number to obtain the third number, and select the third number of alliance chain nodes 10 from the alliance chain nodes 10 whose current computing power is less than the preset computing power value;
  • the second number of alliance chain nodes 10 and the third number of alliance chain nodes 10 send a second notification to notify the second number of alliance chain nodes 10 and the third number of alliance chain nodes 10 to generate an empty block. If the current time is not in the preset transaction time period, when the current block generation period arrives, it will refuse to generate an empty block.
  • the alliance chain network will identify whether the transaction data submitted by the alliance user 40 has passed the number of multiple alliance users 40 sign.
  • the transaction data digitally signed by multiple alliance users 40 can be packaged into a block, and has the possibility of being uploaded to the alliance chain 30 .
  • Transaction data that has not been digitally signed by multiple alliance users 40 is discarded by the alliance chain network and will not be packaged into blocks.
  • the first consortium chain node receives the first transaction data broadcast by other consortium chain nodes 10 in the consortium chain network during the current block generation cycle or receives its corresponding consortium chain node within the current block generation cycle
  • the user 40 submits the second transaction data
  • Signature processing then generate a non-empty block according to the first transaction data or the second transaction data, and broadcast the non-empty block to the alliance chain network for each alliance chain node 10 in the alliance chain network to verify the non-empty block validity and add the non-empty block to the consortium chain 30 when the non-empty block is valid.
  • any consortium chain node 10 After any consortium chain node 10 receives the transaction data submitted by its corresponding consortium user 40, it will also broadcast the transaction data to the consortium chain network for other consortium chain nodes 10 in the consortium chain network to continue based on the transaction data. Transaction data generates non-empty blocks.
  • the node identification of the alliance chain node 10 with transaction data sending authority is added to the white list.
  • any consortium chain node 10 broadcasts transaction data to the consortium chain network, it will judge whether its own node ID is in the white list. If it is in the white list, it is determined that it has the authority to broadcast the transaction data to the alliance chain network; if it is not in the white list, it is determined that it does not have the authority to broadcast the transaction data to the alliance chain network.
  • the alliance chain node 10 corresponding to the node identification in the whitelist has transaction data transmission authority; broadcast the second transaction data to the alliance chain network, so that each alliance chain node 10 in the alliance chain network can judge whether the second transaction data has passed Signature processing of multiple consortium chain 30 users.
  • each consortium chain node 10 judges that the second transaction data has been signed by multiple consortium chain 30 users, it will generate a non-empty block according to the second transaction data, and broadcast the non-empty block to the consortium chain
  • each alliance chain node 10 in the alliance chain network can verify the validity of the non-empty block and add the non-empty block to the alliance chain 30 when the non-empty block is valid.
  • consortium chain 30 is limited to a maximum of 6 consecutive empty blocks.
  • Alliance user A digitally signs the transaction data Tx0 and Tx1 with its own identity information, and obtains the signed transaction data Tx0(S1), Tx1(S1).
  • the alliance user A requests the alliance user B to continue to digitally sign the transaction data Tx0(S1), and the alliance user B uses its own identity information to digitally sign Tx0(S1) to obtain the signed transaction data Tx0(S1, S2) .
  • alliance user A provides transaction data Tx0 (S1, S2) and transaction data Tx1 (S1) to its corresponding alliance chain node 10, and the alliance chain node 10 corresponding to alliance user A identifies Tx0 (S1, S2) is digitally signed by multiple alliance users 40, and a non-empty block is generated according to Tx0 (S1, S2). If the non-empty block is verified to be valid by the alliance network, the non-empty block will be added To the alliance chain 30.
  • the alliance chain node 10 corresponding to the alliance user A recognizes that the transaction data Tx1(S1) has not been digitally signed by multiple alliance users 40, and then discards the transaction data Tx1(S1).
  • the transaction data Tx1(S1) will not be packed into blocks.
  • the entire consortium chain network did not receive new transaction data submitted by consortium user 40.
  • an empty block is generated every 1 second and added to the alliance chain 30 until six empty blocks are continuously added to the alliance chain 30.
  • each alliance chain node 10 stops generating empty blocks. blocks and continue to add new empty blocks on the consortium chain 30.
  • another consortium chain node 10 receives the transaction data Tx2 (S1, S2) submitted by consortium user 40B, and another consortium chain node 10 verifies the transaction data Tx2 (S1, S2) submitted by consortium user B ( S1, S2) are digitally signed by multiple alliance users 40, and a non-empty block is generated according to Tx2 (S1, S2). If the non-empty block is verified to be valid by the alliance network, the non-empty block is added to the alliance chain 30 on.
  • a non-empty block is obtained.
  • the alliance chain network can continue to verify whether the transaction data recorded in the non-empty block has been signed by multiple alliance users 40 . If the transaction data recorded in the non-empty block has not been signed by multiple alliance users 40, the alliance chain network will confirm that the non-empty block is an invalid block, and the non-empty block still cannot be added to the alliance chain 30. If the transaction data recorded in the non-empty block is signed by multiple alliance users 40, then the non-empty block has the possibility of being added to the alliance chain 30.
  • each step of the method may be the same device, or the method may also be executed by different devices.
  • the execution subject of steps 201 to 203 may be device A; for another example, the execution subject of steps 201 and 202 may be device A, and the execution subject of step 203 may be device B; and so on.
  • Fig. 5 is a schematic structural diagram of a consortium chain block generation device provided by an exemplary embodiment of the present application. As shown in FIG. 5 , the device includes: a processing module 51 and an obtaining module 52 .
  • the processing module 51 is used to generate an empty block and broadcast the empty block to the alliance chain network if the first alliance chain node does not receive transaction data within the current block generation cycle, when the current block generation cycle arrives, For each alliance chain node in the alliance chain network to verify the validity of the empty block and add the empty block to the alliance chain when the empty block is valid.
  • the acquiring module 52 is configured to acquire the number of consecutive empty blocks appearing after the last non-empty block on the alliance chain as the first number when the empty block is added to the alliance chain.
  • the processing module 51 is further configured to prohibit the generation of new empty blocks when the next block generation cycle arrives if the first amount is equal to the preset amount threshold and no transaction data is received within the next block generation cycle.
  • processing module 51 when the processing module 51 generates an empty block when the current block generation period arrives, it is specifically used to: determine whether the current time is in the preset transaction time period; if so, generate an empty block when the current block generation period arrives. blocks.
  • the processing module 51 when the processing module 51 generates an empty block when the current block generation cycle arrives, it is specifically used for: when the block generation cycle arrives, the first consortium chain node judges whether its current computing power is greater than or equal to the pre-calculated Force value; if so, an empty block is generated.
  • the processing module 51 when the processing module 51 generates an empty block when the current block generation cycle arrives, it is specifically used to: determine that the current computing power in the consortium chain network is not less than the preset computing power value when the current block generation cycle arrives.
  • Consortium chain nodes and their number are used as the second number; if the second number is greater than or equal to the specified number, select the specified number of alliance chain nodes from the alliance chain nodes whose current computing power is greater than or equal to the preset computing power value, and send to The specified number of consortium chain nodes send the first notification to notify the specified number of consortium chain nodes to generate empty blocks.
  • the processing module 51 is also used to: if the second amount is less than the specified amount, then subtract the second amount from the specified amount to obtain the third amount, and obtain the third amount from the consortium chain nodes whose current computing power is less than the preset computing power value Select the third number of alliance chain nodes; send the second notification to the second number of alliance chain nodes and the third number of alliance chain nodes to notify the second number of alliance chain nodes and the third number of alliance chain nodes Generate empty blocks.
  • the processing module 51 is specifically configured to: receive the first notification or the second notification sent by the second consortium chain node in the consortium chain network when the current block generation period arrives, and generate an empty block; A notification or a second notification to generate an empty block; wherein, the first notification is that the second consortium chain node recognizes that the number of consortium chain nodes whose current computing power is not less than the preset computing power value in the consortium chain network is greater than or equal to the specified
  • the second notification is sent when the second consortium chain node recognizes that the number of consortium chain nodes whose current computing power is not less than the preset computing power value in the consortium chain network is less than the specified number.
  • the processing module 51 is also used for: if the first consortium chain node receives the first transaction data broadcast by other consortium chain nodes in the consortium chain network within the current block generation cycle or receives its transaction data within the current block generation cycle When the corresponding alliance user submits the second transaction data, it is judged whether the first transaction data or the second transaction data has been signed by multiple alliance chain users; if the first transaction data or the second transaction data has been signed by multiple alliance chain users Signature processing, generate a non-empty block according to the first transaction data or the second transaction data, and broadcast the non-empty block to the alliance chain network for each alliance chain node in the alliance chain network to verify the identity of the non-empty block Validity and add the non-empty block to the alliance chain when the non-empty block is valid.
  • the processing module 51 is also used for: if the first consortium chain node receives the second transaction data submitted by its corresponding consortium user within the current block generation cycle, determine that the node identifier of the first consortium chain node is within the preset In the white list, the alliance chain nodes corresponding to the node identifiers in the white list have transaction data transmission authority; broadcast the second transaction data to the alliance chain network for each alliance chain node in the alliance chain network to judge whether the second transaction data After the signature processing of multiple alliance chain users.
  • consortium chain block generation device shown in FIG. 5 has been described in detail in the above embodiment of the consortium chain block generation method, and will not be described in detail here.
  • Fig. 6 is a schematic structural diagram of an electronic device provided by an exemplary embodiment of the present application.
  • the electronic device includes: a memory 61 and a processor 62 .
  • the memory 61 is used to store computer programs, and can be configured to store other various data to support operations on the computing platform. Examples of such data include instructions for any application or method operating on the computing platform, contact data, phonebook data, messages, pictures, videos, etc.
  • Memory 61 can be realized by any type of volatile or nonvolatile storage device or their combination, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable Programmable Read Only Memory (EPROM), Programmable Read Only Memory (PROM), Read Only Memory (ROM), Magnetic Memory, Flash Memory, Magnetic or Optical Disk.
  • SRAM static random access memory
  • EEPROM electrically erasable programmable read-only memory
  • EPROM erasable Programmable Read Only Memory
  • PROM Programmable Read Only Memory
  • ROM Read Only Memory
  • Magnetic Memory Flash Memory
  • Magnetic or Optical Disk any type of volatile or nonvolatile storage device or their combination, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable Programmable Read Only Memory (EPROM), Programmable Read Only Memory (PROM), Read Only Memory (ROM), Magnetic Memory, Flash Memory, Magnetic or Optical Disk.
  • SRAM static random access memory
  • Processor 62 coupled with memory 61, for executing the computer program in memory 61, for: if the first consortium chain node does not receive transaction data within the current block generation cycle, when the current block generation cycle arrives, Generate an empty block and broadcast the empty block to the alliance chain network for each alliance chain node in the alliance chain network to verify the validity of the empty block and add the empty block to the alliance chain when the empty block is valid Middle; when an empty block is added to the consortium chain, obtain the number of consecutive empty blocks that appear after the last non-empty block on the consortium chain as the first number; if the first number is equal to the preset number threshold, And if no transaction data is received in the next block generation cycle, it is prohibited to generate new empty blocks when the next block generation cycle arrives.
  • the processor 62 when the processor 62 generates an empty block when the current block generation period arrives, it is specifically used to: determine whether the current time is in the preset transaction time period; if so, generate an empty block when the current block generation period arrives. blocks.
  • the processor 62 when the processor 62 generates an empty block when the current block generation period arrives, it is specifically used for: when the block generation period arrives, the first consortium chain node judges whether its current computing power is greater than or equal to the pre-calculated Force value; if so, an empty block is generated.
  • the processor 62 when the processor 62 generates an empty block when the current block generation cycle arrives, it is specifically used to: determine that the current computing power in the consortium chain network is not less than the preset computing power value when the current block generation cycle arrives.
  • Consortium chain nodes and their number are used as the second number; if the second number is greater than or equal to the specified number, select the specified number of alliance chain nodes from the alliance chain nodes whose current computing power is greater than or equal to the preset computing power value, and send to The specified number of consortium chain nodes send the first notification to notify the specified number of consortium chain nodes to generate empty blocks.
  • the processor 62 is also used to: if the second amount is less than the specified amount, then subtract the specified amount from the second amount to obtain the third amount, and obtain the third amount from the consortium chain nodes whose current computing power is less than the preset computing power value Select the third number of alliance chain nodes; send the second notification to the second number of alliance chain nodes and the third number of alliance chain nodes to notify the second number of alliance chain nodes and the third number of alliance chain nodes Generate empty blocks.
  • the processor 62 is specifically configured to: receive the first notification or the second notification sent by the second consortium chain node in the consortium chain network when the current block generation period arrives, and generate an empty block; A notification or a second notification to generate an empty block; wherein, the first notification is that the second consortium chain node recognizes that the number of consortium chain nodes whose current computing power is not less than the preset computing power value in the consortium chain network is greater than or equal to the specified
  • the second notification is sent when the second consortium chain node recognizes that the number of consortium chain nodes whose current computing power is not less than the preset computing power value in the consortium chain network is less than the specified number.
  • the processor 62 is also used for: if the first consortium chain node receives the first transaction data broadcast by other consortium chain nodes in the consortium chain network within the current block generation cycle or receives its transaction data within the current block generation cycle When the corresponding alliance user submits the second transaction data, it is judged whether the first transaction data or the second transaction data has been signed by multiple alliance chain users; if the first transaction data or the second transaction data has been signed by multiple alliance chain users Signature processing, generate a non-empty block according to the first transaction data or the second transaction data, and broadcast the non-empty block to the alliance chain network for each alliance chain node in the alliance chain network to verify the identity of the non-empty block Validity and add the non-empty block to the alliance chain when the non-empty block is valid.
  • the processor 62 is also configured to: if the first consortium chain node receives the second transaction data submitted by its corresponding consortium user within the current block generation period, determine that the node identifier of the first consortium chain node is within the preset In the white list, the alliance chain nodes corresponding to the node identifiers in the white list have transaction data transmission authority; broadcast the second transaction data to the alliance chain network for each alliance chain node in the alliance chain network to judge whether the second transaction data After the signature processing of multiple alliance chain users.
  • the electronic device also includes: a communication component 63, a display 64, a power supply component 65, an audio component 66 and other components.
  • FIG. 6 only schematically shows some components, which does not mean that the electronic device only includes the components shown in FIG. 6 .
  • the components in the dotted line box in FIG. 6 are optional components, not mandatory components, which may depend on the product form of the electronic device.
  • the electronic device in this embodiment can be implemented as a terminal device such as a desktop computer, a notebook computer, a smart phone, or an IOT device, or as a server device such as a conventional server, a cloud server, or a server array.
  • the electronic equipment of this embodiment is implemented as terminal equipment such as desktop computers, notebook computers, smart phones, etc., it can include the components in the dashed box in Figure 6; if the electronic equipment of this embodiment is implemented as a conventional server, cloud server or server array, etc.
  • the server device may not include the components in the dashed box in FIG. 6 .
  • an embodiment of the present application further provides a computer-readable storage medium storing a computer program.
  • the computer program When the computer program is executed, the steps that can be executed by the electronic device in the above method embodiments can be implemented.
  • an embodiment of the present application further provides a computer program product, including a computer program, which, when the computer program is executed by a processor, causes the processor to implement the steps executable by the electronic device in the foregoing method embodiments.
  • the above-mentioned communication component is configured to facilitate wired or wireless communication between the device where the communication component is located and other devices.
  • the device where the communication component is located can access a wireless network based on communication standards, such as WiFi, 2G, 3G, 4G/LTE, 5G and other mobile communication networks, or a combination thereof.
  • the communication component receives a broadcast signal or broadcast related information from an external broadcast management system via a broadcast channel.
  • the communication assembly also includes a near field communication (NFC) module to facilitate short-range communication.
  • the NFC module may be implemented based on Radio Frequency Identification (RFID) technology, Infrared Data Association (IrDA) technology, Ultra Wideband (UWB) technology, Bluetooth (BT) technology and other technologies.
  • RFID Radio Frequency Identification
  • IrDA Infrared Data Association
  • UWB Ultra Wideband
  • Bluetooth Bluetooth
  • the above-mentioned display includes a screen, and the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from a user.
  • the touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel. The touch sensor may not only sense a boundary of a touch or a swipe action, but also detect duration and pressure associated with the touch or swipe operation.
  • a power supply component provides power for various components of the equipment where the power supply component is located.
  • a power supply component may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the device in which the power supply component resides.
  • the aforementioned audio components may be configured to output and/or input audio signals.
  • the audio component includes a microphone (MIC), which is configured to receive an external audio signal when the device on which the audio component is located is in an operation mode, such as a calling mode, a recording mode, and a speech recognition mode.
  • the received audio signal may be further stored in a memory or sent via a communication component.
  • the audio component further includes a speaker for outputting audio signals.
  • the embodiments of the present invention may be provided as methods, systems, or computer program products. Accordingly, the present invention can take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) having computer-usable program code embodied therein.
  • computer-usable storage media including but not limited to disk storage, CD-ROM, optical storage, etc.
  • These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing apparatus to operate in a specific manner, such that the instructions stored in the computer-readable memory produce an article of manufacture comprising instruction means, the instructions
  • the device realizes the function specified in one or more procedures of the flowchart and/or one or more blocks of the block diagram.
  • a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
  • processors CPUs
  • input/output interfaces network interfaces
  • memory volatile and non-volatile memory
  • Memory may include non-permanent storage in computer readable media, in the form of random access memory (RAM) and/or nonvolatile memory such as read-only memory (ROM) or flash RAM. Memory is an example of computer readable media.
  • RAM random access memory
  • ROM read-only memory
  • flash RAM flash random access memory
  • Computer-readable media including both permanent and non-permanent, removable and non-removable media, can be implemented by any method or technology for storage of information.
  • Information may be computer readable instructions, data structures, modules of a program, or other data.
  • Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read only memory (ROM), Electrically Erasable Programmable Read-Only Memory (EEPROM), Flash memory or other memory technology, Compact Disc Read-Only Memory (CD-ROM), Digital Versatile Disc (DVD) or other optical storage, Magnetic tape cartridge, tape magnetic disk storage or other magnetic storage device or any other non-transmission medium that can be used to store information that can be accessed by a computing device.
  • computer-readable media excludes transitory computer-readable media, such as modulated data signals and carrier waves.
  • the embodiments of the present application may be provided as methods, systems or computer program products. Accordingly, the present application can take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) having computer-usable program code embodied therein.
  • a computer-usable storage media including but not limited to disk storage, CD-ROM, optical storage, etc.

Abstract

Embodiments of the present application provide an alliance chain block generation method and apparatus, an electronic device, and a medium. In the embodiments of the present application, if any alliance chain node receive no transaction data in a current block generation period, an empty block is generated when the current block generation period elapses, and the empty block is broadcast to an alliance chain network, so that the empty block is added onto an alliance chain under the condition that the alliance chain network verifies that the generated empty block is valid. After the empty block is added onto the alliance chain, the number of empty blocks continuously present behind the last non-empty block on the alliance chain is counted. If there are a large number of empty blocks continuously present behind the last non-empty block on the alliance chain, in a case that no transaction data is received in a next block generation period, generation of a new empty block is forbidden when the next block generation period elapses. Therefore, the waste of computing power in generation of a large number of empty blocks is reduced, the storage space is saved, and the number of empty blocks on the alliance chain is efficiently and securely controlled.

Description

联盟链出块方法、装置、电子设备及介质Method, device, electronic equipment and medium for consortium chain block production
交叉引用cross reference
本申请引用于2021年12月15日递交的名称为“联盟链出块方法、装置、电子设备及介质”的第2021115375927号中国专利申请,其通过引用被全部并入本申请。This application refers to the Chinese patent application No. 2021115375927, which was submitted on December 15, 2021, entitled "Consortium Chain Block Generation Method, Device, Electronic Equipment, and Medium", which is fully incorporated by reference into this application.
技术领域technical field
本申请涉及区块链技术领域,尤其涉及一种联盟链出块方法、装置、电子设备及介质。The present application relates to the technical field of blockchain, in particular to a method, device, electronic equipment and medium for consortium chain block generation.
背景技术Background technique
区块链技术是利用块链式数据结构来验证与存储数据、利用分布式节点共识算法来生成和更新数据、利用密码学的方式保证数据传输和访问的安全、利用由自动化脚本代码组成的智能合约来编程和操作数据的一种全新的分布式基础架构与计算范式。Blockchain technology uses block chain data structure to verify and store data, uses distributed node consensus algorithm to generate and update data, uses cryptography to ensure the security of data transmission and access, and utilizes intelligence composed of automated script codes. A new distributed infrastructure and computing paradigm that uses contracts to program and manipulate data.
目前,基于区块链的安全特性,联盟链的形式在各个企业和组织中的应用越来越广泛。在联盟链中为了提高交易执行的效率及吞吐量,通常会降低区块链的出块周期,出块周期例如为1秒,也即每隔1秒出一个区块。但是,在实际场景中,联盟链中的交易量并不是特别大,或者交易时间比较固定,因此会导致产生大量的空区块,而产生大量空区块不仅会浪费算力,也会浪费大量的存储空间。At present, based on the security features of blockchain, the form of alliance chain is more and more widely used in various enterprises and organizations. In order to improve the efficiency and throughput of transaction execution in the consortium chain, the block generation cycle of the blockchain is usually reduced. The block generation cycle is, for example, 1 second, that is, a block is generated every 1 second. However, in actual scenarios, the transaction volume in the consortium chain is not particularly large, or the transaction time is relatively fixed, so a large number of empty blocks will be generated, and the generation of a large number of empty blocks will not only waste computing power, but also waste a lot of storage space.
发明内容Contents of the invention
本申请的多个方面提供一种联盟链出块方法、装置、电子设备及介质,用以减少生成大量的空区块对算力的浪费,节约存储空间。Various aspects of the present application provide a method, device, electronic device and medium for consortium chain block generation, which are used to reduce the waste of computing power generated by generating a large number of empty blocks and save storage space.
本申请实施例提供一种联盟链出块方法,应用于联盟链网络中的第一联盟链节点,该方法包括:若第一联盟链节点在当前出块周期内未接收到交易数据,则在当前出块周期到达时,生成空区块,并将空区块广播至联盟链网络中,以供联盟链网络中的各联盟链节点验证空区块的有效性并在空区块有效时将空区块加入至联盟链中;在空区块被加入至联盟链的情况下,获取联盟链上最后一个非空区块后面连续出现的空区块的数量,作为第一数量;若第一数量等于预设数量阈值,且在下一个出块周期内未收到交易数据,则在下一个出块周期到达时禁止生成新的空区块。The embodiment of the present application provides a method for generating a block of a consortium chain, which is applied to the first consortium chain node in the consortium chain network. When the current block generation period arrives, generate an empty block and broadcast the empty block to the alliance chain network for each alliance chain node in the alliance chain network to verify the validity of the empty block and send the empty block when the empty block is valid The empty block is added to the alliance chain; when the empty block is added to the alliance chain, the number of empty blocks that appear consecutively after the last non-empty block on the alliance chain is obtained as the first number; if the first If the quantity is equal to the preset quantity threshold, and no transaction data is received in the next block generation period, it is forbidden to generate new empty blocks when the next block generation period arrives.
本申请实施例还提供一种联盟链出块装置,包括:处理模块,用于若第一联盟链节点在当前出块周期内未接收到交易数据,则在当前出块周期到达时,生成空区块,并将空区块广播至联盟链网络中,以供联盟链网络中的各联盟链节点验证空区块的有效性并在空区块有效时将空区块加入至联盟链中;获取模块,用于在空区块被加入至联盟链的情况下,获取联盟链上最后一个非空区块后面连续出现的空区块的数量,作为第一数量;处理模块,还用于若第一数量等于预设数量阈值,且在下一个出块周期内未收到交易数据,则在下一个出块周期到达时禁止生成新的空区块。The embodiment of the present application also provides a consortium chain block generation device, including: a processing module, used to generate an empty block when the current block generation period arrives if the first consortium chain node does not receive transaction data within the current block generation period. block, and broadcast the empty block to the alliance chain network for each alliance chain node in the alliance chain network to verify the validity of the empty block and add the empty block to the alliance chain when the empty block is valid; The acquisition module is used to obtain the number of empty blocks that appear consecutively after the last non-empty block on the alliance chain when the empty block is added to the alliance chain, as the first number; the processing module is also used if The first number is equal to the preset number threshold, and no transaction data is received within the next block generation cycle, then the generation of new empty blocks is prohibited when the next block generation cycle arrives.
本申请实施例还提供一种电子设备,包括:存储器和处理器;存储器,用于存储计算机程序;处理器耦合至存储器,用于执行计算机程序以用于执行联盟链出块方法。The embodiment of the present application also provides an electronic device, including: a memory and a processor; the memory is used to store a computer program; the processor is coupled to the memory, and is used to execute the computer program to execute the consortium chain block generation method.
本申请实施例还提供一种存储有计算机程序的计算机可读存储介质,当计算机程序被处理器执行时,致使处理器实现联盟链出块方法。The embodiment of the present application also provides a computer-readable storage medium storing a computer program, and when the computer program is executed by a processor, the processor is caused to realize the consortium chain block generation method.
在本申请实施例中,任一联盟链节点在当前出块周期内未接收到交易数据,则在当前出块周期到达时,生成空区块,并将空区块广播至联盟链网络中,以在联盟链网络验证所生成的空区块有效的情况下,将空区块加入至联盟链上。在空区块加入至联盟链上后,对联盟链上最后一个非空区块后面连续出现的空区块的数量进行统计。若联盟链上最后一个非空区块后面连续出现的空区块的数量较多,且在下一个出块周期内未收到交易数据的情况下, 则在下一个出块周期到达时禁止生成新的空区块。由此,既在联盟链上生成空区块,以保证联盟链的安全性,又对联盟链上连续出现的空区块的数量进行限制,限制空区块高频生成,进而减少生成大量的空区块对算力的浪费,节约存储空间,实现了高效安全地控制联盟链上的空区块的数量。In the embodiment of this application, if any consortium chain node does not receive transaction data within the current block generation cycle, it will generate an empty block when the current block generation cycle arrives, and broadcast the empty block to the consortium chain network, In order to add the empty block to the alliance chain when the alliance chain network verifies that the generated empty block is valid. After the empty block is added to the consortium chain, count the number of consecutive empty blocks that appear after the last non-empty block on the consortium chain. If the number of empty blocks that appear consecutively after the last non-empty block on the consortium chain is large, and no transaction data is received in the next block generation cycle, it is forbidden to generate new blocks when the next block generation cycle arrives. Empty block. As a result, empty blocks are generated on the consortium chain to ensure the security of the consortium chain, and the number of consecutive empty blocks appearing on the consortium chain is limited to limit the high-frequency generation of empty blocks, thereby reducing the generation of a large number of Empty blocks waste computing power, save storage space, and realize efficient and safe control of the number of empty blocks on the alliance chain.
附图说明Description of drawings
此处所说明的附图用来提供对本申请的进一步理解,构成本申请的一部分,本申请的示意性实施例及其说明用于解释本申请,并不构成对本申请的不当限定。在附图中:The drawings described here are used to provide a further understanding of the application and constitute a part of the application. The schematic embodiments and descriptions of the application are used to explain the application and do not constitute an improper limitation to the application. In the attached picture:
图1为本申请一示例性实施例提供的一种联盟链网络的架构图;Fig. 1 is an architecture diagram of a consortium chain network provided by an exemplary embodiment of the present application;
图2为本申请一示例性实施例提供的一种联盟链出块方法的流程示意图;Fig. 2 is a schematic flow diagram of a method for producing blocks in an alliance chain provided by an exemplary embodiment of the present application;
图3为本申请一示例性实施例提供的联盟链出块方法所适用的一种应用场景图;Fig. 3 is a diagram of an application scenario applicable to the alliance chain block generation method provided by an exemplary embodiment of the present application;
图4为本申请一示例性实施例提供的联盟链出块方法所适用的另一种应用场景图;Fig. 4 is another application scenario diagram applicable to the consortium chain block generation method provided by an exemplary embodiment of the present application;
图5为本申请一示例性实施例提供的一种联盟链出块装置的结构示意图;Fig. 5 is a schematic structural diagram of a consortium chain block generation device provided by an exemplary embodiment of the present application;
图6为本申请一示例性实施例提供的一种电子设备的结构示意图。Fig. 6 is a schematic structural diagram of an electronic device provided by an exemplary embodiment of the present application.
具体实施方式Detailed ways
为使本申请的目的、技术方案和优点更加清楚,下面将结合本申请具体实施例及相应的附图对本申请技术方案进行清楚、完整地描述。显然,所描述的实施例仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。In order to make the purpose, technical solution and advantages of the present application clearer, the technical solution of the present application will be clearly and completely described below in conjunction with specific embodiments of the present application and corresponding drawings. Apparently, the described embodiments are only some of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in this application, all other embodiments obtained by persons of ordinary skill in the art without making creative efforts belong to the scope of protection of this application.
目前,联盟链中的交易量并不是特别大,或者交易时间比较固定,因此会导致产生大量的空区块,而产生大量空区块不仅会浪费算力,也会浪费大 量的存储空间。针对上述技术问题,本申请实施例提供一种联盟链出块方法、装置、电子设备及介质,在本申请实施例中,任一联盟链节点在当前出块周期内未接收到交易数据,则在当前出块周期到达时,生成空区块,并将空区块广播至联盟链网络中,以在联盟链网络验证所生成的空区块有效的情况下,将空区块加入至联盟链上。在空区块加入至联盟链上后,对联盟链上最后一个非空区块后面连续出现的空区块的数量进行统计。若联盟链上最后一个非空区块后面连续出现的空区块的数量较多,且在下一个出块周期内未收到交易数据的情况下,则在下一个出块周期到达时禁止生成新的空区块。由此,既在联盟链上生成空区块,以保证联盟链的安全性,又对联盟链上连续出现的空区块的数量进行限制,限制空区块高频生成,进而减少生成大量的空区块对算力的浪费,节约存储空间,实现了高效安全地控制联盟链上的空区块的数量。At present, the transaction volume in the alliance chain is not particularly large, or the transaction time is relatively fixed, so a large number of empty blocks will be generated, and the generation of a large number of empty blocks will not only waste computing power, but also waste a lot of storage space. In view of the above technical problems, the embodiment of this application provides a method, device, electronic equipment and medium for consortium chain block generation. In the embodiment of this application, if any consortium chain node does not receive transaction data within the current block generation cycle, then When the current block generation period arrives, generate an empty block and broadcast the empty block to the alliance chain network, so that the empty block can be added to the alliance chain when the alliance chain network verifies that the generated empty block is valid superior. After the empty block is added to the consortium chain, count the number of consecutive empty blocks that appear after the last non-empty block on the consortium chain. If the number of empty blocks that appear consecutively after the last non-empty block on the consortium chain is large, and no transaction data is received in the next block generation cycle, it is forbidden to generate new blocks when the next block generation cycle arrives. Empty block. As a result, empty blocks are generated on the consortium chain to ensure the security of the consortium chain, and the number of consecutive empty blocks appearing on the consortium chain is limited to limit the high-frequency generation of empty blocks, thereby reducing the generation of a large number of Empty blocks waste computing power, save storage space, and realize efficient and safe control of the number of empty blocks on the alliance chain.
图1为本申请一示例性实施例提供的一种联盟链网络的架构图。如图1所示,该联盟链网络可以包括多个联盟链节点10,各联盟链节点10共同形成联盟链网络。其中,联盟链节点10可以是终端设备20或服务器,各联盟链节点10在联盟链网络中的地位对等,各联盟链节点10共同维护一条联盟链30。Fig. 1 is an architecture diagram of a consortium chain network provided by an exemplary embodiment of the present application. As shown in FIG. 1 , the consortium chain network may include a plurality of consortium chain nodes 10, and all consortium chain nodes 10 jointly form a consortium chain network. Among them, the alliance chain node 10 can be a terminal device 20 or a server, and the status of each alliance chain node 10 in the alliance chain network is equal, and each alliance chain node 10 jointly maintains an alliance chain 30 .
在实际应用中,联盟用户40可以通过终端设备20向联盟链网络中的联盟链节点10发起交易请求,提交交易数据,该联盟链节点10对交易数据进行相应的数据处理,比如请求其他联盟链节点10对交易数据进行共识处理、生成区块、上链存储等等。In practical applications, the alliance user 40 can initiate a transaction request to the alliance chain node 10 in the alliance chain network through the terminal device 20, and submit the transaction data. The alliance chain node 10 performs corresponding data processing on the transaction data, such as requesting other alliance chain Nodes 10 perform consensus processing on transaction data, generate blocks, store on chain, and so on.
其中,联盟用户40包括但不限于共同参与管理联盟链30的机构用户、企业用户或者个人用户等。Among them, the alliance users 40 include but are not limited to institutional users, enterprise users or individual users who jointly participate in the management of the alliance chain 30 .
其中,终端设备可以是硬件也可以是软件。当终端设备为硬件时,终端设备例如为手机、平板电脑、台式计算机、可穿戴式智能设备、智能家居设备等。当终端设备为软件时,其可以安装在上述列举的硬件设备中,此时,终端设备例如为多个软件模块或单个软件模块等,本申请实施例并不限制。 服务器可以是硬件也可以是软件。当服务器为硬件时,该服务器为单个服务器或多个服务器组成的分布式服务器集群。当服务器为软件时,可以为多个软件模块或单个软件模块等,本申请实施例并不限制。Wherein, the terminal device may be hardware or software. When the terminal device is hardware, the terminal device is, for example, a mobile phone, a tablet computer, a desktop computer, a wearable smart device, a smart home device, and the like. When the terminal device is software, it can be installed in the hardware devices listed above. In this case, the terminal device is, for example, multiple software modules or a single software module, which is not limited in this embodiment of the present application. Servers can be hardware or software. When the server is hardware, the server is a single server or a distributed server cluster composed of multiple servers. When the server is software, it may be multiple software modules or a single software module, which is not limited in this embodiment of the present application.
应当理解的是,图1中的联盟链节点10、终端设备20和联盟用户40的数量仅仅是示意性的。实际应用中,根据实际需求部署任意数量的联盟链节点10、终端设备20和联盟用户40。It should be understood that the numbers of consortium chain nodes 10 , terminal devices 20 and consortium users 40 in FIG. 1 are only illustrative. In practical applications, any number of alliance chain nodes 10, terminal devices 20 and alliance users 40 are deployed according to actual needs.
以下结合附图,详细说明本申请各实施例提供的技术方案。The technical solutions provided by various embodiments of the present application will be described in detail below in conjunction with the accompanying drawings.
图2为本申请一示例性实施例提供的一种联盟链出块方法的流程示意图。参见图2,该方法可以包括以下步骤:Fig. 2 is a schematic flow chart of a method for generating blocks in an alliance chain provided by an exemplary embodiment of the present application. Referring to Figure 2, the method may include the following steps:
201、若第一联盟链节点在当前出块周期内未接收到交易数据,则在当前出块周期到达时,生成空区块。201. If the first consortium chain node does not receive transaction data within the current block generation cycle, generate an empty block when the current block generation cycle arrives.
202、将空区块广播至联盟链网络中,以供联盟链网络中的各联盟链节点验证空区块的有效性并在空区块有效时将空区块加入至联盟链中。202. Broadcast the empty block to the alliance chain network, so that each alliance chain node in the alliance chain network can verify the validity of the empty block and add the empty block to the alliance chain when the empty block is valid.
203、在空区块被加入至联盟链的情况下,获取联盟链上最后一个非空区块后面连续出现的空区块的数量,作为第一数量。203. In the case that an empty block is added to the consortium chain, acquire the number of consecutive empty blocks appearing after the last non-empty block on the consortium chain as the first number.
204、若第一数量等于预设数量阈值,且在下一个出块周期内未收到交易数据,则在下一个出块周期到达时禁止生成新的空区块。204. If the first quantity is equal to the preset quantity threshold and no transaction data is received within the next block production period, prohibit generating new empty blocks when the next block production period arrives.
本实施例提供的联盟链出块方法可以由联盟链网络中的任一联盟链节点10执行,为了便于理解和区分,将该任一联盟链节点10称作为第一联盟链节点。The consortium chain block generation method provided in this embodiment can be executed by any consortium chain node 10 in the consortium chain network. For ease of understanding and distinction, any consortium chain node 10 is referred to as the first consortium chain node.
实际应用中,联盟链网络可以根据实际应用需求设置出块周期,例如出块周期为1秒。第一联盟链节点若在当前出块周期内接收到交易数据,则在当前出块周期到达时,对交易数据进行打包以生成非空区块,并广播至联盟链网络中,以供联盟链网络中的各联盟链节点10验证非空区块的有效性并在非空区块有效时将非空区块加入至联盟链30中。第一联盟链节点若在当前出块周期内未接收到交易数据,则在当前出块周期到达时,生成空区块,并广播至联盟链网络中,以供联盟链网络中的各联盟链30节点验证空区块的有效 性并在空区块有效时将空区块加入至联盟链30中。In practical applications, the alliance chain network can set the block generation cycle according to the actual application requirements, for example, the block generation cycle is 1 second. If the first consortium chain node receives transaction data within the current block generation cycle, it will package the transaction data to generate a non-empty block when the current block generation cycle arrives, and broadcast it to the consortium chain network for the consortium chain Each alliance chain node 10 in the network verifies the validity of the non-empty block and adds the non-empty block to the alliance chain 30 when the non-empty block is valid. If the first alliance chain node does not receive transaction data within the current block generation cycle, it will generate an empty block when the current block generation cycle arrives, and broadcast it to the alliance chain network for all alliance chains in the alliance chain network The 30 nodes verify the validity of the empty block and add the empty block to the alliance chain 30 when the empty block is valid.
值得注意的是,本申请实施例对联盟链网络中的各联盟链30节点验证空区块的有效性的方式不做限制。实际应用中,各联盟链30节点均有可能在生成空区块,并广播至联盟链网络中。作为一种示例,各联盟链30节点基于共识协议将难度值最大的空区块作为有效的空区块并将该有效的空区块加入至联盟链30中,也即将有效的空区块进行上链。其中,空区块中记录有对应的难度值。It is worth noting that the embodiment of the present application does not limit the way each consortium chain 30 nodes in the consortium chain network verify the validity of empty blocks. In practical applications, each alliance chain 30 nodes may generate empty blocks and broadcast them to the alliance chain network. As an example, each alliance chain 30 node takes the empty block with the highest difficulty value as an effective empty block based on the consensus protocol and adds the effective empty block to the alliance chain 30, that is, the effective empty block is processed. winding. Among them, the corresponding difficulty value is recorded in the empty block.
值得注意的是,非空区块是在接收到联盟用户40提交的交易数据情况下基于交易数据生成区块,空区块是在未接收到联盟用户40提交的交易数据的情况下生成的不包括交易数据的区块。It is worth noting that a non-empty block is generated based on the transaction data when the transaction data submitted by the alliance user 40 is received, and an empty block is generated when the transaction data submitted by the alliance user 40 is not received. A block containing transaction data.
在本实施例中,既在联盟链30上生成空区块,以保证联盟链30的安全性,又对联盟链30上连续出现的空区块的数量进行限制,限制空区块高频生成,进而减少生成大量的空区块对算力的浪费,节约存储空间。于是,可以理解的是,即使在低频交易场景,随着时间推移,联盟链30上最后一个非空区块后面连续出现的空区块的数量也不会很多。另外,限制联盟链30上连续出现的空区块的数量,并不影响联盟链30可以设置较小的出块周期,以保证联盟链30具有较高的交易执行效率和吞吐量。In this embodiment, empty blocks are generated on the consortium chain 30 to ensure the security of the consortium chain 30, and the number of consecutive empty blocks on the consortium chain 30 is limited to limit the high-frequency generation of empty blocks , thereby reducing the waste of computing power generated by generating a large number of empty blocks and saving storage space. Therefore, it is understandable that even in low-frequency transaction scenarios, as time goes by, the number of empty blocks that appear consecutively after the last non-empty block on the consortium chain 30 will not be many. In addition, limiting the number of consecutive empty blocks on the consortium chain 30 does not affect the consortium chain 30 can set a smaller block generation period to ensure that the consortium chain 30 has higher transaction execution efficiency and throughput.
基于上述,在将空区块加入至联盟链30之后,统计联盟链30上最后一个非空区块后面连续出现的空区块的数量。为了便于理解和区分,将联盟链30上最后一个非空区块后面连续出现的空区块的数量作为第一数量。若该第一数量小于或等于预设数量阈值,说明联盟链30上最后一个非空区块后面连续出现的空区块的数量较少,在下一个出块周期内未收到交易数据的情况下,则在下一个出块周期到达时继续生成新的空区块。若第一数量等于预设数量阈值,则控制联盟链网络中的各个联盟链节点10在下一个出块周期内未收到交易数据的情况下,则在下一个出块周期到达时禁止生成新的空区块。当然,联盟链网络中的各个联盟链节点10在下一个出块周期内收到交易数据的情况下,则在下一个出块周期到达时基于交易数据生成新的非空区块。由此,控 制联盟链30上最后一个非空区块后面连续出现的空区块的数量不超过预设数量阈值。其中,预设数量阈值是根据实际应用需求设置的。Based on the above, after the empty block is added to the consortium chain 30, the number of consecutive empty blocks appearing after the last non-empty block on the consortium chain 30 is counted. In order to facilitate understanding and distinction, the number of empty blocks that appear consecutively after the last non-empty block on the consortium chain 30 is taken as the first number. If the first number is less than or equal to the preset number threshold, it means that the number of empty blocks that appear consecutively after the last non-empty block on the consortium chain 30 is small, and if no transaction data is received in the next block generation cycle , then continue to generate new empty blocks when the next block generation cycle arrives. If the first quantity is equal to the preset quantity threshold, then if each consortium chain node 10 in the consortium chain network does not receive transaction data in the next block generation cycle, it is forbidden to generate new empty blocks when the next block generation cycle arrives. blocks. Of course, when each alliance chain node 10 in the alliance chain network receives transaction data in the next block generation cycle, it will generate a new non-empty block based on the transaction data when the next block generation cycle arrives. Thus, the number of consecutive empty blocks appearing after the last non-empty block on the control consortium chain 30 does not exceed the preset number threshold. Wherein, the preset quantity threshold is set according to actual application requirements.
可以理解的是,即使在低频交易场景,联盟链网络长时间未收到联盟用户40提交的交易数据,也不会无限制地在联盟链30上生成空区块,而是联盟链30上最后一个非空区块后面连续出现的空区块的数量至多为预设数量阈值。It is understandable that even in a low-frequency transaction scenario, if the alliance chain network has not received the transaction data submitted by the alliance user 40 for a long time, it will not generate empty blocks on the alliance chain 30 without limit, but the last block on the alliance chain 30 The number of consecutive empty blocks following a non-empty block is at most a preset number threshold.
为了便于理解,结合图3进行说明。假设出块周期为1秒钟,限制联盟链30上最多连续出现6个空区块。在2021-12-11的13:00时间,一个联盟链节点10接收到联盟用户40提交的交易数据Tx0和交易数据Tx1,并向联盟链网络进行广播,联盟链网络将有效的包括交易数据Tx0和交易数据Tx1的非空区块加入至联盟链30上。在一小时内,整个联盟链网络没有接收到联盟用户40提交的新的交易数据。在这一小时内,每隔1秒钟生成一个空区块,并加入至联盟链30上,直至在联盟链30上连续加入6个空区块,此时,各个联盟链节点10停止生成空区块以及在联盟链30上继续加入新的空区块。在2021-12-11的14:00时间,另一个联盟链节点10接收到交易数据Tx2,并向联盟链网络进行广播,联盟链网络将有效的包括交易数据Tx2的非空区块加入至联盟链30上。由此可知,在1小时内联盟用户40只提交两次交易请求的低频交易场景下,尽管出块周期是1秒钟,但是,也仅仅在联盟链30上生成了6个空区块,大大地减少了空区块的生成数量,节约了算力和存储空间。For ease of understanding, description will be made in conjunction with FIG. 3 . Assuming that the block generation period is 1 second, the consortium chain 30 is limited to a maximum of 6 consecutive empty blocks. At 13:00 on December 11, 2021, an alliance chain node 10 receives the transaction data Tx0 and transaction data Tx1 submitted by the alliance user 40, and broadcasts to the alliance chain network, and the alliance chain network will effectively include the transaction data Tx0 and the non-empty blocks of the transaction data Tx1 are added to the alliance chain 30. Within one hour, the entire consortium chain network did not receive new transaction data submitted by consortium user 40. During this hour, an empty block is generated every 1 second and added to the alliance chain 30 until six empty blocks are continuously added to the alliance chain 30. At this time, each alliance chain node 10 stops generating empty blocks. blocks and continue to add new empty blocks on the consortium chain 30. At 14:00 on December 11, 2021, another consortium chain node 10 receives the transaction data Tx2 and broadcasts it to the consortium chain network, and the consortium chain network will add valid non-empty blocks including transaction data Tx2 to the consortium Chain 30 on. It can be seen from this that in the low-frequency transaction scenario where alliance users 40 only submit two transaction requests within one hour, although the block generation period is 1 second, only 6 empty blocks are generated on the alliance chain 30, greatly It greatly reduces the number of generated empty blocks and saves computing power and storage space.
本申请实施例提供的联盟链出块方法,任一联盟链节点在当前出块周期内未接收到交易数据,则在当前出块周期到达时,生成空区块,并将空区块广播至联盟链网络中,以在联盟链网络验证所生成的空区块有效的情况下,将空区块加入至联盟链上。在空区块加入至联盟链上后,对联盟链上最后一个非空区块后面连续出现的空区块的数量进行统计。若联盟链上最后一个非空区块后面连续出现的空区块的数量较多,且在下一个出块周期内未收到交易数据的情况下,则在下一个出块周期到达时禁止生成新的空区块。由此, 既在联盟链上生成空区块,以保证联盟链的安全性,又对联盟链上连续出现的空区块的数量进行限制,限制空区块高频生成,进而减少生成大量的空区块对算力的浪费,节约存储空间,实现了高效安全地控制联盟链上的空区块的数量。In the alliance chain block generation method provided by the embodiment of this application, if any alliance chain node does not receive transaction data within the current block generation cycle, when the current block generation cycle arrives, an empty block is generated and the empty block is broadcast to In the consortium chain network, if the consortium chain network verifies that the generated empty block is valid, the empty block will be added to the consortium chain. After the empty block is added to the consortium chain, count the number of consecutive empty blocks that appear after the last non-empty block on the consortium chain. If the number of empty blocks that appear consecutively after the last non-empty block on the consortium chain is large, and no transaction data is received in the next block generation cycle, it is forbidden to generate new blocks when the next block generation cycle arrives. Empty block. As a result, empty blocks are generated on the consortium chain to ensure the security of the consortium chain, and the number of consecutive empty blocks on the consortium chain is limited to limit the high-frequency generation of empty blocks, thereby reducing the generation of a large number of Empty blocks waste computing power, save storage space, and realize efficient and safe control of the number of empty blocks on the alliance chain.
实际应用中,有些联盟业务的交易时间较为固定,例如,在一个工作日中仅有4个小时的交易时间段。于是,进一步可选的,为了高效安全地控制联盟链上的空区块的数量,对区块生成时间进行限制。基于此,在当前出块周期到达时,生成空区块的一种实施过程是:判断当前时间是否处于预设的交易时间段;若是,在当前出块周期到达时,生成空区块。若否,在当前出块周期到达时,拒绝生成空区块。In practical application, the transaction time of some affiliate businesses is relatively fixed, for example, there are only 4 hours of transaction time in a working day. Therefore, as a further option, in order to efficiently and safely control the number of empty blocks on the consortium chain, the block generation time is limited. Based on this, when the current block generation cycle arrives, an implementation process of generating an empty block is: to determine whether the current time is within the preset transaction time period; if so, when the current block generation cycle arrives, an empty block is generated. If not, when the current block generation period arrives, refuse to generate an empty block.
实际应用中,各个联盟链节点10的算力可能相同,也可能不同。应理解,算力越高,联盟链节点10的处理能力越大。进一步可选的,为了高效安全地控制联盟链30上的空区块的数量,可以选择算力较大的联盟链节点10生成空区块。基于此,在当前出块周期到达时,生成空区块的一种实施过程是:在出块周期到达时,第一联盟链节点判断自身当前算力是否大于或等于预设算力值;若是,则生成空区块。若否,在当前出块周期到达时,拒绝生成空区块。In practical applications, the computing power of each consortium chain node 10 may be the same or different. It should be understood that the higher the computing power, the greater the processing capability of the consortium chain node 10. Further optionally, in order to efficiently and safely control the number of empty blocks on the alliance chain 30, the alliance chain node 10 with larger computing power can be selected to generate empty blocks. Based on this, when the current block generation period arrives, an implementation process of generating an empty block is: when the block generation period arrives, the first consortium chain node judges whether its current computing power is greater than or equal to the preset computing power value; , an empty block is generated. If not, when the current block generation period arrives, refuse to generate an empty block.
实际应用中,参与空区块生成的联盟链节点10的算力越大,以及参与空区块生成的联盟链节点10的数量越多,越能够高效安全地控制联盟链30上的空区块的数量。于是,进一步可选的,在当前出块周期到达时,生成空区块一种实施过程是:在当前出块周期到达时,确定联盟链网络中当前算力不小于预设算力值的联盟链节点10及其数量,作为第二数量;若第二数量大于或等于指定数量,则从当前算力大于或等于预设算力值的联盟链节点10中选择指定数量个联盟链节点10,并向指定数量个联盟链节点10发送第一通知,以通知指定数量个联盟链节点10生成空区块。若第二数量小于指定数量,则将指定数量减去第二数量,得到第三数量,从当前算力小于预设算力值的联盟链节点10中选择第三数量个联盟链节点10;向第二数量个联盟链节点10 联盟链节点10和第三数量个联盟链节点10发送第二通知,以通知第二数量个联盟链节点10和第三数量个联盟链节点10生成空区块。In practical applications, the greater the computing power of the alliance chain nodes 10 participating in the generation of empty blocks, and the greater the number of alliance chain nodes 10 participating in the generation of empty blocks, the more efficiently and securely they can control the empty blocks on the alliance chain 30 quantity. Therefore, as a further option, when the current block generation period arrives, an implementation process of generating an empty block is: when the current block generation period arrives, determine the alliance whose current computing power is not less than the preset computing power value in the alliance chain network Chain nodes 10 and their number, as the second number; if the second number is greater than or equal to the specified number, select a specified number of alliance chain nodes 10 from the alliance chain nodes 10 whose current computing power is greater than or equal to the preset computing power value, And send the first notification to the specified number of alliance chain nodes 10 to notify the specified number of alliance chain nodes 10 to generate an empty block. If the second number is less than the specified number, then subtract the second number from the specified number to obtain the third number, and select the third number of alliance chain nodes 10 from the alliance chain nodes 10 whose current computing power is less than the preset computing power value; The second number of alliance chain nodes 10 and the third number of alliance chain nodes 10 send a second notification to notify the second number of alliance chain nodes 10 and the third number of alliance chain nodes 10 to generate an empty block.
其中,指定数量根据实际应用需求设置,要求参与生成空区块的联盟链节点10的数量达到指定数量,且选择算力高的联盟链节点10参与生成空区块,能够保证高效地在联盟链30上连续生成多个空区块。Among them, the specified number is set according to the actual application requirements. It is required that the number of alliance chain nodes 10 participating in the generation of empty blocks reaches the specified number, and the alliance chain nodes 10 with high computing power are selected to participate in the generation of empty blocks, which can ensure efficient block generation in the alliance chain. 30 consecutively generate multiple empty blocks.
值得注意的是,联盟链网络是去中心化的网络,联盟链网络中的各个联盟链节点10的地位对等。任一联盟链节点10都能够发送第一通知或第二通知,并在接收到第一通知或第二通知下执行空区块生成任务。也就是说,第一联盟链节点可以向第二联盟链节点10发送的第一通知或第二通知,或者第二联盟链节点10可以向第一联盟链节点发送的第一通知或第二通知。其中,第二联盟链节点10是联盟链网络中不包括第一联盟链节点的其他联盟链节点10。于是,在本申请的一些实施例中,第一联盟链节点在当前出块周期到达时,生成空区块的一种实施过程是接收联盟链网络中的第二联盟链节点10发送的第一通知或第二通知,并根据第一通知或第二通知,生成空区块;其中,第一通知是第二联盟链节点10在识别到联盟链网络中当前算力不小于预设算力值的联盟链节点10的数量大于或等于指定数量的情况下发送的,第二通知是第二联盟链节点10在识别到联盟链网络中当前算力小于预设算力值的联盟链节点10的数量小于指定数量的情况下发送的。It is worth noting that the alliance chain network is a decentralized network, and the status of each alliance chain node 10 in the alliance chain network is equal. Any consortium chain node 10 can send the first notification or the second notification, and execute the empty block generation task after receiving the first notification or the second notification. That is to say, the first notification or the second notification that the first consortium chain node can send to the second consortium chain node 10, or the first notification or the second notification that the second consortium chain node 10 can send to the first consortium chain node . Wherein, the second consortium chain node 10 is other consortium chain nodes 10 not including the first consortium chain node in the consortium chain network. Therefore, in some embodiments of the present application, when the first alliance chain node arrives at the current block generation period, an implementation process of generating an empty block is to receive the first block sent by the second alliance chain node 10 in the alliance chain network. notification or the second notification, and generate an empty block according to the first notification or the second notification; wherein, the first notification is that the second consortium chain node 10 recognizes that the current computing power in the consortium chain network is not less than the preset computing power value When the number of consortium chain nodes 10 is greater than or equal to the specified number, the second notification is that the second consortium chain node 10 recognizes that the consortium chain node 10 whose current computing power is less than the preset computing power value in the consortium chain network Sent if the quantity is less than the specified quantity.
进一步可选的,第一联盟链节点可以兼顾交易时间段和算力执行空区块生成任务。于是,作为一种示例,在当前出块周期到达时,生成空区块的一种实施过程是:判断当前时间是否处于预设的交易时间段;若当前时间是处于预设的交易时间段,在出块周期到达时,第一联盟链节点判断自身当前算力是否大于或等于预设算力值;若自身当前算力大于或等于预设算力值,则生成空区块。若当前时间不是处于预设的交易时间段,或者,当前时间处于预设的交易时间段且自身当前算力小于预设算力值,则在当前出块周期到达时,拒绝生成空区块。Further optionally, the first consortium chain node can perform the empty block generation task taking into account the transaction time period and computing power. Therefore, as an example, when the current block generation period arrives, an implementation process of generating an empty block is: to determine whether the current time is in the preset transaction time period; if the current time is in the preset transaction time period, When the block generation period arrives, the first consortium chain node judges whether its current computing power is greater than or equal to the preset computing power value; if its current computing power is greater than or equal to the preset computing power value, an empty block will be generated. If the current time is not in the preset transaction time period, or if the current time is in the preset transaction time period and its current computing power is less than the preset computing power value, it will refuse to generate an empty block when the current block generation period arrives.
进一步可选的,第一联盟链节点可以兼顾交易时间段、算力、和联盟链 节点10的数量执行空区块生成任务。于是,作为一种示例,在当前出块周期到达时,生成空区块的一种实施过程是:判断当前时间是否处于预设的交易时间段;若当前时间是处于预设的交易时间段,在出块周期到达时,确定联盟链网络中当前算力不小于预设算力值的联盟链节点10及其数量,作为第二数量;若第二数量大于或等于指定数量,则从当前算力大于或等于预设算力值的联盟链节点10中选择指定数量个联盟链节点10,并向指定数量个联盟链节点10发送第一通知,以通知指定数量个联盟链节点10生成空区块。若第二数量小于指定数量,则将指定数量减去第二数量,得到第三数量,从当前算力小于预设算力值的联盟链节点10中选择第三数量个联盟链节点10;向第二数量个联盟链节点10联盟链节点10和第三数量个联盟链节点10发送第二通知,以通知第二数量个联盟链节点10和第三数量个联盟链节点10生成空区块。若当前时间不是处于预设的交易时间段,则在当前出块周期到达时,拒绝生成空区块。Further optionally, the first consortium chain node can perform an empty block generation task taking into account the transaction period, computing power, and the number of consortium chain nodes 10. Therefore, as an example, when the current block generation period arrives, an implementation process of generating an empty block is: to determine whether the current time is in the preset transaction time period; if the current time is in the preset transaction time period, When the block generation period arrives, determine the alliance chain nodes 10 and their number whose current calculation power is not less than the preset calculation power value in the alliance chain network as the second number; if the second number is greater than or equal to the specified number, then start from the current calculation Select a specified number of alliance chain nodes 10 from the alliance chain nodes 10 whose force is greater than or equal to the preset computing power value, and send the first notification to the specified number of alliance chain nodes 10 to notify the specified number of alliance chain nodes 10 to generate an empty area piece. If the second number is less than the specified number, then subtract the second number from the specified number to obtain the third number, and select the third number of alliance chain nodes 10 from the alliance chain nodes 10 whose current computing power is less than the preset computing power value; The second number of alliance chain nodes 10 and the third number of alliance chain nodes 10 send a second notification to notify the second number of alliance chain nodes 10 and the third number of alliance chain nodes 10 to generate an empty block. If the current time is not in the preset transaction time period, when the current block generation period arrives, it will refuse to generate an empty block.
实际应用中,可能会存在恶意交易的情形或者私藏区块的情形。例如,出现单个联盟用户40私自发起交易生成区块并私藏区块以利于自身的情况,这种情况特别容易在不同组织之间的联盟链网络中出现。于是,在一些实施例中,为了减少出现单个联盟用户40私自发起交易生成区块并私藏区块的情形,联盟链网络会识别联盟用户40提交的交易数据是否经过多个联盟用户40的数字签名。经过多个联盟用户40数字签名的交易数据可以被打包到区块中,并具有上链至联盟链30的可能性。未经过多个联盟用户40数字签名的交易数据被联盟链网络丢弃,不会被打包至区块中。In practical applications, there may be situations of malicious transactions or private hiding of blocks. For example, a single alliance user 40 privately initiates a transaction to generate a block and hides the block for his own benefit. This situation is especially easy to appear in the alliance chain network between different organizations. Therefore, in some embodiments, in order to reduce the occurrence of a single alliance user 40 privately initiating a transaction to generate a block and privately hide the block, the alliance chain network will identify whether the transaction data submitted by the alliance user 40 has passed the number of multiple alliance users 40 sign. The transaction data digitally signed by multiple alliance users 40 can be packaged into a block, and has the possibility of being uploaded to the alliance chain 30 . Transaction data that has not been digitally signed by multiple alliance users 40 is discarded by the alliance chain network and will not be packaged into blocks.
于是,在一些实施例中,若第一联盟链节点在当前出块周期内接收到联盟链网络中其它联盟链节点10广播的第一交易数据或者在当前出块周期内接收到其对应的联盟用户40提交的第二交易数据时,判断第一交易数据或者第二交易数据是否经过多个联盟链30用户的签名处理;若第一交易数据或者第二交易数据经过多个联盟链30用户的签名处理,则根据第一交易数据或者第二交易数据生成非空区块,并将非空区块广播至联盟链网络中,以供联盟链 网络中的各联盟链节点10验证非空区块的有效性并在非空区块的有效时将非空区块加入至联盟链30中。Therefore, in some embodiments, if the first consortium chain node receives the first transaction data broadcast by other consortium chain nodes 10 in the consortium chain network during the current block generation cycle or receives its corresponding consortium chain node within the current block generation cycle When the user 40 submits the second transaction data, it is judged whether the first transaction data or the second transaction data has been signed by multiple alliance chain 30 users; Signature processing, then generate a non-empty block according to the first transaction data or the second transaction data, and broadcast the non-empty block to the alliance chain network for each alliance chain node 10 in the alliance chain network to verify the non-empty block validity and add the non-empty block to the consortium chain 30 when the non-empty block is valid.
实际应用中,任一联盟链节点10接收到其对应的联盟用户40提交的交易数据之后,还会向联盟链网络广播该交易数据,以供联盟链网络中的其他联盟链节点10继续基于该交易数据生成非空区块。In practical applications, after any consortium chain node 10 receives the transaction data submitted by its corresponding consortium user 40, it will also broadcast the transaction data to the consortium chain network for other consortium chain nodes 10 in the consortium chain network to continue based on the transaction data. Transaction data generates non-empty blocks.
进一步可选的,为了更好地减少出现单个联盟用户40私自发起交易生成区块并私藏区块的情形,将具有交易数据发送权限的联盟链节点10的节点标识加入至白名单中。任一联盟链节点10在向联盟链网络广播的交易数据时,会判断自身的节点标识是否在白名单中。若在白名单中,确定自身具有将交易数据向联盟链网络广播的权限,若不在白名单中,确定自身不具有将交易数据向联盟链网络广播的权限。Optionally, in order to better reduce the occurrence of a single alliance user 40 privately initiating a transaction to generate a block and hiding the block privately, the node identification of the alliance chain node 10 with transaction data sending authority is added to the white list. When any consortium chain node 10 broadcasts transaction data to the consortium chain network, it will judge whether its own node ID is in the white list. If it is in the white list, it is determined that it has the authority to broadcast the transaction data to the alliance chain network; if it is not in the white list, it is determined that it does not have the authority to broadcast the transaction data to the alliance chain network.
于是,在一些实施例中,若第一联盟链节点在当前出块周期内接收到其对应的联盟用户40提交的第二交易数据,确定第一联盟链节点的节点标识在预设白名单中,白名单中的节点标识对应的联盟链节点10具有交易数据发送权限;将第二交易数据广播至联盟链网络中,以供联盟链网络中的各联盟链节点10判断第二交易数据是否经过多个联盟链30用户的签名处理。Therefore, in some embodiments, if the first alliance chain node receives the second transaction data submitted by its corresponding alliance user 40 within the current block generation period, it is determined that the node identification of the first alliance chain node is in the preset white list , the alliance chain node 10 corresponding to the node identification in the whitelist has transaction data transmission authority; broadcast the second transaction data to the alliance chain network, so that each alliance chain node 10 in the alliance chain network can judge whether the second transaction data has passed Signature processing of multiple consortium chain 30 users.
值得注意的是,各联盟链节点10若判断出第二交易数据经过多个联盟链30用户的签名处理,则根据第二交易数据生成非空区块,并将非空区块广播至联盟链网络中,以供联盟链网络中的各联盟链节点10验证非空区块的有效性并在非空区块的有效时将非空区块加入至联盟链30中。It is worth noting that, if each consortium chain node 10 judges that the second transaction data has been signed by multiple consortium chain 30 users, it will generate a non-empty block according to the second transaction data, and broadcast the non-empty block to the consortium chain In the network, each alliance chain node 10 in the alliance chain network can verify the validity of the non-empty block and add the non-empty block to the alliance chain 30 when the non-empty block is valid.
为了便于理解,结合图4进行说明。假设出块周期为1秒钟,限制联盟链30上最多连续出现6个空区块。联盟用户A利用自身的身份信息对交易数据Tx0和Tx1分别进行数字签名,得到签名后的交易数据Tx0(S1),Tx1(S1)。同时该联盟用户A请求联盟用户B继续对交易数据Tx0(S1)进行数字签名,联盟用户B利用自身的身份信息对Tx0(S1)进行数字签名,得到签名后的交易数据Tx0(S1,S2)。在2021-12-11的13:00时间,联盟用户A向其对应的联盟链节点10提供交易数据Tx0(S1,S2)和交易数据Tx1(S1),联盟用 户A对应的联盟链节点10识别出Tx0(S1,S2)经过多个联盟用户40的数字签名,并根据Tx0(S1,S2)生成非空区块,若该非空区块被联盟网络验证有效,该非空区块被加入至联盟链30上。联盟用户A对应的联盟链节点10识别出交易数据Tx1(S1)未经过多个联盟用户40的数字签名,则丢弃该交易数据Tx1(S1),此时,交易数据Tx1(S1)不会被打包至区块中。在一小时内,整个联盟链网络没有接收到联盟用户40提交的新的交易数据。在这一小时内,每隔1秒钟生成一个空区块,并加入至联盟链30上,直至在联盟链30上连续加入6个空区块,此时,各个联盟链节点10停止生成空区块以及在联盟链30上继续加入新的空区块。在2021-12-11的14:00时间,另一个联盟链节点10接收到联盟用户40B提交的交易数据Tx2(S1,S2),另一个联盟链节点10验证联盟用户B提交的交易数据Tx2(S1,S2)经过多个联盟用户40的数字签名,并根据Tx2(S1,S2)生成非空区块,若该非空区块被联盟网络验证有效,该非空区块被加入至联盟链30上。For ease of understanding, description will be made in conjunction with FIG. 4 . Assuming that the block generation period is 1 second, the consortium chain 30 is limited to a maximum of 6 consecutive empty blocks. Alliance user A digitally signs the transaction data Tx0 and Tx1 with its own identity information, and obtains the signed transaction data Tx0(S1), Tx1(S1). At the same time, the alliance user A requests the alliance user B to continue to digitally sign the transaction data Tx0(S1), and the alliance user B uses its own identity information to digitally sign Tx0(S1) to obtain the signed transaction data Tx0(S1, S2) . At 13:00 on December 11, 2021, alliance user A provides transaction data Tx0 (S1, S2) and transaction data Tx1 (S1) to its corresponding alliance chain node 10, and the alliance chain node 10 corresponding to alliance user A identifies Tx0 (S1, S2) is digitally signed by multiple alliance users 40, and a non-empty block is generated according to Tx0 (S1, S2). If the non-empty block is verified to be valid by the alliance network, the non-empty block will be added To the alliance chain 30. The alliance chain node 10 corresponding to the alliance user A recognizes that the transaction data Tx1(S1) has not been digitally signed by multiple alliance users 40, and then discards the transaction data Tx1(S1). At this time, the transaction data Tx1(S1) will not be packed into blocks. Within one hour, the entire consortium chain network did not receive new transaction data submitted by consortium user 40. During this hour, an empty block is generated every 1 second and added to the alliance chain 30 until six empty blocks are continuously added to the alliance chain 30. At this time, each alliance chain node 10 stops generating empty blocks. blocks and continue to add new empty blocks on the consortium chain 30. At 14:00 on December 11, 2021, another consortium chain node 10 receives the transaction data Tx2 (S1, S2) submitted by consortium user 40B, and another consortium chain node 10 verifies the transaction data Tx2 (S1, S2) submitted by consortium user B ( S1, S2) are digitally signed by multiple alliance users 40, and a non-empty block is generated according to Tx2 (S1, S2). If the non-empty block is verified to be valid by the alliance network, the non-empty block is added to the alliance chain 30 on.
值得说明的是,即使任一联盟链节点10将未经过多个联盟用户40签名的数据打包进区块,得到非空区块。在该非空区块广播至联盟链网络时,联盟链网络可以继续验证该非空区块记录的交易数据是否经过多个联盟用户40签名。若非空区块记录的交易数据没有经过多个联盟用户40签名,则联盟链网络确认该非空区块为无效区块,该非空区块仍然不能加入至联盟链30上。若非空区块记录的交易数据是经过多个联盟用户40签名,则该非空区块具有加入至联盟链30上的可能性。It is worth noting that even if any consortium chain node 10 packs data that has not been signed by multiple consortium users 40 into a block, a non-empty block is obtained. When the non-empty block is broadcast to the alliance chain network, the alliance chain network can continue to verify whether the transaction data recorded in the non-empty block has been signed by multiple alliance users 40 . If the transaction data recorded in the non-empty block has not been signed by multiple alliance users 40, the alliance chain network will confirm that the non-empty block is an invalid block, and the non-empty block still cannot be added to the alliance chain 30. If the transaction data recorded in the non-empty block is signed by multiple alliance users 40, then the non-empty block has the possibility of being added to the alliance chain 30.
需要说明的是,上述实施例所提供方法的各步骤的执行主体均可以是同一设备,或者,该方法也由不同设备作为执行主体。比如,步骤201至步骤203的执行主体可以为设备A;又比如,步骤201和202的执行主体可以为设备A,步骤203的执行主体可以为设备B;等等。It should be noted that the subject of execution of each step of the method provided in the foregoing embodiments may be the same device, or the method may also be executed by different devices. For example, the execution subject of steps 201 to 203 may be device A; for another example, the execution subject of steps 201 and 202 may be device A, and the execution subject of step 203 may be device B; and so on.
另外,在上述实施例及附图中的描述的一些流程中,包含了按照特定顺序出现的多个操作,但是应该清楚了解,这些操作可以不按照其在本文中出现的顺序来执行或并行执行,操作的序号如201、202等,仅仅是用于区分开 各个不同的操作,序号本身不代表任何的执行顺序。另外,这些流程可以包括更多或更少的操作,并且这些操作可以按顺序执行或并行执行。需要说明的是,本文中的“第一”、“第二”等描述,是用于区分不同的消息、设备、模块等,不代表先后顺序,也不限定“第一”和“第二”是不同的类型。In addition, in some of the processes described in the above embodiments and accompanying drawings, multiple operations appearing in a specific order are included, but it should be clearly understood that these operations may not be executed in the order in which they appear herein or executed in parallel , the serial numbers of the operations, such as 201, 202, etc., are only used to distinguish different operations, and the serial numbers themselves do not represent any execution order. Additionally, these processes can include more or fewer operations, and these operations can be performed sequentially or in parallel. It should be noted that the descriptions of "first" and "second" in this article are used to distinguish different messages, devices, modules, etc. are different types.
图5为本申请一示例性实施例提供的一种联盟链出块装置的结构示意图。如图5所示,该装置包括:处理模块51和获取模块52。Fig. 5 is a schematic structural diagram of a consortium chain block generation device provided by an exemplary embodiment of the present application. As shown in FIG. 5 , the device includes: a processing module 51 and an obtaining module 52 .
处理模块51,用于若第一联盟链节点在当前出块周期内未接收到交易数据,则在当前出块周期到达时,生成空区块,并将空区块广播至联盟链网络中,以供联盟链网络中的各联盟链节点验证空区块的有效性并在空区块有效时将空区块加入至联盟链中。The processing module 51 is used to generate an empty block and broadcast the empty block to the alliance chain network if the first alliance chain node does not receive transaction data within the current block generation cycle, when the current block generation cycle arrives, For each alliance chain node in the alliance chain network to verify the validity of the empty block and add the empty block to the alliance chain when the empty block is valid.
获取模块52,用于在空区块被加入至联盟链的情况下,获取联盟链上最后一个非空区块后面连续出现的空区块的数量,作为第一数量。The acquiring module 52 is configured to acquire the number of consecutive empty blocks appearing after the last non-empty block on the alliance chain as the first number when the empty block is added to the alliance chain.
处理模块51,还用于若第一数量等于预设数量阈值,且在下一个出块周期内未收到交易数据,则在下一个出块周期到达时禁止生成新的空区块。The processing module 51 is further configured to prohibit the generation of new empty blocks when the next block generation cycle arrives if the first amount is equal to the preset amount threshold and no transaction data is received within the next block generation cycle.
进一步可选的,处理模块51在当前出块周期到达时,生成空区块时,具体用于:判断当前时间是否处于预设的交易时间段;若是,在当前出块周期到达时,生成空区块。Further optionally, when the processing module 51 generates an empty block when the current block generation period arrives, it is specifically used to: determine whether the current time is in the preset transaction time period; if so, generate an empty block when the current block generation period arrives. blocks.
进一步可选的,处理模块51在当前出块周期到达时,生成空区块时,具体用于:在出块周期到达时,第一联盟链节点判断自身当前算力是否大于或等于预设算力值;若是,则生成空区块。Further optionally, when the processing module 51 generates an empty block when the current block generation cycle arrives, it is specifically used for: when the block generation cycle arrives, the first consortium chain node judges whether its current computing power is greater than or equal to the pre-calculated Force value; if so, an empty block is generated.
进一步可选的,处理模块51在当前出块周期到达时,生成空区块时,具体用于:在当前出块周期到达时,确定联盟链网络中当前算力不小于预设算力值的联盟链节点及其数量,作为第二数量;若第二数量大于或等于指定数量,则从当前算力大于或等于预设算力值的联盟链节点中选择指定数量个联盟链节点,并向指定数量个联盟链节点发送第一通知,以通知指定数量个联盟链节点生成空区块。Further optionally, when the processing module 51 generates an empty block when the current block generation cycle arrives, it is specifically used to: determine that the current computing power in the consortium chain network is not less than the preset computing power value when the current block generation cycle arrives. Consortium chain nodes and their number are used as the second number; if the second number is greater than or equal to the specified number, select the specified number of alliance chain nodes from the alliance chain nodes whose current computing power is greater than or equal to the preset computing power value, and send to The specified number of consortium chain nodes send the first notification to notify the specified number of consortium chain nodes to generate empty blocks.
进一步可选的,处理模块51还用于:若第二数量小于指定数量,则将指 定数量减去第二数量,得到第三数量,从当前算力小于预设算力值的联盟链节点中选择第三数量个联盟链节点;向第二数量个联盟链节点联盟链节点和第三数量个联盟链节点发送第二通知,以通知第二数量个联盟链节点和第三数量个联盟链节点生成空区块。Further optionally, the processing module 51 is also used to: if the second amount is less than the specified amount, then subtract the second amount from the specified amount to obtain the third amount, and obtain the third amount from the consortium chain nodes whose current computing power is less than the preset computing power value Select the third number of alliance chain nodes; send the second notification to the second number of alliance chain nodes and the third number of alliance chain nodes to notify the second number of alliance chain nodes and the third number of alliance chain nodes Generate empty blocks.
进一步可选的,处理模块51在当前出块周期到达时,生成空区块时,具体用于:接收联盟链网络中的第二联盟链节点发送的第一通知或第二通知,并根据第一通知或第二通知,生成空区块;其中,第一通知是第二联盟链节点在识别到联盟链网络中当前算力不小于预设算力值的联盟链节点的数量大于或等于指定数量的情况下发送的,第二通知是第二联盟链节点在识别到联盟链网络中当前算力不小于预设算力值的联盟链节点的数量小于指定数量的情况下发送的。Further optionally, the processing module 51 is specifically configured to: receive the first notification or the second notification sent by the second consortium chain node in the consortium chain network when the current block generation period arrives, and generate an empty block; A notification or a second notification to generate an empty block; wherein, the first notification is that the second consortium chain node recognizes that the number of consortium chain nodes whose current computing power is not less than the preset computing power value in the consortium chain network is greater than or equal to the specified The second notification is sent when the second consortium chain node recognizes that the number of consortium chain nodes whose current computing power is not less than the preset computing power value in the consortium chain network is less than the specified number.
进一步可选的,处理模块51还用于:若第一联盟链节点在当前出块周期内接收到联盟链网络中其它联盟链节点广播的第一交易数据或者在当前出块周期内接收到其对应的联盟用户提交的第二交易数据时,判断第一交易数据或者第二交易数据是否经过多个联盟链用户的签名处理;若第一交易数据或者第二交易数据经过多个联盟链用户的签名处理,则根据第一交易数据或者第二交易数据生成非空区块,并将非空区块广播至联盟链网络中,以供联盟链网络中的各联盟链节点验证非空区块的有效性并在非空区块的有效时将非空区块加入至联盟链中。Further optionally, the processing module 51 is also used for: if the first consortium chain node receives the first transaction data broadcast by other consortium chain nodes in the consortium chain network within the current block generation cycle or receives its transaction data within the current block generation cycle When the corresponding alliance user submits the second transaction data, it is judged whether the first transaction data or the second transaction data has been signed by multiple alliance chain users; if the first transaction data or the second transaction data has been signed by multiple alliance chain users Signature processing, generate a non-empty block according to the first transaction data or the second transaction data, and broadcast the non-empty block to the alliance chain network for each alliance chain node in the alliance chain network to verify the identity of the non-empty block Validity and add the non-empty block to the alliance chain when the non-empty block is valid.
进一步可选的,处理模块51还用于:若第一联盟链节点在当前出块周期内接收到其对应的联盟用户提交的第二交易数据,确定第一联盟链节点的节点标识在预设白名单中,白名单中的节点标识对应的联盟链节点具有交易数据发送权限;将第二交易数据广播至联盟链网络中,以供联盟链网络中的各联盟链节点判断第二交易数据是否经过多个联盟链用户的签名处理。Further optionally, the processing module 51 is also used for: if the first consortium chain node receives the second transaction data submitted by its corresponding consortium user within the current block generation cycle, determine that the node identifier of the first consortium chain node is within the preset In the white list, the alliance chain nodes corresponding to the node identifiers in the white list have transaction data transmission authority; broadcast the second transaction data to the alliance chain network for each alliance chain node in the alliance chain network to judge whether the second transaction data After the signature processing of multiple alliance chain users.
关于图5所示的联盟链出块装置的具体实现方式已经在上述联盟链出块方法的实施例中进行了详细描述,此处将不做详细阐述说明。The specific implementation of the consortium chain block generation device shown in FIG. 5 has been described in detail in the above embodiment of the consortium chain block generation method, and will not be described in detail here.
图6为本申请一示例性实施例提供的一种电子设备的结构示意图。参见 图6,该电子设备包括:存储器61和处理器62。Fig. 6 is a schematic structural diagram of an electronic device provided by an exemplary embodiment of the present application. Referring to FIG. 6 , the electronic device includes: a memory 61 and a processor 62 .
存储器61,用于存储计算机程序,并可被配置为存储其它各种数据以支持在计算平台上的操作。这些数据的示例包括用于在计算平台上操作的任何应用程序或方法的指令,联系人数据,电话簿数据,消息,图片,视频等。The memory 61 is used to store computer programs, and can be configured to store other various data to support operations on the computing platform. Examples of such data include instructions for any application or method operating on the computing platform, contact data, phonebook data, messages, pictures, videos, etc.
存储器61可以由任何类型的易失性或非易失性存储设备或者它们的组合实现,如静态随机存取存储器(SRAM),电可擦除可编程只读存储器(EEPROM),可擦除可编程只读存储器(EPROM),可编程只读存储器(PROM),只读存储器(ROM),磁存储器,快闪存储器,磁盘或光盘。 Memory 61 can be realized by any type of volatile or nonvolatile storage device or their combination, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable Programmable Read Only Memory (EPROM), Programmable Read Only Memory (PROM), Read Only Memory (ROM), Magnetic Memory, Flash Memory, Magnetic or Optical Disk.
处理器62,与存储器61耦合,用于执行存储器61中的计算机程序,以用于:若第一联盟链节点在当前出块周期内未接收到交易数据,则在当前出块周期到达时,生成空区块,并将空区块广播至联盟链网络中,以供联盟链网络中的各联盟链节点验证空区块的有效性并在空区块有效时将空区块加入至联盟链中;在空区块被加入至联盟链的情况下,获取联盟链上最后一个非空区块后面连续出现的空区块的数量,作为第一数量;若第一数量等于预设数量阈值,且在下一个出块周期内未收到交易数据,则在下一个出块周期到达时禁止生成新的空区块。 Processor 62, coupled with memory 61, for executing the computer program in memory 61, for: if the first consortium chain node does not receive transaction data within the current block generation cycle, when the current block generation cycle arrives, Generate an empty block and broadcast the empty block to the alliance chain network for each alliance chain node in the alliance chain network to verify the validity of the empty block and add the empty block to the alliance chain when the empty block is valid Middle; when an empty block is added to the consortium chain, obtain the number of consecutive empty blocks that appear after the last non-empty block on the consortium chain as the first number; if the first number is equal to the preset number threshold, And if no transaction data is received in the next block generation cycle, it is prohibited to generate new empty blocks when the next block generation cycle arrives.
进一步可选的,处理器62在当前出块周期到达时,生成空区块时,具体用于:判断当前时间是否处于预设的交易时间段;若是,在当前出块周期到达时,生成空区块。Further optionally, when the processor 62 generates an empty block when the current block generation period arrives, it is specifically used to: determine whether the current time is in the preset transaction time period; if so, generate an empty block when the current block generation period arrives. blocks.
进一步可选的,处理器62在当前出块周期到达时,生成空区块时,具体用于:在出块周期到达时,第一联盟链节点判断自身当前算力是否大于或等于预设算力值;若是,则生成空区块。Further optionally, when the processor 62 generates an empty block when the current block generation period arrives, it is specifically used for: when the block generation period arrives, the first consortium chain node judges whether its current computing power is greater than or equal to the pre-calculated Force value; if so, an empty block is generated.
进一步可选的,处理器62在当前出块周期到达时,生成空区块时,具体用于:在当前出块周期到达时,确定联盟链网络中当前算力不小于预设算力值的联盟链节点及其数量,作为第二数量;若第二数量大于或等于指定数量,则从当前算力大于或等于预设算力值的联盟链节点中选择指定数量个联盟链节点,并向指定数量个联盟链节点发送第一通知,以通知指定数量个联盟链 节点生成空区块。Further optionally, when the processor 62 generates an empty block when the current block generation cycle arrives, it is specifically used to: determine that the current computing power in the consortium chain network is not less than the preset computing power value when the current block generation cycle arrives. Consortium chain nodes and their number are used as the second number; if the second number is greater than or equal to the specified number, select the specified number of alliance chain nodes from the alliance chain nodes whose current computing power is greater than or equal to the preset computing power value, and send to The specified number of consortium chain nodes send the first notification to notify the specified number of consortium chain nodes to generate empty blocks.
进一步可选的,处理器62还用于:若第二数量小于指定数量,则将指定数量减去第二数量,得到第三数量,从当前算力小于预设算力值的联盟链节点中选择第三数量个联盟链节点;向第二数量个联盟链节点联盟链节点和第三数量个联盟链节点发送第二通知,以通知第二数量个联盟链节点和第三数量个联盟链节点生成空区块。Further optionally, the processor 62 is also used to: if the second amount is less than the specified amount, then subtract the specified amount from the second amount to obtain the third amount, and obtain the third amount from the consortium chain nodes whose current computing power is less than the preset computing power value Select the third number of alliance chain nodes; send the second notification to the second number of alliance chain nodes and the third number of alliance chain nodes to notify the second number of alliance chain nodes and the third number of alliance chain nodes Generate empty blocks.
进一步可选的,处理器62在当前出块周期到达时,生成空区块时,具体用于:接收联盟链网络中的第二联盟链节点发送的第一通知或第二通知,并根据第一通知或第二通知,生成空区块;其中,第一通知是第二联盟链节点在识别到联盟链网络中当前算力不小于预设算力值的联盟链节点的数量大于或等于指定数量的情况下发送的,第二通知是第二联盟链节点在识别到联盟链网络中当前算力不小于预设算力值的联盟链节点的数量小于指定数量的情况下发送的。Further optionally, the processor 62 is specifically configured to: receive the first notification or the second notification sent by the second consortium chain node in the consortium chain network when the current block generation period arrives, and generate an empty block; A notification or a second notification to generate an empty block; wherein, the first notification is that the second consortium chain node recognizes that the number of consortium chain nodes whose current computing power is not less than the preset computing power value in the consortium chain network is greater than or equal to the specified The second notification is sent when the second consortium chain node recognizes that the number of consortium chain nodes whose current computing power is not less than the preset computing power value in the consortium chain network is less than the specified number.
进一步可选的,处理器62还用于:若第一联盟链节点在当前出块周期内接收到联盟链网络中其它联盟链节点广播的第一交易数据或者在当前出块周期内接收到其对应的联盟用户提交的第二交易数据时,判断第一交易数据或者第二交易数据是否经过多个联盟链用户的签名处理;若第一交易数据或者第二交易数据经过多个联盟链用户的签名处理,则根据第一交易数据或者第二交易数据生成非空区块,并将非空区块广播至联盟链网络中,以供联盟链网络中的各联盟链节点验证非空区块的有效性并在非空区块的有效时将非空区块加入至联盟链中。Further optionally, the processor 62 is also used for: if the first consortium chain node receives the first transaction data broadcast by other consortium chain nodes in the consortium chain network within the current block generation cycle or receives its transaction data within the current block generation cycle When the corresponding alliance user submits the second transaction data, it is judged whether the first transaction data or the second transaction data has been signed by multiple alliance chain users; if the first transaction data or the second transaction data has been signed by multiple alliance chain users Signature processing, generate a non-empty block according to the first transaction data or the second transaction data, and broadcast the non-empty block to the alliance chain network for each alliance chain node in the alliance chain network to verify the identity of the non-empty block Validity and add the non-empty block to the alliance chain when the non-empty block is valid.
进一步可选的,处理器62还用于:若第一联盟链节点在当前出块周期内接收到其对应的联盟用户提交的第二交易数据,确定第一联盟链节点的节点标识在预设白名单中,白名单中的节点标识对应的联盟链节点具有交易数据发送权限;将第二交易数据广播至联盟链网络中,以供联盟链网络中的各联盟链节点判断第二交易数据是否经过多个联盟链用户的签名处理。Further optionally, the processor 62 is also configured to: if the first consortium chain node receives the second transaction data submitted by its corresponding consortium user within the current block generation period, determine that the node identifier of the first consortium chain node is within the preset In the white list, the alliance chain nodes corresponding to the node identifiers in the white list have transaction data transmission authority; broadcast the second transaction data to the alliance chain network for each alliance chain node in the alliance chain network to judge whether the second transaction data After the signature processing of multiple alliance chain users.
进一步,如图6所示,该电子设备还包括:通信组件63、显示器64、电 源组件65、音频组件66等其它组件。图6中仅示意性给出部分组件,并不意味着电子设备只包括图6所示组件。另外,图6中虚线框内的组件为可选组件,而非必选组件,具体可视电子设备的产品形态而定。本实施例的电子设备可以实现为台式电脑、笔记本电脑、智能手机或IOT设备等终端设备,也可以是常规服务器、云服务器或服务器阵列等服务端设备。若本实施例的电子设备实现为台式电脑、笔记本电脑、智能手机等终端设备,可以包含图6中虚线框内的组件;若本实施例的电子设备实现为常规服务器、云服务器或服务器阵列等服务端设备,则可以不包含图6中虚线框内的组件。Further, as shown in Figure 6, the electronic device also includes: a communication component 63, a display 64, a power supply component 65, an audio component 66 and other components. FIG. 6 only schematically shows some components, which does not mean that the electronic device only includes the components shown in FIG. 6 . In addition, the components in the dotted line box in FIG. 6 are optional components, not mandatory components, which may depend on the product form of the electronic device. The electronic device in this embodiment can be implemented as a terminal device such as a desktop computer, a notebook computer, a smart phone, or an IOT device, or as a server device such as a conventional server, a cloud server, or a server array. If the electronic equipment of this embodiment is implemented as terminal equipment such as desktop computers, notebook computers, smart phones, etc., it can include the components in the dashed box in Figure 6; if the electronic equipment of this embodiment is implemented as a conventional server, cloud server or server array, etc. The server device may not include the components in the dashed box in FIG. 6 .
相应地,本申请实施例还提供一种存储有计算机程序的计算机可读存储介质,计算机程序被执行时能够实现上述方法实施例中可由电子设备执行的各步骤。Correspondingly, an embodiment of the present application further provides a computer-readable storage medium storing a computer program. When the computer program is executed, the steps that can be executed by the electronic device in the above method embodiments can be implemented.
相应地,本申请实施例还提供一种计算机程序产品,包括计算机程序,当计算机程序被处理器执行时,致使处理器能够实现上述方法实施例中可由电子设备执行的各步骤。Correspondingly, an embodiment of the present application further provides a computer program product, including a computer program, which, when the computer program is executed by a processor, causes the processor to implement the steps executable by the electronic device in the foregoing method embodiments.
上述通信组件被配置为便于通信组件所在设备和其他设备之间有线或无线方式的通信。通信组件所在设备可以接入基于通信标准的无线网络,如WiFi,2G、3G、4G/LTE、5G等移动通信网络,或它们的组合。在一个示例性实施例中,通信组件经由广播信道接收来自外部广播管理系统的广播信号或广播相关信息。在一个示例性实施例中,通信组件还包括近场通信(NFC)模块,以促进短程通信。例如,在NFC模块可基于射频识别(RFID)技术,红外数据协会(IrDA)技术,超宽带(UWB)技术,蓝牙(BT)技术和其他技术来实现。The above-mentioned communication component is configured to facilitate wired or wireless communication between the device where the communication component is located and other devices. The device where the communication component is located can access a wireless network based on communication standards, such as WiFi, 2G, 3G, 4G/LTE, 5G and other mobile communication networks, or a combination thereof. In one exemplary embodiment, the communication component receives a broadcast signal or broadcast related information from an external broadcast management system via a broadcast channel. In one exemplary embodiment, the communication assembly also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module may be implemented based on Radio Frequency Identification (RFID) technology, Infrared Data Association (IrDA) technology, Ultra Wideband (UWB) technology, Bluetooth (BT) technology and other technologies.
上述显示器包括屏幕,其屏幕可以包括液晶显示器(LCD)和触摸面板(TP)。如果屏幕包括触摸面板,屏幕可以被实现为触摸屏,以接收来自用户的输入信号。触摸面板包括一个或多个触摸传感器以感测触摸、滑动和触摸面板上的手势。触摸传感器可以不仅感测触摸或滑动动作的边界,而且还检测与触摸或滑动操作相关的持续时间和压力。The above-mentioned display includes a screen, and the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from a user. The touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel. The touch sensor may not only sense a boundary of a touch or a swipe action, but also detect duration and pressure associated with the touch or swipe operation.
上述电源组件,为电源组件所在设备的各种组件提供电力。电源组件可以包括电源管理系统,一个或多个电源,及其他与为电源组件所在设备生成、管理和分配电力相关联的组件。The above-mentioned power supply component provides power for various components of the equipment where the power supply component is located. A power supply component may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the device in which the power supply component resides.
上述音频组件,可被配置为输出和/或输入音频信号。例如,音频组件包括一个麦克风(MIC),当音频组件所在设备处于操作模式,如呼叫模式、记录模式和语音识别模式时,麦克风被配置为接收外部音频信号。所接收的音频信号可以被进一步存储在存储器或经由通信组件发送。在一些实施例中,音频组件还包括一个扬声器,用于输出音频信号。The aforementioned audio components may be configured to output and/or input audio signals. For example, the audio component includes a microphone (MIC), which is configured to receive an external audio signal when the device on which the audio component is located is in an operation mode, such as a calling mode, a recording mode, and a speech recognition mode. The received audio signal may be further stored in a memory or sent via a communication component. In some embodiments, the audio component further includes a speaker for outputting audio signals.
本领域内的技术人员应明白,本发明的实施例可提供为方法、系统、或计算机程序产品。因此,本发明可采用完全硬件实施例、完全软件实施例、或结合软件和硬件方面的实施例的形式。而且,本发明可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。Those skilled in the art should understand that the embodiments of the present invention may be provided as methods, systems, or computer program products. Accordingly, the present invention can take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) having computer-usable program code embodied therein.
本发明是参照根据本发明实施例的方法、设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It should be understood that each procedure and/or block in the flowchart and/or block diagram, and a combination of procedures and/or blocks in the flowchart and/or block diagram can be realized by computer program instructions. These computer program instructions may be provided to a general purpose computer, special purpose computer, embedded processor, or processor of other programmable data processing equipment to produce a machine such that the instructions executed by the processor of the computer or other programmable data processing equipment produce a An apparatus for realizing the functions specified in one or more procedures of the flowchart and/or one or more blocks of the block diagram.
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing apparatus to operate in a specific manner, such that the instructions stored in the computer-readable memory produce an article of manufacture comprising instruction means, the instructions The device realizes the function specified in one or more procedures of the flowchart and/or one or more blocks of the block diagram.
这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的 处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。These computer program instructions can also be loaded onto a computer or other programmable data processing device, causing a series of operational steps to be performed on the computer or other programmable device to produce a computer-implemented process, thereby The instructions provide steps for implementing the functions specified in the flow chart or blocks of the flowchart and/or the block or blocks of the block diagrams.
在一个典型的配置中,计算设备包括一个或多个处理器(CPU)、输入/输出接口、网络接口和内存。In a typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
内存可能包括计算机可读介质中的非永久性存储器,随机存取存储器(RAM)和/或非易失性内存等形式,如只读存储器(ROM)或闪存(flash RAM)。内存是计算机可读介质的示例。Memory may include non-permanent storage in computer readable media, in the form of random access memory (RAM) and/or nonvolatile memory such as read-only memory (ROM) or flash RAM. Memory is an example of computer readable media.
计算机可读介质包括永久性和非永久性、可移动和非可移动媒体可以由任何方法或技术来实现信息存储。信息可以是计算机可读指令、数据结构、程序的模块或其他数据。计算机的存储介质的例子包括,但不限于相变内存(PRAM)、静态随机存取存储器(SRAM)、动态随机存取存储器(DRAM)、其他类型的随机存取存储器(RAM)、只读存储器(ROM)、电可擦除可编程只读存储器(EEPROM)、快闪记忆体或其他内存技术、只读光盘只读存储器(CD-ROM)、数字多功能光盘(DVD)或其他光学存储、磁盒式磁带,磁带磁磁盘存储或其他磁性存储设备或任何其他非传输介质,可用于存储可以被计算设备访问的信息。按照本文中的界定,计算机可读介质不包括暂存电脑可读媒体(transitory media),如调制的数据信号和载波。Computer-readable media, including both permanent and non-permanent, removable and non-removable media, can be implemented by any method or technology for storage of information. Information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read only memory (ROM), Electrically Erasable Programmable Read-Only Memory (EEPROM), Flash memory or other memory technology, Compact Disc Read-Only Memory (CD-ROM), Digital Versatile Disc (DVD) or other optical storage, Magnetic tape cartridge, tape magnetic disk storage or other magnetic storage device or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media excludes transitory computer-readable media, such as modulated data signals and carrier waves.
还需要说明的是,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、商品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、商品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、商品或者设备中还存在另外的相同要素。It should also be noted that the term "comprises", "comprises" or any other variation thereof is intended to cover a non-exclusive inclusion such that a process, method, article, or apparatus comprising a set of elements includes not only those elements, but also includes Other elements not expressly listed, or elements inherent in the process, method, commodity, or apparatus are also included. Without further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of additional identical elements in the process, method, article or apparatus comprising said element.
本领域技术人员应明白,本申请的实施例可提供为方法、系统或计算机程序产品。因此,本申请可采用完全硬件实施例、完全软件实施例或结合软件和硬件方面的实施例的形式。而且,本申请可采用在一个或多个其中包含 有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。Those skilled in the art should understand that the embodiments of the present application may be provided as methods, systems or computer program products. Accordingly, the present application can take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) having computer-usable program code embodied therein.
以上所述仅为本申请的实施例而已,并不用于限制本申请。对于本领域技术人员来说,本申请可以有各种更改和变化。凡在本申请的精神和原理之内所作的任何修改、等同替换、改进等,均应包含在本申请的权利要求范围之内。The above descriptions are only examples of the present application, and are not intended to limit the present application. For those skilled in the art, various modifications and changes may occur in this application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included within the scope of the claims of the present application.

Claims (12)

  1. 一种联盟链出块方法,其特征在于,应用于联盟链网络中的第一联盟链节点,所述方法包括:A consortium chain block production method is characterized in that it is applied to the first consortium chain node in the consortium chain network, and the method includes:
    若第一联盟链节点在当前出块周期内未接收到交易数据,则在当前出块周期到达时,生成空区块,并将所述空区块广播至所述联盟链网络中,以供所述联盟链网络中的各联盟链节点验证所述空区块的有效性并在所述空区块有效时将所述空区块加入至联盟链中;If the first consortium chain node does not receive transaction data within the current block generation cycle, an empty block is generated when the current block generation cycle arrives, and the empty block is broadcast to the consortium chain network for Each alliance chain node in the alliance chain network verifies the validity of the empty block and adds the empty block to the alliance chain when the empty block is valid;
    在所述空区块被加入至所述联盟链的情况下,获取所述联盟链上最后一个非空区块后面连续出现的空区块的数量,作为第一数量;When the empty block is added to the consortium chain, obtain the number of consecutive empty blocks appearing after the last non-empty block on the consortium chain as the first quantity;
    若所述第一数量等于预设数量阈值,且在下一个出块周期内未收到交易数据,则在下一个出块周期到达时禁止生成新的空区块。If the first quantity is equal to the preset quantity threshold, and no transaction data is received within the next block producing period, it is forbidden to generate new empty blocks when the next block producing period arrives.
  2. 根据权利要求1所述的方法,其特征在于,在当前出块周期到达时,生成空区块,包括:The method according to claim 1, wherein when the current block generation period arrives, generating an empty block includes:
    判断当前时间是否处于预设的交易时间段;Determine whether the current time is within the preset trading time period;
    若是,在当前出块周期到达时,生成空区块。If so, an empty block will be generated when the current block generation period arrives.
  3. 根据权利要求1所述的方法,其特征在于,在当前出块周期到达时,生成空区块,包括:The method according to claim 1, wherein when the current block generation period arrives, generating an empty block includes:
    在所述出块周期到达时,所述第一联盟链节点判断自身当前算力是否大于或等于预设算力值;When the block generation period arrives, the first consortium chain node judges whether its current computing power is greater than or equal to a preset computing power value;
    若是,则生成空区块。If so, an empty block is generated.
  4. 根据权利要求1所述的方法,其特征在于,在当前出块周期到达时,生成空区块,包括:The method according to claim 1, wherein when the current block generation period arrives, generating an empty block includes:
    在当前出块周期到达时,确定所述联盟链网络中当前算力不小于预设算力值的联盟链节点及其数量,作为第二数量;When the current block generation cycle arrives, determine the consortium chain nodes whose current computing power is not less than the preset computing power value in the consortium chain network and the number thereof, as the second number;
    若所述第二数量大于或等于指定数量,则从当前算力大于或等于所述预设算力值的联盟链节点中选择所述指定数量个联盟链节点,并向所述指定数 量个联盟链节点发送第一通知,以通知所述指定数量个联盟链节点生成空区块。If the second number is greater than or equal to the specified number, select the specified number of alliance chain nodes from the alliance chain nodes whose current computing power is greater than or equal to the preset computing power value, and send the specified number of alliance chain nodes The chain node sends a first notification to notify the specified number of consortium chain nodes to generate an empty block.
  5. 根据权利要求4所述的方法,其特征在于,还包括:The method according to claim 4, further comprising:
    若所述第二数量小于指定数量,则将所述指定数量减去所述第二数量,得到第三数量,从当前算力小于所述预设算力值的联盟链节点中选择所述第三数量个联盟链节点;If the second amount is less than the specified amount, the specified amount is subtracted from the second amount to obtain a third amount, and the second amount is selected from alliance chain nodes whose current computing power is less than the preset computing power value Three number of alliance chain nodes;
    向所述第二数量个联盟链节点联盟链节点和所述第三数量个联盟链节点发送第二通知,以通知所述第二数量个联盟链节点和所述第三数量个联盟链节点生成空区块。Send a second notification to the second number of alliance chain nodes and the third number of alliance chain nodes to notify the second number of alliance chain nodes and the third number of alliance chain nodes to generate Empty block.
  6. 根据权利要求5所述的方法,其特征在于,在当前出块周期到达时,生成空区块,包括:The method according to claim 5, wherein when the current block generation period arrives, generating an empty block includes:
    接收所述联盟链网络中的第二联盟链节点发送的第一通知或第二通知,并根据所述第一通知或第二通知,生成空区块;receiving the first notification or the second notification sent by the second consortium chain node in the consortium chain network, and generating an empty block according to the first or second notification;
    其中,所述第一通知是所述第二联盟链节点在识别到所述联盟链网络中当前算力不小于预设算力值的联盟链节点的数量大于或等于指定数量的情况下发送的,所述第二通知是所述第二联盟链节点在识别到所述联盟链网络中当前算力不小于预设算力值的联盟链节点的数量小于指定数量的情况下发送的。Wherein, the first notification is sent by the second consortium chain node when it is recognized that the number of consortium chain nodes whose current computing power is not less than the preset computing power value in the consortium chain network is greater than or equal to the specified number , the second notification is sent by the second consortium chain node when it is recognized that the number of consortium chain nodes whose current computing power is not less than a preset computing power value in the consortium chain network is less than a specified number.
  7. 根据权利要求1所述的方法,其特征在于,还包括:The method according to claim 1, further comprising:
    若所述第一联盟链节点在当前出块周期内接收到所述联盟链网络中其它联盟链节点广播的第一交易数据或者在当前出块周期内接收到其对应的联盟用户提交的第二交易数据时,判断所述第一交易数据或者第二交易数据是否经过多个联盟链用户的签名处理;If the first consortium chain node receives the first transaction data broadcast by other consortium chain nodes in the consortium chain network within the current block generation cycle or receives the second transaction data submitted by its corresponding consortium user within the current block generation cycle When trading data, it is judged whether the first transaction data or the second transaction data has been signed by multiple alliance chain users;
    若所述第一交易数据或者第二交易数据经过多个联盟链用户的签名处理,则根据所述第一交易数据或者第二交易数据生成非空区块,并将所述非空区块广播至所述联盟链网络中,以供所述联盟链网络中的各联盟链节点验证所述非空区块的有效性并在所述非空区块的有效时将所述非空区块加入至 所述联盟链中。If the first transaction data or the second transaction data is processed by signatures of multiple alliance chain users, a non-empty block is generated according to the first transaction data or the second transaction data, and the non-empty block is broadcast To the alliance chain network, for each alliance chain node in the alliance chain network to verify the validity of the non-empty block and add the non-empty block when the non-empty block is valid to the alliance chain.
  8. 根据权利要求7所述的方法,其特征在于,还包括:The method according to claim 7, further comprising:
    若所述第一联盟链节点在当前出块周期内接收到其对应的联盟用户提交的第二交易数据,确定所述第一联盟链节点的节点标识在预设白名单中,所述白名单中的节点标识对应的联盟链节点具有交易数据发送权限;If the first consortium chain node receives the second transaction data submitted by its corresponding consortium user within the current block generation period, it is determined that the node identification of the first consortium chain node is in the preset white list, and the white list The alliance chain node corresponding to the node ID in has the authority to send transaction data;
    将所述第二交易数据广播至所述联盟链网络中,以供所述联盟链网络中的各联盟链节点判断所述第二交易数据是否经过多个联盟链用户的签名处理。The second transaction data is broadcast to the alliance chain network, so that each alliance chain node in the alliance chain network can judge whether the second transaction data has been signed by multiple alliance chain users.
  9. 一种联盟链出块装置,其特征在于,包括:A consortium chain block generating device is characterized in that it includes:
    处理模块,用于若第一联盟链节点在当前出块周期内未接收到交易数据,则在当前出块周期到达时,生成空区块,并将所述空区块广播至所述联盟链网络中,以供所述联盟链网络中的各联盟链节点验证所述空区块的有效性并在所述空区块有效时将所述空区块加入至联盟链中;A processing module, configured to generate an empty block when the current block generation cycle arrives if the first alliance chain node does not receive transaction data within the current block generation cycle, and broadcast the empty block to the alliance chain In the network, each alliance chain node in the alliance chain network can verify the validity of the empty block and add the empty block to the alliance chain when the empty block is valid;
    获取模块,用于在所述空区块被加入至所述联盟链的情况下,获取所述联盟链上最后一个非空区块后面连续出现的空区块的数量,作为第一数量;An acquisition module, configured to acquire the number of empty blocks that appear consecutively after the last non-empty block on the alliance chain as the first number when the empty block is added to the alliance chain;
    处理模块,还用于若所述第一数量等于预设数量阈值,且在下一个出块周期内未收到交易数据,则在下一个出块周期到达时禁止生成新的空区块。The processing module is further configured to prohibit the generation of new empty blocks when the next block generation cycle arrives if the first amount is equal to the preset amount threshold and no transaction data is received within the next block generation cycle.
  10. 一种电子设备,其特征在于,包括:存储器和处理器;An electronic device, characterized in that it includes: a memory and a processor;
    所述存储器,用于存储计算机程序;The memory is used to store computer programs;
    所述处理器耦合至所述存储器,用于执行所述计算机程序以用于执行权利要求1-8任一项所述方法中的步骤。The processor is coupled to the memory for executing the computer program for performing the steps in the method of any one of claims 1-8.
  11. 一种存储有计算机程序的计算机可读存储介质,其特征在于,当所述计算机程序被处理器执行时,致使所述处理器实现权利要求1-8任一项所述方法中的步骤。A computer-readable storage medium storing a computer program, characterized in that, when the computer program is executed by a processor, the processor is caused to implement the steps in the method of any one of claims 1-8.
  12. 一种计算机程序产品,包括计算机程序,该计算机程序被处理器执行时实现权利要求1-8任一项所述方法中的步骤。A computer program product, comprising a computer program, which implements the steps in the method of any one of claims 1-8 when the computer program is executed by a processor.
PCT/CN2022/098136 2021-12-15 2022-06-10 Alliance chain block generation method and apparatus, electronic device, and medium WO2023109040A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202111537592.7A CN114385647B (en) 2021-12-15 2021-12-15 Alliance link-out block method, alliance link-out block device, electronic equipment and medium
CN202111537592.7 2021-12-15

Publications (1)

Publication Number Publication Date
WO2023109040A1 true WO2023109040A1 (en) 2023-06-22

Family

ID=81197087

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/098136 WO2023109040A1 (en) 2021-12-15 2022-06-10 Alliance chain block generation method and apparatus, electronic device, and medium

Country Status (2)

Country Link
CN (1) CN114385647B (en)
WO (1) WO2023109040A1 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114385647B (en) * 2021-12-15 2023-04-07 达闼科技(北京)有限公司 Alliance link-out block method, alliance link-out block device, electronic equipment and medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110322350A (en) * 2019-06-25 2019-10-11 北京众享比特科技有限公司 Cut method, apparatus, equipment and the storage medium of the common recognition hollow block of network
CN110493148A (en) * 2019-08-12 2019-11-22 深圳前海微众银行股份有限公司 A kind of block processes, block common recognition and block synchronous method and device
CN112633879A (en) * 2020-12-18 2021-04-09 上海万向区块链股份公司 Consensus system and method applied to block chain and capable of preventing empty blocks from appearing in non-transaction state
CN112783976A (en) * 2021-01-05 2021-05-11 上海特高信息技术有限公司 Consensus algorithm for flexibly packaging out blocks by allied block chains
CN114385647A (en) * 2021-12-15 2022-04-22 达闼科技(北京)有限公司 Alliance link-out block method and device, electronic equipment and medium

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109964446B (en) * 2018-06-08 2022-03-25 北京大学深圳研究生院 Consensus method based on voting
CN109165324A (en) * 2018-08-20 2019-01-08 深圳市元征科技股份有限公司 A kind of transaction data packaging method and relevant apparatus
CN109255057B (en) * 2018-09-18 2021-05-07 百度在线网络技术(北京)有限公司 Block generation method, device, equipment and storage medium
CN110213046A (en) * 2019-05-30 2019-09-06 全链通有限公司 Auth method, equipment and storage medium based on alliance's block chain
CN111506655B (en) * 2020-04-20 2022-06-21 腾讯科技(深圳)有限公司 Synchronous processing method and device of block chain system, intelligent equipment and storage medium
CN111507717B (en) * 2020-04-20 2022-08-12 腾讯科技(深圳)有限公司 Data processing method, device, block node and computer readable storage medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110322350A (en) * 2019-06-25 2019-10-11 北京众享比特科技有限公司 Cut method, apparatus, equipment and the storage medium of the common recognition hollow block of network
CN110493148A (en) * 2019-08-12 2019-11-22 深圳前海微众银行股份有限公司 A kind of block processes, block common recognition and block synchronous method and device
CN112633879A (en) * 2020-12-18 2021-04-09 上海万向区块链股份公司 Consensus system and method applied to block chain and capable of preventing empty blocks from appearing in non-transaction state
CN112783976A (en) * 2021-01-05 2021-05-11 上海特高信息技术有限公司 Consensus algorithm for flexibly packaging out blocks by allied block chains
CN114385647A (en) * 2021-12-15 2022-04-22 达闼科技(北京)有限公司 Alliance link-out block method and device, electronic equipment and medium

Also Published As

Publication number Publication date
CN114385647B (en) 2023-04-07
CN114385647A (en) 2022-04-22

Similar Documents

Publication Publication Date Title
US11259178B2 (en) Bluetooth mesh network provisioning authentication
WO2020238751A1 (en) Resource access method under serverless architecture, device, system, and storage medium
US11611863B2 (en) Method and apparatus for low energy discovery
US20210051186A1 (en) Managing data communications based on phone calls between mobile computing devices
US9569607B2 (en) Security verification method and apparatus
WO2020216204A1 (en) Information acquisition method and apparatus
WO2023109040A1 (en) Alliance chain block generation method and apparatus, electronic device, and medium
US8984078B2 (en) Systems and methods for device-to-cloud message delivery
US9185148B1 (en) Methods and systems for efficient discovery of devices in a peer-to-peer network
JP7300799B2 (en) Computing device, method of protecting data, and computer program
US20160182685A1 (en) Mobile cloud proxy apparatus and method
CN113420007B (en) Audit processing method and device for database access and electronic equipment
US11716415B2 (en) Suppressing indications of events in user interfaces
CN117319086B (en) System, method, electronic device and storage medium for inadvertent transmission
CN109660579B (en) Data processing method and system and electronic equipment
CN112217873B (en) Device sharing method, related device and storage medium
US20210011710A1 (en) Electronic device management
WO2022121524A1 (en) Method and device for removing friend relationship
CN114430410A (en) System access method, device and equipment based on virtual domain name
KR20150054636A (en) Method and electronic device for sharing applications among a plurality of electronic devices
CN116755842B (en) Identity verification system deployment method, device, equipment and storage medium
CN114978702B (en) Account management method, platform and system, computing device and readable storage medium
CN113973089B (en) Streaming media transmission method, system, equipment and storage medium
US20230319559A1 (en) Enrollment of enrollee devices to a wireless network
CN111240868B (en) Instance processing and calling method, device, system and storage medium

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22905806

Country of ref document: EP

Kind code of ref document: A1