Secure video transmission method based on block chain and multi-path dynamic routing
By using blockchain and multi-path dynamic routing methods in video data transmission, black hole nodes are detected, trust values are evaluated and optimal paths are selected, and the security and reliability of video data transmission in dynamic network environments are solved, achieving efficient and secure video data transmission.
Patent Information
- Application Number
- CN202411930918.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-26
- Publication Date
- 2025-05-13
AI Technical Summary
In dynamic and complex network environments, video data transmission faces threats such as data loss and tampering. Traditional routing protocols are difficult to adapt to the rapid changes in network topology, and encrypted transmission has the problem of high computing resource consumption.
A secure video transmission method based on blockchain and multipath dynamic routing is adopted to detect black hole nodes through dense convolutional bidirectional gated network model, dynamically evaluate node trust values, select the optimal path, and enhance the immutability of data through blockchain.
It realizes the continuity and stability of video data in a dynamic network environment, improves the security and reliability of data transmission, reduces the computing resource consumption of equipment, and is suitable for equipment with limited resources.
Smart Images

Figure CN119996733A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a video data secure transmission method based on dynamic routing, and in particular to a secure video transmission method based on blockchain and multi-path dynamic routing, belonging to the field of video data secure transmission. Background Art
[0002] With the widespread popularity of applications such as video surveillance, video communication, and streaming media, the demand for video data transmission is increasing. In a dynamic and complex network environment, video transmission faces threats such as data loss and tampering.
[0003] Currently, the main technologies for secure transmission of video data rely on encryption algorithms, such as Advanced Encryption Standard (AES) and Transport Layer Security (TLS), which can effectively prevent eavesdropping and tampering. However, these technologies face the following problems in a dynamic network environment:
[0004] (1) Network dynamics: Node movement may cause frequent changes in network topology, making it difficult for routing protocols to adapt to this dynamic environment. Traditional routing protocols such as Ad hoc On-Demand Distance Vector Routing (AODV) and Open Shortest Path First (OSPF) may fail when the topology changes rapidly, resulting in interruption or delay of video data transmission.
[0005] (2) Threats from malicious nodes: Since dynamic nodes lack centralized control, they are vulnerable to attacks from malicious nodes, such as black hole attacks and gray hole attacks. Malicious nodes can pretend to participate in routing selection normally, and then discard or tamper with transmitted data packets, which greatly threatens the integrity and security of video data. Existing routing protocols (such as AODV and OSPF) focus mainly on transmission efficiency and route discovery time during design, but pay less attention to security. These protocols are vulnerable to threats such as route hijacking and black hole attacks, and cannot effectively detect malicious nodes, resulting in the loss or tampering of video data.
[0006] (3) Limitations of encrypted transmission: Although encryption technology can protect the security of data during transmission, once the video data is successfully intercepted, attackers can try to obtain the data by cracking or attacking the encryption key. In addition, the encryption and decryption process requires a lot of computing resources. For resource-constrained devices, the delay and power consumption problems caused by traditional encryption methods will affect the performance of real-time video transmission. Summary of the invention
[0007] In the face of a dynamic and complex network environment, in order to solve the shortcomings gradually emerging from the above-mentioned technologies, the purpose of the present invention is to provide a secure video transmission method based on blockchain and multi-path dynamic routing. The method first performs black hole node detection, and then the dynamic routing mechanism can monitor the changes in network topology in real time, quickly select the optimal path, and ensure that the video data maintains the continuity and stability of transmission in a complex node environment. Through the trust management system, a trust value is assigned to each node, and the node reliability is dynamically evaluated and detected to ensure the security of the data transmission path and effectively prevent data from being tampered with or lost. The immutability of the data is further enhanced by introducing blockchain, ensuring the transparency and security of the transmission path and node records. Combined with malicious node detection and optimized routing selection, not only the security of the secure video transmission system is improved, but also the computing resource consumption of the device is reduced. The present invention is particularly suitable for resource-constrained devices. The present invention has the advantages of high efficiency, safety, and strong adaptability.
[0008] The objective of the present invention is achieved through the following technical solutions:
[0009] The invention discloses a secure video transmission method based on blockchain and multi-path dynamic routing, which collects input video data; introduces a dense convolutional bidirectional gated network SA_DCBiGNet (Self-Attention Dense Convolutional Bidirectional Gated Network) model to detect black hole nodes; calculates a trust value to analyze the reliability of adjacent nodes and uses an extended Osprey assisted optimized link state routing protocol EO_OLSRP (Extended Osprey Optimized Link State Routing Protocol) for routing; selects an optimal path according to parameters such as node stability and link stability through an Osprey optimization algorithm OOA (Osprey Optimization Algorithm); and implements blockchain storage through an interplanetary file system IPFS (InterPlanetary File System) to achieve secure and efficient transmission of video data.
[0010] The present invention discloses a secure video transmission method based on blockchain and multi-path dynamic routing, comprising the following steps:
[0011] Step 1: Input video into the dense convolutional bidirectional gated network model for processing to achieve black hole node detection.
[0012] Step 1 specifically includes the following sub-steps:
[0013] Step 1.1: The original video data is input into the convolutional neural network of the dense convolutional bidirectional gated network model for feature extraction. The convolution layer extracts the local features of each frame in the video, the pooling layer reduces the data dimension and reduces the computational complexity, and then the dense layer integrates the global features and outputs the feature map B∈R C×H×W ;
[0014] Step 1.2: Feature map B enters the dual attention network, and feature map F is calculated by the spatial attention module. 1 , the feature map F is calculated by the channel attention module 2 ;
[0015] Step 1.2.1: Perform spatial attention calculation through the position attention module:
[0016] First, feature map B undergoes three layers of convolution operations to generate three feature maps A, D, and E, where {A, D, E}∈R C×H×W , reshape the feature maps A, D and E dimensions into R C×N , perform matrix multiplication of feature map A and feature map D and apply SoftMax function to generate position attention matrix S∈R N×N , the matrix S represents the correlation and weight of each spatial position; the specific calculation formula of the matrix S is as follows:
[0017]
[0018] Where S ij Represents the elements in the matrix S, indicating the degree to which the i-th position is affected by the j-th position, A i represents the i-th element in feature A, D j represents the jth element in feature D, and N represents the number of pixels, which is obtained by multiplying the height and width of the image, that is, N = H × W.
[0019] Then, the feature map E∈R C×N With the matrix S ij Multiply them to adjust the spatial position features in a weighted manner, and then add them to the feature map B to generate the feature map F 1 , the calculation formula is as follows:
[0020]
[0021] in, The final feature F 1 The value at the jth position, feature F 1 ∈R C×H×W space; α is the weight factor, which controls the increase of additional weight; E i is the value of feature E at the ith position, feature E∈R C×N Space; Bj It is a C-dimensional vector, representing the value of feature B at the jth position.
[0022] Step 1.2.2: Calculate channel attention through the channel attention module:
[0023] Reshape the feature map B into R C×N , extract the feature vector of each channel, calculate the similarity between channels, and generate the channel attention matrix Y∈R by matrix multiplication C×C , apply the SoftMax function to normalize the channel attention matrix Y. The specific calculation formula is as follows:
[0024]
[0025] Among them, Y ji represents the elements in the channel attention matrix Y, which measures the influence of the jth channel on the ith channel. B is the original local feature, B i Represents the feature vector of the i-th channel in feature B, B j Represents the feature vector of the jth channel in feature B. C represents the number of channels of feature B.
[0026] Then, through weighted operation, the channel attention matrix Y is multiplied by the feature map B, and the weight of each channel is adjusted to obtain the channel optimized feature map F 2 , the formula is as follows:
[0027]
[0028] in, The final feature F 2 At the value of the jth channel, feature F 1 ∈R C×H×W space, β is the weight factor;
[0029] Step 1.3: The feature map F obtained in step 1.2 1 、F 2 Perform a weighted addition operation to generate an enhanced fusion feature map Fc, and then integrate the features Fc of each frame into F∈R in the video time sequence T×C×H×W ;
[0030] Step 1.4: Reduce the dimension of the spatial features of F by using Global Average Pooling (GAP) to reduce the spatial dimensions of H and W and generate a global feature representation for each frame. The GAP operation formula is as follows:
[0031]
[0032] Among them, f tRepresents the global feature vector of the t-th time step, the output after spatial dimensionality reduction. t,c,i,j Represents the feature value of channel c at time step t, position (i, j).
[0033] Step 1.5: Perform a one-dimensional convolution operation on the time dimension T, with a convolution kernel size of k and a step size of 1. The convolution formula is as follows:
[0034]
[0035] Among them, F′ t represents the output feature of time step t, k represents the size of the convolution kernel, and W i represents the weight of the convolution kernel at the i-th position. t-i represents the input feature vector at time step ti, and b represents the bias in the convolution operation.
[0036] Then, the final features of all nodes are integrated into feature G, whose shape is [T, n, d], where T is the number of time steps, indicating the number of video frames; n corresponds to the number of nodes; and d is the feature dimension of each node after one-dimensional convolution.
[0037] Step 1.6: Organize the feature map G in step 1.5 into a sequence {G1, G2, …, GT} by time step, and the feature Gt∈R n×d The time step sequence {G1, G2, …, GT} is input into the Bi-GRU network step by step in time order. The Bi-GRU network consists of a forward GRU and a backward GRU, which process the time series from two directions. The forward GRU processes the data sequentially from time step t = 1 to t = T to generate the forward hidden state The backward GRU processes in reverse order to generate the backward hidden state At each time step t, the forward hidden state and the backward hidden state Fusion into a comprehensive hidden state H t It has a dimension of 2h and contains the global time characteristics of the node at the current time step.
[0038] Step 1.7: Update the Bi-GRU hidden state.
[0039] Step 1.7.1. Calculation of update gate, update gate z t Control the influence of the hidden state of the previous time step on the current time step. The formula is as follows
[0040] z t =σ(W z ·x t +U z ·h t-1 +bz ) (7)
[0041] Among them, z t Represents the update gate output, ranging from [0,1]; W z and U z is the weight matrix of the update gate, b z is the bias vector of the update gate, x t Represents the input feature Gt at the current time step, h t-1 represents the hidden state of the previous time step, and σ is the Sigmoid activation function.
[0042] Step 1.7.2, reset gate calculation, reset gate r t Control the degree of utilization of historical information in the current time step. The formula is as follows:
[0043] r t =σ(W r ·x t +U r ·h t-1 +b r ) (8)
[0044] Among them, r t Represents the reset gate output, ranging from [0,1]; W r and U r is the weight matrix of the reset gate, b r is the bias vector for the reset gate.
[0045] Step 1.7.3, candidate hidden state calculation, under the control of the reset gate, generate the candidate hidden state of the current time step, the formula is as follows:
[0046]
[0047] in, is the candidate hidden state, W h and U h is the weight matrix, b h is the bias vector, and ⊙ represents element-by-element multiplication.
[0048] Step 1.7.4: According to the weight of the update gate, the candidate hidden state is fused with the hidden state of the previous time step to generate the hidden state of the current time step. The formula is as follows:
[0049]
[0050] Among them, h t Represents the hidden state at the current time step.
[0051] Step 1.8 classifies nodes and distinguishes between normal nodes and black hole nodes.
[0052] Step 1.8.1: The comprehensive hidden state H output by Bi-GRU t Input the fully connected classification layer to generate the classification results for each time step. The formula is as follows:
[0053] o i =W o ·H t +b o (11)
[0054] Among them, i is the output of the fully connected layer, indicating the original score of category i, where i represents the classification category, and W o and b o are the weight matrix and bias vector of the fully connected layer respectively.
[0055] Step 1.8.2, use the Softmax activation function to calculate the node classification probability, the formula is as follows:
[0056]
[0057] Among them, P(y=i|H t ) is the node classification probability, y corresponds to the category of the node, y = 0 is a normal node, y = 1 is a black hole node, and K is the number of classification categories.
[0058] Step 1.8.3: Determine the node category based on the probability value output by Softmax. If P(y=0|H t )>P(y=1|H t ), the node is classified as a normal node, otherwise the node is a black hole node.
[0059] Step 2: Each normal node periodically sends HELLO and topology control TC messages to collect the status information of neighbor nodes and record the message transmission data of neighbors; then, according to the transmission success rate and message quantity of neighbor nodes, the trust value is calculated, and only nodes whose trust value reaches the preset standard are selected for data transmission; then, according to whether effective coverage of nodes within two hops can be achieved, the minimum number of multi-point relay MPR nodes that meet the coverage requirements are selected as set A; after receiving the TC message, these relay MPR node sets A update the routing table to ensure that the paths to all nodes are directly available; finally, the extended Osprey optimization algorithm OOA is used to optimize the path selection, and the optimal path is further determined based on link quality, node stability and security parameters to ensure the reliability and efficiency of data transmission;
[0060] Step 2 specifically includes the following sub-steps:
[0061] Step 2.1, each normal node collects the status information of adjacent nodes by periodically sending HELLO messages and topology control TC messages. The normal node records the transmission success rate and number of message transmissions of each neighbor through the received messages;
[0062] Step 2.2: Each normal node calculates the trust value T based on the transmission success rate and message transmission quantity of its neighboring nodes. y (n):
[0063]
[0064] Among them, p c is the number of packets successfully transmitted, p s is the number of successfully transmitted messages, p a is the total number of transmission attempts, p t is the total number of transmissions, ∈ is the weight factor;
[0065] Step 2.3, only nodes whose trust values meet the preset standard will be selected for data packet transmission. These nodes collect neighbor information based on the HELLO message, and then select a group of multipoint relay MPR nodes from the neighbor nodes. The selection criterion is to ensure that all nodes within two hops are covered by the minimum number of relay nodes, thereby reducing the number of message propagation times in the network;
[0066] Step 2.4: The relay MPR node updates the routing table according to the received TC message and obtains all available paths; therefore, the routing table stores the path information to all nodes in the network, and when a node receives a data packet, it directly forwards it to the next node without searching for a path;
[0067] Step 2.5, use the extended Osprey optimization algorithm OOA to select the best path from the paths obtained in 2.4; optimize path selection; the algorithm finds the best path candidate through the node link quality LQ, node stability S and security X parameters, and the specific calculation formula is:
[0068] C ij =λ1LQ ij +λ2X ij +λ3S ij (14)
[0069] Among them C ij is the link stability from node i to node j, LQ ij Represents link quality, X ij is security, S ij is the node stability; λ1, λ2, λ3 are the corresponding weight factors.
[0070] By sorting the link stability of all available paths, the path with the highest stability is selected as the optimal routing path.
[0071] Step 3. On the optimal path obtained in step 2, the normal nodes or users in the optimal path upload the video file to the IPFS network, generate a unique content identifier CID through a hash algorithm, which is used as the encrypted address of the file and stored in IPFS for retrieval and access by other nodes in the optimal path; other nodes use CID to download files from IPFS, and the files are stored on multiple nodes to ensure that the data remains available even if a node fails; after downloading the file, the integrity of the file is verified by comparing the file hash value and CID to prevent data tampering; the CID is recorded on the blockchain, and the upload time and access records are retained to ensure the immutability and traceability of the file; that is, the combination of the interstellar file system IPFS and the blockchain is used to achieve the secure storage and transmission of video data in a dynamic network environment.
[0072] Step 3.1: A normal node or user in the optimal path uploads the video file to the IPFS network, and generates a unique content identifier CID through the IPFS hash algorithm. The CID is used as the encrypted address of the file for file storage and access. The CID generation process is recorded in real time by the blockchain smart contract to ensure that the CID and its corresponding uploaded file information cannot be tampered with.
[0073] Step 3.2: Video files are stored on multiple nodes, forming a decentralized distributed storage structure. Since the blockchain's smart contract is responsible for recording and verifying the status and CID information of storage nodes, even if a storage node fails, other nodes can still provide data access, ensuring high availability and reliability of files. At the same time, the blockchain records the dynamic changes of storage nodes, including node joining, exiting, or storage status updates, to enhance the system's dynamic adaptability.
[0074] Step 3.3: Other nodes retrieve and download video files from the IPFS network through CID, and use the smart contract provided by the blockchain to verify whether the CID and the file hash value match. The verification process is based on the consensus mechanism of the blockchain to ensure the integrity and authenticity of the file and prevent the data from being maliciously tampered with or forged.
[0075] Step 3.4: After the download is completed, the blockchain records the access operation of the node as an unalterable transaction. The record content includes CID, download time, and access node identification. Finally, through the transaction traceability function on the blockchain, a transparent audit of the file access history is provided to ensure the security and traceability of the video data.
[0076] Step 3.5: Based on the CID information stored in the blockchain and the distributed storage mechanism of IPFS, users can quickly share and transmit video data through other nodes in the optimal path. The blockchain records the path and node status of each transmission, providing reliable network monitoring and data sharing history, further enhancing the security of data transmission.
[0077] Beneficial effects:
[0078] 1. The present invention discloses a secure video transmission method based on blockchain and multi-path dynamic routing. It adopts a malicious node detection method and can identify and isolate malicious nodes in the network through a black hole detection mechanism, especially nodes that perform black hole attacks, to avoid data packet loss and tampering, thereby significantly improving the security and reliability of data transmission.
[0079] 2. The present invention discloses a secure video transmission method based on blockchain and multi-path dynamic routing. By calculating the trustworthiness of nodes, only trusted nodes are used for data transmission, thereby reducing unnecessary data packet retransmission and resource waste. The method is suitable for resource-constrained mobile devices and highly dynamic network environments.
[0080] 3. The present invention discloses a secure video transmission method based on blockchain and multi-path dynamic routing. It adopts dynamic routing optimization and analyzes network topology changes and trust values between nodes in real time. The system can quickly select the optimal path to transmit data, reduce transmission delays caused by node failure or path changes, and improve network stability and transmission efficiency.
[0081] 4. The present invention discloses a secure video transmission method based on blockchain and multi-path dynamic routing. The blockchain technology is introduced to record the operations in the data transmission process in an unalterable distributed ledger, and the integrity and authenticity of the data are verified by the content identifier CID. The decentralized nature of the blockchain ensures the transparency and traceability of data transmission, and prevents data tampering and information leakage. BRIEF DESCRIPTION OF THE DRAWINGS
[0082] Figure 1 This is a flow chart of a secure video transmission method based on blockchain and multi-path dynamic routing of the present invention;
[0083] Figure 2 A schematic diagram of black hole node detection of the present invention;
[0084] Figure 3 A schematic diagram of a relay node selected for the present invention;
[0085] Figure 4 This is an example diagram of the final routing selection of the present invention. DETAILED DESCRIPTION
[0086] The present invention will be described in detail below in conjunction with the accompanying drawings and embodiments, and the technical problems solved by the technical solution of the present invention and the beneficial effects will be discussed. It should be noted that the described embodiments are intended to facilitate the understanding of the present invention and do not have any limiting effect on the present invention.
[0087] Embodiment 1:
[0088] This embodiment is an application of a secure video transmission method based on blockchain and multi-path dynamic routing to achieve secure video transmission in a complex network environment.
[0089] This example realizes video security transmission based on black hole detection, extended Osprey-assisted optimized link state routing protocol and blockchain storage. The overall process of the invention is as follows: Figure 1 The present invention uses a deep learning model to detect malicious nodes. The schematic diagram of the black hole node is shown in Figure 2 As shown. Figure 3 As shown, the dynamic routing method adopted in this embodiment combines trust value calculation and multi-point relay to perform efficient and secure routing.
[0090] This embodiment discloses a secure video transmission method based on blockchain and multi-path dynamic routing, and the specific implementation steps are as follows:
[0091] Step 1. By building a video streaming transmission system based on Linux modules, complete the verification of video transmission function in a dynamic network environment and create a dedicated video data set suitable for wireless sensor network detection. First, import the input video data into the system in mainstream formats (such as MP4, AVI, etc.), use two Linux-based network modules as the transmitter and receiver respectively, and use the socket programming interface to achieve real-time transmission of video streams to ensure continuity and low latency in a dynamic network environment. By adjusting the network simulation parameters, the bandwidth range is 10Mbps to 100Mbps, the packet loss rate range is 0% to 10%, and the delay range is 10ms to 100ms, simulate complex network transmission scenarios, and verify the system's adaptability and stability to dynamic changes in the network environment.
[0092] Step 2: In the process of video data collection and creation, 10,000 short videos with a total duration of about 500 hours were first obtained from the Kaggle public platform. These videos cover a variety of scenarios, such as traffic monitoring, indoor activities, drone views, etc., and are divided into training sets and test sets according to the needs of video processing applications, supporting target recognition and classification functions. Subsequently, by screening the scenes containing abnormal behaviors in the short videos, a WSN-DS dataset specifically for wireless sensor network detection is constructed. This dataset focuses on marking behaviors related to network attacks, including denial of service (DoS) attacks (simulating nodes sending a large number of data packets to cause network congestion) and black hole attacks (simulating nodes discarding or tampering with data packets after pretending to be trusted nodes). The final dataset created has a scale of 500 samples, a total data size of 50GB, and a video duration of 30 seconds to 5 minutes per segment, covering typical attack scenarios of wireless sensor networks, and significantly improving the applicability of black hole detection and classification algorithms.
[0093] Step 3: This embodiment uses a dense convolutional bidirectional gated network model to detect black hole nodes for video data in a dynamic network environment, thereby achieving efficient extraction of video features and accurate classification of node behaviors.
[0094] Step 3 specifically includes the following sub-steps:
[0095] Step 3.1: Figure 1 As shown in the figure, the original video data is input into the convolutional neural network of the dense convolutional bidirectional gated network model for feature extraction. The local features of each frame in the video, such as edges, textures, and key points, are extracted through convolution operations; then, the pooling layer performs dimensionality reduction operations on the feature data, which reduces the computational complexity and improves the processing efficiency of the model by retaining important feature points and suppressing redundant information. After completing local feature extraction and dimensionality reduction, the dense connection layer further integrates the global features of the video, establishes the correlation between frames, and enhances the ability to express the temporal information of the video data, and finally outputs the feature map B∈R C×H×W , where C represents the number of channels, H and W are the height and width of the feature map respectively.
[0096] Through the above feature extraction process, the dense convolutional network not only captures the spatial local features in the video, but also builds the global association between frames through the dense connection mechanism, providing high-quality input features for the subsequent bidirectional gated recurrent network (Bi-GRU) module.
[0097] Step 3.2: Based on the dual attention network module, the feature map B output by the dense convolutional network is further processed to generate the feature map F through the spatial attention module and the channel attention module respectively. 1 and F 2 , in order to enhance the feature expression capability and improve the detection accuracy of black hole nodes.
[0098] Step 3.2.1: Perform spatial attention calculation through the position attention module:
[0099] First, feature map B undergoes three layers of convolution operations to generate three feature maps A, D, and E, where {A, D, E}∈R C×H×W , reshape the feature maps A, D and E dimensions into R C×N , perform matrix multiplication of feature map A and feature map D and apply SoftMax function to generate position attention matrix S∈R N×N , the matrix S represents the correlation and weight of each spatial position; the specific calculation formula of the matrix S is as follows:
[0100]
[0101] Where S ij Represents the elements in the matrix S, indicating the degree to which the i-th position is affected by the j-th position, A i represents the i-th element in feature A, D j represents the jth element in feature D, and N represents the number of pixels, which is obtained by multiplying the height and width of the image, that is, N = H × W.
[0102] Then, the feature map E∈R C×N With the matrix S ij Multiply them to adjust the spatial position features in a weighted manner, and then add them to the feature map B to generate the feature map F 1 , the calculation formula is as follows:
[0103]
[0104] in, Is a C-dimensional vector, representing the final feature F 1 The value at the jth position, feature F 1 ∈R C ×H×W space; α is the weight factor, which controls the increase of additional weight; E i is the value of feature E at the ith position, feature E∈R C×N Space; B j It is a C-dimensional vector, representing the value of feature B at the jth position.
[0105] Formula (2) shows that the final feature F contains the weighted average of each position, combining the global region and the initial parameters;
[0106] Step 3.2.2: Calculate channel attention through the channel attention module:
[0107] Reshape the feature map B into R C×N, extract the feature vector of each channel, calculate the similarity between channels, and generate the channel attention matrix Y∈R by matrix multiplication C×C , apply the SoftMax function to normalize the channel attention matrix Y. The specific calculation formula is as follows:
[0108]
[0109] Among them, Y ji represents the elements in the channel attention matrix Y, which measures the influence of the jth channel on the ith channel. B is the original local feature, B i Represents the feature vector of the i-th channel in feature B, B j Represents the feature vector of the jth channel in feature B. C represents the number of channels of feature map B.
[0110] Then, through weighted operation, the channel attention matrix Y is multiplied by the feature map B, and the weight of each channel is adjusted to obtain the channel optimized feature map F 2 , the formula is as follows:
[0111]
[0112] in, The final feature F 2 At the value of the jth channel, feature F 1 ∈R C×H×W space; β is the weight factor;
[0113] According to formula (4), the long-term structural connection between feature map elements is described, and the final feature of each channel is composed of the weighted average of the features extracted from other channels and the original attributes.
[0114] Step 3.3: The feature map F obtained in step 3.2 1 、F 2 Perform a weighted addition operation to generate an enhanced fusion feature map Fc, and then integrate the features Fc of each frame into F∈R in the video time sequence T×C×H×W , F represents the global enhancement feature of the video.
[0115] Step 3.4: Reduce the dimension of the spatial features of F by using Global Average Pooling (GAP) to reduce the spatial dimensions of H and W and generate a global feature representation for each frame. The GAP operation formula is as follows:
[0116]
[0117] Among them, f t Represents the global feature vector at the tth time step, with dimension R C. F t,c,i,j Represents the feature value of channel c at time step t, position (i, j).
[0118] After the GAP operation, the feature map is transformed from R T×C×H×W Convert to R T×C , each frame feature is compressed into a global representation, which significantly reduces the computational complexity.
[0119] Step 3.5: Perform a one-dimensional convolution operation on the time dimension T, with a convolution kernel size of k and a step size of 1. The convolution formula is as follows:
[0120]
[0121] Among them, F′ t represents the output feature of time step t, k represents the size of the convolution kernel, and W i represents the weight of the convolution kernel at the i-th position. t-i represents the input feature vector at time step ti, and b represents the bias in the convolution operation.
[0122] Then, the final features of all nodes are integrated into feature G, whose shape is [T, n, d], where T is the number of time steps, indicating the number of video frames; n corresponds to the number of nodes; and d is the feature dimension of each node after one-dimensional convolution.
[0123] In steps 3.4 and 3.5, the weights of the convolution kernels are used to retain important features in the time series, reduce redundant information, and capture the feature changes of video frames between adjacent time steps. The feature tensor G finally generated integrates the spatial position, channel, and time series features of the video frame, providing high-quality representation for the subsequent Bi-GRU network input.
[0124] Step 3.6: Organize the feature map G in step 3.5 into a sequence {G1, G2, …, GT} by time step, and the feature Gt∈R n×d The time step sequence {G1, G2, …, GT} is input into the Bi-GRU network step by step in time order. The Bi-GRU network consists of a forward GRU and a backward GRU, which process the time series from two directions. The forward GRU processes the data sequentially from time step t = 1 to t = T to generate the forward hidden state The backward GRU processes in reverse order to generate the backward hidden state At each time step t, the forward hidden state and the backward hidden state Fusion into a comprehensive hidden state H t It has a dimension of 2h and contains the global time characteristics of the node at the current time step.
[0125] Through the bidirectional processing of the Bi-GRU network, the comprehensive hidden state H t The bidirectional dependencies and global characteristics of video data in time series are captured, which enhances the ability to understand node behavior in dynamic networks. This step provides key support for the accurate identification of black hole nodes and ensures the integrity and consistency of feature information in the time dimension.
[0126] Step 3.7: Update the Bi-GRU hidden state.
[0127] Step 3.7.1. Calculation of update gate, update gate z t Control the influence of the hidden state of the previous time step on the current time step. The formula is as follows
[0128] z t =σ(W z ·x t +U z ·h t-1 +b z ) (7)
[0129] Among them, z t Represents the update gate output, ranging from [0,1]; W z and U z is the weight matrix of the update gate, b z is the bias vector of the update gate, x t Represents the input feature Gt at the current time step, h t-1 represents the hidden state of the previous time step, and σ is the Sigmoid activation function.
[0130] Step 3.7.2, reset gate calculation, reset gate r t Control the degree of utilization of historical information in the current time step. The formula is as follows:
[0131] r t =σ(W r ·x t +U r ·h t-1 +b r ) (8)
[0132] Among them, r t Represents the reset gate output, ranging from [0,1]; W r and U r is the weight matrix of the reset gate, b r is the bias vector for the reset gate.
[0133] Step 3.7.3, candidate hidden state calculation, under the control of the reset gate, generate the candidate hidden state of the current time step, the formula is as follows:
[0134]
[0135] in, is the candidate hidden state, W h and U h is the weight matrix, b h is the bias vector, and ⊙ represents element-by-element multiplication.
[0136] Step 3.7.4: According to the weight of the update gate, the candidate hidden state is fused with the hidden state of the previous time step to generate the hidden state of the current time step. The formula is as follows:
[0137]
[0138] Among them, h t Represents the hidden state at the current time step.
[0139] Step 3.8: Classify nodes and distinguish normal nodes from black hole nodes.
[0140] Step 3.8.1: The comprehensive hidden state H output by Bi-GRU t Input the fully connected classification layer to generate the raw score for each category. The formula is as follows:
[0141] o i =W o ·H t +b o (11)
[0142] Among them, i is the output of the fully connected layer, indicating the original score of category i, where i represents the classification category, and W o and b o are the weight matrix and bias vector of the fully connected layer respectively.
[0143] Step 3.8.2, use the Softmax activation function to calculate the node classification probability, the formula is as follows:
[0144]
[0145] Among them, P(y=i|H t ) is the node classification probability, y corresponds to the category of the node, y = 0 is a normal node, y = 1 is a black hole node, and K is the number of classification categories.
[0146] Step 3.8.3: Determine the node category based on the probability value output by Softmax. If P(y=0|H t )>P(y=1|H t ), the node is classified as a normal node, otherwise the node is a black hole node.
[0147] like Figure 2As shown, a small network with 10 nodes is simulated, in which node 4 is set as a black hole node. After the above model processing and calculation, Table 1 is obtained.
[0148] Table 1 The probability that a node is a black hole node
[0149] Serial number 1 2 3 4 5 6 7 8 9 10 Probability 0.327 0.341 0.468 0.868 0.372 0.257 0.308 0.423 0.212 0.391
[0150] From the table results, it can be determined that node 4 is a black hole node.
[0151] Step 4: After removing the black hole nodes, each normal node periodically sends HELLO and topology control TC messages to collect the status information of neighbor nodes and record the message transmission data of neighbors; then, according to the transmission success rate and total number of messages of neighbor nodes, the trust value is calculated, and only nodes whose trust value reaches the preset standard are selected for data transmission; then, according to whether effective coverage of nodes within two hops can be achieved, the minimum number of multi-point relay MPR nodes that meet the coverage requirements are selected as set A; after receiving the TC message, these relay MPR node sets A update the routing table to ensure that the paths to all nodes are directly available; finally, the extended Osprey optimization algorithm OOA is used to optimize the path selection, and the optimal path is further determined based on link quality, node stability and security parameters to ensure the reliability and efficiency of data transmission;
[0152] Step 4 specifically includes the following sub-steps:
[0153] Step 4.1, each normal node collects the status information of adjacent nodes by periodically sending HELLO messages and topology control TC messages. The normal node records the transmission success rate and number of message transmissions of each neighbor through the received messages;
[0154] Step 4.2: Each normal node calculates the trust value T based on the transmission success rate and message transmission quantity of its neighboring nodes. y (n):
[0155]
[0156] Among them, p c is the number of packets successfully transmitted, p s is the number of successfully transmitted messages, p a is the total number of transmission attempts, p t is the total number of transmissions, ∈ is the weight factor;
[0157] For example, the status information of node n is as follows, and the default standard is set to 0.7:
[0158] p c =80, p s =20, p a =25, p t=100,∈=0.5;
[0159] Calculate the trust value:
[0160] T y (n) = 0.8
[0161] Trust value T y (n) If the preset standard is met, the node is considered a trusted node and can be used for data transmission.
[0162] Step 4.3: Only nodes whose trust values meet the preset criteria will be selected for data packet transmission. These nodes collect neighbor information based on the HELLO message, and then select a group of multipoint relay MPR nodes from the neighbor nodes. The selection criterion is to ensure that all nodes within two hops are covered by the minimum number of relay nodes, thereby reducing the number of message propagation times in the network.
[0163] like Figure 3 As shown in FIG. 1 , after the neighbor nodes of node N are selected through MPR, the relay node set A can cover all nodes within the two-hop range, ensuring efficient network transmission.
[0164] Step 4.4: The relay MPR node updates the routing table according to the received TC message, and the routing table obtains all available paths; therefore, the routing table stores the path information to all nodes in the network, and when a node receives a data packet, it directly forwards it to the next node without searching for a path, thereby improving efficiency and reliability;
[0165] Step 4.5, use the extended Osprey optimization algorithm OOA to select the best path from the paths obtained in 4.4; optimize path selection; the algorithm finds the best path candidate through the node link quality LQ, node stability S and security X parameters, and the specific calculation formula is:
[0166] C ij =λ1LQ ij +λ2X ij +λ3S ij (14)
[0167] Among them C ij is the link stability from node i to node j, LQ ij Represents the link quality, X ij is security, S ij is the node stability; λ1, λ2, λ3 are the corresponding weight factors.
[0168] Then, by sorting the link stability of all available paths, the path with the highest stability is selected as the optimal path for routing;
[0169] like Figure 4As shown, the parameters of the inter-node path are as follows:
[0170] Path 1 (nodes 1→2→3→8): LQ=0.8, X=0.7, S=0.9;
[0171] Path 2 (nodes 1→4→5→8): LQ=0.9, X=0.6, S=0.8;
[0172] Path 3 (nodes 1→6→7→8): LQ=0.85, X=0.8, S=0.75.
[0173] Set weight factors: λ1=0.4, λ2=0.3, λ3=0.3;
[0174] Calculate the path score:
[0175] Path 1: C 18 =0.8, Path 2: C 18 =0.78, Path 3: C 18 =0.805;
[0176] Through sorting, path 3 has the highest link stability and is finally selected as the optimal path.
[0177] Step 4 periodically collects neighbor node status information, dynamically calculates the trust value, and selects the optimal path in combination with the extended Osprey optimization algorithm. This step reduces redundant messages and improves network efficiency while ensuring the reliability and security of data transmission, providing an effective solution for transmission optimization in a dynamic network environment.
[0178] Step 5: Based on the optimal path obtained in step 4, the combination of Interstellar File System (IPFS) and blockchain is used to achieve secure storage and transmission of video data in a dynamic network environment.
[0179] Step 5.1: The normal node or user in the optimal path uploads the video file to the IPFS network, and generates a unique content identifier CID through the IPFS hash algorithm. The CID is used as the encrypted address of the file for file storage and access. The CID generation process is recorded in real time by the blockchain smart contract to ensure that the CID and its corresponding uploaded file information cannot be tampered with.
[0180] Step 5.2: Video files are stored on multiple nodes, forming a decentralized distributed storage structure. Since the blockchain's smart contract is responsible for recording and verifying the status and CID information of storage nodes, even if a storage node fails, other nodes can still provide data access, ensuring high availability and reliability of files. At the same time, the blockchain records the dynamic changes of storage nodes, including node joining, exiting, or storage status updates, to enhance the system's dynamic adaptability.
[0181] Step 5.3: Other nodes retrieve and download video files from the IPFS network through CID, and use the smart contract provided by the blockchain to verify whether the CID and the file hash value match. The verification process is based on the consensus mechanism of the blockchain to ensure the integrity and authenticity of the file and prevent the data from being maliciously tampered with or forged.
[0182] Step 5.4: After the download is completed, the blockchain records the access operation of the node as an unalterable transaction. The record content includes CID, download time, and the identification of the access node. Finally, through the transaction traceability function on the blockchain, a transparent audit of the file access history is provided to ensure the security and traceability of the video data.
[0183] Step 5.5: Based on the CID information stored in the blockchain and the distributed storage mechanism of IPFS, users can quickly share and transmit video data through other nodes in the optimal path. The blockchain records the path and node status of each transmission, providing reliable network monitoring and data sharing history, further enhancing the security of data transmission.
[0184] By combining IPFS and blockchain technology, this step ensures efficient distributed storage of video files while achieving full monitoring and security verification of the data transmission process. The uniqueness of CID combined with the tamper-proof nature of blockchain provides a solid guarantee for the integrity and authenticity of video data, while achieving high reliability and traceability of data storage and sharing in a dynamic network environment.
[0185] At this point, the video security transmission process in the dynamic network environment is completed.
[0186] This embodiment uses the black hole detection model, the extended Osprey optimized routing protocol and blockchain storage technology to ensure efficient and secure transmission of video data in a complex network environment. The core steps of the transmission process and routing method are as follows: Figures 1 to 3 shown.
[0187] This embodiment is different from the traditional static encryption strategy. This method focuses on dealing with the uncertainty caused by the dynamic changes of nodes in the network. It combines black hole node detection, optimal path selection and the immutability of blockchain. It stores video data through IPFS to ensure that even if part of the data and content identifiers are leaked, they cannot be maliciously decrypted or tampered with. This method is particularly suitable for highly dynamic and complex network environments, and provides significant advantages for application scenarios with strict requirements on data transmission security.
[0188] The specific description above further illustrates the purpose, technical solutions and beneficial effects of the invention in detail. It should be understood that the above is only a specific embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.
Claims
1. A secure video transmission method based on blockchain and multi-path dynamic routing, characterized in that: The following steps are included: Step 1: Input video into the dense convolutional bidirectional gated network model for processing to achieve black hole node detection; Step 1 specifically includes the following sub-steps: Step 1.1: The original video data is input into the convolutional neural network of the dense convolutional bidirectional gated network model for feature extraction. The convolution layer extracts the local features of each frame in the video, the pooling layer reduces the data dimension and reduces the computational complexity, and then the dense layer integrates the global features and outputs the feature map B∈R C×H×W ; Step 1.2: Feature map B enters the dual attention network, and feature map F is calculated by the spatial attention module. 1 , the feature map F is calculated by the channel attention module 2 ; Step 1.2.1: Perform spatial attention calculation through the position attention module: The feature map B undergoes three layers of convolution operations to generate three feature maps A, D, and E, where {A, D, E}∈R C×H×W , reshape the feature maps A, D and E dimensions into R C×N , perform matrix multiplication of feature map A and feature map D and apply SoftMax function to generate position attention matrix S∈R N×N , the matrix S represents the correlation and weight of each spatial position; the specific calculation formula of the matrix S is as follows: Where S ij Represents the elements in the matrix S, indicating the degree to which the i-th position is affected by the j-th position, A i represents the i-th element in feature A, D j represents the jth element in feature D, N represents the number of pixels, which is obtained by multiplying the height and width of the image, that is, N = H × W; The feature map E∈R C×N With the matrix S ij Multiply them together to adjust the spatial position features in a weighted manner, and then add them to the feature map B to generate the feature map F 1 , the calculation formula is as follows: in, The final feature F 1 The value at the jth position, feature F 1 ∈R C×H×W space; α is the weight factor, which controls the increase of additional weight; E i is the value of feature E at the ith position, feature E∈R C×N Space; B j is a C-dimensional vector, representing the value of feature B at the jth position; Step 1.2.2: Calculate channel attention through the channel attention module: Reshape the feature map B into R C×N , extract the feature vector of each channel, calculate the similarity between channels, and generate the channel attention matrix Y∈R by matrix multiplication C×C , apply the SoftMax function to normalize the channel attention matrix Y. The specific calculation formula is as follows: Among them, Y ji represents the elements in the channel attention matrix Y, which measures the influence of the jth channel on the ith channel; B is the original local feature, B i Represents the feature vector of the i-th channel in feature B, B j represents the feature vector of the jth channel in feature B; C represents the number of channels of feature B; Through weighted operation, the channel attention matrix Y is multiplied by the feature map B, and the weight of each channel is adjusted to obtain the channel optimized feature map F 2 , the formula is as follows: in, The final feature F 2 At the value of the jth channel, feature F 1 ∈R C×H×W space, β is the weight factor; Step 1.3: The feature map F obtained in step 1.2 1 、F 2 Perform weighted addition operation to generate enhanced fusion feature map Fc, and integrate the feature Fc of each frame into F∈R in video timing. T×C×H×W ; Step 1.4: Reduce the dimension of the spatial features of F by using Global Average Pooling (GAP) to reduce the spatial dimensions of H and W and generate a global feature representation for each frame. The GAP operation formula is as follows: Among them, f t represents the global feature vector at the t-th time step, the output after spatial dimensionality reduction; F t,c,i,j represents the feature value of channel c at time step t, position (i, j); Step 1.5: Perform a one-dimensional convolution operation on the time dimension T, with a convolution kernel size of k and a step size of 1. The convolution formula is as follows: in, represents the output feature of time step t, k represents the size of the convolution kernel, and W i represents the weight of the convolution kernel at the i-th position; f t-i represents the input feature vector at time step ti, and b represents the bias in the convolution operation; The final features of all nodes are integrated into feature G, whose shape is [T, n, d], where T is the number of time steps, indicating the number of video frames; n corresponds to the number of nodes; and d is the feature dimension of each node after one-dimensional convolution. Step 1.6: Organize the feature map G in step 1.5 into a sequence {G1, G2, …, GT} by time step, and the feature Gt∈R n×d ; Input the time step sequence {G1, G2, …, GT} into the Bi-GRU network step by step in chronological order; The Bi-GRU network consists of a forward GRU and a backward GRU, which process the time series from two directions respectively; The forward GRU processes the data sequentially from time step t = 1 to t = T to generate the forward hidden state The backward GRU processes in reverse order to generate the backward hidden state At each time step t, the forward hidden state and the backward hidden state Fusion into a comprehensive hidden state H t The dimension is 2h, which contains the global time characteristics of the node at the current time step; Step 1.7, update the Bi-GRU hidden state; Step 1.7.
1. Calculation of update gate, update gate z t Control the influence of the hidden state of the previous time step on the current time step. The formula is as follows z t =σ(W z ·x t +U z ·h t-1 +b z ) (7) Among them, z t Represents the update gate output, ranging from [0,1]; W z and U z is the weight matrix of the update gate, b z is the bias vector of the update gate, x t Represents the input feature Gt at the current time step, h t-1 represents the hidden state of the previous time step, σ is the Sigmoid activation function; Step 1.7.2, reset gate calculation, reset gate r t Control the degree of utilization of historical information in the current time step. The formula is as follows: r t =σ(W r ·x t +U r ·h t-1 +b r ) (8) Among them, r t Represents the reset gate output, ranging from [0,1]; W r and U r is the weight matrix of the reset gate, b r is the bias vector for resetting the gate; Step 1.7.3, candidate hidden state calculation, under the control of the reset gate, generate the candidate hidden state of the current time step, the formula is as follows: in, is the candidate hidden state, W h and U h is the weight matrix, b h is the bias vector, ⊙ represents element-by-element multiplication; Step 1.7.4: According to the weight of the update gate, the candidate hidden state is fused with the hidden state of the previous time step to generate the hidden state of the current time step. The formula is as follows: Among them, h t represents the hidden state of the current time step; Step 1.8 classifies nodes and distinguishes normal nodes from black hole nodes; Step 1.8.1: The comprehensive hidden state H output by Bi-GRU t Input the fully connected classification layer to generate the classification results for each time step. The formula is as follows: o i =W o H t +b o (11) Among them, i is the output of the fully connected layer, indicating the original score of category i, where i represents the classification category, and W o and b o They are the weight matrix and bias vector of the fully connected layer respectively; Step 1.8.2, use the Softmax activation function to calculate the node classification probability, the formula is as follows: Among them, P(y=i|H t ) is the node classification probability, y corresponds to the node category, y = 0 is a normal node, y = 1 is a black hole node, and K is the number of classification categories; Step 1.8.3: Determine the node category based on the probability value output by Softmax. If P(y=0|H t )>P(y=1|H t ), the node is classified as a normal node, otherwise the node is a black hole node; Step 2, each normal node periodically sends HELLO and topology control TC messages to collect the status information of neighbor nodes, and records the message transmission data of neighbors; then, according to the transmission success rate and message quantity of neighbor nodes, the trust value is calculated, and only nodes whose trust value reaches the preset standard are selected for data transmission; then, according to whether effective coverage of nodes within two hops can be achieved, the minimum number of multi-point relay MPR nodes that meet the coverage requirements are selected as set A; after receiving the TC message, the relay MPR node set A updates the routing table to ensure that the paths to all nodes are directly available; finally, the extended Osprey optimization algorithm OOA is used to optimize the path selection, and the optimal path is further determined based on link quality, node stability and security parameters to ensure the reliability and efficiency of data transmission; Step 3. On the optimal path obtained in step 2, the normal nodes or users in the optimal path upload the video file to the IPFS network, generate a unique content identifier CID through a hash algorithm, which is used as the encrypted address of the file and stored in IPFS for retrieval and access by other nodes in the optimal path; other nodes use CID to download files from IPFS, and the files are stored on multiple nodes to ensure that the data remains available even if a node fails; after downloading the file, the integrity of the file is verified by comparing the file hash value and CID to prevent data tampering; the CID is recorded on the blockchain, and the upload time and access records are retained to ensure the immutability and traceability of the file; that is, the combination of the interstellar file system IPFS and the blockchain is used to achieve the secure storage and transmission of video data in a dynamic network environment.
2. A secure video transmission method based on blockchain and multi-path dynamic routing as claimed in claim 1, characterized in that: Step 2 specifically includes the following sub-steps: Step 2.1, each normal node collects the status information of adjacent nodes by periodically sending HELLO messages and topology control TC messages. The normal node records the transmission success rate and number of message transmissions of each neighbor through the received messages; Step 2.2: Each normal node calculates the trust value T based on the transmission success rate and message transmission quantity of its neighboring nodes. y (n): Among them, p c is the number of packets successfully transmitted, p s is the number of successfully transmitted messages, p a is the total number of transmission attempts, p t is the total number of transmissions, ∈ is the weight factor; Step 2.3, only nodes whose trust values meet the preset standard will be selected for data packet transmission. These nodes collect neighbor information based on the HELLO message, and then select a group of multipoint relay MPR nodes from the neighbor nodes. The selection criterion is to ensure that all nodes within two hops are covered by the minimum number of relay nodes, thereby reducing the number of message propagation times in the network; Step 2.4: The relay MPR node updates the routing table according to the received TC message and obtains all available paths; therefore, the routing table stores the path information of all nodes in the network, and when a node receives a data packet, it directly forwards it to the next node without searching for a path; Step 2.5: Use the extended Osprey optimization algorithm OOA to select the optimal path from the paths obtained in step 2.4; find the best path candidate through the node link quality LQ, node stability S and security X parameters. The specific calculation formula is: C ij =λ1LQ ij +λ2X ij +λ3S ij (14) Among them C ij is the link stability from node i to node j, LQ ij Represents link quality, X ij is security, S ij is the node stability; λ1, λ2, λ3 are the corresponding weight factors; By sorting the link stability of all available paths, the path with the highest stability is selected as the optimal routing path.
3. A secure video transmission method based on blockchain and multi-path dynamic routing as claimed in claim 2, characterized in that: The implementation method of step three is: Step 3.1: The normal node or user in the optimal path uploads the video file to the IPFS network, and generates a unique content identifier CID through the IPFS hash algorithm. The CID is used as the encrypted address of the file for file storage and access. The CID generation process is recorded in real time by the blockchain smart contract to ensure that the CID and its corresponding uploaded file information cannot be tampered with. Step 3.2: Video files are stored on multiple nodes, forming a decentralized distributed storage structure. Since the blockchain’s smart contract is responsible for recording and verifying the status and CID information of storage nodes, even if a storage node fails, other nodes can still provide data access, ensuring high availability and reliability of the file. At the same time, the blockchain records the dynamic changes of storage nodes, including node joining, exiting, or storage status update, to enhance the system’s dynamic adaptability. Step 3.3, other nodes retrieve and download video files from the IPFS network through CID, and use the smart contract provided by the blockchain to verify whether the CID and the file hash value match. The verification process is based on the consensus mechanism of the blockchain to ensure the integrity and authenticity of the file and prevent the data from being maliciously tampered or forged; Step 3.4: After the download is completed, the blockchain records the access operation of the node as an unalterable transaction. The record content includes CID, download time, and the ID of the access node. Through the transaction traceability function on the blockchain, a transparent audit of the file access history is provided to ensure the security and traceability of the video data. Step 3.5: Based on the CID information stored in the blockchain and the distributed storage mechanism of IPFS, users can quickly share and transmit video data through other nodes in the optimal path. The blockchain records the path and node status of each transmission, providing reliable network monitoring and data sharing history, further enhancing the security of data transmission.
Citation Information
Cited By
Internet-based remote video transmission potential safety hazard processing method and system
CN120512306A
Electric power data leakage identification method and system based on deep learning
CN120579221A