A Method for Authenticable Sharing of Spatial Data on Blockchain for Mobile Internet of Things
By deploying NFT smart contracts and FBSI structures on the mobile Internet of Things, the problem of space-text data sharing in the mobile Internet of Things is solved, unique identification and efficient query of data are realized, adapting to the random movement of devices and random distribution of data, meeting the verifiable query needs of light nodes, and improving the security and efficiency of data sharing.
Patent Information
- Application Number
- CN202310125302.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-16
- Publication Date
- 2025-07-08
- Estimated Expiration
- 2043-02-16
AI Technical Summary
The shared space-text data in the mobile Internet of Things has problems such as different data expressions, random and non-uniform distribution of perceived data, and the inability of light nodes to ensure the credibility of data requests, which cannot be effectively solved by the existing technology.
Deploy blockchains that support smart contracts on the mobile Internet of Things, use NFT smart contracts to instantiate the spatial index data structure (FBSI) with free boundaries to store metadata on the blockchain. Light nodes obtain query results and verify them through the query service provider, and provide proof objects in combination with the blockchain transaction tree.
It realizes unique identification and efficient query of space-text data, adapts to the random movement of mobile IoT devices and random data distribution, meets the verifiable query needs of light nodes, and improves the security and efficiency of data sharing.
Smart Images

Figure CN116340278B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of blockchain technology, and in particular to a method for authenticable sharing of spatial data on a blockchain for mobile Internet of Things. Background Art
[0002] The Internet of Things (IoT) with the goal of "connecting everything" is regarded as the third technological revolution in the information industry. The IoT integrates technologies such as sensor perception, feature recognition, artificial intelligence, edge computing, and cloud computing to collect and process environmental information, and uses network communication technologies to transmit data to achieve the interconnection of things and the interconnection of people and things. Due to the limited sensing range and insufficient computing power of a single IoT device, mobile Internet of Things represented by drone networks and vehicle-to-everything (V2X) networks have an urgent need to share data.
[0003] Sharing data with each other can better exert the comprehensive sensing ability of the mobile Internet of Things and improve the intelligent service level. The original data shared in the mobile Internet of Things usually comes from the perception of the environment by terminal devices, and these perception data are closely related to the location of the terminal devices when they are generated; in addition, some of these data are text types, and some are multimedia data that can be extracted into text descriptions through data processing technologies. Therefore, the data shared in the mobile Internet of Things are essentially heterogeneous data with geographical information tags and text descriptions, which are called spatial-text data.
[0004] Safely and reliably sharing these spatial-text data is an inherent requirement of the mobile Internet of Things. Applying blockchain technology to the Internet of Things can effectively solve the security problem of data sharing. However, different from traditional databases, blockchain uses a file system or a Key-Value database (such as LevelDB) to store data, provides limited types of query services, and does not support indexing of spatial data. Sharing spatial-text data in the mobile Internet of Things faces three problems:
[0005] 1) Since the content contained in the perception data generated by IoT devices varies, and the data presentation forms are diverse, data requesters need to be able to correctly understand and accurately identify these data.
[0006] 2) The unpredictability of the movement trajectories of mobile Internet of Things terminals results in the random expandability of their sensing coverage areas. Therefore, the generated perception data is randomly and non-uniformly distributed in space.
[0007] 3) Some Internet of Things devices are limited by their low computing power and scarce storage space, and can only play the role of light nodes in the blockchain. Such nodes only store block headers, do not participate in the blockchain consensus process, do not store a complete copy of the blockchain, but have the ability to publish data to the chain and can also request data from full nodes; however, light nodes cannot guarantee that the full nodes responding to data requests are trustworthy, because mutual distrust is an inherent assumption of the blockchain.
[0008] CN109472699A discloses an automated artificial intelligence data sharing method and device based on a blockchain. The method is as follows: The data provider publishes the training dataset data to the artificial intelligence training dataset data center and publishes the training dataset information and the data access payment smart contract to the blockchain; the data acquirer queries the information published by the data provider, and if the information meets its own needs, it calls the payment smart contract to conduct a payment transaction; the artificial intelligence training dataset data center queries the status of the payment smart contract and obtains the public key of the data acquirer; modifies the firewall to open the access permission of the payer, and the data acquirer can obtain the training dataset data, and the data sharing process is completed, thus solving the problem that only a small amount of data can be shared in the data sharing established on the blockchain, and the data sharing process is supervised by the whole network nodes of the blockchain. However, this patent still cannot solve the above problems. Summary of the Invention
[0009] The purpose of the present invention is to provide a method for authenticable sharing of spatial data on a blockchain for mobile Internet of Things, which can adapt to the random movement of mobile Internet of Things devices in spatial positions, overcome the difficulty of uneven distribution of data in space, and support verifiable queries of shared data by light nodes.
[0010] The purpose of the present invention can be achieved by the following technical solutions:
[0011] A method for authenticable sharing of spatial data on a blockchain for mobile Internet of Things includes the following steps:
[0012] Step 1) Deploy a blockchain supporting smart contracts on the mobile Internet of Things;
[0013] Step 2) Instantiate a spatial index data structure in the NFT smart contract and deploy the NFT smart contract on the blockchain;
[0014] Step 3) The mobile Internet of Things terminal stores the original data of the spatial-text data to be shared in an off-chain distributed storage system and stores the corresponding metadata on the blockchain;
[0015] Step 4) The light node sends a data query request to the query service provider, and the query service provider initiates a spatial-text data query transaction to the NFT smart contract based on the data query request;
[0016] Step 5) After receiving the spatial-text data query transaction in step 4), the full node immediately executes the query function in the NFT smart contract and records the query result on the blockchain in the form of an event.
[0017] Step 6) The query service provider obtains the query result from the blockchain, constructs a proof object of the query result using the transaction tree of the block containing the query result, and returns the query result and the proof object to the light node together.
[0018] Step 7) The light node verifies the query result. If the query result passes the verification, it extracts the uniform resource identifier (URI) in the metadata from the query result and obtains the original spatial-text data from the off-chain distributed storage system. If the query result fails to pass the verification, it indicates that the data is unavailable, and it returns to step 4) to resend the data query request to the query service provider.
[0019] In the above-mentioned step 1), the movement trajectory of the terminal of the mobile Internet of Things in space is unpredictable. Therefore, it is impossible to judge in advance the spatial range sensed by the mobile Internet of Things. Due to the random movement of the terminal, the spatial distribution of the generated spatial-text data is also random.
[0020] The spatial index data structure in the above-mentioned step 2) is a free boundary spatial index data structure (FBSI), which is a tree-shaped spatial index data structure with unrestricted spatial range and adaptable to the random distribution of spatial data. Each node in the tree represents a spatial range, and the space can be freely divided into N non-overlapping sub-spaces. On the one hand, the space is divided according to the data density, so that there is a sufficient amount of data on the sub-space, which can improve the utilization rate of the sub-space nodes. On the other hand, the method of dimension reduction is adopted to select a dimension to divide the space when dividing the space, and it is divided into two one-dimensional sub-spaces, which can reduce the complexity of spatial data processing. Each layer of the tree corresponds to a splitting dimension. From top to bottom, the 0th layer corresponds to the 1st dimension, the 1st layer corresponds to the 2nd dimension, the 2nd layer corresponds to the 1st dimension, …, and so on. As the number of layers increases, the dimensions are used cyclically.
[0021] The FBSI includes three types of node types: root node, leaf node, and intermediate node;
[0022] The root node represents the global space, which is an infinitely large spatial range. The space of the parent node is divided into multiple non-overlapping sub-spaces, and each of its child nodes represents one of the sub-spaces. The intermediate node only represents the spatial range of this branch. The leaf node is associated with a list of spatial-text data; when the amount of data associated with the leaf node exceeds the set upper limit, the splitting of the node space occurs, and the splitting follows the following principles:
[0023] a) Only leaf nodes can undergo splitting, and the splitting occurs in the dimension corresponding to the splitting reference node;
[0024] b) Each time a node splits, only one space can be divided into two smaller spaces;
[0025] c) The amount of associated data in each subspace after splitting is equal;
[0026] The space demarcation point when splitting a node is defined as:
[0027]
[0028] Among them, if the splitting reference node is in an even layer, the space-text data associated with the leaf node is sorted by longitude, otherwise, if the splitting reference node is in an odd layer, the space-text data associated with the leaf node is sorted by latitude; N is the number of space-text data associated with the leaf node, Lon represents longitude, and Lat represents latitude;
[0029] The method for selecting the splitting reference node is as follows:
[0030] If the number of sibling nodes of the splitting node is greater than or equal to fan mai -1, where fan max is the fan-out upper limit of its parent node, and the selected splitting reference node is the splitting node itself; otherwise, it is its parent node.
[0031] The digital assets in the NFT smart contract are irreplaceably unique. Therefore, the space-text data in the NFT smart contract cannot be modified but can be destroyed. Based on this, there are two maintenance operations for the FBSI: 1) Insertion; 2) Deletion.
[0032] The process of inserting space-text data into the FBSI is as follows:
[0033] Step 201) Create an NFT asset with metadata for the space-text data;
[0034] Step 202) Using the space coordinate attribute of the space-text data as an index, search for the leaf node on the FBSI that contains the space coordinates of the space-text data, and add it to the list of space-text data associated with that leaf node;
[0035] Step 203) If the length of the list of space-text data associated with the leaf node in Step 202) exceeds the upper limit, split the space of the leaf node into two subspaces, and the associated space-text data is divided into two at the splitting point and associated with the two new subspaces respectively;
[0036] Step 204) If the splitting reference node is the leaf node itself, the split leaf node becomes an intermediate node, and the two split subspaces form its two leaf nodes. The one before the splitting point is the left child node, and the one after the splitting point is the right child node. If the splitting reference node is the parent node of the leaf node, then one of the two split subspaces before the splitting point replaces the original leaf node, and the other becomes the sibling node immediately following it.
[0037] In the said Step 202), the method for finding the leaf node Leaf containing the spatial-text data spatial coordinates on the FBSI is as follows:
[0038] The root node of the FBSI is R, the longitude of the spatial-text data to be found is Lon, and the latitude is Lat;
[0039] Step 2021) If R is a leaf node, then R is the leaf node Leaf to be found, and the process ends. Otherwise, determine whether the layer where R is located is an even layer or an odd layer;
[0040] Step 2022) If the layer where R is located is an even layer, match the child node R containing Lon among the child nodes of R lon , and use R lon to replace R, and return to Step 2021);
[0041] Step 2023) If the layer where R is located is an odd layer, match the child node R containing Lat among the child nodes of R lat , and use R lat to replace R, and return to Step 2021).
[0042] The process of deleting spatial-text data in the FBSI is as follows:
[0043] Step 205) Verify the permission of the deletion requester;
[0044] Step 206) Using the spatial coordinate attribute of the spatial-text data as an index, find the leaf node containing the spatial coordinates of the spatial-text data on the said FBSI, and delete the spatial-text data from the list of spatial-text data associated with the leaf node;
[0045] Step 207) If the list of spatial-text data associated with the leaf node in Step 206) is empty, then delete the leaf node;
[0046] Step 208) If the parent node of the leaf node in Step 207) has only one child node left, then merge the parent node and the child node into one leaf node.
[0047] In step 3) described above, the metadata is in the form of the space-text data stored in the NFT smart contract described in step 2). It includes the unique identifier assigned by the NFT smart contract to the space-text data and the description of the characteristics of the space-text data. The URI of the original space-text data in the off-chain distributed storage system is one of the characteristics.
[0048] In step 4) described above, in the blockchain network, the lightweight node only stores the block headers, and the full node stores a complete copy of the blockchain, including the block headers and the block bodies. The concepts of lightweight nodes and full nodes are common knowledge in this field. The query service provider is a full node, and the lightweight node sends a data query request:
[0049] q = <[lon start ,lon end ,[lat start ,lat end ,ψ>
[0050] where [lon start ,lon end and [lat start ,lat end are the selected longitude range and latitude range respectively, lon start 、lon end 、lat start 、lat end are the left longitude, right longitude, lower latitude, and upper latitude of the query range respectively, and ψ is the feature set required by the query.
[0051] The space-text data is represented as:
[0052] o i = <t i ,lon i ,lat i ,Ψ i >
[0053] where t i 、lon i and lat i are the timestamp, longitude, and latitude respectively, and Ψ i is the feature set of the data.
[0054] The query result is the set of all space-text data that falls within the query space range and has all the characteristics in ψ:
[0055]
[0056] The query function in the NFT smart contract in step 5) described above performs the following steps:
[0057] Step 501) Search for all sets of leaf nodes on the FBSI that overlap with the query space <[lon start , lon end ,[lat start , lat end >;
[0058] Step 502) Check one by one whether the space-text data associated with each leaf node in the set of leaf nodes obtained in Step 501) meets the query conditions to obtain a set of query results.
[0059] In the above-mentioned Step 501), the method for searching for the set of leaf nodes LS that overlaps with the query space on the FBSI is as follows:
[0060] The root node of the FBSI is R, the space represented by the root node is Sr, and the query space is Sq;
[0061] Step 5011) If R is a leaf node, add R to LS and end;
[0062] Step 5012) For each child node C of R, if the space Sc represented by C overlaps with Sq, replace R and Sr with C and Sc, and recursively call this method.
[0063] The event is a way provided by the smart contract to record data on the blockchain and appears as a transaction on the blockchain. Therefore, its hash digest is organized in the transaction tree of the block.
[0064] To further improve the query efficiency of space-text data, in the NFT smart contract, an inverted file is organized with the feature set of space-text data. Before performing a query on the FBSI, first filter the space-text data of the feature set that meets the query requirements through the inverted file, and then filter the data that meets the space requirements through the FBSI. The intersection of the two is the query result.
[0065] In the above-mentioned Step 6), it is common knowledge in the art to construct the existence proof of a certain transaction using the transaction tree of the block. To avoid obscuring the purpose of this application, it will not be elaborated here.
[0066] The mobile Internet of Things includes a drone network and a vehicle network.
[0067] The drones in the drone network are light nodes, the intelligent vehicles in the vehicle network are full nodes, and the intelligent vehicles and the roadside units of the mobile Internet of Things deploy an off-chain distributed data storage system.
[0068] The off-chain distributed data storage system is IPFS, and the metadata includes the location, timestamp, feature set, owner, URI, and data type of the space-text data.
[0069] Compared with the prior art, the present invention has the following beneficial effects:
[0070] (1) The present invention uses NFT metadata to standardize the description of the characteristics of the shared space-text data, uniquely identifies the data, enabling it to be correctly understood by the nodes in the mobile Internet of Things and uniquely identified on the blockchain.
[0071] (2) The FBSI used by the present invention to manage and query space-text data adopts the idea of dividing space based on data density and dimensionality reduction, overcoming the difficulties brought by the arbitrary movement of mobile Internet of Things nodes in position and the random distribution of shared data in space to space indexing.
[0072] (3) After completing the query of space data based on FBSI in the NFT smart contract, the present invention combines the transaction tree of the blockchain to provide proof objects to light nodes, meeting the verification requirements of shared data in the mobile Internet of Things.
[0073] (4) The present invention combines the inverted file to retrieve the feature information of space-text data in advance during the query process, further improving the query efficiency of space-text data. BRIEF DESCRIPTION OF THE DRAWINGS
[0074] Figure 1 It is a framework for sharing space data on the blockchain for the mobile Internet of Things with the drone network and vehicle network as examples.
[0075] Figure 2 It is a flowchart of the method for authenticable sharing of data on the blockchain of the present invention.
[0076] Figure 3 It is a structural diagram of FBSI.
[0077] Figure 4 It is a splitting result diagram when the number of sibling nodes of the splitting node is greater than or equal to fan max -1 during the splitting of FBSI nodes.
[0078] Figure 5 It is a splitting result diagram when the number of sibling nodes of the splitting node is less than fan max -1 during the splitting of FBSI nodes.
[0079] Figure 6 It is a performance comparison diagram of FBSI in terms of improving the data capacity of the space index structure.
[0080] Figure 7 It is a comparison diagram of the leaf node resource capacity rate of FBSI. DETAILED DESCRIPTION OF THE INVENTION
[0081] The present invention will be described in detail below with reference to the accompanying drawings and specific embodiments. This embodiment is implemented on the premise of the technical solution of the present invention, and gives the detailed implementation manners and specific operation processes, but the protection scope of the present invention is not limited to the following embodiments.
[0082] This embodiment provides a method for authenticable sharing of spatial data on a blockchain for the mobile Internet of Things, which is divided into a spatial-text data sharing architecture on the blockchain for the mobile Internet of Things (as shown in Figure 1 ), and a method for authenticable sharing of spatial data on the blockchain for the mobile Internet of Things (as shown in Figure 2 ). Among them, the method includes the following steps:
[0083] Step 1) Deploy a blockchain supporting smart contracts on the mobile Internet of Things;
[0084] Step 2) Instantiate a spatial index data structure in the NFT smart contract, and deploy the NFT smart contract on the blockchain;
[0085] Step 3) The mobile Internet of Things terminal stores the original data of the spatial-text data to be shared in an off-chain distributed storage system, and stores the corresponding metadata on the blockchain;
[0086] Step 4) The light node sends a data query request to the query service provider, and the query service provider initiates a spatial-text data query transaction to the NFT smart contract based on the data query request;
[0087] Step 5) After receiving the spatial-text data query transaction in Step 4), the full node immediately executes the query function in the NFT smart contract, and records the query result in the form of an event on the blockchain;
[0088] Step 6) The query service provider obtains the query result from the blockchain, constructs a proof object of the query result by using the transaction tree of the block containing the query result, and returns the query result and the proof object to the light node together;
[0089] Step 7) The light node verifies the query result. If the query result passes the verification, it extracts the uniform resource identifier (URI) in the metadata from the query result, and obtains the original spatial-text data from the off-chain distributed storage system; if the query result fails to pass the verification, it indicates that the data is unavailable, and returns to Step 4) to send a data query request to the query service provider again.
[0090] The above method for authenticable sharing of spatial data can be divided into two parts: a method for querying spatial-text data based on a free boundary spatial index data structure (FBSI) as shown in Steps 2)-5), and a method for verifying the query result based on the blockchain transaction tree as shown in Steps 6)-7).
[0091] Part 1: Blockchain-based Spatial-Text Data Sharing Architecture for Mobile Internet of Things
[0092] As Figure 1 shown, the blockchain-based spatial-text data sharing architecture for mobile Internet of Things includes a mobile Internet of Things layer and a blockchain network layer.
[0093] Mobile Internet of Things layer:
[0094] Taking the drone network and the vehicle-to-everything (V2X) network as examples, the nodes of the mobile Internet of Things are drones and intelligent vehicles, which can move freely in space and have no spatial boundary restrictions. Due to the random movement of the nodes of the mobile Internet of Things, the spatial distribution of the generated spatial-text data is also random, and the nodes communicate with each other through spatial wireless links, ground base stations, etc.
[0095] Blockchain network layer:
[0096] Deploy the Ethereum blockchain on the mobile Internet of Things. To save blockchain storage overhead, the nodes store the original spatial-text data in the off-chain distributed storage system IPFS, thereby obtaining the URI of the data for requesting data from the off-chain distributed storage system. Among them, IFPS is deployed on intelligent vehicles and roadside units.
[0097] Deploy the NFT smart contract on the blockchain. The metadata of the spatial-text data is stored on the chain through the NFT smart contract. The metadata includes the unique identifier assigned by the NFT smart contract to the spatial-text data and the description of the characteristics of the spatial-text data. The metadata includes information such as the location, timestamp, feature set, owner, URI, and data type of the spatial-text data.
[0098] In this architecture, drones are lightweight nodes of the blockchain network, and intelligent vehicles are full nodes of the blockchain network. The way for lightweight nodes to obtain shared spatial-text data is to send query requests to full nodes, and the full nodes return the query results and proof objects to lightweight nodes.
[0099] Part 2: Spatial-Text Data Query Method Based on Free-Boundary Spatial Index Data Structure (FBSI)
[0100] Instantiate the free-boundary spatial index data structure (FBSI) in the NFT smart contract and provide a spatial-text data query algorithm based on FBSI.
[0101] FBSI is a tree structure, as Figure 3As shown in the figure, it includes three types of nodes: root nodes, leaf nodes, and intermediate nodes. The root node represents the global space, which is an infinitely large spatial range. The space of the parent node is divided into multiple non-overlapping sub-spaces, and each of its child nodes represents one of the sub-spaces. The intermediate node only represents the spatial range of this branch, and a list of space-text data is associated with the leaf node. When the amount of data associated with the leaf node exceeds the set upper limit, the splitting of the node space occurs, and the splitting follows the following principles:
[0102] 1) Only leaf nodes can split, and the split occurs in the dimension corresponding to the split reference node;
[0103] 2) Each time a node splits, only one space can be divided into two smaller spaces;
[0104] 3) After splitting, the amount of data associated with each sub-space is equal.
[0105] The spatial demarcation point when splitting a node is defined as:
[0106]
[0107] Among them, if the split reference node is on an even layer, the space-text data associated with the leaf node is sorted by longitude, otherwise, if the split reference node is on an odd layer, the space-text data associated with the leaf node is sorted by latitude; N is the number of space-text data associated with the leaf node, Lon represents longitude, and Lat represents latitude.
[0108] If the number of sibling nodes of the split node is greater than or equal to fan max -1, fan max is the fan-out upper limit of its parent node, and the selected split reference node is the split node itself. The split result is as Figure 4 shown. Conversely, it is the parent node, and the split result is as Figure 5 shown.
[0109] In this embodiment, the fan-out upper limit fan max of the nodes in FBSI = 9, that is: if the number of sibling nodes of the split node is greater than or equal to 8, the selected split reference node is the split node itself, otherwise, it is the parent node.
[0110] The process of inserting space-text data into FBSI is as follows:
[0111] Step 201) Create an NFT asset with metadata for the space-text data;
[0112] Step 202) Using the spatial coordinate attribute of the space-text data as an index, search for the leaf node on FBSI that contains the spatial coordinates of the space-text data, and add it to the list of space-text data associated with the leaf node;
[0113] Step 203) If the length of the space-text data list associated with the leaf node in Step 202) exceeds the upper limit, split the space of the leaf node into two sub-spaces, and the associated space-text data is divided into two at the split point and associated with the two new sub-spaces respectively;
[0114] Step 204) If the split reference node is the leaf node itself, the split leaf node becomes an intermediate node, and the two split sub-spaces form its two leaf nodes. The one before the split point is the left child node, and the one after the split point is the right child node; if the split reference node is the parent node of the leaf node, one of the two split sub-spaces before the split point replaces the original leaf node, and the other becomes the sibling node immediately following it.
[0115] In Step 202), the root node of the FBSI is R, the longitude of the space-text data to be searched is Lon, and the latitude is Lat. The method for finding the leaf node Leaf containing the spatial coordinates of the space-text data on the FBSI is as follows:
[0116] Step 2021) If R is a leaf node, then R is the leaf node Leaf to be found, and the process ends. Otherwise, determine whether the layer where R is located is an even layer or an odd layer;
[0117] Step 2022) If the layer where R is located is an even layer, match the child node R containing Lon among the child nodes of R lon , and use R lon to replace R, and return to Step 2021);
[0118] Step 2023) If the layer where R is located is an odd layer, match the child node R containing Lat among the child nodes of R lat , and use R lat to replace R, and return to Step 2021).
[0119] The process of deleting space-text data in the FBSI is as follows:
[0120] Step 205) Verify the authority of the deletion requester;
[0121] Step 206) Using the spatial coordinate attribute of the space-text data as an index, find the leaf node containing the spatial coordinates of the space-text data on the FBSI, and delete the space-text data from the space-text data list associated with the leaf node;
[0122] Step 207) If the space-text data list associated with the leaf node in Step 206) is empty, delete the leaf node;
[0123] Step 208) If the parent node of the leaf node described in Step 207) has only one child node, then merge the parent node and the child node into one leaf node.
[0124] When sharing data, the UAV sends a data query request to a smart vehicle that provides query services:
[0125] q = <[lon start , lon end , [lat start , lat end , ψ>
[0126] where [lon start , lon end and [lat start , lat end are the selected longitude range and latitude range respectively, lon start , lon end , lat start , lat end are the left longitude, right longitude, lower latitude, and upper latitude of the query range respectively, and ψ is the feature set required for the query.
[0127] The space-text data is represented as:
[0128] o i = <t i , lon i , lat i , Ψ i >
[0129] where t i , lon i and lat i are the timestamp, longitude, and latitude respectively, and Ψ i is the feature set of the data.
[0130] The query result is the set of space-text data that all falls within the query space range and has all the features in ψ:
[0131]
[0132] After receiving the query request, the smart vehicle that provides query services calls the query function of the NFT smart contract and initiates a contract call transaction, enabling all full nodes in the blockchain network to execute this query request. The method for implementing the query on the FBSI is as follows:
[0133] Step 501) Search on the FBSI for all data related to the query space <[lon start , lon end , [lat start , latend > The set of overlapping leaf nodes;
[0134] Step 502) Check one by one whether the spatial-text data associated with each leaf node in the leaf node set obtained in step 501) meets the query conditions, and obtain a query result set.
[0135] Finally, record the query result on the blockchain in the form of an event. An event is a way provided by the smart contract to record data on the blockchain and appears as a transaction on the blockchain. Therefore, its hash digest is organized in the transaction tree of the block.
[0136] In step 501), the root node of the FBSI is R, the space represented by the root node is Sr, and the query space is Sq; the method for finding the set of leaf nodes LS that has spatial overlap with Sq on the FBSI is as follows:
[0137] Step 5011) If R is a leaf node, add R to LS and end;
[0138] Step 5012) For each child node C of R, if the space Sc represented by C overlaps with Sq, replace R and Sr with C and Sc, and recursively call this method.
[0139] Part Three: Query Result Verification Method Based on the Blockchain Transaction Tree
[0140] The query result verification algorithm based on the blockchain transaction tree means that the query service provider obtains the query result from the blockchain, constructs a proof object VO of the query result using the transaction tree of the block containing the query result, and returns the query result and VO to the light node together; the light node verifies the query result. If the query result passes the verification, extract the uniform resource identifier (URI) in the metadata from the query result, and obtain the original spatial-text data from the off-chain distributed storage system.
[0141] Constructing the existence proof of a certain transaction using the transaction tree of the block is common knowledge in the art. To avoid obscuring the purpose of this application, it will not be elaborated here.
[0142] To further improve the query efficiency of spatial-text data, organize an inverted file with the feature set of spatial-text data in the NFT smart contract. Before executing the query on the FBSI, first filter the spatial-text data of the feature set that meets the query requirements through the inverted file, and then filter the data that meets the spatial requirements through the FBSI. Take the intersection of the two as the query result.
[0143] In this embodiment, an experimental environment is built for experimental verification. To compare the performance of the present invention, a classic quadtree is introduced as a control group. A quadtree is a multi-dimensional spatial hierarchical indexing data structure based on the principle of spatial recursive decomposition. In a two-dimensional space, each split of a node always divides a space from the middle of each dimension to form four rectangular sub-spaces of equal size. Correspondingly, each non-leaf node in the tree structure has four child nodes.
[0144] Experimental platform:
[0145] Use Ganache to locally deploy a private Ethereum test chain, implement the NFT smart contract with Solidity, and deploy the full-node and light-node emulation programs on an x64 server equipped with an 8-core Intel Xeon 3.0GHz CPU and 32G of memory.
[0146] Experimental dataset:
[0147] Two datasets containing 2,500 spatial-text data are generated through Python programming. The datasets adopt uniform distribution and normal distribution in terms of spatial distribution. The longitude range of the uniform distribution is [30, 31], and the latitude range is [20, 21]. In the normal distribution, the mean values of longitude and latitude are 30 and 20 respectively, and the variance is 1. The feature set of each spatial-text data in the dataset is composed of 3 - 5 keywords randomly selected from a set of 100 keywords.
[0148] In the experiment, the maximum capacity T of the leaf node is set to 10.
[0149] As Figure 6 shown, regardless of how the distribution of the spatial-text data changes, the amount of data that FBSI can accommodate shows a linear growth trend and can accommodate more data than the quadtree. This shows that the present invention is not affected by the distribution of data in space.
[0150] As Figure 7 shown, regardless of how the distribution of the spatial-text data changes, the spatial-text data associated with the leaf nodes of the present invention is at least T×50%, greatly improving the utilization rate of the leaf nodes.
[0151] The preferred specific embodiments of the present invention have been described in detail above. It should be understood that those of ordinary skill in the art can make many modifications and variations based on the concept of the present invention without creative labor. Therefore, all technical solutions that can be obtained by those skilled in the art in the technical field based on the concept of the present invention through logical analysis, reasoning, or limited experiments on the basis of the prior art should be within the protection scope determined by the claims.
Claims
1. A method for authenticable sharing of spatial data on a blockchain for the mobile Internet of Things, characterized in that Including the following steps: Step 1) Deploy a blockchain that supports smart contracts on the mobile Internet of Things; Step 2) Instantiate a spatial index data structure in the NFT smart contract and deploy the NFT smart contract on the blockchain; Step 3) The mobile Internet of Things terminal stores the original data of the spatial-text data to be shared in an off-chain distributed storage system and stores the corresponding metadata on the blockchain; Step 4) The light node sends a data query request to the query service provider, and the query service provider initiates a spatial-text data query transaction to the NFT smart contract based on the data query request; Step 5) After receiving the spatial-text data query transaction in Step 4), the full node immediately executes the query function in the NFT smart contract and records the query result on the blockchain in the form of an event; Step 6) The query service provider obtains the query result from the blockchain, constructs a proof object of the query result using the transaction tree of the block containing the query result, and returns the query result and the proof object to the light node together; Step 7) The light node verifies the query result. If the query result passes the verification, it extracts the URI in the metadata from the query result and obtains the original spatial-text data from the off-chain distributed storage system; If the query result fails to pass the verification, it indicates that the data is unavailable, and returns to Step 4) to send a data query request to the query service provider again; The spatial index data structure in Step 2) is a free-boundary spatial index data structure FBSI, which is a tree-shaped spatial index data structure, including three types of node types: root node, leaf node, and intermediate node; The root node represents the global space, which is an infinitely large space range. The space of the parent node is divided into multiple non-overlapping sub-spaces, and each of its child nodes represents one of the sub-spaces. The intermediate node only represents the space range of this branch. The leaf node is associated with a list of spatial-text data; when the amount of data associated with the leaf node exceeds the set upper limit, node space splitting occurs, and the splitting follows the following principles: a) Only leaf nodes can split, and the split occurs in the dimension corresponding to the split reference node; b) Each time a node splits, only one space can be divided into two smaller spaces; c) The amount of data associated with each sub-space after splitting is equal; The spatial demarcation point when splitting a node is defined as: Where, if the split reference node is on an even layer, the spatial-text data associated with the leaf node is sorted by longitude, otherwise, if the split reference node is on an odd layer, the spatial-text data associated with the leaf node is sorted by latitude; N is the number of spatial-text data associated with the leaf node, Lon represents longitude, and Lat represents latitude; The method for selecting the split reference node is: If the number of sibling nodes of the splitting node is greater than or equal to fan max -1, where fan max is the fan-out upper limit of its parent node, and the selected splitting reference node is the splitting node itself; otherwise, it is its parent node.
2. The blockchain-based spatial data authenticable sharing method for the mobile Internet of Things according to claim 1, wherein The process of inserting spatial-text data into FBSI is: Step 201) Create an NFT asset with metadata for the spatial-text data; Step 202) Using the spatial coordinate attribute of the spatial-text data as an index, find the leaf node on the FBSI that contains the spatial coordinates of the spatial-text data and add it to the list of spatial-text data associated with the leaf node; Step 203) If the length of the space-text data list associated with the leaf node in Step 202) exceeds the upper limit, split the space of the leaf node into two sub-spaces, and the associated space-text data is divided into two at the splitting point and associated with the two new sub-spaces respectively; Step 204) If the splitting reference node is the leaf node itself, the split leaf node becomes an intermediate node, and the two split sub-spaces form its two leaf nodes. The one before the splitting point is the left child node, and the one after the splitting point is the right child node; if the splitting reference node is the parent node of the leaf node, then one of the two split sub-spaces before the splitting point replaces the original leaf node, and the other becomes the sibling node immediately following it; The process of deleting space-text data in FBSI is as follows: Step 205) Verify the permissions of the deletion requester; Step 206) Using the spatial coordinate attribute of the space-text data as an index, find the leaf node containing the spatial coordinates of the space-text data on the FBSI, and delete the space-text data from the space-text data list associated with the leaf node; Step 207) If the space-text data list associated with the leaf node in Step 206) is empty, delete the leaf node; Step 208) If the parent node of the leaf node in Step 207) has only one child node, merge the parent node and the child node into one leaf node.
3. The method for authenticable sharing of spatial data on a blockchain for the mobile Internet of Things according to claim 2, wherein The query function in the NFT smart contract in Step 5) performs the following steps: Step 501) Search all leaf node sets overlapping with the query space <[lon start ,lon end ,[lat start ,lat end > on the FBSI, where lon start , lon end , lat start , lat end are the left longitude, right longitude, lower latitude, and upper latitude of the query range, respectively; Step 502) Check one by one whether the space-text data associated with each leaf node in the leaf node set obtained in Step 501) meets the query conditions to obtain a query result set.
4. A method for authenticable sharing of spatial data on a blockchain for mobile Internet of Things according to claim 2 or 3, characterized in that In Step 202), the method for finding the leaf node Leaf containing the spatial coordinates of the space-text data on the FBSI is as follows: The root node of the FBSI is R, the longitude of the space-text data to be found is Lon, and the latitude is Lat; Step 2021) If R is a leaf node, then R is the leaf node Leaf to be found, end, otherwise, determine whether the layer where R is located is an even layer or an odd layer; Step 2022) If the layer where R is located is an even layer, match the child node R that contains Lon among the child nodes of R lon , and use R lon to replace R, and return to Step 2021); Step 2023) If the layer where R is located is an odd layer, match the child node R that contains Lat among the child nodes of R lat , and use R lat to replace R, and return to Step 2021).
5. A method for authenticable sharing of spatial data on a blockchain for the mobile Internet of Things according to claim 3, characterized in that In Step 501), the method for searching the leaf node set LS that overlaps with the query space on the FBSI is as follows: The root node of the FBSI is R, the space represented by the root node is Sr, and the query space is Sq; Step 5011) If R is a leaf node, add R to LS and end; Step 5012) For each child node C of R, if the space Sc represented by C overlaps with Sq, replace R and Sr with C and Sc, and recursively call this method.
6. A method for authenticable sharing of spatial data on a blockchain for the mobile Internet of Things according to claim 4, characterized in that, In Step 501), the method for searching the leaf node set LS that overlaps with the query space on the FBSI is as follows: The root node of the FBSI is R, the space represented by the root node is Sr, and the query space is Sq; Step 5011) If R is a leaf node, add R to LS and end; Step 5012) For each child node C of R, if the space Sc represented by C overlaps with Sq, replace R and Sr with C and Sc, and recursively call this method.
7. A method for authenticable sharing of spatial data on a blockchain for mobile Internet of Things according to claim 6, characterized in that In the NFT smart contract, an inverted file is organized with the feature set of spatial-text data. Before executing a query on the FBSI, first filter the spatial-text data of the feature set that meets the query requirements through the inverted file, and then filter the data that meets the spatial requirements through the FBSI. The intersection of the two is the query result.
8. A method for authenticable sharing of spatial data on a blockchain for mobile Internet of Things according to claim 1, characterized in that, The mobile Internet of Things includes a drone network and a vehicle network.
9. A method for authenticable sharing of spatial data on a blockchain for the mobile Internet of Things according to claim 8, characterized in that, The drones in the drone network are light nodes, and the intelligent vehicles in the vehicle network are full nodes. The intelligent vehicles and the roadside units of the mobile Internet of Things deploy an off-chain distributed data storage system.
10. A method for authenticable sharing of spatial data on a blockchain for the mobile Internet of Things according to claim 9, characterized in that, The off-chain distributed data storage system is IPFS, and the metadata includes the location, timestamp, feature set, owner, URI, and data type of the spatial-text data.
Citation Information
Patent Citations
Automatic artificial intelligence data sharing method and device based on block chain
CN109472699A
Hybrid spatial indexing mechanism for processing geographic text Skyline query
CN108052514A
Unconscious intelligent retrieval method based on remote sensing space big data
CN113987024A