A blockchain consensus method
By introducing a blockchain consensus method between RSU and vehicles into the on-board blockchain network, the problem of block consensus consumption time and communication resources in the existing technology is solved, and a more efficient block propagation and consensus process is achieved.
Patent Information
- Application Number
- CN202210665453.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-13
- Publication Date
- 2025-06-27
- Estimated Expiration
- 2042-06-13
AI Technical Summary
The in-vehicle blockchain consensus method in the prior art consumes time and communication resources, resulting in a long time for new blocks to spread.
By establishing a blockchain consensus method between the first RSU and the vehicle, a new block sent by the second RSU is received, and after acknowledging its legitimacy, an identification information is generated and forwarded, and the new block is not on the chain until the threshold is reached.
The propagation efficiency of new blocks across the entire network is improved, communication resources are fully utilized, and the time for block consensus is shortened.
Smart Images

Figure CN115278604B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of blockchain technology, and in particular to a blockchain consensus method. Background Art
[0002] In a traditional vehicle-mounted blockchain, a new block may be generated by a vehicle or a Road Side Unit (RSU), and as an incentive means in the blockchain system, a reputation mechanism can effectively reduce malicious behaviors in the blockchain system.
[0003] In related technologies, a Trust Authority (TA) designates a certain RSU to generate a new block according to the reputation values of the RSUs or vehicles stored by it, and broadcasts the new block to all RSU nodes and vehicle nodes within its communication range, and this broadcast process is continuous. If all RSU nodes and vehicle nodes consider the new block legal, they attach their own private key signatures to the new block and forward the new block to other nodes within their communication ranges; if a certain node considers the new block illegal, it will not attach a private key signature to the new block and will not participate in the continuous forwarding process of the new block. During the forwarding process, if the number of private key signatures in the new block received by a certain node reaches a preset threshold, the new block is chained, and then, a message indicating that the chaining is completed is forwarded. At the same time, the TA performs an increase or deduction operation on the reputation value of the designated RSU according to the chaining situation of the new block by different nodes in the entire network.
[0004] However, in the vehicle-mounted blockchain consensus method based on reputation value management, nodes that do not recognize the new block will not continue to participate in the forwarding of the block, which makes the time and communication resources consumed for the new block to spread throughout the network relatively large. Summary of the Invention
[0005] The present invention provides a blockchain consensus method to solve the defect in related technologies that the block consensus consumes a relatively long time and a large amount of communication resources, and to reduce the time for block propagation and make full use of communication resources.
[0006] In a first aspect, the present invention provides a blockchain consensus method applied to a first Road Side Unit (RSU), and the method includes:
[0007] Receiving a new block sent by a second RSU, and forwarding the new block to the remaining RSUs; the second RSU is selected by a Trust Authority (TA) according to the reputation values of at least one RSU stored by it; the new block is generated by the second RSU;
[0008] When the first RSU recognizes the legitimacy of the new block, generate first recognition information and forward the first recognition information to the remaining RSUs; the first recognition information is used to indicate that the first RSU recognizes the legitimacy of the new block.
[0009] Receive second recognition information sent by the remaining RSUs. When the quantity of the second recognition information is greater than a first threshold, continuously forward the new block to at least one vehicle within the communication range of the first RSU; the second recognition information is used to indicate that the remaining RSUs recognize the legitimacy of the new block.
[0010] According to a blockchain consensus method provided by the present invention, after continuously forwarding the new block to at least one vehicle within the communication range of the first RSU, the method further includes:
[0011] Receive third recognition information sent by each of the vehicles; the third recognition information is fourth recognition information, and / or fifth recognition information; the fourth recognition information is used to indicate that a first vehicle recognizes the legitimacy of the new block; the fifth recognition information is used to indicate that the remaining vehicles recognize the legitimacy of the new block.
[0012] When the quantity of the third recognition information is greater than a second threshold, the consensus of the new block is completed and the new block is chained.
[0013] According to a blockchain consensus method provided by the present invention, after continuously forwarding the new block to at least one vehicle within the communication range of the first RSU, the method further includes:
[0014] Receive first reputation value adjustment information sent by each of the vehicles; the first reputation value adjustment information is third reputation value adjustment information, and / or fourth reputation value adjustment information; the third reputation value adjustment information is used to indicate that the first vehicle generates adjustment information for the reputation value of the second RSU according to the new block; the fourth reputation value adjustment information is used to indicate that the remaining vehicles generate adjustment information for the reputation value of the second RSU according to the new block.
[0015] When the quantity of the first reputation value adjustment information is greater than a third threshold, terminate forwarding the new block.
[0016] When the quantity of the first reputation value adjustment information is less than or equal to the third threshold, continue to forward the new block.
[0017] According to a blockchain consensus method provided by the present invention, the method further includes:
[0018] Send the second reputation value adjustment information and the first reputation value adjustment information to the TA; the second reputation value adjustment information is used to indicate that the first RSU generates the adjustment information for the second RSU reputation value according to the new block.
[0019] In a second aspect, the present invention provides a blockchain consensus method applied to a first vehicle. The method includes:
[0020] Receive new blocks forwarded by at least one roadside unit (RSU), and continuously forward the new blocks to the remaining vehicles; the new blocks are generated by a second RSU; the second RSU is selected by a reputation value management agency (TA) according to the reputation values of at least one stored RSU.
[0021] When the first vehicle approves the legitimacy of the new block, generate a fourth approval information, and forward the fourth approval information to each of the RSUs and the remaining vehicles within the communication range of the first vehicle; the fourth approval information is used to indicate that the first vehicle approves the legitimacy of the new block.
[0022] Receive the fifth approval information sent by the remaining vehicles. When the number of the fifth approval information is greater than a fourth threshold, the new block consensus is completed, and the new block is chained; the fifth approval information is used to indicate that the remaining vehicles approve the legitimacy of the new block.
[0023] According to a blockchain consensus method provided by the present invention, after forwarding the fourth approval information to each of the RSUs and the remaining vehicles within the communication range of the first vehicle, the method further includes:
[0024] Receive the fourth reputation value adjustment information sent by the remaining vehicles; the fourth reputation value adjustment information is used to indicate that the remaining vehicles generate the adjustment information for the target RSU reputation value according to the new block.
[0025] When the number of the fourth reputation value adjustment information is greater than a fifth threshold, terminate forwarding the new block to the remaining vehicles.
[0026] When the number of the fourth reputation value adjustment information is less than or equal to the fifth threshold, continue to forward the new block to the remaining vehicles.
[0027] In a third aspect, the present invention further provides a blockchain consensus device applied to a first roadside unit (RSU). The device includes:
[0028] The first forwarding module is configured to receive a new block sent by a second RSU and forward the new block to the remaining RSUs; the second RSU is selected by a reputation value management agency TA according to the reputation values of at least one RSU stored; the new block is generated by the second RSU.
[0029] The first generation module is configured to generate first approval information and forward the first approval information to the remaining RSUs when the first RSU approves the legitimacy of the new block; the first approval information is used to indicate that the first RSU approves the legitimacy of the new block.
[0030] The second forwarding module is configured to receive second approval information sent by the remaining RSUs and, when the quantity of the second approval information is greater than a first threshold, continuously forward the new block to at least one vehicle within the communication range of the first RSU; the second approval information is used to indicate that the remaining RSUs approve the legitimacy of the new block.
[0031] Fourthly, the present invention further provides a blockchain consensus device applied to a first vehicle, and the device includes:
[0032] The third forwarding module is configured to receive a new block forwarded by at least one roadside unit RSU and continuously forward the new block to the remaining vehicles; the new block is generated by a second RSU; the second RSU is selected by a reputation value management agency TA according to the reputation values of at least one RSU stored.
[0033] The second generation module is configured to generate fourth approval information and forward the fourth approval information to each of the RSUs and the remaining vehicles within the communication range of the first vehicle when the first vehicle approves the legitimacy of the new block; the fourth approval information is used to indicate that the first vehicle approves the legitimacy of the new block.
[0034] The fourth forwarding module is configured to receive the fifth approval information sent by the remaining vehicles and, when the quantity of the fifth approval information is greater than a fourth threshold, complete the consensus of the new block and upload the new block to the chain; the fifth approval information is used to indicate that the remaining vehicles approve the legitimacy of the new block.
[0035] The present invention further provides an electronic device, including a memory, a processor, and a computer program stored on the memory and executable on the processor, and when the processor executes the program, it implements the blockchain consensus method as described in the first aspect or implements the blockchain consensus method as described in the second aspect.
[0036] The present invention also provides a non-transitory computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the blockchain consensus method described in the first aspect is implemented, or the blockchain consensus method described in the second aspect is implemented.
[0037] The present invention also provides a computer program product, including a computer program. When the computer program is executed by a processor, the blockchain consensus method described in the first aspect is implemented, or the blockchain consensus method described in the second aspect is implemented.
[0038] The blockchain consensus method provided by the present invention receives a new block sent by a second RSU through a first RSU and forwards the new block to the remaining RSUs; at the same time, verifies the legality of the new block. In the case of recognizing the legality of the new block, generates a first recognition message and also forwards the first recognition message to the remaining RSUs; then, receives the second recognition messages sent by the remaining RSUs. In the case where the number of the second recognition messages is greater than a first threshold, continuously forwards the new block to at least one vehicle within the communication range of the first RSU. The method provided by the present invention improves the propagation efficiency of the new block in the entire network and the utilization rate of communication resources by forwarding the new block among the RSUs and continuously forwarding the new block to each vehicle. At the same time, the efficiency of block consensus is improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, the drawings in the following description are some embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0040] Figure 1 is one of the flow diagrams of the blockchain consensus method provided by the present invention;
[0041] Figure 2 is another flow diagram of the blockchain consensus method provided by the present invention;
[0042] Figure 3 is yet another flow diagram of the blockchain consensus method provided by the present invention;
[0043] Figure 4 is still another flow diagram of the blockchain consensus method provided by the present invention;
[0044] Figure 5 is yet still another flow diagram of the blockchain consensus method provided by the present invention;
[0045] Figure 6 is the framework structure diagram of the blockchain consensus method provided by the present invention;
[0046] Figure 7 is one of the schematic structural diagrams of the blockchain consensus device provided by the present invention;
[0047] Figure 8 is another schematic structural diagram of the blockchain consensus device provided by the present invention;
[0048] Figure 9 is the schematic structural diagram of the first RSU provided by the present invention. Detailed implementation manners
[0049] To make the objectives, technical solutions and advantages of the present invention clearer, the technical solutions in the present invention will be clearly and completely described below with reference to the accompanying drawings in the present invention. Apparently, the described embodiments are some but not all of the embodiments of the present invention. All other embodiments obtained by those of ordinary skill in the art based on the embodiments in the present invention without creative efforts shall fall within the protection scope of the present invention.
[0050] The blockchain consensus method provided by the present invention will be described in detail below with reference to the accompanying drawings and through some embodiments and their application scenarios.
[0051] The present invention provides a blockchain consensus method, which is applicable to the implementation scenario of the vehicle-mounted blockchain consensus method. The method includes receiving a new block sent by a second RSU and forwarding the new block to the remaining RSUs; the second RSU is selected by a reputation value management institution TA according to the reputation values of at least one RSU stored; the new block is generated by the second RSU; in the case where the first RSU recognizes the legality of the new block, generating a first recognition message and forwarding the first recognition message to the remaining RSUs; the first recognition message is used to indicate that the first RSU recognizes the legality of the new block; receiving second recognition messages sent by the remaining RSUs, and in the case where the number of the second recognition messages is greater than a first threshold, continuously forwarding the new block to at least one vehicle within the communication range of the first RSU; the second recognition message is used to indicate that the remaining RSUs recognize the legality of the new block. The method provided by the present invention improves the propagation efficiency of the new block in the entire network and the utilization rate of communication resources by forwarding the new block among the RSUs and continuously forwarding the new block to each vehicle. At the same time, the efficiency of block consensus is improved.
[0052] The following combines Figures 1-6 to describe the blockchain consensus method of the present invention.
[0053] Figure 1 is one of the flow schematic diagrams of the blockchain consensus method provided by the present invention, and is applied to the first roadside unit RSU, as Figure 1As shown, the method includes steps 101 - 103, where:
[0054] Step 101, receiving a new block sent by a second RSU, and forwarding the new block to the remaining RSUs; the second RSU is selected by a reputation value management institution TA according to the reputation values of at least one stored RSU; the new block is generated by the second RSU.
[0055] It should be noted that the blockchain consensus method provided by the present invention can be applied to the implementation scenario of the in - vehicle blockchain consensus method. The execution subject of this method can be a blockchain consensus device, such as an electronic device, or a control module in the blockchain consensus device for executing the blockchain consensus method.
[0056] Specifically, the first RSU can be any RSU other than the second RSU in the in - vehicle blockchain network; among them, the second RSU is an RSU with a relatively high reputation value selected by the reputation value management institution TA according to the reputation values of at least one stored RSU.
[0057] It should be noted that TA includes a reputation value storage module, a reputation value update module, and an identity issuance module. Among them, the reputation value storage module is used to store the reputation values of multiple RSUs and multiple vehicles; the reputation value update module is used to receive the reputation value adjustment information sent by multiple RSUs, and update the reputation value of the second RSU based on the reputation value adjustment information; the identity issuance module is used to issue identity information and public - private key pairs to multiple RSUs, and issue the identity information and public - private key pairs of each vehicle to multiple vehicles.
[0058] In practice, if an RSU or a vehicle needs to newly join the in - vehicle blockchain network, then the RSU or the vehicle needs to submit a join request to TA. TA verifies the legitimacy of the requester. When the verification passes, TA issues an identity certificate and a public - private key pair to the initiator of the join request (i.e., the RSU or the vehicle), making it a legal RSU or vehicle; moreover, TA sets an initial reputation value for the initiator and locally stores the identity certificate and public - private key pair of the request initiator. For example, TA issues an identity identifier ID, a public key (PK), a private key (SK), and an initial reputation value of 3 for the RSU or the vehicle.
[0059] Specifically, TA selects an RSU with a relatively high reputation value from the stored reputation values of multiple RSUs as the producer of the new block, and this RSU is the second RSU. Among them, there is exactly one RSU as the producer of the new block each time. Then, after receiving the block generation instruction from TA, the second RSU packs the collected transaction information to generate a new block, and attaches its own private key signature to the new block. The new block contains basic information such as a random number, timestamp information, and a set of transaction values. At the same time, it contains the private key signature SK of the second RSU. After the second RSU generates the new block, it forwards the new block to the first RSU, and the first RSU forwards the complete block information of the new block it receives without any modification to the remaining RSUs, that is, all RSUs participate in the forwarding process of the new block together. Among them, the remaining RSUs are other RSUs except the first RSU and the second RSU, and the number of the remaining RSUs is multiple.
[0060] Step 102, when the first RSU recognizes the legality of the new block, generate a first recognition message and forward the first recognition message to the remaining RSUs. The first recognition message is used to indicate that the first RSU recognizes the legality of the new block.
[0061] Specifically, after receiving the new block sent by the second RSU, the first RSU verifies the legality of the new block. When the first RSU recognizes the legality of the new block, the first RSU generates its own first recognition message for the new block and forwards the first recognition message to the remaining RSUs. Among them, the first recognition message is used to indicate that the first RSU recognizes the legality of the new block. When the first RSU does not recognize the legality of the new block, the first RSU does not generate the first recognition message.
[0062] It can be understood that after receiving the new block forwarded by the first RSU, the remaining RSUs also verify the legality of the new block and forward the new block.
[0063] Step 103, receive the second recognition messages sent by the remaining RSUs. When the number of the second recognition messages is greater than the first threshold, continuously forward the new block to at least one vehicle within the communication range of the first RSU. The second recognition message is used to indicate that the remaining RSUs recognize the legality of the new block.
[0064] Specifically, after receiving the new block, the remaining RSUs verify the legality of the new block. If they recognize the legality of the new block, the remaining RSUs generate second recognition messages and forward the second recognition messages. If they do not recognize the legality of the new block, they do not generate second recognition messages.
[0065] In practice, the first RSU receives the second approval information sent by the other RSUs and counts the number of the second approval information sent by the other RSUs. When the number of the second approval information counted by the first RSU for the other vehicles' forwarding is greater than the first threshold, it is considered that the new block is "RSU valid", and the first preparation message is broadcast to the other RSUs. The first preparation message is used to indicate that the first RSU has completed the preparation work for forwarding the new block to the vehicles. At the same time, the first RSU also receives the second preparation messages broadcast by the other RSUs. The second preparation messages are used to indicate that the other RSUs have completed the preparation work for forwarding the block to the vehicles. The first RSU counts the number of the second preparation messages. When the number is greater than the first preset threshold, the new block is continuously forwarded to at least one vehicle within the communication range of the first RSU.
[0066] It should be noted that due to the high mobility of the vehicles, it is possible that a certain vehicle does not pass through the communication range of the first RSU during a certain period. When the first RSU forwards the new block, this vehicle cannot receive the new block. Therefore, it is necessary to continuously forward the new block so that this vehicle can make full use of the communication resources and thus quickly receive the new block.
[0067] The blockchain consensus method provided by the present invention includes that the first RSU receives the new block sent by the second RSU and forwards the new block to the other RSUs. At the same time, the legitimacy of the new block is verified. When the legitimacy of the new block is approved, the first approval information is generated and the first approval information is also forwarded to the other RSUs. Then, the second approval information sent by the other RSUs is received. When the number of the second approval information is greater than the first threshold, it is considered that the new block is "RSU valid", and the new block is continuously forwarded to at least one vehicle within the communication range of the first RSU. The method provided by the present invention improves the propagation efficiency of the new block in the whole network and the utilization rate of the communication resources by forwarding the new block among the RSUs and continuously forwarding the new block to each vehicle. At the same time, the efficiency of block consensus is improved.
[0068] Optionally, after the step 103 of continuously forwarding the new block to at least one vehicle within the communication range of the first RSU, the specific implementation manner of the method further includes the following steps:
[0069] Step 1: Receive the third approval information sent by each of the vehicles. The third approval information is the fourth approval information, and / or the fifth approval information. The fourth approval information is used to indicate that the first vehicle approves the legitimacy of the new block. The fifth approval information is used to indicate that the other vehicles approve the legitimacy of the new block.
[0070] Specifically, the first vehicle is any vehicle within the communication range of the first RSU; after the first RSU continuously forwards the new block to at least one vehicle within the communication range of the first RSU, for example, if the first RSU forwards the new block to the first vehicle, the first vehicle will continuously forward the new block to the remaining vehicles without modification.
[0071] Among them, the first vehicle verifies the legality of the new block. If the first vehicle recognizes the legality of the new block, it generates the fourth recognition information and continuously forwards the fourth recognition information to the remaining vehicles within the communication range of the first vehicle and at least one RSU within the communication range of the first vehicle until the termination condition is reached; if the first vehicle does not recognize the legality of the new block, it does not generate the fourth recognition information; among them, the fourth recognition information is used to indicate that the first vehicle recognizes the legality of the new block; the termination condition is that when the number of fourth recognition information received by any vehicle is greater than the second preset threshold, the forwarding of the fourth recognition information is terminated.
[0072] It should be noted that there may be at least one vehicle and at least one RSU within the communication range of the first vehicle, or only at least one vehicle, or only at least one RSU, or there may be no vehicles and RSU. Therefore, according to the actual position of the first vehicle, the fourth recognition message can be received by at least one vehicle and RSU, or by at least one vehicle, or by at least one RSU, or neither by RSU nor by vehicle.
[0073] At the same time, the remaining vehicles will also verify the legality of the new block. If the remaining vehicles recognize the legality of the new block, they generate the fifth recognition information and continuously forward the fifth recognition information to at least one vehicle within the communication range of the remaining vehicles and at least one RSU within the communication range of the remaining vehicles until the termination condition is reached; if the remaining vehicles do not recognize the legality of the new block, they do not generate the fifth recognition information; among them, the fifth recognition information is used to indicate that the remaining vehicles recognize the legality of the new block; other vehicles can be the vehicles among the remaining vehicles except those that generate the fifth recognition information; the termination condition is that when the number of fifth recognition information received by any vehicle is greater than the third preset threshold, the forwarding of the fifth recognition information is terminated.
[0074] It should be noted that there may be at least one vehicle and at least one RSU within the communication range of the remaining vehicles, or only at least one vehicle, or only at least one RSU, or there may be no vehicles and RSU. Therefore, according to the actual position of the remaining vehicles, the fifth recognition message can be received by at least one vehicle and RSU, or by at least one vehicle, or by at least one RSU, or neither by RSU nor by vehicle.
[0075] In practice, the first RSU receives the third approval information sent by each vehicle within its communication range. Among them, the third approval information can be the fourth approval information and / or the fifth approval information. That is, the first RSU can receive the fourth approval information sent by the first vehicle and the fifth approval information sent by the remaining vehicles, or the first RSU only receives the fourth approval information sent by the first vehicle, or the first RSU only receives the fifth approval information sent by the remaining vehicles. When the first RSU receives the fourth approval information sent by the first vehicle and the fifth approval information sent by the remaining vehicles, the third approval information includes the fourth approval information and the fifth approval information; when the first RSU only receives the fourth approval information sent by the first vehicle, the third approval information is the fourth approval information; when the first RSU only receives the fifth approval information sent by the remaining vehicles, the third approval information is the fifth approval information.
[0076] Optionally, the first RSU may also not receive the fourth approval information sent by the first vehicle or the fifth approval information sent by the remaining vehicles, mainly due to the high mobility of the vehicles. Therefore, the first vehicle and the remaining vehicles respectively continuously forward the fourth approval information and the fifth approval information to at least one vehicle and at least one RSU within their respective communication ranges until the termination condition is reached.
[0077] Step 2) When the quantity of the third approval information is greater than the second threshold, the new block consensus is completed, and the new block is chained.
[0078] Specifically, after the first RSU receives the third approval information sent by each vehicle, it counts the quantity of the third approval information. If within a preset time interval, the quantity of the third approval information counted by the first RSU is greater than the second threshold, it is considered that the new block is "vehicle valid", that is, the new block consensus is completed, and the first RSU broadcasts the third preparation message to the remaining RSUs and other vehicles within its communication range. The third preparation message is used to indicate that the first RSU is ready to chain the block. At the same time, it will also receive the fourth preparation messages broadcast by the remaining RSUs and other vehicles within its communication range. The fourth preparation message is used to indicate that the remaining RSUs and other vehicles within the communication range are ready to chain the block; then, the first RSU counts the quantity of the fourth preparation messages broadcast by the remaining RSUs and other vehicles within its communication range. When this quantity is greater than the fourth preset threshold, the first RSU broadcasts a completion message to the remaining RSUs and other vehicles within its communication range. The completion message is used to indicate that the block chaining of the first RSU has been completed, and at the same time, the new block is chained; among them, other vehicles can be the first vehicle or the remaining vehicles, or a combination of the first vehicle and the remaining vehicles.
[0079] Optionally, if the number of the third approval messages counted by the first RSU is less than or equal to the second threshold within a preset time interval, it is considered that the new block is not "vehicle valid", and this new block will not be chained and will be discarded.
[0080] Optionally, if the preset time interval has been reached and the number of the third approval messages counted by the first RSU is still less than or equal to the second threshold, it is considered that the new block is not "vehicle valid", and this new block will not be chained and will be discarded.
[0081] The blockchain consensus method provided by the present invention receives and counts the number of the third approval messages sent by each vehicle within its communication range through the first RSU. When the number of the third approval messages is greater than the second threshold, the consensus of the new block is completed, and the new block is chained, realizing the forwarding and block consensus of the new block between the RSU and each vehicle, improving the utilization rate of communication resources and the efficiency of new block propagation, and at the same time, improving the efficiency of block consensus.
[0082] Optionally, after continuously forwarding the new block to at least one vehicle within the communication range of the first RSU in step 103, the specific implementation manner of the method further includes the following steps:
[0083] Step 1) Receive the first reputation value adjustment information sent by each vehicle; the first reputation value adjustment information is the third reputation value adjustment information and / or the fourth reputation value adjustment information; the third reputation value adjustment information is used to represent the adjustment information of the reputation value of the second RSU generated by the first vehicle according to the new block; the fourth reputation value adjustment information is used to represent the adjustment information of the reputation value of the second RSU generated by the remaining vehicles according to the new block.
[0084] Specifically, after the first RSU continuously forwards the new block to at least one vehicle within the communication range of the first RSU, for example, the first RSU forwards the new block to the first vehicle, and the first vehicle continuously forwards the new block to the remaining vehicles without modification.
[0085] After receiving the new block, the first vehicle generates adjustment information of the reputation value of the producer of the new block (i.e., the second RSU), that is, the third reputation value adjustment information, attaches the public key signature of the first vehicle, and continuously forwards the third reputation value adjustment information to at least one vehicle within the communication range of the first vehicle and at least one RSU within the communication range of the first vehicle until the termination condition is reached; the termination condition is that when the number of the third reputation value adjustment messages received by any vehicle is greater than the fifth preset threshold, the forwarding of the third reputation value adjustment information is terminated.
[0086] It should be noted that there may be at least one vehicle and at least one RSU within the communication range of the first vehicle, or only at least one vehicle, or only at least one RSU, or there may be no vehicles and RSU. Therefore, according to the actual position of the first vehicle, the third reputation value adjustment information can be received by at least one vehicle and RSU, or by at least one vehicle, or by at least one RSU, or neither by the RSU nor the vehicle.
[0087] Meanwhile, after the remaining vehicles receive the new block, they will also generate adjustment information for the reputation value of the producer of the new block (i.e., the second RSU), that is, the fourth reputation value adjustment information, append their own public key signature, and continuously forward the fourth reputation value adjustment information to at least one vehicle within the communication range of the remaining vehicles and at least one RSU within the communication range of the remaining vehicles until the termination condition is reached; where at least one vehicle within the communication range of the remaining vehicles can be the first vehicle or a vehicle other than the one that generates the fourth reputation value adjustment information among the remaining vehicles; at least one RSU can be the first RSU or other RSU other than the first RSU; the termination condition is that when the number of times any vehicle receives the fourth reputation value adjustment information is greater than the sixth preset threshold, the forwarding of the fourth reputation value adjustment information is terminated.
[0088] Specifically, taking the first vehicle generating the third reputation value adjustment information according to the new block as an example, the adjustment information for the reputation value of the producer of the new block (i.e., the second RSU) generated according to the new block is described. Among them, the specific form of the third reputation value adjustment information is shown in the following formula (1):
[0089]
[0090] Among them, represents the public key of the first vehicle V i , timestamp represents the timestamp information, Block_Hash represents the hash value of the block, and timestamp and Block_Hash are to ensure that the third reputation value adjustment information generated by the first vehicle V i is real-time valid; is_Vehicle_Valid represents whether the first vehicle approves of the behavior of the producer (the second RSU) of the new block; subsequently, the third reputation value adjustment information RV Vi is forwarded and cached by at least one RSU that receives it.
[0091] In practice, the first RSU receives the first reputation value adjustment information sent by each vehicle within its communication range. The first reputation value adjustment information may be the third reputation value adjustment information and / or the fourth reputation value adjustment information. That is, the first RSU may receive the third reputation value adjustment information sent by the first vehicle and the fourth reputation value adjustment information sent by the remaining vehicles, or the first RSU only receives the third reputation value adjustment information sent by the first vehicle, or the first RSU only receives the fourth reputation value adjustment information sent by the remaining vehicles. When the first RSU receives the third reputation value adjustment information sent by the first vehicle and the fourth reputation value adjustment information sent by the remaining vehicles, the first reputation value adjustment information includes the third reputation value adjustment information and the fourth reputation value adjustment information. When the first RSU only receives the third reputation value adjustment information sent by the first vehicle, the first reputation value adjustment information is the third reputation value adjustment information. When the first RSU only receives the fourth reputation value adjustment information sent by the remaining vehicles, the first reputation value adjustment information is the fourth reputation value adjustment information.
[0092] Optionally, the first RSU may also not receive the third reputation value adjustment information sent by the first vehicle or the fourth reputation value adjustment information sent by the remaining vehicles, mainly due to the high mobility of the vehicles. Therefore, the first vehicle and the remaining vehicles respectively continuously forward the third reputation value adjustment information and the fourth reputation value adjustment information to at least one vehicle and at least one RSU within their respective communication ranges until the termination condition is reached.
[0093] Step 2) When the quantity of the first reputation value adjustment information is greater than the third threshold, terminate forwarding the new block.
[0094] Specifically, after the first RSU receives the first reputation value adjustment information sent by each vehicle, it counts the quantity of the first reputation value adjustment information. If, within a preset time interval, the quantity of the first reputation value adjustment information counted by the first RSU is greater than the third threshold, it is considered that the forwarding of the new block is complete, and the forwarding process of the new block is terminated.
[0095] Optionally, if the preset time interval has been reached and the quantity of the first reputation value adjustment information counted by the first RSU is still less than or equal to the third threshold, the forwarding of the new block can also be terminated.
[0096] Step 3) When the quantity of the first reputation value adjustment information is less than or equal to the third threshold, continue to forward the new block.
[0097] Specifically, if, within a preset time interval, the quantity of the first reputation value adjustment information counted by the first RSU is less than or equal to the third threshold, continue to forward the new block.
[0098] The blockchain consensus method provided by the present invention receives and counts the number of first reputation value adjustment messages sent by each vehicle within its communication range through the first RSU. When the number of first reputation value adjustment messages is greater than a third threshold, the forwarding of the new block can be terminated; otherwise, the new block continues to be forwarded, realizing multiple forwarding of the new block between the RSU and each vehicle, thereby achieving block consensus, improving the utilization rate of communication resources, reducing the time for the new block to spread, and improving the efficiency of block consensus.
[0099] Optionally, the method further includes:
[0100] Sending the second reputation value adjustment message and the first reputation value adjustment message to the TA; the second reputation value adjustment message is used to represent the adjustment information of the reputation value of the second RSU generated by the first RSU according to the new block.
[0101] Specifically, after receiving the new block, the first RSU generates a second reputation value adjustment message according to the new block, attaches the public key signature of the first RSU, and caches it locally; wherein, the second reputation value adjustment message is used to represent the adjustment information of the reputation value of the second RSU generated by the first RSU according to the new block.
[0102] Specifically, taking the first RSU generating a second reputation value adjustment message according to the new block as an example, the adjustment information of the reputation value of the producer (i.e., the second RSU) of the new block generated according to the new block is described. Among them, the specific form of the second reputation value adjustment message is shown in the following formula (2):
[0103]
[0104] Among them, represents the public key of the first RSU RSU i timestamp represents the timestamp information, Block_Hash represents the hash value of the block, and timestamp and Block_Hash are used to ensure that the second reputation value adjustment message generated by the first vehicle V i is real-time valid; is_RSU_Valid represents whether the first RSU approves of the behavior of the producer (the second RSU) of the new block; subsequently, this second reputation value adjustment message is cached locally by the first RSU.
[0105] In practice, after the first RSU uploads a new block to the blockchain, the first RSU sends the first reputation value adjustment information and the second reputation value adjustment information to the TA. That is, the first RSU sends the first reputation value adjustment information generated by itself and the second reputation value adjustment information from different vehicles to the TA. The TA receives the first reputation value adjustment information and the second reputation value adjustment information, and updates the reputation value of the second RSU according to the first reputation value adjustment information and the second reputation value adjustment information.
[0106] The blockchain consensus method provided by the present invention enables the TA to update the reputation value of the second RSU by sending the first reputation value adjustment information and the second reputation value adjustment information to the TA through the first RSU, thereby preparing for the next selection of the RSU, improving the efficiency of RSU selection, and thus enhancing the efficiency of block consensus.
[0107] Figure 2 It is the second flow chart of the blockchain consensus method provided by the present invention. As Figure 2 shown, the method includes steps 201 - 208, where:
[0108] Step 201, designating the second RSU as the producer of the new block. If an RSU is a legal RSU, it has the qualification to generate a new block; the TA designates a second RSU with a relatively high reputation value as the producer of the new block each time according to the reputation values of multiple RSUs stored by it.
[0109] Step 202, the second RSU generates a new block. After receiving the block generation instruction from the TA, the second RSU packs the collected transaction information and generates a block; the new block includes basic information such as a random number, a timestamp, and a set of transaction values, and also includes the private key signature of the second RSU.
[0110] Step 203, the second RSU forwards the new block to the remaining RSUs. After generating the new block, the second RSU forwards it to the first RSU, and the first RSU forwards the new block to the remaining RSUs without modification, realizing the forwarding of the new block among the RSUs; at the same time, the first RSU verifies the legality of the new block. If it agrees with the legality of the new block, the first RSU generates the first approval information and forwards the first approval information to the remaining RSUs. At the same time, the remaining RSUs also verify the legality of the new block. If they agree with the legality of the new block, the remaining RSUs generate the second approval information and forward the second approval information. At the same time, the first RSU generates the second reputation value adjustment information for the block producer (i.e., the second RSU) based on the new block, encrypts it with its own public key, and temporarily stores it locally.
[0111] Step 204: Determine whether the forwarding of the new block has reached the preset time. During the forwarding of the new block, determine whether the preset time interval has been reached. If the preset time interval has been reached, go to Step 205; otherwise, go to Step 203.
[0112] Step 205: The first RSU counts the number of second recognition messages received from the other RSUs.
[0113] Step 206: Determine whether the number of second recognition messages is greater than the first threshold. If, within the preset time interval, the number of second recognition messages received by the first RSU is greater than the preset first threshold, and the new block is considered "RSU valid", then go to Step 207; otherwise, go to Step 208.
[0114] Step 207: Forward the new block to the vehicle. The first RSU continuously forwards the "RSU valid" new block to at least one vehicle within the communication range of the first RSU until the termination condition is met; wherein, the termination condition is that when the number of first reputation value adjustment messages counted by the first RSU is greater than the third threshold, the forwarding of the new block is terminated.
[0115] Step 208: Forward the second reputation value adjustment message generated by the first RSU to the TA. If, within the preset time interval, the number of second recognition messages received by the first RSU is less than or equal to the preset first threshold, and the new block is considered not "RSU valid", the new block will not be forwarded to the vehicle; at the same time, the first RSU sends the locally stored second reputation value adjustment message to the TA. Blocks that do not pass the "RSU valid" authentication will be discarded.
[0116] Figure 3 It is the third flowchart of the blockchain consensus method provided by the present invention, applied to the first vehicle, as Figure 3 shown, the method includes Step 301 - Step 303, where:
[0117] Step 301: Receive new blocks forwarded by at least one roadside unit RSU, and continuously forward the new blocks to the other vehicles; the new blocks are generated by the second RSU; the second RSU is selected by the reputation value management agency TA according to the reputation values of at least one stored RSU.
[0118] Specifically, in the case where the new block is determined to be "RSU valid", the first vehicle receives new blocks forwarded by at least one RSU, and after receiving the new blocks, continuously forwards the new blocks to the other vehicles without modification; wherein, the new blocks are generated by the second RSU; the second RSU is selected by the reputation value management agency TA according to the reputation values of at least one stored RSU.
[0119] Step 302: When the first vehicle recognizes the legality of the new block, generate fourth recognition information and forward the fourth recognition information to each of the RSUs and the remaining vehicles within the communication range of the first vehicle; the fourth recognition information is used to indicate that the first vehicle recognizes the legality of the new block.
[0120] Specifically, after the first vehicle receives the new block forwarded by at least one RSU, it verifies the legality of the new block. If the first vehicle recognizes the legality of the new block, it generates fourth recognition information and forwards the fourth recognition information to the remaining vehicles and at least one RSU within the communication range of the first vehicle. If it does not recognize the legality of the new block, it does not generate fourth recognition information; among them, the fourth recognition information is used to indicate that the first vehicle recognizes the legality of the new block.
[0121] Step 303: Receive the fifth recognition information sent by the remaining vehicles. When the quantity of the fifth recognition information is greater than the fourth threshold, the consensus on the new block is completed, and the new block is chained; the fifth recognition information is used to indicate that the remaining vehicles recognize the legality of the new block.
[0122] Specifically, after the remaining vehicles receive the new block, they also verify the legality of the new block. If the remaining vehicles recognize the legality of the new block, they generate fifth recognition information and forward the fifth recognition information to other vehicles and at least one RSU within the communication range of the remaining vehicles; if the remaining vehicles do not recognize the legality of the new block, they do not generate fifth recognition information; among them, the fifth recognition information is used to indicate that the remaining vehicles recognize the legality of the new block, and other vehicles can be the vehicles among the remaining vehicles except those that generate the fifth recognition information.
[0123] In practice, the first vehicle receives the fifth recognition information sent by the remaining vehicles and counts the quantity of the fifth recognition information. If, within a preset time interval, the quantity of the fifth recognition information counted by the first vehicle is greater than the fourth threshold, it is considered that the new block is "vehicle-valid", that is, the consensus on the new block is completed, and a fifth preparation message is broadcast to at least one RSU and the remaining vehicles within the communication range. The fifth preparation message is used to indicate that the first vehicle is ready to chain the new block; then, the first vehicle counts the quantity of the sixth preparation message. The sixth preparation message is used to indicate that the remaining vehicles and the RSU are ready to chain the new block. When the quantity is greater than the seventh preset threshold, the first vehicle broadcasts a completion message to at least one RSU and the remaining vehicles. The completion message is used to indicate that the first vehicle has chained the new block, and at the same time, the new block is chained.
[0124] Optionally, if the number of the fifth approval messages counted by the first vehicle is less than or equal to the fourth threshold within a preset time interval, it is considered that the new block is not "vehicle-valid", and this new block will not be chained and will be discarded.
[0125] Optionally, if the preset time interval has been reached and the number of the fifth approval messages counted by the first vehicle is still less than or equal to the fourth threshold, it is considered that the new block is not "vehicle-valid", and this new block will not be chained and will be discarded.
[0126] The blockchain consensus method provided by the present invention includes: the first vehicle receives at least one new block forwarded by an RSU, forwards the new block, and verifies the legality of the new block; in the case of recognizing the legality of the new block, generates a fourth approval message, and forwards the fourth approval message to each RSU and the remaining vehicles within the communication range of the first vehicle; at the same time, also receives the fifth approval messages sent by the remaining vehicles, and counts the fifth approval messages; in the case that the number of the fifth approval messages is greater than the fourth threshold, it is considered that the consensus of the new block is completed, and the new block is chained. The method provided by the present invention improves the utilization rate of communication resources, reduces the time for the propagation of the new block, and improves the efficiency of block consensus.
[0127] Optionally, after forwarding the fourth approval message to each of the RSUs and the remaining vehicles within the communication range of the first vehicle in step 302 above, the implementation manner of the method further includes the following steps:
[0128] Step 1) Receive the fourth reputation value adjustment information sent by the remaining vehicles; the fourth reputation value adjustment information is used to represent the adjustment information of the reputation value of the target RSU generated by the remaining vehicles according to the new block.
[0129] Specifically, during the forwarding process of the new block, after receiving the new block, the remaining vehicles generate the fourth reputation value adjustment information according to the new block and forward the fourth reputation value adjustment information; the first vehicle can receive the fourth reputation value adjustment information sent by the remaining vehicles.
[0130] Step 2) When the number of the fourth reputation value adjustment information is greater than the fifth threshold, terminate forwarding the new block to the remaining vehicles.
[0131] Specifically, after receiving the fourth reputation value adjustment information sent by the remaining vehicles, the first vehicle counts the number of the fourth reputation value adjustment information; if the number of the fourth reputation value adjustment information counted by the first vehicle is greater than the fifth threshold within a preset time interval, it is considered that the forwarding of the new block is complete, and the forwarding process of the new block is terminated.
[0132] Optionally, if the preset time interval has been reached and the number of fourth reputation value adjustment information statistics by the first vehicle is still less than or equal to the threshold, the forwarding of the new block can also be terminated.
[0133] Step 3) When the number of the second reputation value adjustment information is less than or equal to the fifth threshold, continue to forward the new block to the remaining vehicles.
[0134] Specifically, after the first vehicle receives the fourth reputation value adjustment information sent by the remaining vehicles, it counts the number of the fourth reputation value adjustment information. When the number of the fourth reputation value adjustment information is less than or equal to the fifth threshold, the first vehicle terminates forwarding the new block to the remaining vehicles.
[0135] The blockchain consensus method provided by the present invention receives and counts the number of the fourth reputation value adjustment information sent by the remaining vehicles through the first vehicle. When the number of the fourth reputation value adjustment information is greater than the fifth threshold, the forwarding of the new block can be terminated. Otherwise, continue to forward the new block to the remaining vehicles, realizing multiple forwarding and verification of the new block between the RSU and the vehicles, and among the vehicles, thereby achieving block consensus, improving the utilization rate of communication resources, reducing the time for the new block to spread, and improving the efficiency of block consensus.
[0136] Figure 4 is the fourth flow diagram of the blockchain consensus method provided by the present invention. As Figure 4 shown, the method includes steps 401 - 407, where:
[0137] Step 401, the first vehicle receives the new block forwarded by at least one RSU. The first vehicle receives the new block forwarded by at least one RSU within its communication range and continuously forwards the new block to the remaining vehicles without modification until the termination condition is met; where the termination condition is that when the number of the fourth reputation value adjustment information counted by the first vehicle is greater than the fifth threshold, the forwarding of the new block is terminated.
[0138] Step 402, the first vehicle verifies the legality of the new block. If the first vehicle approves of the legality of the new block, the first vehicle generates the fourth approval information and forwards the fourth approval information to at least one RSU and the remaining vehicles within the communication range of the first vehicle; where the fourth approval information is used to indicate that the first vehicle approves of the legality of the new block; the first vehicle also receives the fifth approval information sent by the remaining vehicles. At the same time, the first vehicle generates the reputation value adjustment information for the second RSU according to the new block, that is, the third reputation value adjustment information.
[0139] Step 403: Determine whether the forwarding of the new block has reached the preset time. During the forwarding process of the new block, determine whether the preset time interval is reached. If the preset time interval is reached, proceed to Step 404; otherwise, proceed to Step 402.
[0140] Step 404: The first vehicle counts the number of fifth approval messages received from the other vehicles.
[0141] Step 405: Determine whether the number of fifth approval messages is greater than the fourth threshold. If, within the preset time interval, the number of fifth approval messages received by the first vehicle is greater than the preset fourth threshold, it is considered that the new block is "vehicle valid", and at the same time, the new block consensus is completed, then proceed to Step 406; otherwise, proceed to Step 407.
[0142] Step 406: Upload the new block to the chain. The first vehicle broadcasts a fifth preparation message to at least one RSU and the other vehicles within its communication range. The fifth preparation message is used to indicate that the first vehicle is ready to upload the block to the chain. At the same time, it will also receive sixth preparation messages broadcast by the other vehicles and at least one RSU. The sixth preparation message is used to indicate that the other vehicles and the RSU are ready to upload the block to the chain. Then, the first vehicle counts the number of sixth preparation messages. If this number is greater than the seventh preset threshold, the first vehicle broadcasts a completion message to at least one RSU and the other vehicles. The completion message is used to indicate that the first vehicle has uploaded the new block to the chain, and at the same time, uploads the new block to the chain.
[0143] Step 407: The first vehicle forwards the generated third reputation value adjustment information to at least one RSU within the communication range of the first RSU. If, within the preset time interval, the number of fifth approval messages received by the first vehicle is less than or equal to the preset fourth threshold, it is considered that the new block is not "vehicle valid", and this new block will not be uploaded to the chain and will be discarded; at the same time, the first vehicle sends the locally stored third reputation value adjustment information to at least one RSU within the communication range of the first RSU.
[0144] Next, taking the TA receiving the third reputation value adjustment information and the first reputation value adjustment information sent by the first RSU as an example, the situation where the TA manages the reputation value, receives the reputation value adjustment information, and updates the reputation value of the second RSU will be described.
[0145] Step 1): When the TA selects the second RSU with a higher reputation value as the generator of the new block based on the reputation values of at least one RSU, record the identity ID of the second RSU.
[0146] Step 2): After receiving the second reputation value adjustment information generated by the first RSU then, first use the first RSU RSU iThe private key is used to verify the authenticity of the second reputation value adjustment information. If the identity ID of the generator of the second reputation value adjustment information (i.e., the first RSU) does not match the pre-allocated public-private key pair, or the timestamp information timestamp in the second reputation value adjustment information does not meet the conditions of the current time interval, or the block hash value Block_Hash does not match the hash value of the current new block, then the second reputation value adjustment information is rejected; if all the above conditions are met, then the judgment information is_RSU_Valid in the second reputation value adjustment information is queried.
[0147] Step 3) After receiving the third reputation value adjustment information sent by the first RSU and generated by the first vehicle V i First, the private key of the first vehicle V is used to verify the authenticity of the third reputation value adjustment information. If the identity i of the generator of the third reputation value adjustment information (i.e., the first vehicle) does not match the pre-allocated public-private key pair, or the timestamp information timestamp in the third reputation value adjustment information does not meet the conditions of the current time interval, or the block hash value Block_Hash does not match the hash value of the current new block, then the third reputation value adjustment information is rejected; if all the above conditions are met, then the judgment information is_Vehicle_Valid in the third reputation value adjustment information is queried.
[0148] Step 4) According to the identity ID of the generator of the new block, the reputation value tables of multiple RSUs maintained by TA are queried.
[0149] Then, according to the judgment information is_RSU_Valid of the second reputation value adjustment information of the first RSU and the judgment information is_Vehicle_Valid of the third reputation value adjustment information of the first vehicle, TA judges and updates the reputation value situation of the second RSU.
[0150] If is_RSU_Valid = 0 and is_Vehicle_Valid = 0, then TA performs a deduction operation on the reputation value of the second RSU that generates the new block, TA changes the reputation value of the second RSU and updates the maintained reputation value tables of multiple RSUs;
[0151] If is_RSU_Valid = 1 and is_Vehicle_Valid = 0, then TA keeps the reputation value of the second RSU that generates the new block unchanged, and TA updates the maintained reputation value tables of multiple RSUs;
[0152] If is_RSU_Valid = 1 and is_Vehicle_Valid = 1, then the TA performs an increase operation on the reputation value of the second RSU for generating a new block, changes the reputation value of the second RSU, and updates the maintained reputation value table of multiple RSUs.
[0153] Figure 5 It is the fifth flowchart of the blockchain consensus method provided by the present invention. As Figure 5 shown, the method includes steps 501 - step 510, where:
[0154] Step 501, the TA selects the second RSU with a higher reputation value as the generator of the new block according to the reputation values of at least one RSU.
[0155] Step 502, the TA listens for the reputation value adjustment information sent by the first RSU.
[0156] Step 503, determine whether the reputation value adjustment information is generated by the second RSU. If the reputation value adjustment information is generated by the second RSU, then go to step 504;
[0157] Step 504, determine whether the value of the judgment information is_RSU_Valid of the reputation value adjustment information is 1. If the value of is_RSU_Valid is 1, then go to step 506, otherwise go to step 505;
[0158] Step 505, deduct the reputation value of the second RSU;
[0159] Step 506, keep the reputation value of the second RSU unchanged;
[0160] Step 507, determine whether the reputation value adjustment information is generated by the first vehicle. If the reputation value adjustment information is generated by the first vehicle, then go to step 508;
[0161] Step 508, determine whether the value of the judgment information is_Vehicle_Valid of the reputation value adjustment information is 1. If the value of is_Vehicle_Valid is 1, then go to step 509, otherwise go to step 507;
[0162] Step 509, increase the reputation value of the second RSU;
[0163] Step 510, update the reputation value table maintained by the TA.
[0164] Figure 6 It is the framework structure diagram of the blockchain consensus method provided by the present invention. As Figure 6As shown in the figure, it includes TA601, RSU module 602, and vehicle module 603. Among them, TA601 includes a reputation value storage module 6011, a reputation value update module 6012, and an identity issuance module 6013. The reputation value storage module 6011 is used to store the reputation values of multiple RSUs and multiple vehicles. The reputation value update module 6012 is used to receive the reputation value adjustment information sent by multiple RSUs and update the reputation value of the second RSU based on this reputation value adjustment information. The identity issuance module 6013 is used to issue identity information and public-private key pairs to multiple RSUs, and issue the identity information and public-private key pairs of each vehicle to multiple vehicles.
[0165] The RSU module 602 includes RSU6021, RSU6022, RSU6023, RSU6024, RSU6025, and the vehicle module 603 includes vehicle 6031, vehicle 6032, vehicle 6033, vehicle 6034, vehicle 6035. Each RSU in the RSU module 602 includes a digital signature and verification unit, a block forwarding module, and a block verification unit. Among them, RSU6021, RSU6022, RSU6023, RSU6024, and RSU6025 are legal and can all be block producers. They send new blocks to each vehicle in the vehicle module 603 and can receive verification feedback from each vehicle on the new blocks. The digital signature and verification unit is used to append its own private key signature to the block to be verified, and at the same time, verify the legality of the private key signature included in the block. The block forwarding unit is used to forward the block between RSUs, between RSU and vehicle, and between vehicles. The block verification unit is used to verify the integrity and legality of the block.
[0166] For example, taking RSU6021 as the second RSU, RSU602 as the first RSU, and vehicle 6031 as the first vehicle as an example, the blockchain consensus method provided by the present invention will be described.
[0167] Specifically, TA601 selects an RSU6021 with a relatively high reputation value as the producer of the new block according to the reputation value table of multiple RSUs maintained. That is, RSU6021 is the second RSU. After receiving the block generation instruction from TA601, RSU6021 packs the collected transaction information, generates a new block 604, and appends its own private key signature to the new block 604.
[0168] Next, the RSU6021 forwards the new block 604 to the RSU6022. As the first RSU, the RSU6022 forwards the new block to the RSU6023, RSU6024, and RSU6025. At the same time, after receiving the new block 604, the RSU6023, RSU6024, and RSU6025 respectively forward the new block 604 to the other RSUs except themselves without modification, that is, all the RSUs participate in the forwarding process of the new block together.
[0169] After receiving the new block 604, the RSU6022, RSU6023, RSU6024, and RSU6025 respectively verify the legality of the new block 604. If the RSU6022 approves the legality of the new block 604, it generates the first approval information and forwards the first approval information. If the RSU6022 does not approve the legality of the new block 604, it does not generate the first approval information. If the RSU6023, RSU6024, and RSU6025 approve the legality of the new block 604, they generate the second approval information and forward the second approval information. If the RSU6023, RSU6024, and RSU6025 do not approve the legality of the new block 604, they do not generate the second approval information.
[0170] At the same time, the RSU6022 generates the second reputation value adjustment information for the RSU6021 based on the new block 604, signs it with its own public key, and temporarily stores it locally. The RSU6023, RSU6024, and RSU6025 generate the fifth reputation value adjustment information for the RSU6021 based on the new block 604, sign it with their own public keys, and temporarily store it locally.
[0171] Next, the RSU6022 respectively counts the number of the received second approval information. Within a preset time interval, if the number of the second approval information is greater than a preset first threshold, it is considered that the new block 604 is "RSU valid", and the RSU6022 forwards the new block 604 to the vehicle 6031 within the communication range of the RSU6022. The vehicle 6031 is the first vehicle. At the same time, the vehicle 6031 forwards the new block to the vehicles 6032, 6033, 6034, and 6035. Among them, at the same time, the vehicle 6031 records the fourth approval information and the fourth reputation value adjustment information of each vehicle returned from the vehicles 6032, 6033, 6034, and 6035 for the new block 604.
[0172] If the quantity of the second approval information is less than or equal to a preset first threshold value, it is considered that the new block 604 is not "RSU valid", and the new block 604 is not forwarded to vehicles 6031, 6032, 6033, 6034, and 6035 within the communication range of RSU6022. The new block 604 is discarded, and the reputation value adjustment information generated by each RSU before is fed back to the TA.
[0173] After receiving the new block 604 forwarded by RSU6022, RSU6023, RSU6024, and RSU6025, vehicles 6031, 6032, 6033, 6034, and 6035 forward the new block 604 without modification to the remaining vehicles except themselves; meanwhile, vehicles 6031, 6032, 6033, 6034, and 6035 respectively verify the legality of the new block 604. If vehicle 6031 approves the legality of the new block 604, a fourth approval information is generated and forwarded to the RSU and the remaining vehicles within the communication range of vehicle 6031; if vehicle 6031 does not approve the legality of the new block 604, no fourth approval information is generated; if vehicles 6032, 6033, 6034, and 6035 approve the legality of the new block 604, a fifth approval information is generated and forwarded to the RSU and the remaining vehicles within the communication range of each vehicle; if vehicles 6032, 6033, 6034, and 6035 do not approve the legality of the new block 604, no fifth approval information is generated.
[0174] Meanwhile, vehicle 6031 generates a third reputation value adjustment information for RSU6021 based on the new block 604, and forwards it to the RSU and the remaining vehicles within the communication range of vehicle 6031 after signing with its own public key. Vehicles 6032, 6033, 6034, and 6035 respectively generate a fourth reputation value adjustment information for RSU6021 based on the new block 604, and forwards it to the RSU and the remaining vehicles within the communication range of each vehicle after signing with their own public keys.
[0175] The first RSU counts the third approval information received from each vehicle. The third approval information includes the fourth approval information and the fifth approval information, as well as the first reputation value adjustment information sent by each vehicle; the first reputation value adjustment information includes the third reputation value adjustment information and the fourth reputation value adjustment information; the first vehicle counts the fifth approval information received from the remaining vehicles, and counts the fourth reputation value adjustment information sent by the remaining vehicles.
[0176] If the number of first reputation value adjustment messages received by the first RSU from each vehicle is greater than a preset third threshold, it is considered that the propagation of the new block 604 in the entire network is almost complete, and the first RSU stops forwarding the new block; otherwise, it continues to forward the new block.
[0177] If the number of fourth reputation value adjustment messages received by the first vehicle from the remaining vehicles is greater than a preset fifth threshold, it is considered that the propagation of the new block 604 in the entire network is almost complete, and the first vehicle stops forwarding the new block; otherwise, it continues to forward the new block.
[0178] If the number of third approval messages received by the first RSU from each vehicle is greater than a preset second threshold, it is considered that the new block 604 is "vehicle valid", the consensus of the new block 604 is completed, the first RSU chains the new block, and at the same time, the first RSU sends the first reputation value adjustment messages received from each vehicle and the second reputation value adjustment messages generated by itself before to the TA; otherwise, it is considered that the new block 604 is not "vehicle valid", and the new block 604 is discarded.
[0179] If the number of fifth approval messages received by the first vehicle from the remaining vehicles is greater than a preset fifth threshold, it is considered that the new block 604 is "vehicle valid", the consensus of the new block 604 is completed, and the first vehicle chains the new block 604; otherwise, it is considered that the new block 604 is not "vehicle valid", and the new block 604 is discarded.
[0180] The blockchain consensus device provided by the present invention is described below. The blockchain consensus device described below can be correspondingly referred to the blockchain consensus method described above.
[0181] Figure 7 FIG. is one of the structural schematic diagrams of the blockchain consensus device provided by the present invention, which is applied to the first RSU. The blockchain consensus device 700 includes a first forwarding module 701, a first generating module 702, and a second forwarding module 703; wherein:
[0182] The first forwarding module 701 is configured to receive a new block sent by the second RSU and forward the new block to the remaining RSUs; the second RSU is selected by the reputation value management agency TA according to the stored reputation values of at least one RSU; the new block is generated by the second RSU.
[0183] The first generating module 702 is configured to generate a first approval message and forward the first approval message to the remaining RSUs when the first RSU approves the legality of the new block; the first approval message is used to indicate that the first RSU approves the legality of the new block.
[0184] The second forwarding module 703 is configured to receive the second approval information sent by the remaining RSUs, and when the quantity of the second approval information is greater than a first threshold, continuously forward the new block to at least one vehicle within the communication range of the first RSU; the second approval information is used to indicate that the remaining RSUs approve the legality of the new block.
[0185] The blockchain consensus device provided by the present invention receives a new block sent by a second RSU through a first RSU and forwards the new block to the remaining RSUs; at the same time, verifies the legality of the new block, generates first approval information when approving the legality of the new block, and also forwards the first approval information to the remaining RSUs; then, receives the second approval information sent by the remaining RSUs, and when the quantity of the second approval information is greater than the first threshold, considers the new block as "RSU valid" and continuously forwards the new block to at least one vehicle within the communication range of the first RSU. The device provided by the present invention improves the propagation efficiency of the new block in the entire network and the utilization rate of communication resources by forwarding the new block among the RSUs and continuously forwarding the new block to each vehicle, and at the same time, improves the efficiency of block consensus.
[0186] Optionally, the device 700 further includes:
[0187] A first receiving module, configured to receive third approval information sent by each of the vehicles; the third approval information is fourth approval information, and / or fifth approval information; the fourth approval information is used to indicate that the first vehicle approves the legality of the new block; the fifth approval information is used to indicate that the remaining vehicles approve the legality of the new block;
[0188] A first chain-uploading module, configured to, when the quantity of the third approval information is greater than a second threshold, complete the consensus of the new block and upload the new block to the chain.
[0189] Optionally, the device 700 further includes:
[0190] A second receiving module, configured to receive first reputation value adjustment information sent by each of the vehicles; the first reputation value adjustment information is third reputation value adjustment information, and / or fourth reputation value adjustment information; the third reputation value adjustment information is used to indicate that the first vehicle generates adjustment information for the reputation value of the second RSU according to the new block; the fourth reputation value adjustment information is used to indicate that the remaining vehicles generate adjustment information for the reputation value of the second RSU according to the new block;
[0191] A fifth forwarding module, configured to terminate forwarding the new block when the quantity of the first reputation value adjustment information is greater than a third threshold;
[0192] A sixth forwarding module, configured to continue forwarding the new block when the number of the first reputation value adjustment information is less than or equal to a third threshold.
[0193] Optionally, the apparatus 700 further includes:
[0194] A first sending module, configured to send second reputation value adjustment information and the first reputation value adjustment information to the TA; the second reputation value adjustment information is used to represent that the first RSU generates adjustment information for the reputation value of the second RSU according to the new block.
[0195] Figure 8 FIG. 2 is a schematic structural diagram of a blockchain consensus apparatus provided by the present invention, applied to a first vehicle. The blockchain consensus apparatus 800 includes a third forwarding module 801, a second generating module 802, and a fourth forwarding module 803; wherein:
[0196] The third forwarding module 801 is configured to receive a new block forwarded by at least one roadside unit (RSU), and continuously forward the new block to the remaining vehicles; the new block is generated by a second RSU; the second RSU is selected by a reputation value management authority (TA) according to the reputation values of at least one stored RSU.
[0197] The second generating module 802 is configured to generate fourth approval information and forward the fourth approval information to each of the RSU and the remaining vehicles within the communication range of the first vehicle when the first vehicle approves the legitimacy of the new block; the fourth approval information is used to represent that the first vehicle approves the legitimacy of the new block.
[0198] The fourth forwarding module 803 is configured to receive the fifth approval information sent by the remaining vehicles, and when the number of the fifth approval information is greater than a fourth threshold, the new block consensus is completed, and the new block is chained; the fifth approval information is used to represent that the remaining vehicles approve the legitimacy of the new block.
[0199] The blockchain consensus apparatus provided by the present invention receives a new block forwarded by at least one RSU through a first vehicle, forwards the new block, and verifies the legitimacy of the new block; when the legitimacy of the new block is approved, fourth approval information is generated and the fourth approval information is forwarded to each RSU and the remaining vehicles within the communication range of the first vehicle; at the same time, the fifth approval information sent by the remaining vehicles is also received, and the fifth approval information is counted; when the number of the fifth approval information is greater than a fourth threshold, it is considered that the new block consensus is completed, and the new block is chained. The apparatus provided by the present invention improves the utilization rate of communication resources, reduces the time for new block propagation, and improves the efficiency of block consensus.
[0200] Optionally, the device 800 further includes:
[0201] A third receiving module, configured to receive fourth reputation value adjustment information sent by the remaining vehicles; the fourth reputation value adjustment information is used to represent adjustment information for the target RSU reputation value generated by the remaining vehicles according to the new block;
[0202] A seventh forwarding module, configured to terminate forwarding the new block to the remaining vehicles when the number of the fourth reputation value adjustment information is greater than a fifth threshold;
[0203] An eighth forwarding module, configured to continue forwarding the new block to the remaining vehicles when the number of the fourth reputation value adjustment information is less than or equal to the fifth threshold.
[0204] Figure 9 It is a schematic diagram of the entity structure of a first RSU provided by the present invention. As Figure 9 shown, the electronic device 900 may include: a processor 910, a communications interface 920, a memory 930, and a communication bus 940. Among them, the processor 910, the communications interface 920, and the memory 930 complete mutual communication through the communication bus 940. The processor 910 may call logic instructions in the memory 930 to execute a blockchain consensus method, which includes: receiving a new block sent by a second RSU, and forwarding the new block to the remaining RSUs; the second RSU is selected by a reputation value management institution TA according to the reputation values of at least one RSU stored; the new block is generated by the second RSU; when the first RSU approves the legality of the new block, generating a first approval information and forwarding the first approval information to the remaining RSUs; the first approval information is used to represent that the first RSU approves the legality of the new block; receiving second approval information sent by the remaining RSUs, and when the number of the second approval information is greater than a first threshold, continuously forwarding the new block to at least one vehicle within the communication range of the first RSU; the second approval information is used to represent that the remaining RSUs approve the legality of the new block.
[0205] Optionally, the present invention further provides a first vehicle, which may include: a processor, a communications interface, a memory, and a communication bus. Among them, the processor, the communication interface, and the memory complete communication with each other through the communication bus. The processor may call the logical instructions in the memory to execute a blockchain consensus method, which includes: receiving a new block forwarded by at least one roadside unit (RSU), and continuously forwarding the new block to the remaining vehicles; the new block is generated by a second RSU; the second RSU is selected by a reputation value management institution (TA) according to the stored reputation values of at least one RSU; in the case where the first vehicle recognizes the legality of the new block, generating a fourth recognition information, and forwarding the fourth recognition information to each of the RSU and the remaining vehicles within the communication range of the first vehicle; the fourth recognition information is used to indicate that the first vehicle recognizes the legality of the new block; receiving the fifth recognition information sent by the remaining vehicles, and in the case where the number of the fifth recognition information is greater than a fourth threshold, the new block consensus is completed, and the new block is chained; the fifth recognition information is used to indicate that the remaining vehicles recognize the legality of the new block; the fifth recognition information is used to indicate that the remaining vehicles recognize the legality of the new block.
[0206] In addition, when the logical instructions in the above-mentioned memory 930 are implemented in the form of software function units and sold or used as an independent product, they may be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or a part of this technical solution, may be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in various embodiments of the present invention. The foregoing storage medium includes: various media such as USB flash drives, mobile hard disks, read-only memories (ROMs), random access memories (RAMs), magnetic disks, or optical discs that can store program codes.
[0207] On the other hand, the present invention also provides a computer program product, which includes a computer program. The computer program can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the blockchain consensus method provided by each of the above methods. The method includes: receiving a new block sent by a second RSU, and forwarding the new block to the remaining RSUs; the second RSU is selected by a reputation value management institution TA according to the stored reputation values of at least one RSU; the new block is generated by the second RSU; when the first RSU approves the legality of the new block, generating a first approval message and forwarding the first approval message to the remaining RSUs; the first approval message is used to indicate that the first RSU approves the legality of the new block; receiving second approval messages sent by the remaining RSUs, and when the number of the second approval messages is greater than a first threshold, continuously forwarding the new block to at least one vehicle within the communication range of the first RSU; the second approval message is used to indicate that the remaining RSUs approve the legality of the new block.
[0208] On the other hand, the present invention also provides a computer program product, which includes a computer program. The computer program can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the blockchain consensus method provided by each of the above methods. The method includes: receiving a new block forwarded by at least one roadside unit (RSU), and continuously forwarding the new block to the remaining vehicles; the new block is generated by a second RSU; the second RSU is selected by a reputation value management institution TA according to the stored reputation values of at least one RSU; when the first vehicle approves the legality of the new block, generating a fourth approval message and forwarding the fourth approval message to each of the RSUs and the remaining vehicles within the communication range of the first vehicle; the fourth approval message is used to indicate that the first vehicle approves the legality of the new block; receiving the fifth approval message sent by the remaining vehicles, and when the number of the fifth approval messages is greater than a fourth threshold, the new block consensus is completed and the new block is uploaded to the chain; the fifth approval message is used to indicate that the remaining vehicles approve the legality of the new block; the fifth approval message is used to indicate that the remaining vehicles approve the legality of the new block.
[0209] In another aspect, the present invention also provides a non-transitory computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, it implements the blockchain consensus method provided by the above-mentioned various methods. The method includes: receiving a new block sent by a second RSU, and forwarding the new block to the remaining RSUs; the second RSU is selected by a reputation value management institution TA according to the stored reputation values of at least one RSU; the new block is generated by the second RSU; in the case where the first RSU approves the legitimacy of the new block, generating a first approval message and forwarding the first approval message to the remaining RSUs; the first approval message is used to indicate that the first RSU approves the legitimacy of the new block; receiving the second approval messages sent by the remaining RSUs, and in the case where the number of the second approval messages is greater than a first threshold, continuously forwarding the new block to at least one vehicle within the communication range of the first RSU; the second approval message is used to indicate that the remaining RSUs approve the legitimacy of the new block.
[0210] In another aspect, the present invention also provides a non-transitory computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, it implements the blockchain consensus method provided by the above-mentioned various methods. The method includes: receiving a new block forwarded by at least one roadside unit (RSU), and continuously forwarding the new block to the remaining vehicles; the new block is generated by a second RSU; the second RSU is selected by a reputation value management institution TA according to the stored reputation values of at least one RSU; in the case where the first vehicle approves the legitimacy of the new block, generating a fourth approval message and forwarding the fourth approval message to each of the RSUs and the remaining vehicles within the communication range of the first vehicle; the fourth approval message is used to indicate that the first vehicle approves the legitimacy of the new block; receiving the fifth approval messages sent by the remaining vehicles, and in the case where the number of the fifth approval messages is greater than a fourth threshold, the new block consensus is completed and the new block is chained; the fifth approval message is used to indicate that the remaining vehicles approve the legitimacy of the new block; the fifth approval message is used to indicate that the remaining vehicles approve the legitimacy of the new block.
[0211] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed to multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment. Those of ordinary skill in the art can understand and implement it without creative efforts.
[0212] Through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on such an understanding, the essence of the above technical solution, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0213] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions recorded in the foregoing embodiments, or perform equivalent replacements for some of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A blockchain consensus method, characterized in that, Applied to the first roadside unit (RSU), the method includes: Receiving a new block sent by a second RSU and forwarding the new block to the remaining RSUs; the second RSU is selected by the reputation value management institution (TA) according to the stored reputation values of at least one RSU; the new block is generated by the second RSU. When the first RSU approves the legality of the new block, generating first approval information and forwarding the first approval information to the remaining RSUs; the first approval information is used to indicate that the first RSU approves the legality of the new block. Receiving second approval information sent by the remaining RSUs, and when the quantity of the second approval information is greater than a first threshold, broadcasting a first preparation message to the remaining RSUs, where the first preparation message is used to indicate that the first RSU has completed the preparation work for forwarding the new block to vehicles. Receiving a second preparation message broadcast by the remaining RSUs, where the second preparation message is used to indicate that the remaining RSUs have completed the preparation work for forwarding the new block to vehicles; when the quantity of the second preparation message is greater than a first preset threshold, continuously forwarding the new block to at least one vehicle within the communication range of the first RSU; the second approval information is used to indicate that the remaining RSUs approve the legality of the new block.
2. The blockchain consensus method according to claim 1, characterized in that After continuously forwarding the new block to at least one vehicle within the communication range of the first RSU, the method further includes: Receiving third approval information sent by each of the vehicles; the third approval information is fourth approval information and / or fifth approval information; the fourth approval information is used to indicate that a first vehicle approves the legality of the new block; the fifth approval information is used to indicate that the remaining vehicles approve the legality of the new block. When the quantity of the third approval information is greater than a second threshold, the consensus on the new block is completed, and the new block is chained.
3. The blockchain consensus method according to claim 1, wherein After continuously forwarding the new block to at least one vehicle within the communication range of the first RSU, the method further includes: Receiving first reputation value adjustment information sent by each of the vehicles; the first reputation value adjustment information is third reputation value adjustment information and / or fourth reputation value adjustment information; the third reputation value adjustment information is used to indicate that a first vehicle generates adjustment information for the reputation value of the second RSU according to the new block; the fourth reputation value adjustment information is used to indicate that the remaining vehicles generate adjustment information for the reputation value of the second RSU according to the new block. When the quantity of the first reputation value adjustment information is greater than a third threshold, terminate forwarding the new block. When the quantity of the first reputation value adjustment information is less than or equal to the third threshold, continue to forward the new block.
4. The blockchain consensus method according to claim 3, wherein The method further includes: Sending second reputation value adjustment information and the first reputation value adjustment information to the TA; the second reputation value adjustment information is used to indicate that the first RSU generates adjustment information for the reputation value of the second RSU according to the new block.
5. A blockchain consensus method, characterized in that, Applied to a first vehicle, the method includes: Receive at least one new block forwarded by a roadside unit (RSU), and continuously forward the new block to the remaining vehicles; the new block is generated by a second RSU; the second RSU is selected by a reputation value management agency (TA) according to the reputation values of at least one stored RSU; When the first vehicle recognizes the legality of the new block, generate a fourth recognition message, and forward the fourth recognition message to each of the RSU and the remaining vehicles within the communication range of the first vehicle; the fourth recognition message is used to indicate that the first vehicle recognizes the legality of the new block; Receive the fifth recognition message sent by the remaining vehicles. When the quantity of the fifth recognition message is greater than a fourth threshold, the consensus on the new block is completed, and broadcast a fifth preparation message to the at least one RSU and the remaining vehicles within the communication range. The fifth preparation message is used to indicate that the first vehicle is ready to upload the new block to the chain; Receive the sixth preparation message sent by the remaining vehicles. When the quantity of the sixth preparation message is greater than a seventh preset threshold, the first vehicle broadcasts a completion message to the at least one RSU and the remaining vehicles. The completion message is used to indicate that the first vehicle has uploaded the new block to the chain, and at the same time upload the new block to the chain; the fifth recognition message is used to indicate that the remaining vehicles recognize the legality of the new block.
6. The blockchain consensus method according to claim 5, wherein After forwarding the fourth recognition message to each of the RSU and the remaining vehicles within the communication range of the first vehicle, the method further includes: Receive the fourth reputation value adjustment information sent by the remaining vehicles; the fourth reputation value adjustment information is used to indicate that the remaining vehicles generate adjustment information for the reputation value of a target RSU according to the new block; When the quantity of the fourth reputation value adjustment information is greater than a fifth threshold, terminate forwarding the new block to the remaining vehicles; When the quantity of the fourth reputation value adjustment information is less than or equal to the fifth threshold, continue to forward the new block to the remaining vehicles.
7. A blockchain consensus device, characterized in that, Applied to a first roadside unit (RSU), the device includes: A first forwarding module, configured to receive a new block sent by a second RSU, and forward the new block to the remaining RSUs; the second RSU is selected by a reputation value management agency (TA) according to the reputation values of at least one stored RSU; the new block is generated by the second RSU; A first generation module, configured to generate a first recognition message and forward the first recognition message to the remaining RSUs when the first RSU recognizes the legality of the new block; the first recognition message is used to indicate that the first RSU recognizes the legality of the new block; A second forwarding module, configured to receive second approval information sent by the remaining RSU, and broadcast a first preparation message to the remaining RSU when the number of the second approval information is greater than a first threshold, where the first preparation message is used to indicate that the first RSU has completed the preparation work for forwarding the new block to a vehicle; receive a second preparation message broadcast by the remaining RSU, where the second preparation message is used to indicate that the remaining RSU has completed the preparation work for forwarding the new block to a vehicle; and continuously forward the new block to at least one vehicle within the communication range of the first RSU when the number of the second preparation messages is greater than a first preset threshold; the second approval information is used to indicate that the remaining RSU approves the legality of the new block.
8. A blockchain consensus device, characterized in that, Applied to a first vehicle, the device includes: A third forwarding module, configured to receive a new block forwarded by at least one roadside unit (RSU), and continuously forward the new block to the remaining vehicles; the new block is generated by a second RSU; the second RSU is selected by a trust value management authority (TA) according to the trust values of at least one stored RSU. A second generation module, configured to generate fourth approval information and forward the fourth approval information to each of the RSU and the remaining vehicles within the communication range of the first vehicle when the first vehicle approves the legality of the new block; the fourth approval information is used to indicate that the first vehicle approves the legality of the new block. A fourth forwarding module, configured to receive fifth approval information sent by the remaining vehicles, and when the number of the fifth approval information is greater than a fourth threshold, the new block consensus is completed, and broadcast a fifth preparation message to the at least one RSU and the remaining vehicles within the communication range, where the fifth preparation message is used to indicate that the first vehicle has completed the preparation for uploading the new block; receive a sixth preparation message sent by the remaining vehicles, and when the number of the sixth preparation messages is greater than a seventh preset threshold, the first vehicle broadcasts a completion message to the at least one RSU and the remaining vehicles, where the completion message is used to indicate that the first vehicle has uploaded the new block, and simultaneously upload the new block; the fifth approval information is used to indicate that the remaining vehicles approve the legality of the new block.
9. An electronic device, comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the blockchain consensus method according to any one of claims 1 to 4, or implements the blockchain consensus method according to claim 5 or 6.
10. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the blockchain consensus method according to any one of claims 1 to 4, or implements the blockchain consensus method according to claim 5 or 6.
11. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the blockchain consensus method according to any one of claims 1 to 4, or implements the blockchain consensus method according to claim 5 or 6.