Internet of Things data encryption transmission method based on block chain
By constructing an identity blockchain for IoT devices using blockchain technology, employing hybrid encryption algorithms and dynamic key management, and monitoring node behavior in real time, the security and consistency of IoT data transmission are ensured through cross-chain interaction protocols. This solves the problems of the single encryption method, identity forgery, and imperfect cross-chain transmission in IoT systems, and achieves efficient and secure data transmission and network collaboration.
Patent Information
- Application Number
- CN202511617501.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-06
- Publication Date
- 2026-02-06
AI Technical Summary
Existing IoT data encryption methods suffer from problems such as relying on a single encryption algorithm, vulnerability to device authentication fraud, insufficient dynamic key management, and imperfect cross-chain data transmission, resulting in inadequate security and consistency in IoT systems.
An IoT device identity blockchain is built based on blockchain technology. A hybrid encryption algorithm is used to encrypt data in layers. A dynamic key management mechanism is designed to monitor node behavior in real time and use cross-chain interaction protocols for data transmission. Hash locking and time lock mechanisms are used to ensure the atomicity and consistency of cross-chain transmission.
It ensures the uniqueness of device identity and the security of encrypted transmission, enables the flexibility and automation of dynamic key management, enhances the interoperability and synergy of IoT networks, prevents data tampering and malicious nodes, and guarantees the integrity and consistency of cross-chain transmission.
Smart Images

Figure CN121485998A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of data encryption technology, specifically to a blockchain-based method for encrypted transmission of Internet of Things (IoT) data. Background Technology
[0002] With the widespread adoption of IoT devices, security has increasingly become a bottleneck in IoT development. IoT devices face numerous security threats during the collection and transmission of large amounts of sensitive data, including data tampering, identity forgery, and data leakage. Traditional network security solutions are insufficient to meet the data encryption and transmission requirements of IoT devices. Blockchain technology, with its advantages of decentralization, data immutability, and transparency, has become an effective solution for improving IoT data security. Building identity authentication mechanisms, encrypted data transmission, and dynamic key management for IoT devices through blockchain can significantly enhance the security of IoT systems.
[0003] Existing IoT data encryption methods suffer from the following problems: they typically employ a single encryption algorithm, failing to adopt appropriate encryption methods based on different data types; device authentication has vulnerabilities, making it susceptible to forgery and difficult to guarantee device uniqueness; dynamic key management mechanisms are insufficient, lacking automated support for key generation, distribution, and rotation, and unable to adapt to different data sensitivity levels; existing cross-chain data transmission mechanisms are inadequate, failing to effectively guarantee the atomicity and consistency of cross-chain data transmission. Therefore, how to build a secure, flexible, and efficient IoT data encryption transmission method based on blockchain technology has become a current research focus.
[0004] To address the aforementioned technical shortcomings, a solution is proposed. Summary of the Invention
[0005] The purpose of this invention is to solve the problems mentioned above by proposing a blockchain-based method for encrypted transmission of Internet of Things (IoT) data.
[0006] The objective of this invention can be achieved through the following technical solutions:
[0007] Blockchain-based methods for encrypted data transmission in the Internet of Things (IoT) include:
[0008] Construct an IoT device identity blockchain, generate unique digital certificates based on device hardware characteristics, and use a consensus mechanism to confirm and dynamically update node identities.
[0009] A hybrid encryption algorithm is used to perform layered encryption on IoT data, with asymmetric encryption for metadata and symmetric encryption for business data, generating encrypted data blocks and associating them with device identity information;
[0010] Design a chain-like data transmission structure to form a Merkle tree by timestamp order of encrypted data blocks, and write the root hash value into the blockchain block;
[0011] Establish a dynamic key management mechanism that automatically generates, distributes, and rotates keys based on blockchain smart contracts, and sets the key validity period according to the data sensitivity level.
[0012] Real-time monitoring of the behavioral characteristics of data transmission nodes; identification of malicious nodes through anomaly detection algorithms; triggering of the blockchain consensus penalty mechanism; interruption of abnormal transmission links.
[0013] Cross-chain interaction protocols are used to enable encrypted data exchange between heterogeneous IoT networks, and hash locking and time locking mechanisms are used to ensure the atomicity and consistency of cross-chain transmission.
[0014] Preferably, the construction of the IoT device identity blockchain, generating unique digital certificates based on device hardware characteristics, and completing node identity confirmation and dynamic updates through a consensus mechanism specifically includes:
[0015] The CPU serial number, MAC address and sensor firmware hash value of IoT devices are extracted as hardware feature vectors, and the SM3 algorithm is used to generate a unique device identifier.
[0016] A device identity blockchain is built based on identity identifiers. Each node contains the device public key, registration time, and permission level information. An improved Practical Byzantine Fault-Tolerant Consensus algorithm is used to complete identity verification.
[0017] When a device undergoes hardware replacement or permission changes, a smart contract is triggered to execute an identity update process. The old identity information is marked as invalid and its historical record is retained. The new identity can only take effect after being verified by more than 2 / 3 of the nodes in the entire network. The device identity blockchain is periodically snapshotted to generate an identity state Merkle tree, and the root node hash is written to the main chain.
[0018] Preferably, the consensus efficiency calculation formula for the improved practical Byzantine fault-tolerant consensus algorithm is as follows:
[0019]
[0020] In the formula, η is the consensus efficiency value, N is the total number of nodes, λ is the fault-tolerant node ratio threshold (ranging from 0 to 1 / 3), and T v R represents the block verification time and the consensus round.
[0021] Preferably, the step of using a hybrid encryption algorithm to perform layered encryption on IoT data, employing asymmetric encryption for metadata and symmetric encryption for business data, and generating encrypted data blocks and associating them with device identity information specifically includes:
[0022] IoT data is divided into metadata (device ID, timestamp, data type) and business data (sensor readings, control commands). The metadata is encrypted using the SM2 asymmetric encryption algorithm, and the business data is encrypted using the SM4 symmetric encryption algorithm.
[0023] A symmetric key is randomly generated. The symmetric key is then encrypted using the recipient's public key and packaged with encrypted business data to form a data transmission unit. The encrypted metadata is embedded in the header of the data transmission unit.
[0024] The sender's identity is verified through the device identity blockchain, and a digital signature containing the sender's public key, the receiver's public key, and a data digest is generated and appended to the end of the data transmission unit.
[0025] Large-scale business data is divided into fixed-size data slices using a fragmented encryption technique. Each data slice is encrypted independently and a hash value is generated. The hash values of all data slices are combined to form a Merkle tree of the data block.
[0026] Preferably, the method for constructing the Merkle tree of the data block is as follows:
[0027] The hash value of each encrypted data piece is used as the leaf node of the Merkle tree, and parent nodes are generated by merging pairwise hashes until a unique root node is formed.
[0028] The root node hash value is bound to the data block generation time and the sender's identity identifier and written into the blockchain transaction record. Any data fragment that is tampered with can be verified and detected through the Merkle tree. The verification time is logarithmically related to the data block size.
[0029] Preferably, the establishment of a dynamic key management mechanism, which automatically executes key generation, distribution, and rotation based on blockchain smart contracts, and sets the key validity period according to the data sensitivity level, specifically includes:
[0030] The master key is generated based on the key derivation function, and the master key is sharded and stored on multiple authorized nodes through a smart contract. Threshold cryptography is used to realize key reconstruction.
[0031] The key rotation cycle is set according to the data sensitivity level (low, medium, high), corresponding to 7 days, 24 hours, and 1 hour respectively. The sensitivity level is automatically determined by the data type and application scenario.
[0032] The key distribution adopts a broadcast encryption mechanism. After the smart contract verifies the recipient's permissions, it only pushes the encrypted session key to the authorized device. The key transmission process adopts a one-time pad mechanism.
[0033] When a potential key leak is detected, an emergency key rotation process is triggered. The old key immediately becomes invalid, and the new key is asynchronously broadcast to all relevant nodes via the blockchain to ensure the consistency of key updates.
[0034] Preferably, the real-time monitoring of the behavioral characteristics of data transmission nodes, the identification of malicious nodes through anomaly detection algorithms, the triggering of the blockchain consensus penalty mechanism, and the interruption of abnormal transmission links specifically include:
[0035] The transmission frequency, data integrity, authentication success rate, and resource consumption characteristics of the data collection nodes are used to construct a node behavior feature vector, and the isolated forest algorithm is used for anomaly detection.
[0036] Set an abnormal behavior threshold. When a node detects an abnormality 5 times consecutively or the score of a single abnormality exceeds the threshold, it is marked as a suspicious node and multi-node cross-validation is initiated.
[0037] Once a malicious node is verified, the smart contract executes the penalty mechanism: freezing the node's identity and permissions, recording the malicious behavior to the blockchain blacklist, and notifying associated nodes to terminate the connection;
[0038] Blacklist information is synchronized across the entire network. Malicious nodes need to go through the identity reset and credit repair process to reconnect. The repair period increases with the severity of the malicious behavior.
[0039] Preferably, the anomaly scoring formula of the anomaly detection algorithm is:
[0040] S = D1·F d +D2·C f +D3·I v +D4·R e
[0041] In the formula, S is the anomaly score (0-1, the larger the value, the more abnormal), and F... d For transmission frequency deviation, C f To determine the data integrity verification failure rate, I v R represents the number of authentication failures. e For outliers in resource consumption, D1, D2, D3, and D4 are feature weights.
[0042] Preferably, the method of using cross-chain interaction protocols to achieve encrypted data interoperability between heterogeneous IoT networks, and ensuring the atomicity and consistency of cross-chain transmission through hash locking and time locking mechanisms, specifically includes:
[0043] Construct cross-chain gateway nodes to act as an interaction intermediary for heterogeneous IoT networks. The gateway node can simultaneously connect to two or more blockchains and maintain a cross-chain mapping table.
[0044] Cross-chain data transmission is achieved using a hash time-locked contract. The sender generates a random number and calculates a hash value, which is then written into the source chain contract. The receiver provides a random number to unlock the data after verifying its integrity on the target chain.
[0045] Set time lock parameters. If the recipient fails to unlock within the specified time, the source chain contract will automatically return the data to avoid data retention or double-spending.
[0046] Cross-chain data is encapsulated in an encrypted container. The container header contains the source chain identifier, the target chain identifier, and the data digest. Through format conversion and protocol adaptation by the gateway node, IoT networks with different encryption standards can communicate with each other.
[0047] Preferably, the atomicity verification mechanism for cross-chain data transmission is as follows: a three-stage state of preparation, submission, and confirmation is defined for cross-chain transactions. The transaction will only become effective when all participating chains have completed the corresponding stage operations. Each stage generates a state hash and writes it into the block of each chain. The cross-chain verification node compares the state hashes of multiple chains to ensure the consistency of the transaction state. If any chain fails to complete the state update within the specified time, a global rollback mechanism is triggered, and all executed operations are automatically revoked through the smart contract.
[0048] Compared with the prior art, the beneficial effects of the present invention are:
[0049] 1. By generating unique digital certificates based on device hardware characteristics and leveraging the decentralized nature of blockchain, the authenticity and immutability of device identities are ensured. A consensus mechanism dynamically updates and confirms node identities, effectively preventing device identity forgery. A hybrid encryption algorithm is employed for layered encryption of IoT data, ensuring encrypted transmission of metadata and business data. Asymmetric encryption is used for metadata, while symmetric encryption is used for business data. Secure data transmission is achieved by associating encrypted data blocks with device identity information.
[0050] 2. Based on blockchain smart contracts, the system enables the automatic generation, distribution, and rotation of keys. The smart contracts can automatically adjust the key validity period according to the sensitivity level of the data, ensuring the flexibility and automation of key management and greatly improving the security of IoT data. By monitoring the behavioral characteristics of data transmission nodes in real time, the system effectively identifies malicious nodes using anomaly detection algorithms. Once an abnormal node is detected, the system can punish it through the blockchain consensus mechanism, immediately interrupting the abnormal transmission link to ensure the integrity and security of data transmission.
[0051] 3. Enabling encrypted data transmission between heterogeneous IoT networks using cross-chain interaction protocols. Hash locking and time-locking mechanisms ensure the atomicity and consistency of cross-chain transmission, avoiding data stagnation and double-spending issues, and improving interoperability and synergy between IoT networks. By constructing a Merkle tree to hash data blocks, the integrity and immutability of each encrypted data piece are ensured. If a data piece is tampered with, the system can quickly verify it through the Merkle tree, ensuring data trustworthiness. An improved practical Byzantine fault-tolerant consensus algorithm is adopted to improve consensus efficiency, and the total number of nodes and the proportion of fault-tolerant nodes are optimized through a consensus efficiency calculation formula, ensuring the efficient operation of the blockchain network. Attached Figure Description
[0052] To facilitate understanding by those skilled in the art, the present invention will be further described below with reference to the accompanying drawings.
[0053] Figure 1 This is a flowchart of the overall method of the present invention. Detailed Implementation
[0054] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0055] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of the invention. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.
[0056] Please see Figure 1 As shown, a blockchain-based IoT data encryption transmission method includes:
[0057] Construct an IoT device identity blockchain, generate unique digital certificates based on device hardware characteristics, and use a consensus mechanism to confirm and dynamically update node identities.
[0058] A hybrid encryption algorithm is used to perform layered encryption on IoT data, with asymmetric encryption for metadata and symmetric encryption for business data, generating encrypted data blocks and associating them with device identity information;
[0059] Design a chain-like data transmission structure to form a Merkle tree by timestamp order of encrypted data blocks, and write the root hash value into the blockchain block;
[0060] Establish a dynamic key management mechanism that automatically generates, distributes, and rotates keys based on blockchain smart contracts, and sets the key validity period according to the data sensitivity level.
[0061] Real-time monitoring of the behavioral characteristics of data transmission nodes; identification of malicious nodes through anomaly detection algorithms; triggering of the blockchain consensus penalty mechanism; interruption of abnormal transmission links.
[0062] Cross-chain interaction protocols are used to enable encrypted data exchange between heterogeneous IoT networks, and hash locking and time locking mechanisms are used to ensure the atomicity and consistency of cross-chain transmission.
[0063] The construction of an IoT device identity blockchain, which generates unique digital certificates based on device hardware characteristics and completes node identity confirmation and dynamic updates through a consensus mechanism, specifically includes:
[0064] The CPU serial number, MAC address and sensor firmware hash value of IoT devices are extracted as hardware feature vectors, and the SM3 algorithm is used to generate a unique device identifier.
[0065] A device identity blockchain is built based on identity identifiers. Each node contains the device public key, registration time, and permission level information. An improved Practical Byzantine Fault-Tolerant Consensus algorithm is used to complete identity verification.
[0066] When a device undergoes hardware replacement or permission changes, a smart contract is triggered to execute an identity update process. The old identity information is marked as invalid and its history is retained. The new identity can only take effect after being verified by more than 2 / 3 of the nodes in the entire network. The device identity blockchain is periodically snapshotted to generate an identity state Merkle tree, and the root node hash is written to the main chain.
[0067] Using device hardware characteristics (CPU serial number, MAC, firmware hash) as the basis for identity generation avoids the problem of traditional account password identity systems being easily stolen; it innovatively adopts a triple identity control mechanism of improved practical Byzantine fault-tolerant consensus, smart contract identity update, and Merkle tree snapshot of identity state, which not only ensures the fault tolerance of identity verification, but also realizes the traceability of identity changes, while improving the efficiency of identity query and verification through Merkle tree snapshot.
[0068] The consensus efficiency calculation formula for the improved practical Byzantine fault-tolerant consensus algorithm is as follows:
[0069]
[0070] In the formula, η is the consensus efficiency value, N is the total number of nodes, λ is the fault-tolerant node ratio threshold (ranging from 0 to 1 / 3), and T v R represents the block verification time, and R represents the consensus round.
[0071] To address the significant decrease in consensus efficiency of traditional practical Byzantine fault-tolerant algorithms as the number of nodes increases, a quantitative consensus efficiency model is constructed. This model incorporates key parameters such as the total number of nodes, fault tolerance ratio, verification time, and consensus rounds into the calculation. The consensus parameters can be dynamically adjusted according to the scale of IoT nodes, achieving a quantitative balance between fault tolerance and efficiency, and avoiding transmission delay problems caused by blindly increasing fault tolerance capabilities.
[0072] The method of using a hybrid encryption algorithm to perform layered encryption on IoT data, employing asymmetric encryption for metadata and symmetric encryption for business data, and generating encrypted data blocks and associating them with device identity information specifically includes:
[0073] IoT data is divided into metadata (device ID, timestamp, data type) and business data (sensor readings, control commands). The metadata is encrypted using the SM2 asymmetric encryption algorithm, and the business data is encrypted using the SM4 symmetric encryption algorithm.
[0074] A symmetric key is randomly generated. The symmetric key is then encrypted using the recipient's public key and packaged with encrypted business data to form a data transmission unit. The encrypted metadata is embedded in the header of the data transmission unit.
[0075] The sender's identity is verified through the device identity blockchain, and a digital signature containing the sender's public key, the receiver's public key, and a data digest is generated and appended to the end of the data transmission unit.
[0076] Large-sized business data is divided into fixed-size data slices using fragmented encryption technology. Each data slice is encrypted independently and a hash value is generated. The hash values of all data slices are combined to form a Merkle tree of the data block.
[0077] The system innovatively adopts a layered encryption strategy combining the "SM2+SM4" national cryptographic algorithms. It uses asymmetric encryption to ensure security for metadata and symmetric encryption to ensure transmission efficiency for business data, thus resolving the contradiction between security and efficiency that traditional single encryption algorithms cannot balance. At the same time, it introduces fragmented encryption and Merkle trees for data blocks to achieve efficient encryption of large-size data and rapid detection of tampering.
[0078] The method for constructing the Merkle tree of the data block is as follows:
[0079] The hash value of each encrypted data piece is used as the leaf node of the Merkle tree, and parent nodes are generated by merging pairwise hashes until a unique root node is formed.
[0080] The root node hash value is bound to the data block generation time and the sender's identity identifier and written into the blockchain transaction record. Any data fragment that is tampered with can be verified and detected through the Merkle tree. The verification time is logarithmically related to the data block size.
[0081] The establishment of a dynamic key management mechanism, which automatically generates, distributes, and rotates keys based on blockchain smart contracts, and sets key validity periods according to data sensitivity levels, specifically includes:
[0082] The master key is generated based on the key derivation function, and the master key is sharded and stored on multiple authorized nodes through a smart contract. Threshold cryptography is used to realize key reconstruction.
[0083] The key rotation cycle is set according to the data sensitivity level (low, medium, high), corresponding to 7 days, 24 hours, and 1 hour respectively. The sensitivity level is automatically determined by the data type and application scenario.
[0084] The key distribution adopts a broadcast encryption mechanism. After the smart contract verifies the recipient's permissions, it only pushes the encrypted session key to the authorized device. The key transmission process adopts a one-time pad mechanism.
[0085] When a potential key leak is detected, an emergency key rotation process is triggered. The old key immediately becomes invalid, and the new key is asynchronously broadcast to all relevant nodes via the blockchain to ensure the consistency of key updates.
[0086] It pioneers a dynamic key management mechanism driven by sensitivity levels, which automates the entire key process of "generation-sharded storage-permission distribution-periodic rotation-emergency update" through smart contracts. This avoids the risks of leakage and expiration caused by traditional manual key management. By introducing threshold cryptography and a one-time pad mechanism, it not only prevents single-point leakage of the master key but also ensures the absolute security of the key transmission process. At the same time, it sets different rotation cycles according to sensitivity levels to balance security and resource consumption.
[0087] The real-time monitoring of the behavioral characteristics of data transmission nodes, the identification of malicious nodes through anomaly detection algorithms, the triggering of the blockchain consensus penalty mechanism, and the interruption of abnormal transmission links specifically include:
[0088] The transmission frequency, data integrity, authentication success rate, and resource consumption characteristics of the data collection nodes are used to construct a node behavior feature vector, and the isolated forest algorithm is used for anomaly detection.
[0089] Set an abnormal behavior threshold. When a node detects an abnormality 5 times consecutively or the score of a single abnormality exceeds the threshold, it is marked as a suspicious node and multi-node cross-validation is initiated.
[0090] Once a malicious node is verified, the smart contract executes the penalty mechanism: freezing the node's identity and permissions, recording the malicious behavior to the blockchain blacklist, and notifying associated nodes to terminate the connection;
[0091] Blacklist information is synchronized across the entire network. Malicious nodes need to go through the identity reset and credit repair process to reconnect. The repair period increases with the severity of the malicious behavior.
[0092] The anomaly scoring formula of the anomaly detection algorithm is as follows:
[0093] S = D1·F d +D2·C f +D3·I v +D4·R e
[0094] In the formula, S is the anomaly score (0-1, the larger the value, the more abnormal), and F... d For transmission frequency deviation, C f To determine the data integrity verification failure rate, I v R represents the number of authentication failures. e For outliers in resource consumption, D1, D2, D3, and D4 are feature weights;
[0095] By quantifying abnormal node behavior into a computable scoring model and introducing feature weights, the importance of each feature can be dynamically adjusted according to different IoT application scenarios. This solves the problem that traditional single threshold detection cannot adapt to diverse scenarios. At the same time, the scoring range is clearly defined, which facilitates the unification of judgment standards and improves the flexibility and accuracy of anomaly detection.
[0096] The method of using cross-chain interaction protocols to achieve encrypted data interoperability between heterogeneous IoT networks, and ensuring the atomicity and consistency of cross-chain transmission through hash locking and time locking mechanisms, specifically includes:
[0097] Construct cross-chain gateway nodes to act as an interaction intermediary for heterogeneous IoT networks. The gateway node can simultaneously connect to two or more blockchains and maintain a cross-chain mapping table.
[0098] Cross-chain data transmission is achieved using a hash time-locked contract. The sender generates a random number and calculates a hash value, which is then written into the source chain contract. The receiver provides a random number to unlock the data after verifying its integrity on the target chain.
[0099] Set time lock parameters. If the recipient fails to unlock within the specified time, the source chain contract will automatically return the data to avoid data retention or double-spending.
[0100] Cross-chain data is encapsulated in an encrypted container. The container header contains the source chain identifier, the target chain identifier, and the data digest. Through format conversion and protocol adaptation by the gateway node, IoT networks with different encryption standards can communicate with each other.
[0101] The atomicity verification mechanism for cross-chain data transmission is as follows: a three-stage state of preparation, submission, and confirmation is defined for cross-chain transactions. The transaction will only become effective when all participating chains have completed the corresponding stage operations. Each stage generates a state hash and writes it into the block of each chain. The cross-chain verification node compares the state hashes of multiple chains to ensure the consistency of the transaction state. If any chain fails to complete the state update within the specified time, a global rollback mechanism is triggered, and all executed operations are automatically revoked through the smart contract.
[0102] Breaking away from the limitations of traditional cross-chain technology, which only guarantees atomicity within a single chain and cannot guarantee atomicity for multi-chain collaboration, this innovative atomic verification mechanism combines three-stage state management with multi-chain hash comparison and global rollback. By breaking down transactions into preparation, submission, and confirmation stages, it ensures that all participating chains proceed synchronously. Simultaneously, it utilizes state hash comparison to verify the consistency of multi-chain states. In the event of an anomaly, a global rollback is immediately initiated, completely resolving the issue of partial success and partial failure in cross-chain transmission and ensuring the reliability of data interaction in heterogeneous IoT networks.
[0103] In summary, the advantages of this invention are:
[0104] This invention extracts the hardware features of IoT devices and uses the SM3 algorithm to generate unique device identifiers. This innovative method effectively avoids the problem of device identity being forged or reused in traditional identity authentication methods, ensuring the uniqueness and credibility of each device identity.
[0105] Layered encryption mechanism of hybrid encryption algorithm: This invention uses a hybrid encryption algorithm to perform layered encryption on IoT data, that is, SM2 asymmetric encryption is used for metadata and SM4 symmetric encryption is used for business data. This layered encryption scheme can select the appropriate encryption method according to different data types, which improves data security and encryption efficiency, while avoiding the limitation of traditional encryption schemes that use the same encryption algorithm for all data.
[0106] By automatically executing the generation, distribution, and rotation of keys through smart contracts, this invention realizes dynamic key management in IoT data transmission. The validity period of the key matches the sensitivity level of the data, ensuring that sensitive data is protected more strictly. At the same time, when a key leak is detected, the system can quickly trigger an emergency key rotation process to ensure the real-time performance and consistency of key management.
[0107] This invention combines anomaly detection algorithms (such as the Isolation Forest algorithm) to identify malicious nodes by real-time monitoring of the behavioral characteristics of IoT data transmission nodes (such as transmission frequency, data integrity, etc.) and triggers the blockchain consensus penalty mechanism. This mechanism can effectively identify and isolate malicious nodes, ensuring network security and data integrity. This behavior-based anomaly detection method is highly innovative in IoT security.
[0108] During encrypted data transmission, this invention organizes encrypted data blocks into a Merkle tree structure according to timestamp order and writes the root hash value into the blockchain. This innovative design not only ensures data integrity but also verifies whether any data has been tampered with through the Merkle tree, improving data verification efficiency. Furthermore, the verification time is logarithmically related to the data size, further enhancing the system's scalability.
[0109] This invention proposes a cross-chain data transmission scheme based on hash locking and time locking mechanisms, which can guarantee the atomicity and consistency of encrypted data communication between heterogeneous IoT networks. This innovation enables different IoT networks to share data securely and efficiently, avoiding data retention and double-spending issues in cross-chain transmission, and greatly improving the collaborative capabilities and interoperability of IoT systems.
[0110] Blockchain-based consensus mechanism optimization: This invention calculates the consensus efficiency value using an improved Practical Byzantine Fault-Tolerant (PBFT) consensus algorithm and optimizes the consensus efficiency based on the total number of nodes and the threshold for the proportion of fault-tolerant nodes. This innovation improves the efficiency of blockchain consensus, enhances the system's processing power, and adapts to the rapid expansion needs of large-scale IoT devices.
[0111] In terms of key management, this invention proposes to dynamically adjust the key rotation cycle according to the data sensitivity level, adopt different rotation strategies for low-sensitivity data and high-sensitivity data, and manage the key lifecycle through smart contracts, thereby improving the Internet of Things system's ability to protect data of different levels.
[0112] The preferred embodiments of the present invention disclosed above are merely illustrative of the invention. These preferred embodiments do not exhaustively describe all details, nor do they limit the invention to any specific implementation. Clearly, many modifications and variations can be made based on the content of this specification. This specification selects and specifically describes these embodiments to better explain the principles and practical applications of the invention, thereby enabling those skilled in the art to better understand and utilize the invention. The invention is limited only by the claims and their full scope and equivalents.
Claims
1. A blockchain-based method for encrypted data transmission in the Internet of Things (IoT), characterized in that: include: Construct an IoT device identity blockchain, generate unique digital certificates based on device hardware characteristics, and use a consensus mechanism to confirm and dynamically update node identities. A hybrid encryption algorithm is used to perform layered encryption on IoT data, with asymmetric encryption for metadata and symmetric encryption for business data, generating encrypted data blocks and associating them with device identity information; Design a chain-like data transmission structure to form a Merkle tree by timestamp order of encrypted data blocks, and write the root hash value into the blockchain block; Establish a dynamic key management mechanism that automatically generates, distributes, and rotates keys based on blockchain smart contracts, and sets the key validity period according to the data sensitivity level. Real-time monitoring of the behavioral characteristics of data transmission nodes; identification of malicious nodes through anomaly detection algorithms; triggering of the blockchain consensus penalty mechanism; interruption of abnormal transmission links. Cross-chain interaction protocols are used to enable encrypted data exchange between heterogeneous IoT networks, and hash locking and time locking mechanisms are used to ensure the atomicity and consistency of cross-chain transmission.
2. The blockchain-based IoT data encryption transmission method according to claim 1, characterized in that, The construction of an IoT device identity blockchain, which generates unique digital certificates based on device hardware characteristics and completes node identity confirmation and dynamic updates through a consensus mechanism, specifically includes: The CPU serial number, MAC address and sensor firmware hash value of IoT devices are extracted as hardware feature vectors, and the SM3 algorithm is used to generate a unique device identifier. A device identity blockchain is built based on identity identifiers. Each node contains the device public key, registration time, and permission level information. An improved Practical Byzantine Fault-Tolerant Consensus algorithm is used to complete identity verification. When a device undergoes hardware replacement or permission changes, a smart contract is triggered to execute an identity update process. The old identity information is marked as invalid and its historical record is retained. The device identity blockchain is periodically snapshotted to generate an identity state Merkle tree, and the root node hash is written to the main chain.
3. The blockchain-based IoT data encryption transmission method according to claim 2, characterized in that, The consensus efficiency calculation formula for the improved practical Byzantine fault-tolerant consensus algorithm is as follows: In the formula, η is the consensus efficiency value, N is the total number of nodes, λ is the fault-tolerant node ratio threshold, and T v R represents the block verification time and the consensus round.
4. The blockchain-based IoT data encryption transmission method according to claim 1, characterized in that, The method of using a hybrid encryption algorithm to perform layered encryption on IoT data, employing asymmetric encryption for metadata and symmetric encryption for business data, and generating encrypted data blocks and associating them with device identity information specifically includes: IoT data is divided into metadata and business data. The metadata is encrypted using the SM2 asymmetric encryption algorithm, and the business data is encrypted using the SM4 symmetric encryption algorithm. A symmetric key is randomly generated. The symmetric key is then encrypted using the recipient's public key and packaged with encrypted business data to form a data transmission unit. The encrypted metadata is embedded in the header of the data transmission unit. The sender's identity is verified through the device identity blockchain, and a digital signature containing the sender's public key, the receiver's public key, and a data digest is generated and appended to the end of the data transmission unit. Large-scale business data is divided into fixed-size data slices using a fragmented encryption technique. Each data slice is encrypted independently and a hash value is generated. The hash values of all data slices are combined to form a Merkle tree of the data block.
5. The blockchain-based IoT data encryption transmission method according to claim 4, characterized in that, The method for constructing the Merkle tree of the data block is as follows: The hash value of each encrypted data piece is used as the leaf node of the Merkle tree, and parent nodes are generated by merging pairwise hashes until a unique root node is formed. The root node hash value is bound to the data block generation time and the sender's identity identifier and written into the blockchain transaction record. Any data fragment that is tampered with can be verified and detected through the Merkle tree. The verification time is logarithmically related to the data block size.
6. The blockchain-based IoT data encryption transmission method according to claim 1, characterized in that, The establishment of a dynamic key management mechanism, which automatically generates, distributes, and rotates keys based on blockchain smart contracts, and sets key validity periods according to data sensitivity levels, specifically includes: The master key is generated based on the key derivation function, and the master key is sharded and stored on multiple authorized nodes through a smart contract. Threshold cryptography is used to realize key reconstruction. The key rotation cycle is set according to the data sensitivity level, and the sensitivity level is automatically determined by the data type and application scenario. The key distribution adopts a broadcast encryption mechanism. After the smart contract verifies the recipient's permissions, it only pushes the encrypted session key to the authorized device. The key transmission process adopts a one-time pad mechanism. When a potential key leak is detected, an emergency key rotation process is triggered. The old key immediately becomes invalid, and the new key is asynchronously broadcast to all relevant nodes via the blockchain to ensure the consistency of key updates.
7. The blockchain-based IoT data encryption transmission method according to claim 1, characterized in that, The real-time monitoring of the behavioral characteristics of data transmission nodes, the identification of malicious nodes through anomaly detection algorithms, the triggering of the blockchain consensus penalty mechanism, and the interruption of abnormal transmission links specifically include: The transmission frequency, data integrity, authentication success rate, and resource consumption characteristics of the data collection nodes are used to construct a node behavior feature vector, and the isolated forest algorithm is used for anomaly detection. Set an abnormal behavior threshold. When a node detects an abnormality five times consecutively or the score of a single abnormality exceeds the threshold, it is marked as a suspicious node and multi-node cross-validation is initiated. Once a malicious node is verified, the smart contract executes the penalty mechanism: freezing the node's identity and permissions, recording the malicious behavior to the blockchain blacklist, and notifying associated nodes to terminate the connection; Blacklist information is synchronized across the entire network. Malicious nodes need to go through the identity reset and credit repair process to reconnect. The repair period increases with the severity of the malicious behavior.
8. The blockchain-based IoT data encryption transmission method according to claim 7, characterized in that, The anomaly scoring formula of the anomaly detection algorithm is as follows: S=D1·F d +D2·C f +D3·I v +D4·R e In the formula, S is the anomaly score, and F d For transmission frequency deviation, C f To determine the data integrity verification failure rate, I v R represents the number of authentication failures. e For outliers in resource consumption, D1, D2, D3, and D4 are feature weights.
9. The blockchain-based IoT data encryption transmission method according to claim 1, characterized in that, The method of using cross-chain interaction protocols to achieve encrypted data interoperability between heterogeneous IoT networks, and ensuring the atomicity and consistency of cross-chain transmission through hash locking and time locking mechanisms, specifically includes: Construct cross-chain gateway nodes to act as an interaction intermediary for heterogeneous IoT networks. The gateway node can simultaneously connect to two or more blockchains and maintain a cross-chain mapping table. Cross-chain data transmission is achieved using a hash time-locked contract. The sender generates a random number and calculates a hash value, which is then written into the source chain contract. The receiver provides a random number to unlock the data after verifying its integrity on the target chain. Set time lock parameters. If the recipient fails to unlock within the specified time, the source chain contract will automatically return the data to avoid data retention or double-spending. Cross-chain data is encapsulated in an encrypted container. The container header contains the source chain identifier, the target chain identifier, and the data digest. Through format conversion and protocol adaptation by the gateway node, IoT networks with different encryption standards can communicate with each other.
10. The blockchain-based IoT data encryption transmission method according to claim 9, characterized in that, The atomicity verification mechanism for cross-chain data transmission is as follows: a three-stage state of preparation, submission, and confirmation is defined for cross-chain transactions. When all participating chains complete the corresponding stage operations, the transaction finally takes effect. Each stage generates a state hash and writes it into the block of each chain. The cross-chain verification node compares the state hashes of multiple chains to ensure the consistency of the transaction state. If any chain fails to complete the state update within the specified time, a global rollback mechanism is triggered, and all executed operations are automatically revoked through the smart contract.