Block chain positioning system based on data traceability
By dividing agricultural product positioning information into multiple information segments and generating independent vectors, combined with hash value storage and risk assessment, the problems of inconvenient information storage and leakage in the existing blockchain positioning system are solved, and the system security and feedback speed are improved.
Patent Information
- Application Number
- CN202510661102.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-22
- Publication Date
- 2025-10-10
AI Technical Summary
The existing blockchain positioning system is inconvenient in storing and retrieving agricultural product positioning information, fails to effectively prevent information leakage, and is unable to assess the risk level of data requests, affecting the system's feedback speed.
The agricultural product location information is divided into multiple information segments, and an independent vector is constructed using the initial key. A new key is generated through a sliding window, and information segment analysis and hash value storage are performed. At the same time, a classifier is used to evaluate the risk level of access requests, and blockchain is used to store security information.
It achieves the secure storage and rapid retrieval of agricultural product location information, prevents information leakage, and improves the system operation speed and the reliability of data feedback.
Smart Images

Figure CN120765261A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data analysis technology, and in particular to a blockchain positioning system based on data traceability. Background Art
[0002] The blockchain positioning system based on data traceability mainly utilizes the tamper-proof characteristics of the blockchain, combined with Internet of Things devices, to record the geographical location and environmental data of the entire chain of agricultural products from production, processing to logistics in real time, and provide timely feedback to users to ensure data transparency and credibility, improve supply chain efficiency and brand credibility, and discloses "a blockchain-based location positioning method, system, electronic device and storage medium. Based on the encryption algorithm, the positional relationship between the target user's position and the target area is converted into the area relationship between the target point corresponding to the target user's position and the target polygon corresponding to the target area. The location information of the target point is in the user-end node, and the vertex data information of the target polygon is in the platform node. The plaintext data of the user-end node and the platform node do not leave the local area, and neither party knows the plaintext data of the other party. It solves the problem that the existing location positioning easily leads to a large amount of user data leakage, thereby realizing the privacy protection of user travel data, improving the security of user location data, and reducing the risk of user data leakage."
[0003] The above-mentioned existing technology solves the problem that existing location positioning easily leads to large-scale user data leakage. However, when the system is running, the agricultural product location information is not divided, which is not convenient for storage and retrieval. At the same time, using a single key cannot prevent information leakage. In the process of receiving requests to access data, the risk level of these requested data is not assessed, resulting in harmful data affecting the speed of system feedback, thereby causing the user's actual request to be unable to be responded to in a short time. Summary of the Invention
[0004] The purpose of the present invention is to provide a blockchain positioning system based on data traceability to solve the problems raised in the above background technology.
[0005] To achieve the above objectives, the present invention provides the following technical solutions: a blockchain positioning system based on data traceability, comprising a dimension adjustment unit, a classifier construction unit, a risk identification unit and a data feedback unit,
[0006] An independent vector generation unit, which obtains agricultural product location information, divides it into multiple information segments, sets an initial key and a sliding window, constructs four groups of independent vectors using the initial key, sequentially selects the numbers of the four groups of independent vectors using the sliding window, reads the number of an unconstructed independent vector, counts the previous number and the previous four independent vectors corresponding to the number, analyzes them, and thereby obtains the independent vector for the number, and generates a new key using the independent vectors with different numbers;
[0007] An information segment analysis unit, which reads all bytes in the information segment, processes the bytes, converts them into a square matrix, shifts them left row by row, multiplies the shifted matrix by a preset second transformation matrix to generate a new square matrix, extracts a corresponding key from the sliding set, combines the key with the square matrix to obtain a new information segment, repeats the operation until a maximum number of executions is reached, and then outputs the current information segment;
[0008] The data storage unit receives all information segments of the same category, divides them into multiple unit blocks of the same size and stores them in the database, uses a hash function to analyze each unit block, generates a corresponding hash value, counts the hash values of all unit blocks, constructs a corresponding leaf node based on the hash value of each unit block, analyzes the leaf nodes layer by layer, and obtains the root node, and transmits the hash value of the root node as a content identifier to the blockchain for storage.
[0009] Preferably, the independent vector generation unit includes an information division module, a window setting module and a vector number analysis module. After obtaining the agricultural product positioning information, the information division module divides the categories of planting information, transportation logistics information, production and processing information, and sales information into multiple information segments with a length of sixteen bytes, sets the corresponding initial key according to the category of the information segment, performs a modular addition operation on the information segment and the initial key to obtain a new information segment, the window setting module evenly divides the initial key to construct four groups of independent vectors, sets a corresponding number for each group of independent vectors, and sets a sliding window of size 1×4 and a maximum number of moves, determines that the current number of cycles is zero, and uses the sliding window to select the numbers of the current four groups of independent vectors in turn, the vector number analysis module reads the next unconstructed independent vector number, if the number is zero modulo four, then counts the previous numbered independent vector and the previous four numbered independent vectors corresponding to the current number, cyclically shifts each vector value in the previous numbered independent vector by one position, and performs a modular addition operation with a preset value to obtain a new vector, performs an exclusive OR operation on the previous four numbered independent vectors corresponding to the current number and the new vector, thereby calculating the current numbered independent vector.
[0010] Preferably, the independent vector generating unit further comprises a vector calculating module, a window moving module and a key storage module, the vector calculating module directly performs an XOR operation on the previous numbered independent vector and the previous four numbered independent vectors if the number modulo four is not zero, and the obtained vector is taken as the current numbered independent vector, the window moving module adds one to the current cycle number, judges whether the current cycle number modulo four is zero, if yes, adds one to the moving number of the sliding window and moves four steps according to the numbered sequence, and the independent vector corresponding to the current window is stored as a new key in the sliding set, if not, the next independent vector number to be constructed is read, the key storage module repeats the operation until the moving number is greater than the maximum moving number, and all the keys in the sliding set are extracted and numbered one by one according to the storage order.
[0011] Preferably, the information segment analysis unit comprises a byte processing module, a column vector analysis module, a execution number determining module and a byte reading module, the byte processing module reads the jth byte S ij After that, S ij is processed by inverse element mapping to obtain the processed byte S′ ij , wherein S′ ij = (s′ j1 ,...,s′ jk ,...,s′ j8 ), s′ j1 represents the first binary number of the byte S′ ij , s′ jk represents the kth binary number of the byte S′ ij , s′ j8 represents the 8th binary number of the byte S′ ij , i, j and k represent serial numbers, a first conversion matrix γ and a constant ε are set, γ, ε and the byte S′ ij are used for calculation to obtain a new byte L ij , wherein L ij =S′ ij ·γ+ε=(l j1 ,...,l jk ,...,l j8 ), l j1 represents the first binary number of L ij , l jk represents the kth binary number of L ij , and l j8 represents the 8th binary number of L ij . The column vector analysis module converts the all bytes in each information segment into a 4*4 square matrix after counting the all bytes, circularly left shifts the bytes row by row, each row is shifted by the same number of bits as its corresponding row number, divides the shifted square matrix into multiple column vectors, sets a second conversion matrix, sequentially multiplies the column vectors with the second conversion matrix, combines the obtained column vectors according to the original column numbers, thereby generating a new square matrix, the execution number determination module determines that the initial value of the execution number is zero, and the maximum execution number is equal to the maximum shift number, then combines the initial key with all the square matrices, obtains the information segment as the result after the current execution, and adds one to the execution number, the byte reading module reads the bytes in all the information segments after the current execution if the execution number is less than or equal to the maximum execution number, extracts the corresponding key in the sliding set according to the execution number, takes the key as the initial key for the next execution, and otherwise, ends the execution and outputs all the information segments after the current execution.
[0012] Preferably, the dimension adjustment unit comprises a product-difference value calculation module, a main direction analysis module, a matrix construction module and an actual value determination module. The product-difference value calculation module obtains multiple groups of access request data, counts actual values of different dimensions of all data blocks in each group of access request data, performs standardization processing on the actual values, calculates relative values of the group of access request data according to the total number of data blocks and the processed actual values, analyzes the actual values of the data blocks and the relative values of the access request data, and obtains product-difference values of the data blocks. The main direction analysis module sets an initial projection direction, constructs a conditional function according to the product-difference values of each data block and the projection direction, analyzes the conditional function, obtains multiple projected product-difference values, calculates corresponding main direction values according to each projected product-difference value, and sets an extraction number. After arranging all the projected product-difference values in descending order, the matrix construction module screens multiple projected product-difference values at the front of the sequence according to the extraction number, determines corresponding main direction values by using the screened product-difference values, combines the multiple main direction values, and obtains a main direction matrix. The actual value determination module calculates actual values of new dimensions of the data blocks by using the main direction matrix and the actual values of different dimensions of the data blocks, deletes the original actual values of different dimensions of the data blocks, and stores the actual values of the new dimensions in the data blocks.
[0013]
[0014] Wherein, θ represents the projection direction, τ represents the Lagrange multiplier, m represents the total number of data blocks, r h represents the actual value of the hth data block, represents the relative value of the group of access request data, Q(θ, τ) represents the conditional function, and h represents the parameter.
[0015] Preferably, the classifier construction unit includes a risk level classification module, a type labeling module, a loss value calculation module and a prediction probability output module. The risk level classification module divides the risk levels of data blocks in the access request data into four types, namely low risk, medium-low risk, high risk and extremely high risk, wherein low risk indicates that the current data block is normal access traffic, medium-low risk indicates that the current data block is scanning detection traffic, high risk indicates that the current data block is malicious attack traffic, and extremely high risk indicates that the current data block is penetration attack traffic. The type labeling module sets four binary classifiers, namely normal access classifier, scanning detection classifier, malicious attack classifier and penetration attack classifier. After receiving multiple groups of access request data, the data blocks in each group of access request data are labeled. If the type of the data block belongs to normal access traffic, it is labeled as 1 in the normal access classifier and as 0 in other classifiers. If the type of the data block belongs to scanning detection traffic, it is marked as 0 in the scanning detection classifier. The loss value calculation module divides the labeled data blocks into training set and test set in a ratio of 7:3, and transmits the data blocks in the training set to each classifier for training. The corresponding loss value is calculated according to the output label value and the predicted value according to the loss analysis algorithm, and the parameters of the current classifier are updated by the loss value. The predicted probability output module transmits the data blocks in the test set to each classifier for analysis to obtain the predicted probability value of each type, takes the type with the largest probability value as the predicted type of the data block, and uses the offset value between the predicted type and the actual type to calculate the accuracy of the current combined classifier. The loss analysis algorithm is specifically as follows:
[0016]
[0017] Among them, Z represents the loss value, N represents the total number of data blocks in the training set, g(u t ) represents the label value of the t-th data block, G(u t ) represents the corresponding category prediction probability value of the t-th data block, u t Represents the tth data block, and t represents the parameter.
[0018] Preferably, the risk identification unit includes an accuracy analysis module, a real-time data calculation module, a type determination module and a risk judgment module. The accuracy analysis module transfers the data blocks in the training set to the BiLSTM model for analysis, updates the model parameters according to the offset value between the predicted probability value and the actual type of the data block, and then transfers the data blocks in the test set to the BiLSTM model for calculation to obtain the accuracy of the current model. The real-time data calculation module calculates the corresponding weight values according to the accuracy of the combined classifier and the accuracy of the BiLSTM model, receives real-time access request data, replaces the actual values of all dimensions of the data block contained in the access request data, and transmits them to the combined classifier and the BiLSTM model respectively, thereby obtaining different types of predicted probability values. The type determination module uses a weight analysis algorithm to calculate the predicted probability value and the model weight to obtain a comprehensive predicted probability value of different types of data blocks, and takes the type with the largest predicted probability value as the actual predicted type of the current data block. The risk judgment module determines the risk level of all data blocks according to the actual predicted type. If the risk level is low risk, no operation is performed. Otherwise, the data blocks are filtered according to the priority order of the risk level, where the priority order is extremely high risk, high risk and medium and low risk.
[0019] Preferably, the data feedback unit includes an identifier acquisition module, a byte deduction module, and an early warning prompt module. After receiving the user's real-time access request data, the identifier acquisition module uses a smart contract to verify the data signature in the request data. After determining the access rights of the current visitor, it feeds back to the user end the content identifier, key, and check code of the corresponding information segment. The content identifier is used to obtain the storage location of all specified information segments. Each unit block in the information segment is analyzed by a hash function to generate a corresponding hash value. The hash value is compared with the check code. If they are inconsistent, an early warning is issued to the management end, prompting that the information has been modified. If they are consistent, the byte deduction module deduces the value based on the current key. After calculating all the keys in the sliding set, the square matrix in the information segment is divided into multiple column vectors, and the inverse matrix of the second conversion matrix is calculated. The new column vectors are analyzed according to the column vectors and the inverse matrix of the second conversion matrix, and the new square matrix is obtained by combining them. The bytes in the square matrix are circularly right-shifted row by row. The number of bits shifted in each row is the row number multiplied by eight bits. All bytes are inversely mapped. The new bytes in the information segment are calculated using the first conversion matrix and the constant, and the new bytes are combined with the key to obtain the result after this round of execution. The early warning prompt module repeats the operation until all the keys are involved in the calculation, and then a modular subtraction operation is performed on the information segment and the initial key. The obtained information segment is transmitted to the user end.
[0020] Compared with the prior art, the present invention has the following beneficial effects:
[0021] 1、The present application obtains agricultural product positioning information through an independent vector generation unit, divides planting information, transportation logistics information, production and processing information and sales information into a plurality of information segments with a length of sixteen bytes respectively, facilitates subsequent storage and extraction, divides an initial key into four independent vectors, calculates other independent vectors according to the four independent vectors, designs to obtain multiple keys in a short time on the one hand, and on the other hand, even if the external device obtains the key, it cannot analyze the content of other keys, while the internal device obtains the key, and can analyze other keys in time, the information segment analysis unit converts the read information segment regularly, and combines with the key in each conversion process, so that the content of the information segment can be more secure after storage, and information leakage is prevented;
[0022] 2、The application fuses the actual values of different dimensions of all data blocks in the access request data into the actual values of the specified dimensions through the dimension adjusting unit, which is suitable for large-scale data. The actual values of the specified dimensions can retain the most distinctive features and reduce redundant dimensions, thereby improving the subsequent model generalization capability. The four different binary classifiers set by the classifier construction unit can be trained and predicted synchronously, thereby accelerating the overall operation rate. Each binary classifier can independently analyze key features without interference. The risk identification unit fuses the prediction results of the BiLSTM model and the combined classifier, so that the system can more accurately identify the risk level of the data block, facilitate filtering of harmful data, and the data feedback unit extracts and verifies the information required by the customer to ensure that the feedback information is real and reliable, and notifies the maintenance personnel for adjustment once the information is tampered with. BRIEF DESCRIPTION OF DRAWINGS
[0023] Figure 1 The present application provides an overall system flow diagram for the embodiment;
[0024] Figure 2 The internal module block diagram of the independent vector generation unit provided by the embodiment of the present application is provided;
[0025] Figure 3 The internal module block diagram of the information segment analysis unit provided by the embodiment of the present application is provided;
[0026] Figure 4 The internal module block diagram of the dimension adjusting unit provided by the embodiment of the present application is provided;
[0027] Figure 5 The internal module block diagram of the risk identification unit provided by the embodiment of the present application is provided.
[0028] In the figure: 1, independent vector generation unit; 101, information division module; 102, window setting module; 103, vector number analysis module; 104, vector calculation module; 105, window moving module; 106, key storage module; 2, information segment analysis unit; 201, byte processing module; 202, column vector analysis module; 203, execution frequency determination module; 204, byte reading module; 3, data storage unit; 4, dimension adjustment unit; 401, product difference value calculation module; 402, main direction analysis module; 403, matrix construction module; 404, actual value determination module; 5, classifier construction unit; 501, risk level division module; 502, type labeling module; 503, loss value calculation module; 504, prediction probability output module; 6, risk identification unit; 601, accuracy analysis module; 602, real-time data calculation module; 603, type determination module; 604, risk determination module; 7, data feedback unit; 701, identifier acquisition module; 702, byte calculation module; 703, early warning prompt module. DETAILED DESCRIPTION
[0029] The technical solutions in the embodiments of the present application will be described clearly and completely below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work fall within the scope of protection of the present application.
[0030] Please refer to Figures 1-5 The present application provides a technical solution: a blockchain positioning system based on data traceability, comprising a dimension adjustment unit 4, a classifier construction unit 5, a risk identification unit 6 and a data feedback unit 7.
[0031] The independent vector generation unit 1 divides the agricultural product positioning information into multiple information segments after obtaining the agricultural product positioning information, sets an initial key and a sliding window, constructs four groups of independent vectors using the initial key, sequentially frames the numbers of the four groups of independent vectors through the sliding window, reads the numbers of the independent vectors that have not been constructed, and then counts the previous number and the previous four numbers of the independent vectors corresponding to the number, analyzes them, thereby obtaining the independent vector of the number, and generates a new key using different number independent vectors.
[0032] The information segment analysis unit 2 reads all the bytes in the information segment, processes the bytes, converts them into a square matrix, left shifts row by row, multiplies the shifted matrix with a pre-set second conversion matrix, thereby generating a new square matrix, extracts the corresponding key in the sliding set, combines the key with the square matrix, thereby obtaining a new information segment, and repeats the operation until the maximum number of executions is reached, and then outputs the current information segment;
[0033] The data storage unit 3 receives all information segments of the same category, divides them into multiple unit blocks of the same size, stores them in the database, analyzes each unit block using a hash function, generates a corresponding hash value, and after counting the hash values of all unit blocks, constructs a corresponding leaf node according to the hash value of each unit block, analyzes the leaf node layer by layer, thereby obtaining a root node, and transmits the hash value of the root node as a content identifier to the blockchain for storage.
[0034] The independent vector generation unit 1 includes an information division module 101, a window setting module 102, and a vector number analysis module 103. The information division module 101 obtains agricultural product positioning information, divides the planting information, transportation logistics information, production and processing information, and sales information into multiple information segments of sixteen bytes in length according to the category of the information segment, sets the corresponding initial key, performs a modulo addition operation on the information segment and the initial key to obtain a new information segment, the window setting module 102 uniformly divides the initial key to construct four independent vectors, sets the corresponding number for each independent vector, and sets a sliding window with a size of 1x4 and a maximum number of moves, determines the current number of cycles to be zero, and uses the sliding window to sequentially frame the numbers of the current four independent vectors, the vector number analysis module 103 reads the next unconstructed independent vector number, if the number is zero modulo four, counts the previous number independent vector and the previous four number independent vector corresponding to the current number, performs a cyclic left shift of one bit on each vector value in the previous number independent vector, and performs a modulo addition operation with a preset value to obtain a new vector, and performs an exclusive or operation on the previous four number independent vector corresponding to the current number and the new vector to calculate the current number independent vector, the planting information includes product name, product number, geographical location of planting area, soil health index, sowing time, fertilizer amount, fertilization time, harvesting time, and harvesting personnel information, the transportation logistics information includes product number, carrier name, vehicle number, driver information, transportation route, transportation start and end time, temperature and humidity, loading and unloading time, and storage location, the production and processing information includes product number, geographical location of planting area, warehouse detection index, processing time, additive amount, finished product detection index, packaging material, and label information, and the sales information includes product number, distributor name, sales area, sales time, two-dimensional code scanning times, and product display information.
[0035] The independent vector generation unit 1 also includes a vector calculation module 104, a window movement module 105 and a key storage module 106. If the vector calculation module 104 is not zero modulo four, the previous numbered independent vector and the previous four numbered independent vectors are directly XORed, and the obtained vector is used as the current numbered independent vector. The window movement module 105 increases the current loop count by one and determines whether the current loop count modulo four is zero. If it is zero, the movement count of the sliding window is increased by one and moved four steps according to the number sequence. The independent vector corresponding to the number in the current window is stored as a new key in the sliding set. If it is not zero, the next unconstructed independent vector number is read. The key storage module 106 repeats the operation until the movement count is greater than the maximum movement count, extracts all the keys in the sliding set, and numbers the keys one by one according to the storage order.
[0036] The information segment analysis unit 2 includes a byte processing module 201, a column vector analysis module 202, an execution times determination module 203 and a byte reading module 204. The byte processing module 201 reads the jth byte S in the i-th information segment. ij After that, S ij After inverse element mapping, the processed byte S' is obtained ij , where S′ ij =(s′ j1 ,...,s′ jk ,...,s′ j8 ), s′ j1 Represents byte S' ij The first binary number, s′ jk Represents byte S' ij The kth binary number, s′ j8 Represents byte S' ij The 8th binary number, i, j, k represents the serial number, sets the first conversion matrix γ and constant ε, and uses γ, ε and byte S′ ij Calculate and get the new byte L ij , where L ij =S′ ij γ+ε=(l j1 ,...,l jk ,...,l j8 ), l j1 Indicates L ij The first binary number, l jk Indicates L ij The kth binary number, l j8 Indicates L ij The 8th binary number of The column vector analysis module 202 converts the statistics of all bytes in each information segment into a 4*4 square matrix, cyclically left shifts the bytes row by row, each row is shifted by the same number of bits as its corresponding row number, divides the shifted square matrix into multiple column vectors, sets a second conversion matrix, sequentially multiplies the column vectors with the second conversion matrix, combines the obtained column vectors according to the original column numbers, thereby generating a new square matrix, the execution frequency determination module 203 determines that the initial value of the execution frequency is zero, and the maximum execution frequency is equal to the maximum shift frequency, then combines the initial key with all square matrices, and obtains the information segment as the result after the current execution, and adds one to the execution frequency, the byte reading module 204 reads all the bytes in the information segment after the current execution, if the execution frequency is less than or equal to the maximum execution frequency, extracts the corresponding key in the sliding set according to the execution frequency, takes the key as the initial key for the next execution, and otherwise, ends the execution and outputs all the information segments after the current execution.
[0037] The dimension adjusting unit 4 includes a product difference value calculation module 401, a main direction analysis module 402, a matrix construction module 403, and an actual value determination module 404. The product difference value calculation module 401 obtains a plurality of groups of access request data, and calculates the relative value of each group of access request data according to the total number of data blocks and the actual values of the data blocks after standardization processing. The actual values of the data blocks and the relative values of the access request data are analyzed to obtain the product difference values of the data blocks. The main direction analysis module 402 sets an initial projection direction, constructs a conditional function according to the product difference values of each data block and the projection direction, analyzes the conditional function to obtain a plurality of projected product difference values, calculates the corresponding main direction values according to each projected product difference value, and combines the main direction values to obtain a main direction matrix. The actual value determination module 404 calculates the actual values of each new dimension of the data blocks by using the main direction matrix and the actual values of different dimensions of the data blocks, deletes the original actual values of different dimensions of the data blocks, and stores the actual values of each new dimension in the data blocks. The conditional function is specifically:
[0038]
[0039] Wherein, θ represents the projection direction, τ represents the Lagrange multiplier, m represents the total number of data blocks, r h represents the actual value of the hth data block, represents the relative value of the group of access request data, Q(θ, τ) represents the conditional function, and h represents the parameter.
[0040] The classifier construction unit 5 includes a risk level division module 501, a type labeling module 502, a loss value calculation module 503, and a prediction probability output module 504. The risk level division module 501 divides the risk level of the data block in the access request data into four, namely low risk, medium-low risk, high risk, and extremely high risk, wherein low risk means that the current data block is normal access traffic, medium-low risk means that the current data block is scanning probe traffic, high risk means that the current data block is malicious attack traffic, and extremely high risk means that the current data block is penetration attack traffic. The type labeling module 502 sets four binary classifiers, namely a normal access classifier, a scanning probe classifier, a malicious attack classifier, and a penetration attack classifier. After receiving multiple groups of access request data, the type labeling module 502 labels the data blocks in each group of access request data. If the type of the data block belongs to normal access traffic, it is labeled as 1 in the normal access classifier and 0 in the other classifiers. If the type of the data block belongs to scanning probe traffic, it is labeled as 1 in the scanning probe classifier and 0 in the other classifiers. If the type of the data block belongs to malicious attack traffic, it is labeled as 1 in the malicious attack classifier and 0 in the other classifiers. If the type of the data block belongs to penetration attack traffic, it is labeled as 1 in the penetration attack classifier and 0 in the other classifiers. The loss value calculation module 503 divides the labeled data blocks into training sets and test sets in a ratio of 7:3. The data blocks in the training set are transmitted to each classifier for training. According to the loss analysis algorithm, the loss value corresponding to the output labeled value and the predicted value is calculated. The parameters of the current classifier are updated through the loss value. The prediction probability output module 504 transmits the data blocks in the test set to each classifier for analysis to obtain the prediction probability value of each type. The type with the largest probability value is taken as the predicted type of the data block. The accuracy of the current combined classifier is calculated using the offset value between the predicted type and the actual type. The loss analysis algorithm is as follows:
[0041]
[0042] wherein Z represents the loss value, N represents the total number of data blocks in the training set, g(u t ) represents the labeled value of the tth data block, G(u t ) represents the corresponding category prediction probability value of the tth data block, u t represents the tth data block, and t represents the parameter.
[0043] The risk identification unit 6 includes an accuracy analysis module 601, a real-time data calculation module 602, a type determination module 603, and a risk determination module 604. The accuracy analysis module 601 transmits data blocks in the training set to the BiLSTM model for analysis, updates the model parameters according to the offset value between the predicted probability value and the actual type of the data block, and then transmits the data blocks in the test set to the BiLSTM model for calculation to obtain the accuracy of the current model. The real-time data calculation module 602 calculates the corresponding weight value according to the accuracy of the combined classifier and the accuracy of the BiLSTM model, receives real-time access request data, replaces the actual values of all dimensions of the data blocks contained in the access request data, and then transmits them to the combined classifier and the BiLSTM model respectively to obtain different types of predicted probability values. The type determination module 603 calculates the predicted probability values and the model weights using a weight analysis algorithm to obtain the comprehensive predicted probability values of different types of data blocks. The type with the maximum predicted probability value is taken as the actual predicted type of the current data block. The risk determination module 604 determines the risk level of all data blocks according to the actual predicted type. If the risk level is low, no operation is performed. Otherwise, the data blocks are filtered according to the priority order of the risk level, where the priority order is extremely high risk, high risk, and medium-low risk. The weight analysis algorithm is as follows:
[0044]
[0045] y = max{P(x1), P(x2), P(x3), P(x4)}
[0046] where P(x1) represents the probability value of the data block type being normal access traffic, P(x2) represents the probability value of the data block type being scan probe traffic, P(x3) represents the probability value of the data block type being malicious attack traffic, and P(x4) represents the probability value of the data block type being penetration attack traffic. P a (x1), P a (x2), P a (x3), and P a (x4) represent the predicted probability values of the data block types being normal access traffic, scan probe traffic, malicious attack traffic, and penetration attack traffic in the combined classifier. P b (x1), P b (x2), P b (x3), and P b (x4) represent the predicted probability values of the data block types being normal access traffic, scan probe traffic, malicious attack traffic, and penetration attack traffic in the BiLSTM model. M a represents the number of correct predictions of the combined classifier, and M bThe number of correct predictions of the BiLSTM model, y represents the data block type corresponding to the maximum probability value;
[0047] The data feedback unit 7 comprises an identifier acquisition module 701, a byte calculation module 702 and a warning prompt module 703. After receiving the real-time access request data of the user, the identifier acquisition module 701 verifies the data signature in the request data by using the smart contract, determines the access authority of the current visitor, and then feeds back the content identifier, key and check code of the corresponding information segment of the user end. The storage location of all information segments is obtained by using the content identifier. Each unit block in the information segment is analyzed by using a hash function to generate a corresponding hash value. The hash value is compared with the check code. If they are inconsistent, a warning is sent to the management end to prompt that the information has been modified. If they are consistent, the byte calculation module 702 calculates all the keys in the sliding set according to the current key, divides the square matrix in the information segment into multiple column vectors, calculates the inverse matrix of the second conversion matrix, analyzes the new column vector according to the column vector and the inverse matrix of the second conversion matrix, combines it to obtain a new square matrix, and performs cyclic right shift on the bytes in the square matrix row by row. The number of bits moved in each row is the row number multiplied by eight bits. The inverse element mapping is performed on all bytes. The new bytes in the information segment are calculated by using the first conversion matrix and a constant, combined with the key to obtain the result after the current execution. The warning prompt module 703 repeats the operation until all the keys are involved in the calculation, then performs a modulo subtraction operation on the information segment and the initial key, and the obtained information segment is transmitted to the user end.
[0048] Working principle: The present invention divides the agricultural product positioning information into multiple information segments through the information division module 101 in the independent vector generation unit 1, uses the window setting module 102 to use the sliding window to sequentially select the numbers of the current four groups of independent vectors, the vector number analysis module 103 reads the number of the next unbuilt independent vector, and calculates the independent vector with the corresponding number through the vector calculation module 104. The window moving module 105 stores the independent vector corresponding to the number in the current window as a new key in the sliding set, and the key storage module 106 extracts all the keys in the sliding set, and numbers the keys one by one according to the storage order. The ... stores the keys one by one according to the storage order. The section processing module 201 analyzes the bytes in the information segment to obtain new bytes, and uses the column vector analysis module 202 to generate a new square matrix. The execution number determination module 203 combines the initial key with all square matrices to obtain the result after execution. The byte reading module 204 outputs all information segments after execution, and transmits the content identifier corresponding to the information segment to the blockchain for storage through the data storage unit 3. The product difference calculation module 401 in the dimension adjustment unit 4 analyzes the actual value of the data block and the relative value of the access request data to obtain the product difference value of the data block. The main direction analysis module 402 calculates the corresponding product difference value according to each projection. The main direction value of the matrix construction module 403 combines multiple main direction values to obtain a main direction matrix. The actual value determination module 404 stores the actual value of each new dimension in the data block. The risk level classification module 501 in the classifier construction unit 5 divides the risk level of the data block in the access request data into four types. The type annotation module 502 annotates the data block in each group of access request data. The loss value calculation module 503 updates the parameters of the current classifier according to the loss value. The predicted probability output module 504 calculates the accuracy of the current combined classifier using the offset value between the predicted type and the actual type. The accuracy analysis module 506 in the risk identification unit 6 Module 601 transfers the data blocks in the test set to the BiLSTM model for calculation to obtain the accuracy of the current model. After the real-time data calculation module 602 obtains the prediction probability values of different types, it uses the type determination module 603 to calculate the actual prediction type of the current data block. The risk judgment module 604 determines the risk level of all data blocks based on the actual prediction type and filters them. The identifier acquisition module 701 in the data feedback unit 7 obtains the storage location of all specified information segments based on the content identifier. After the byte calculation module 702 calculates the bytes corresponding to the current information segment, the early warning prompt module 703 is used to feed back the complete information segment to the user end.
[0049] It should be noted that, in this document, relational terms such as first and second, etc., are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that includes a list of elements includes not only those elements but also other elements not explicitly listed, or elements inherent to such process, method, article, or apparatus.
[0050] While embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions, and variations may be made to these embodiments without departing from the principles and spirit of the invention, and that the scope of the invention is defined by the appended claims and their equivalents.
Claims
1. A blockchain positioning system based on data traceability, comprising a dimension adjustment unit (4), a classifier construction unit (5), a risk identification unit (6) and a data feedback unit (7), characterized in that: An independent vector generating unit (1) is provided. After obtaining the agricultural product positioning information, the independent vector generating unit (1) divides the information into a plurality of information segments, sets an initial key and a sliding window, constructs four groups of independent vectors using the initial key, sequentially selects the numbers of the four groups of independent vectors through the sliding window, reads the number of the unconstructed independent vector, counts the previous number and the previous four numbered independent vectors corresponding to the number, analyzes them, thereby obtaining the independent vector of the number, and generates a new key using the independent vectors with different numbers; An information segment analysis unit (2) processes the bytes after reading all bytes in the information segment, converts them into a square matrix, shifts them left row by row, multiplies the shifted matrix with a preset second conversion matrix, thereby generating a new square matrix, extracts a corresponding key from the sliding set, combines the key with the square matrix, thereby obtaining a new information segment, repeats the operation until a maximum number of executions is reached, and then outputs the current information segment; The data storage unit (3) receives all information segments of the same category, divides them into multiple unit blocks of the same size and stores them in a database, uses a hash function to analyze each unit block, generates a corresponding hash value, counts the hash values of all unit blocks, constructs a corresponding leaf node according to the hash value of each unit block, analyzes the leaf nodes layer by layer, thereby obtaining a root node, and transmits the hash value of the root node as a content identifier to the blockchain for storage.
2. A blockchain positioning system based on data traceability according to claim 1, characterized in that: The independent vector generation unit (1) includes an information division module (101), a window setting module (102) and a vector number analysis module (103). After obtaining the agricultural product positioning information, the information division module (101) divides the categories of planting information, transportation logistics information, production and processing information and sales information into a plurality of information segments with a length of 16 bytes, sets a corresponding initial key according to the category of the information segment, performs a modular addition operation on the information segment and the initial key, and obtains a new information segment. The window setting module (102) evenly divides the initial key, thereby constructing four groups of independent vectors, and sets a corresponding The number of the vector is determined, and a sliding window with a size of 1×4 and a maximum number of moves are set. The current number of cycles is determined to be zero. The numbers of the current four groups of independent vectors are selected in sequence using the sliding window. The vector number analysis module (103) reads the number of the next unconstructed independent vector. If the number is zero modulo four, the previous numbered independent vector and the previous four numbered independent vectors corresponding to the current number are counted. Each vector value in the previous numbered independent vector is cyclically shifted to the left by one position, and a modular addition operation is performed with a preset value to obtain a new vector. The previous four numbered independent vectors corresponding to the current number and the new vector are XORed, thereby calculating the current numbered independent vector.
3. A blockchain positioning system based on data traceability according to claim 2, characterized in that: The independent vector generation unit (1) further comprises a vector calculation module (104), a window movement module (105) and a key storage module (106). If the number is not zero modulo four, the vector calculation module (104) directly performs an exclusive OR operation on the previous numbered independent vector and the previous four numbered independent vectors, and the obtained vector is used as the current numbered independent vector. The window movement module (105) increases the current cycle number by one, and determines whether the current cycle number is zero modulo four. If it is zero, the movement number of the sliding window is increased by one and moved four steps according to the numbering sequence, and the independent vector corresponding to the number in the current window is stored as a new key in the sliding set. If it is not zero, the next unconstructed independent vector number is read. The key storage module (106) repeats the operation until the movement number is greater than the maximum movement number, extracts all keys in the sliding set, and numbers the keys one by one according to the storage order.
4. The blockchain positioning system based on data traceability according to claim 1, characterized in that: The information segment analysis unit (2) comprises a byte processing module (201), a column vector analysis module (202), an execution times determination module (203) and a byte reading module (204). The byte processing module (201) reads the jth byte S in the i-th information segment. ij After that, S ij After inverse element mapping, the processed byte S' is obtained ij , where S′ ij =(s′ j1 ,...,s′ jk ,...,s′ j8 ), s′ j1 Represents byte S′ ij The first binary number, s′ jk Represents byte S′ ij The kth binary number, s′ j8 Represents byte S′ ij The 8th binary number, i, j, k represents the serial number, sets the first conversion matrix γ and constant ε, and uses γ, ε and byte S′ ij Calculate and get the new byte L ij , where L ij =S′ ij γ+ε=(l j1 ,...,l jk ,...,l j8 ), l j1 Indicates L ij The first binary number, l jk Indicates L ij The kth binary number, l j8 Indicates L ij The 8th binary number of The column vector analysis module (202) counts all bytes in each information segment and converts it into a 4×4 square matrix, performs cyclic left shift on the bytes row by row, and the number of bits shifted in each row is the same as the row number corresponding to it. The square matrix after the shift is divided into multiple column vectors, and a second conversion matrix is set. The column vectors are multiplied by the second conversion matrix in sequence, and the obtained column vectors are combined according to the original column numbers to generate a new square matrix. The execution number determination module (203) determines that the initial value of the execution number is zero and the maximum execution number is equal to the maximum shift number, and then combines the initial key with all square matrices. The obtained information segment is used as the result after the current round of execution, and the execution number is increased by one. If the execution number is less than or equal to the maximum execution number, the byte reading module (204) extracts the corresponding key from the sliding set according to the execution number, uses the key as the initial key for the next round of execution, and reads each byte in all information segments after the current round of execution. Otherwise, the execution is terminated and all information segments after the current round of execution are output.
5. The blockchain positioning system based on data traceability according to claim 1, characterized in that: The dimension adjustment unit (4) includes a product difference calculation module (401), a main direction analysis module (402), a matrix construction module (403) and an actual value determination module (404). The product difference calculation module (401) obtains multiple groups of access request data, counts the actual values of different dimensions of all data blocks in each group of access request data, performs standardization processing on them, calculates the relative value of the group of access request data based on the total number of data blocks and the actual values after processing, analyzes the actual values of the data blocks and the relative values of the access request data, and obtains the product difference value of the data blocks. The main direction analysis module (402) sets an initial projection direction, and constructs a conditional function based on the product difference value and projection direction of each data block. The number is extracted, and the product difference values after projection are analyzed to obtain a plurality of product difference values after projection. The corresponding main direction value is calculated according to the product difference value after each projection. The matrix construction module (403) sets the number of extractions, arranges all the product difference values after projection in descending order, and filters the front plurality of product difference values after projection in the sequence according to the number of extractions. The corresponding main direction value is determined by using the filtered product difference values, and the plurality of main direction values are combined to obtain a main direction matrix. The actual value determination module (404) calculates the actual value of each new dimension of the data block by using the main direction matrix and the actual values of different dimensions of the data block, deletes the original actual values of different dimensions in the data block, and stores the actual value of each new dimension in the data block.
6. The blockchain positioning system based on data traceability according to claim 1, characterized in that: The classifier construction unit (5) includes a risk level classification module (501), a type marking module (502), a loss value calculation module (503) and a prediction probability output module (504). The risk level classification module (501) classifies the risk level of the data block in the access request data into four types, namely low risk, medium-low risk, high risk and extremely high risk, wherein low risk indicates that the current data block is normal access traffic, medium-low risk indicates that the current data block is scanning detection traffic, high risk indicates that the current data block is malicious attack traffic, and extremely high risk indicates that the current data block is penetration attack traffic. The type marking module (502) sets four binary classifiers, namely normal access classifier, scanning detection classifier, malicious attack classifier and penetration attack classifier. After receiving multiple groups of access request data, the data blocks in each group of access request data are marked. If the type of the data block belongs to normal access traffic, it is marked as 1 in the normal access classifier and marked as 0 in other classifiers. If the type of the data block belongs to Scanning detection traffic, it is marked as 1 in the scanning detection classifier and marked as 0 in other classifiers. If the type of the data block belongs to malicious attack traffic, it is marked as 1 in the malicious attack classifier and marked as 0 in other classifiers. If the type of the data block belongs to penetration attack traffic, it is marked as 1 in the penetration attack classifier and marked as 0 in other classifiers. The loss value calculation module (503) divides the marked data blocks into training sets and test sets in a ratio of 7:3, and transmits the data blocks in the training set to each classifier for training. According to the loss analysis algorithm, the corresponding loss value is calculated according to the output label value and the predicted value, and the parameters of the current classifier are updated according to the loss value. The predicted probability output module (504) transmits the data blocks in the test set to each classifier for analysis to obtain the predicted probability value of each type, takes the type with the largest probability value as the predicted type of the data block, and uses the offset value between the predicted type and the actual type to calculate the accuracy of the current combined classifier.
7. The blockchain positioning system based on data traceability according to claim 1, characterized in that: The risk identification unit (6) includes an accuracy analysis module (601), a real-time data calculation module (602), a type determination module (603) and a risk determination module (604). The accuracy analysis module (601) transmits the data blocks in the training set to the BiLSTM model for analysis, updates the model parameters according to the offset value between the predicted probability value and the actual type of the data block, and then transmits the data blocks in the test set to the BiLSTM model for calculation to obtain the accuracy of the current model. The real-time data calculation module (602) calculates the corresponding weight value according to the accuracy of the combined classifier and the accuracy of the BiLSTM model, receives the real-time access request data, and transmits the access request data to the BiLSTM model. The actual values of all dimensions of the data block contained in the data are replaced and then transmitted to the combined classifier and the BiLSTM model respectively, thereby obtaining different types of prediction probability values. The type determination module (603) uses a weight analysis algorithm to calculate the prediction probability value and the model weight to obtain the comprehensive prediction probability value of different types of data blocks, and takes the type with the largest prediction probability value as the actual prediction type of the current data block. The risk determination module (604) determines the risk level of all data blocks according to the actual prediction type. If the risk level is low risk, no operation is performed. Otherwise, the data blocks are filtered according to the priority order of the risk level, where the priority order is extremely high risk, high risk and medium-low risk.
8. The blockchain positioning system based on data traceability according to claim 1, characterized in that: The data feedback unit (7) comprises an identifier acquisition module (701), a byte deduction module (702) and an early warning prompt module (703). After receiving the user's real-time access request data, the identifier acquisition module (701) verifies the data signature in the request data using a smart contract, determines the access rights of the current visitor, and then feeds back to the user end the content identifier, key and check code of the corresponding information segment. The content identifier is used to obtain the storage location of all designated information segments, and each unit block in the information segment is analyzed by a hash function to generate a corresponding hash value. The hash value is compared with the check code. If they are inconsistent, an early warning is issued to the management end, indicating that the information has been modified. If they are consistent, the byte deduction module (702) sends a warning to the management end. , after all the keys in the sliding set are calculated based on the current key, the square matrix in the information segment is divided into multiple column vectors, and the inverse matrix of the second conversion matrix is calculated. A new column vector is analyzed based on the column vector and the inverse matrix of the second conversion matrix, and the new square matrix is obtained by combining them. The bytes in the square matrix are circularly right-shifted row by row, and the number of bits shifted in each row is the row number multiplied by eight bits. All bytes are inversely mapped, and the new bytes in the information segment are calculated using the first conversion matrix and the constant. The bytes are combined with the key to obtain the result after this round of execution. The early warning prompt module (703) repeats the operation until all the keys are involved in the calculation, and then a modular subtraction operation is performed using the information segment and the initial key. The obtained information segment is transmitted to the user terminal.
Citation Information
Patent Citations
Block chain-based location positioning method, system and device, and storage medium
CN116226270A