



技术领域technical field
本发明属于基于区块链的数据读写领域,尤其是一种基于区块链的非结构化数据操作方法和系统。The invention belongs to the field of data reading and writing based on block chain, in particular to a method and system for operating unstructured data based on block chain.
背景技术Background technique
区块链作为一种分布式储存技术,数据以区块的形式的存储在节点中,每个节点都拥有一个完整的备份,节点通过共识机制共同参与区块的产生,区块上链保证数据不可篡改。然而对于非结构数据上链,需要把数据拆解、分块,读取数据时需要重新组合数据,增加计算资源;其次,非结构数据存储成本非常高,这对节点同步增加不少的负担。Blockchain is a distributed storage technology. Data is stored in nodes in the form of blocks. Each node has a complete backup. The nodes participate in the generation of blocks through a consensus mechanism, and the blockchain guarantees data. Immutable. However, for unstructured data to be uploaded to the chain, the data needs to be disassembled and divided into blocks, and the data needs to be recombined when reading data, which increases computing resources; secondly, the storage cost of unstructured data is very high, which increases a lot of burden on node synchronization.
对于非结构化数据储存,目前有一种做法是IPFS。,IPFS通过把非结构数据区块化,将数据分发到不同节点分别存储,最后通过生成文件的哈希值来索引。但是这种存储方式受限于网络传输性能和背书节点计算性能,效率低下。For unstructured data storage, one of the current practices is IPFS. , IPFS blocks the unstructured data, distributes the data to different nodes for storage, and finally generates the hash value of the file to index. However, this storage method is limited by the network transmission performance and the computing performance of the endorsement node, and the efficiency is low.
还有一种做法是APP在云端直接储存非结构数据,同时把数据的MD5值上传到区块链中,通过区块链校验保证数据的不可篡改性。这种做法违背了数据储存的透明原则,APP在上链过程中,用户可通过恶意上传非法的MD5值,影响系统可靠性。而且在非结构化数据上链的过程割裂性大,难以保证数据的MD5校验过程与共享存储的非结构化保存对应管理,可信程度低。Another approach is that the APP directly stores unstructured data in the cloud, and at the same time uploads the MD5 value of the data to the blockchain to ensure that the data cannot be tampered with through blockchain verification. This approach violates the transparent principle of data storage. During the process of APP being on the chain, users can maliciously upload illegal MD5 values, which will affect the reliability of the system. In addition, the process of uploading unstructured data to the chain is highly fragmented, and it is difficult to ensure that the MD5 verification process of the data corresponds to the management of the unstructured storage of shared storage, and the degree of credibility is low.
发明内容SUMMARY OF THE INVENTION
本发明的目的在于提供一种基于区块链的非结构化数据操作方法和系统,旨在提高基于区块链的非结构数据的可靠性。The purpose of the present invention is to provide a block chain-based unstructured data operation method and system, aiming to improve the reliability of block chain-based unstructured data.
为此,本发明提供了一种基于区块链的非结构化数据操作方法,包括:To this end, the present invention provides a blockchain-based unstructured data operation method, including:
在用于数据操作的第一云函数被触发时,所述第一云函数触发用于校验操作的第二云函数;When the first cloud function for data operation is triggered, the first cloud function triggers the second cloud function for verification operation;
所述第二云函数执行根据所述第一云函数的函数名获取该第一云函数的函数名对应的源代码并根据该源代码计算与该源代码对应的第一特征值的步骤;The second cloud function executes the steps of obtaining the source code corresponding to the function name of the first cloud function according to the function name of the first cloud function and calculating the first feature value corresponding to the source code according to the source code;
所述第二云函数执行根据所述第一云函数的函数名从区块链集群获取与该函数名对应的第二特征值的步骤;The second cloud function executes the step of acquiring the second feature value corresponding to the function name from the blockchain cluster according to the function name of the first cloud function;
在所述第一特征值和第二特征值相同时,执行所述第一云函数。The first cloud function is executed when the first eigenvalue and the second eigenvalue are the same.
优选地,所述第一云函数和第二云函数为lambda云函数。Preferably, the first cloud function and the second cloud function are lambda cloud functions.
优选地,所述第一特征值为所述源代码对应的MD5值,所述第二特征值为存储于所述区块链集群的与所述第一云函数的函数名对应的MD5值。Preferably, the first feature value is an MD5 value corresponding to the source code, and the second feature value is an MD5 value stored in the blockchain cluster and corresponding to the function name of the first cloud function.
优选地,所述用于数据操作的第一云函数被触发的步骤包括:Preferably, the step of triggering the first cloud function for data manipulation includes:
在对象存储单元存储用户终端发出的文件后,用于存储数据的第一云函数被所述对象存储单元触发并接收对象存储单元发送的文件的存储信息,其中,所述存储信息包括所述文件在所述对象存储单元的路径、所述文件的MD5值、所述文件的用户信息、所述文件的时间戳中的一种或多种;After the object storage unit stores the file sent by the user terminal, the first cloud function for storing data is triggered by the object storage unit and receives storage information of the file sent by the object storage unit, where the storage information includes the file One or more of the path of the object storage unit, the MD5 value of the file, the user information of the file, and the timestamp of the file;
在执行所述第一云函数之后,还包括:After executing the first cloud function, the method further includes:
将存储操作数据发送至所述区块链集群以记录该文件信息和操作行为,其中,所述存储操作数据包括文件路径形成的关键字,以及以该文件的MD5值、所述文件的用户信息、此次用户操作行为和时间戳形成的所述关键字对应的值。Send the storage operation data to the blockchain cluster to record the file information and operation behavior, wherein the storage operation data includes a keyword formed by the file path, and the MD5 value of the file and the user information of the file. , the value corresponding to the keyword formed by the current user operation behavior and the timestamp.
优选地,所述用于数据操作的第一云函数被触发的步骤包括:Preferably, the step of triggering the first cloud function for data manipulation includes:
在对象存储单元响应用户终端发出的修改文件的请求后,用于修改数据的第一云函数触发并且接收对象存储单元发送的文件的修改信息,其中,所述修改信息包括所述文件在所述对象存储单元的路径、修改后的文件的MD5值、所述文件的用户信息、用户操作行为和所述文件的时间戳中的一种或多种;After the object storage unit responds to the request for modifying the file sent by the user terminal, the first cloud function for modifying data triggers and receives the modification information of the file sent by the object storage unit, wherein the modification information includes the file in the One or more of the path of the object storage unit, the MD5 value of the modified file, the user information of the file, the user operation behavior, and the timestamp of the file;
在执行所述第一云函数之后,还包括:After executing the first cloud function, the method further includes:
将修改操作数据发送至所述区块链集群以记录该文件的信息和操作行为,其中,所述修改操作数据包括以文件路径形成关键字,以该文件的MD5值、用户信息、用户操作行为和时间戳形成的所述关键字对应的值。Send the modification operation data to the blockchain cluster to record the information and operation behavior of the file, wherein the modification operation data includes forming a keyword with the file path, and using the MD5 value of the file, user information, and user operation behavior. The value corresponding to the key formed by the timestamp.
优选地,所述用于数据操作的第一云函数被触发的步骤包括:Preferably, the step of triggering the first cloud function for data manipulation includes:
在对象存储单元响应用户终端发出的读取文件的请求后,用于读取数据的第一云函数被触发并接收对象存储单元发送的文件的读取信息,其中,所述读取信息包括所述文件在所述对象存储单元的路径、文件的MD5值、所述文件的用户信息、所述文件的时间戳中的一种或多种;After the object storage unit responds to the request for reading the file sent by the user terminal, the first cloud function for reading data is triggered and receives the reading information of the file sent by the object storage unit, wherein the reading information includes all One or more of the path of the file in the object storage unit, the MD5 value of the file, the user information of the file, and the timestamp of the file;
在执行所述第一云函数之后,还包括:After executing the first cloud function, the method further includes:
将读取操作数据发送至所述区块链集群以记录该文件的信息和操作行为,其中,所述读取操作数据包括以文件路径形成关键字,以该文件的MD5值、用户信息、用户操作行为和时间戳形成的所述关键字对应的值。Send the read operation data to the blockchain cluster to record the information and operation behavior of the file, wherein the read operation data includes a keyword formed by the file path, and the MD5 value of the file, user information, user The value corresponding to the keyword formed by the operation behavior and the timestamp.
优选地,在所述将读取操作数据发送至所述区块链集群之后,还包括:Preferably, after the sending the read operation data to the blockchain cluster, the method further includes:
接收用户终端发送的读取的文件的文件路径和文件的MD5值,并触发用于验证文件的第三云函数,所述第三云函数触发用于校验操作的第二云函数;Receive the file path of the read file sent by the user terminal and the MD5 value of the file, and trigger the third cloud function for verifying the file, and the third cloud function triggers the second cloud function for the verification operation;
所述第二云函数执行根据所述第三云函数的函数名获取该第三云函数的函数名对应的源代码并根据该源代码计算与该源代码对应的第三特征值的步骤;The second cloud function executes the step of obtaining the source code corresponding to the function name of the third cloud function according to the function name of the third cloud function and calculating the third feature value corresponding to the source code according to the source code;
所述第二云函数执行根据所述第三云函数的函数名从区块链集群获取与该函数名对应的第四特征值的步骤;The second cloud function executes the step of acquiring the fourth feature value corresponding to the function name from the blockchain cluster according to the function name of the third cloud function;
在所述第三特征值和第四特征值相同时,执行所述第三云函数。When the third eigenvalue and the fourth eigenvalue are the same, the third cloud function is executed.
优选地,执行所述第三云函数包括:Preferably, executing the third cloud function includes:
所述第三云函数执行根据所述文件获取该文件的MD5值的步骤;The third cloud function executes the step of obtaining the MD5 value of the file according to the file;
所述第三云函数执行比对该文件的MD5值和接收用户终端发送的MD5值,如果比对相同,则确定文件安全。The third cloud function performs a comparison between the MD5 value of the file and the MD5 value sent by the receiving user terminal, and if the comparison is the same, it is determined that the file is safe.
一种基于区块链的非结构化数据操作系统,包括云函数服务器,所述云函数服务器包括存储器和处理器,所述存储器用于存储计算机程序,所述处理器在执行所述计算机程序时,包括如下步骤:A blockchain-based unstructured data operating system, including a cloud function server, the cloud function server includes a memory and a processor, the memory is used to store a computer program, and the processor executes the computer program when the computer program is executed. , including the following steps:
在用于数据操作的第一云函数被触发时,所述第一云函数触发用于校验操作的第二云函数;When the first cloud function for data operation is triggered, the first cloud function triggers the second cloud function for verification operation;
所述第二云函数执行根据所述第一云函数的函数名获取该第一云函数的函数名对应的源代码并根据该源代码计算与该源代码对应的第一特征值的步骤;The second cloud function executes the steps of obtaining the source code corresponding to the function name of the first cloud function according to the function name of the first cloud function and calculating the first feature value corresponding to the source code according to the source code;
所述第二云函数执行根据所述第一云函数的函数名从区块链集群获取与该函数名对应的第二特征值的步骤;The second cloud function executes the step of acquiring the second feature value corresponding to the function name from the blockchain cluster according to the function name of the first cloud function;
在所述第一特征值和第二特征值相同时,执行所述第一云函数。The first cloud function is executed when the first eigenvalue and the second eigenvalue are the same.
优选地,还包括对象存储单元,用于在存储用户终端发出的文件后,触发用于存储数据的第一云函数并发送的文件的存储信息,其中,所述存储信息包括所述文件在所述对象存储单元的路径、所述文件的MD5值、所述文件的用户信息、所述文件的时间戳中的一种或多种,或者,Preferably, an object storage unit is further included, which is used to trigger the first cloud function for storing data and send the storage information of the file after storing the file sent by the user terminal, wherein the storage information includes the storage information of the file in the place where the file is stored. One or more of the path of the object storage unit, the MD5 value of the file, the user information of the file, and the timestamp of the file, or,
用于在响应用户终端发出的修改文件的请求后,触发修改数据的第一云函数触发并发送的文件的修改信息,其中,所述修改信息包括所述文件在所述对象存储单元的路径、修改后的文件的MD5值、所述文件的用户信息、所述文件的时间戳中的一种或多种,或者The modification information for the file triggered and sent by the first cloud function that triggers the modification data after responding to the request for modifying the file sent by the user terminal, wherein the modification information includes the path of the file in the object storage unit, one or more of the MD5 value of the modified file, the user information of the file, the timestamp of the file, or
用于响应用户终端发出的读取文件的请求后,触发用于读取数据的第一云函数并发送的文件的读取信息,其中,所述读取信息包括所述文件在所述对象存储单元的路径、文件的MD5值、所述文件的用户信息、所述文件的时间戳中的一种或多种。It is used to trigger the first cloud function for reading data and send the reading information of the file after responding to the request for reading the file sent by the user terminal, wherein the reading information includes the file in the object storage One or more of the path of the unit, the MD5 value of the file, the user information of the file, and the timestamp of the file.
与现有技术相比,上述的一种基于区块链的非结构化数据操作方法和系统通过在用于数据操作的第一云函数被触发时,触发用于校验操作的第二云函数,使得第二云函数根据根据第一云函数的函数名获取的源代码计算得到的第一特征值和根据函数名从区块链集得到的第二特征值进行比对,以校验该第一云函数的函数名是否正确,从而可以确认第一云函数的可靠性,不会被非法篡改,安全可靠的运行第一云函数。Compared with the prior art, the above-mentioned method and system for operating unstructured data based on blockchain can trigger the second cloud function for verification operation when the first cloud function for data operation is triggered. , so that the first eigenvalue calculated by the second cloud function according to the source code obtained according to the function name of the first cloud function is compared with the second eigenvalue obtained from the blockchain set according to the function name to verify the first eigenvalue. Whether the function name of the first cloud function is correct, so that the reliability of the first cloud function can be confirmed, and the first cloud function will not be illegally tampered with, and the first cloud function can be run safely and reliably.
进一步,在操作(读取、存储或修改)非结构化数据时,对文件信息和用户的操作行为写入区块链,保证文件和对应的特征值对应管理,防止外部用户非法调用或者恶意篡改数据,保证非结构化数据的可追溯性和不可篡改性。在读取文件后,还通过对文件进行校验的第三云函数校验该文件,保证文件的可靠性,实现文件的可靠存储。Further, when operating (reading, storing or modifying) unstructured data, the file information and user's operation behavior are written into the blockchain to ensure the corresponding management of files and corresponding feature values, preventing external users from illegally calling or maliciously tampering. data to ensure traceability and immutability of unstructured data. After the file is read, the file is also verified by a third cloud function that verifies the file, so as to ensure the reliability of the file and realize reliable storage of the file.
附图说明Description of drawings
图1是基于区块链的非结构化数据操作方法的流程图。Figure 1 is a flowchart of a blockchain-based unstructured data manipulation method.
图2是基于区块链的非结构化数据存储方法的流程图。Figure 2 is a flowchart of a blockchain-based unstructured data storage method.
图3是基于区块链的非结构化数据修改方法的流程图。Figure 3 is a flowchart of a blockchain-based unstructured data modification method.
图4是基于区块链的非结构化数据读取方法的流程图。Figure 4 is a flowchart of a blockchain-based unstructured data reading method.
具体实施方式Detailed ways
下面结合附图,对本发明做进一步说明。The present invention will be further described below with reference to the accompanying drawings.
作为示例性的,本实施方式中,利用FaaS+S3对象存储实现对区块链的非结构化数据存储,以下说明中FaaS使用AWS的lambda云函数。FaaS+S3对象储存是一种无服务架构,实现非结构数据储存的透明化和自动化,同时lambda云函数支持弹性管理,能够自动分配和扩展所需资源,有效降低开发成本和运营成本。As an example, in this implementation manner, FaaS+S3 object storage is used to implement unstructured data storage on the blockchain, and in the following description, FaaS uses the lambda cloud function of AWS. FaaS+S3 object storage is a serviceless architecture that realizes the transparency and automation of unstructured data storage. At the same time, lambda cloud functions support elastic management and can automatically allocate and expand required resources, effectively reducing development costs and operating costs.
在FaaS+S3对象存储方案中,用户可以直接操作S3服务器存储(读取)文件,通过S3服务自动触发lambda云函数向区块链发送相关信息来保证系统的可靠性,同时lambda云函数会记录每次操作的用户、内容、时间等信息,保证数据可追溯性。另外关于数据的MD5校验值也通过lambda云函数透明实现,防止用户入侵或恶意上传非法MD5值。In the FaaS+S3 object storage solution, users can directly operate the S3 server to store (read) files, and automatically trigger the lambda cloud function to send relevant information to the blockchain through the S3 service to ensure the reliability of the system, and the lambda cloud function will record The user, content, time and other information of each operation ensure data traceability. In addition, the MD5 check value of the data is also transparently implemented through the lambda cloud function, preventing users from intrusion or malicious uploading of illegal MD5 values.
为保证lambda云函数不被非法篡改,安全可靠运行lambda云函数,在每次执行lambda云函数,需要对lambda云函数进行校验,需事先把lambda云函数的函数名和MD5存入到区块链中。S3对象存储器中存储有对应表,该对应表记录有lambda函数名以及与该lambda函数名一一对应的源代码路径。云函数服务器可以从该对应表中根据函数名获取源代码的路径,再根据源代码的路径获取到该函数名对应的源代码。由于云函数服务器在获取源代码后还会校验源代码,而校验码已存放在区块链中,这一校验操作已经保证了源代码的可靠性,所以无需将源代码也存放在区块链中,而仅仅存储在S3对象存储器中即可。In order to ensure that the lambda cloud function is not illegally tampered with and run the lambda cloud function safely and reliably, the lambda cloud function needs to be verified every time the lambda cloud function is executed, and the function name and MD5 of the lambda cloud function must be stored in the blockchain in advance middle. A correspondence table is stored in the S3 object storage, and the correspondence table records a lambda function name and a source code path corresponding to the lambda function name one-to-one. The cloud function server can obtain the source code path according to the function name from the corresponding table, and then obtain the source code corresponding to the function name according to the source code path. Since the cloud function server will verify the source code after obtaining the source code, and the verification code has been stored in the blockchain, this verification operation has ensured the reliability of the source code, so there is no need to store the source code in the In the blockchain, it is only stored in the S3 object storage.
基于区块链的非结构化数据操作方法用于对非结构化数据进行操作,包括但不限于读取数据、存储数据和修改数据。基于区块链的非结构化数据操作方法可被可执行于基于区块链的非结构化数据操作系统。非结构化数据操作系统包括云函数服务器和对象存储器。所述云函数服务器包括存储器和处理器,所述存储器用于存储计算机程序,所述处理器在执行所述计算机程序时执行所述基于区块链的非结构化数据操作方法。Blockchain-based unstructured data manipulation methods are used to manipulate unstructured data, including but not limited to reading data, storing data, and modifying data. The blockchain-based unstructured data manipulation method can be implemented on the blockchain-based unstructured data operating system. Unstructured data operating systems include cloud function servers and object storage. The cloud function server includes a memory and a processor, where the memory is used to store a computer program, and the processor executes the blockchain-based unstructured data manipulation method when executing the computer program.
所述对象存储单元用于在存储用户终端发出的文件后,触发用于存储数据的第一云函数并发送的文件的存储信息,其中,所述存储信息包括所述文件在所述对象存储单元的路径、所述文件的MD5值、所述文件的用户信息、所述文件的时间戳中的一种或多种,或者,用于在响应用户终端发出的修改文件的请求后,触发修改数据的第一云函数触发并发送的文件的修改信息,其中,所述修改信息包括所述文件在所述对象存储单元的路径、修改后的文件的MD5值、所述文件的用户信息、所述文件的时间戳中的一种或多种,或者用于响应用户终端发出的读取文件的请求后,触发用于读取数据的第一云函数并发送的文件的读取信息,其中,所述读取信息包括所述文件在所述对象存储单元的路径、文件的MD5值、所述文件的用户信息、所述文件的时间戳中的一种或多种。The object storage unit is configured to trigger the first cloud function for storing data and send the storage information of the file after storing the file sent by the user terminal, wherein the storage information includes that the file is stored in the object storage unit. One or more of the path of the file, the MD5 value of the file, the user information of the file, and the timestamp of the file, or, after responding to the request for modifying the file sent by the user terminal, triggering the modification of data The modification information of the file triggered and sent by the first cloud function, wherein the modification information includes the path of the file in the object storage unit, the MD5 value of the modified file, the user information of the One or more of the timestamps of the file, or the read information of the file sent by triggering the first cloud function for reading data after responding to the request for reading the file sent by the user terminal, where all The read information includes one or more of the path of the file in the object storage unit, the MD5 value of the file, the user information of the file, and the timestamp of the file.
实施例1Example 1
图1是基于区块链的非结构化数据操作方法的流程图。如图1所示,该基于区块链的非结构化数据操作方法包括如下步骤。Figure 1 is a flowchart of a blockchain-based unstructured data manipulation method. As shown in Figure 1, the blockchain-based unstructured data manipulation method includes the following steps.
步骤1:触发用于数据操作的第一云函数,触发第一云函数的主体可以是用户终端,也可以是对象存储单元。本实施方式中,作为示例性的,该对象存储单元为S3对象存储器。Step 1: Trigger the first cloud function for data operation, and the subject that triggers the first cloud function may be a user terminal or an object storage unit. In this embodiment, as an example, the object storage unit is an S3 object storage.
步骤2:云函数服务器的第一云函数触发用于校验操作的第二云函数。其中,所述第一云函数和第二云函数为lambda云函数。云函数服务器从对象存储器存储的对应表中,根据第一云函数的函数名查询对应的源代码的路径,再根据该源代码的路径从云端下载源代码。Step 2: The first cloud function of the cloud function server triggers the second cloud function for the verification operation. Wherein, the first cloud function and the second cloud function are lambda cloud functions. The cloud function server searches the corresponding source code path according to the function name of the first cloud function from the corresponding table stored in the object storage, and then downloads the source code from the cloud according to the source code path.
步骤3:云函数服务器执行第二云函数,从对象存储器存储的对应表中,根据第一云函数的函数名查询对应的源代码的路径,再根据该源代码的路径从云端下载源代码,然后根据该源代码计算与该源代码对应的第一特征值。本步骤中,第一特征值为根据该第一云函数的源代码计算得到的MD5值。Step 3: The cloud function server executes the second cloud function, searches the corresponding source code path according to the function name of the first cloud function from the corresponding table stored in the object storage, and then downloads the source code from the cloud according to the source code path, Then the first feature value corresponding to the source code is calculated according to the source code. In this step, the first characteristic value is an MD5 value calculated according to the source code of the first cloud function.
步骤4:云函数服务器执行第二云函数,执行根据该函数名从区块链集群获取与该函数名对应的第二特征值的步骤。本步骤中,第一特征值为区块链集群存储的与该云函数应的MD5值。Step 4: The cloud function server executes the second cloud function, and executes the step of obtaining the second feature value corresponding to the function name from the blockchain cluster according to the function name. In this step, the first feature value is the MD5 value stored in the blockchain cluster and corresponding to the cloud function.
步骤5:在所述第一特征值和第二特征值相同时,确定所述第一云函数正确,即该第一云函数校验成功,可以执行该第一云函数。其中,第一云函数可以是多种具有类型的云函数,作为示例性的,以下将第一云函数分别作为存储数据的云函数、修改数据的云函数和读取数据的云函数分别具体描述。Step 5: When the first eigenvalue and the second eigenvalue are the same, it is determined that the first cloud function is correct, that is, the first cloud function is successfully verified, and the first cloud function can be executed. Wherein, the first cloud function may be a variety of cloud functions with different types. As an example, the first cloud function is described below as a cloud function for storing data, a cloud function for modifying data, and a cloud function for reading data, respectively. .
实施例2Example 2
图2是基于区块链的非结构化数据存储方法的流程图,如图2所示,该基于区块链的非结构化数据存储方法包括如下步骤。Fig. 2 is a flow chart of a blockchain-based unstructured data storage method. As shown in Fig. 2, the blockchain-based unstructured data storage method includes the following steps.
步骤1:用户终端向对象存储单元存储文件。本步骤中,对象存储单元为S3对象存储器。Step 1: The user terminal stores the file in the object storage unit. In this step, the object storage unit is the S3 object storage.
步骤2:对象存储单元触发云函数服务器的用于存储操作的第一云函数,并且向云函数服务器发送存储信息,其中,所述存储信息包括所述文件在所述对象存储单元的路径、所述文件的MD5值、所述文件的用户信息、所述文件的时间戳中的一种或多种。Step 2: The object storage unit triggers the first cloud function of the cloud function server for the storage operation, and sends storage information to the cloud function server, wherein the storage information includes the path of the file in the object storage unit, the location One or more of the MD5 value of the file, the user information of the file, and the timestamp of the file.
步骤3:校验用于存储操作的第一云函数。本步骤具体包括如下步骤:Step 3: Verify the first cloud function for storage operations. This step specifically includes the following steps:
1)云函数服务器的第一云函数触发用于校验操作的第二云函数。其中,所述第一云函数和第二云函数为lambda云函数。1) The first cloud function of the cloud function server triggers the second cloud function for the verification operation. Wherein, the first cloud function and the second cloud function are lambda cloud functions.
2)云函数服务器执行第二云函数,从对象存储器存储的对应表中,根据第一云函数的函数名查询对应的源代码的路径,再根据该源代码的路径从云端下载源代码,然后根据该源代码计算与该源代码对应的第一特征值。本步骤中,第一特征值为根据该第一云函数的源代码计算得到的MD5值。2) The cloud function server executes the second cloud function, searches the corresponding source code path according to the function name of the first cloud function from the corresponding table stored in the object storage, and then downloads the source code from the cloud according to the source code path, and then A first feature value corresponding to the source code is calculated according to the source code. In this step, the first characteristic value is an MD5 value calculated according to the source code of the first cloud function.
3)云函数服务器执行第二云函数的根据该函数名从区块链集群获取与该函数名对应的第二特征值的步骤。本步骤中,第一特征值为区块链集群存储的与该云函数应的MD5值。3) The cloud function server executes the step of acquiring the second feature value corresponding to the function name from the blockchain cluster according to the function name of the second cloud function. In this step, the first feature value is the MD5 value stored in the blockchain cluster and corresponding to the cloud function.
步骤4:在所述第一特征值和第二特征值相同时,确定所述第一云函数正确,即该第一云函数校验成功,可以执行该第一云函数。Step 4: When the first eigenvalue and the second eigenvalue are the same, it is determined that the first cloud function is correct, that is, the first cloud function is successfully verified, and the first cloud function can be executed.
步骤5:将所述存储操作数据发送至所述区块链集群以记录该文件信息和操作行为,其中,所述存储操作数据以文件路径为关键字,以该文件的MD5值、用户信息、用户操作行为和时间戳为所述关键字对应的值。Step 5: Send the storage operation data to the blockchain cluster to record the file information and operation behavior, wherein the storage operation data takes the file path as the key, and uses the MD5 value of the file, user information, The user operation behavior and the time stamp are the values corresponding to the keyword.
实施例3Example 3
图3是基于区块链的非结构化数据修改方法的流程图,如图3所示,该基于区块链的非结构化数据修改方法包括如下步骤。Figure 3 is a flow chart of a method for modifying unstructured data based on blockchain. As shown in Figure 3, the method for modifying unstructured data based on blockchain includes the following steps.
步骤1:用户终端向对象修改单元修改文件。本步骤中,对象修改单元为S3对象修改器。Step 1: The user terminal modifies the file to the object modification unit. In this step, the object modification unit is the S3 object modifier.
步骤2:对象修改单元触发云函数服务器的用于修改操作的第一云函数,并且向云函数服务器发送修改信息,其中,所述修改信息包括所述文件在所述对象存储单元的路径、修改后的文件的MD5值、所述文件的用户信息、所述文件的时间戳中的一种或多种。Step 2: The object modification unit triggers the first cloud function of the cloud function server for the modification operation, and sends modification information to the cloud function server, wherein the modification information includes the path of the file in the object storage unit, the modification One or more of the MD5 value of the subsequent file, the user information of the file, and the timestamp of the file.
步骤3:云函数服务器的第一云函数触发用于校验操作的第二云函数,对用于修改操作的第一云函数进行校验操作。其中,所述第一云函数和第二云函数为lambda云函数。本步骤具体包括如下步骤:Step 3: The first cloud function of the cloud function server triggers the second cloud function used for the verification operation, and the verification operation is performed on the first cloud function used for the modification operation. Wherein, the first cloud function and the second cloud function are lambda cloud functions. This step specifically includes the following steps:
1)云函数服务器执行第二云函数,从对象存储器存储的对应表中,根据第一云函数的函数名查询对应的源代码的路径,再根据该源代码的路径从云端下载源代码,然后根据该源代码计算与该源代码对应的第一特征值。本步骤中,第一特征值为根据该第一云函数的源代码计算得到的MD5值。1) The cloud function server executes the second cloud function, searches the corresponding source code path according to the function name of the first cloud function from the corresponding table stored in the object storage, and then downloads the source code from the cloud according to the source code path, and then A first feature value corresponding to the source code is calculated according to the source code. In this step, the first characteristic value is an MD5 value calculated according to the source code of the first cloud function.
2)云函数服务器执行第二云函数的根据该函数名从区块链集群获取与该函数名对应的第二特征值的步骤。本步骤中,第一特征值为区块链集群修改的与该云函数应的MD5值。2) The cloud function server executes the step of acquiring the second feature value corresponding to the function name from the blockchain cluster according to the function name of the second cloud function. In this step, the first feature value is the MD5 value modified by the blockchain cluster and corresponding to the cloud function.
步骤4:在所述第一特征值和第二特征值相同时,确定所述第一云函数正确,即该第一云函数校验成功,执行该用于读取操作的第一云函数。Step 4: When the first eigenvalue and the second eigenvalue are the same, it is determined that the first cloud function is correct, that is, the first cloud function is successfully verified, and the first cloud function used for the read operation is executed.
步骤5:将所述修改操作数据发送至所述区块链集群以记录该文件信息和操作行为,其中,所述修改操作数据包括以文件路径形成关键字,以该文件的MD5值、用户信息、此次用户操作行为和和时间戳形成的所述关键字对应的值。Step 5: Send the modification operation data to the blockchain cluster to record the file information and operation behavior, wherein the modification operation data includes forming a keyword with a file path, using the MD5 value of the file, user information , the current user operation behavior, and the value corresponding to the keyword formed with the timestamp.
实施例4Example 4
图4是基于区块链的非结构化数据读取方法的流程图。如图4所示,该基于区块链的非结构化数据读取方法包括如下步骤。Figure 4 is a flowchart of a blockchain-based unstructured data reading method. As shown in Figure 4, the blockchain-based method for reading unstructured data includes the following steps.
步骤1:用户终端向对象存储单元读取文件。本步骤中,对象存储单元为S3对象存储器。Step 1: The user terminal reads the file from the object storage unit. In this step, the object storage unit is the S3 object storage.
步骤2:对象存储单元响应于读取文件请求后,触发云函数服务器的用于读取操作的第一云函数并且向云函数服务器发送读取信息,其中,所述读取信息包括读取的文件的路径、用户信息和时间戳中的一种或多种。Step 2: After the object storage unit responds to the read file request, triggers the first cloud function of the cloud function server for the read operation and sends read information to the cloud function server, wherein the read information includes the read data. One or more of the file's path, user information, and timestamp.
步骤3:云函数服务器的第一云函数触发用于校验操作的第二云函数。其中,所述第一云函数和第二云函数为lambda云函数。本步骤具体包括如下:Step 3: The first cloud function of the cloud function server triggers the second cloud function for the verification operation. Wherein, the first cloud function and the second cloud function are lambda cloud functions. This step specifically includes the following:
1)云函数服务器执行第二云函数,从对象存储器存储的对应表中,根据第一云函数的函数名查询对应的源代码的路径,再根据该源代码的路径从云端下载源代码,然后根据该源代码计算与该源代码对应的第一特征值。本步骤中,第一特征值为根据该第一云函数的源代码计算得到的MD5值。1) The cloud function server executes the second cloud function, searches the corresponding source code path according to the function name of the first cloud function from the corresponding table stored in the object storage, and then downloads the source code from the cloud according to the source code path, and then A first feature value corresponding to the source code is calculated according to the source code. In this step, the first characteristic value is an MD5 value calculated according to the source code of the first cloud function.
2)云函数服务器执行第二云函数的根据该函数名从区块链集群获取与该函数名对应的第二特征值的步骤。本步骤中,第一特征值为区块链集群存储的与该云函数对应的MD5值。2) The cloud function server executes the step of acquiring the second feature value corresponding to the function name from the blockchain cluster according to the function name of the second cloud function. In this step, the first feature value is the MD5 value stored in the blockchain cluster and corresponding to the cloud function.
步骤4:在所述第一特征值和第二特征值相同时,确定所述第一云函数正确,即该第一云函数校验成功,执行用于读取操作的该第一云函数。Step 4: When the first eigenvalue and the second eigenvalue are the same, it is determined that the first cloud function is correct, that is, the first cloud function is successfully verified, and the first cloud function used for the read operation is executed.
步骤5:云函数服务器将读取操作数据发送至所述区块链集群以记录该文件信息和操作行为,其中,所述读取操作数据包括文件路径形成的关键字(Key),以及该文件的MD5值、用户信息、用户操作行为和时间戳形成的与所述关键字对应的值(Value)。Step 5: The cloud function server sends the read operation data to the blockchain cluster to record the file information and operation behavior, wherein the read operation data includes the keyword (Key) formed by the file path, and the file The value corresponding to the keyword formed by the MD5 value, user information, user operation behavior and timestamp.
以上步骤实现了文件的安全读取。步骤1-5旨在为了验证文件的正确性,防止文件被篡改。在一些优选地的实施方式中,在安全读取文件之后,还可以包括以下步骤。The above steps realize safe reading of the file. Steps 1-5 are designed to verify the correctness of the file and prevent the file from being tampered with. In some preferred embodiments, after the file is securely read, the following steps may also be included.
步骤6:在所述用户终端获取文件后,用户终端触发云函数服务器的用于验证操作的第三云函数以验证该文件,并且用户终端将文件路径和文件的MD5值发送给云函数服务器。Step 6: After the user terminal obtains the file, the user terminal triggers the third cloud function of the cloud function server for verification operation to verify the file, and the user terminal sends the file path and the MD5 value of the file to the cloud function server.
步骤7:云函数服务器的第三云函数触发用于校验操作的第二云函数。其中,所述第三云函数和第二云函数为lambda云函数。本步骤具体包括如下:Step 7: The third cloud function of the cloud function server triggers the second cloud function for the verification operation. Wherein, the third cloud function and the second cloud function are lambda cloud functions. This step specifically includes the following:
1)云函数服务器执行第二云函数,从对象存储器存储的对应表中,根据第三云函数的函数名查询对应的源代码的路径,再根据该源代码的路径从云端下载源代码,然后根据该源代码计算与该源代码对应的第三特征值。本步骤中,第三特征值为根据该第三云函数的源代码计算得到的MD5值。1) The cloud function server executes the second cloud function, searches the corresponding source code path according to the function name of the third cloud function from the corresponding table stored in the object storage, and then downloads the source code from the cloud according to the source code path, and then A third feature value corresponding to the source code is calculated according to the source code. In this step, the third characteristic value is an MD5 value calculated according to the source code of the third cloud function.
2)云函数服务器执行第二云函数的根据该函数名从区块链集群获取与该函数名对应的第四特征值的步骤。本步骤中,第四特征值为区块链集群存储的与该云函数应的MD5值。2) The cloud function server executes the step of acquiring the fourth feature value corresponding to the function name from the blockchain cluster according to the function name of the second cloud function. In this step, the fourth characteristic value is the MD5 value stored in the blockchain cluster and corresponding to the cloud function.
步骤8:在所述第三特征值和第四特征值相同时,确定所述第三云函数正确,即该第三云函数校验成功,执行该第三云函数,并且云函数服务器将校验结果发送给用户终端,用户终端根据该校验结果确定该文件是否正确,如果正确,用户终端可以读取该文件。Step 8: When the third eigenvalue and the fourth eigenvalue are the same, determine that the third cloud function is correct, that is, the third cloud function is successfully verified, execute the third cloud function, and the cloud function server will verify The verification result is sent to the user terminal, and the user terminal determines whether the file is correct according to the verification result, and if it is correct, the user terminal can read the file.
上述的一种基于区块链的非结构化数据操作方法和系统通过在用于数据操作的第一云函数被触发时,触发用于校验操作的第二云函数,使得第二云函数根据根据第一云函数的函数名获取的源代码计算得到的第一特征值和根据函数名从区块链集得到的第二特征值进行比对,以校验该第一云函数的函数名是否正确,从而可以确认第一云函数的可靠性,不会被非法篡改,安全可靠的运行第一云函数。The above-mentioned method and system for unstructured data operation based on blockchain triggers the second cloud function for verification operation when the first cloud function for data operation is triggered, so that the second cloud function is based on the The first eigenvalue calculated from the source code obtained according to the function name of the first cloud function is compared with the second eigenvalue obtained from the blockchain set according to the function name to verify whether the function name of the first cloud function is correct. If it is correct, the reliability of the first cloud function can be confirmed, and it will not be illegally tampered with, and the first cloud function can be run safely and reliably.
进一步,在操作(例如读取、存储或修改)非结构化数据时,对文件信息和用户的操作行为写入区块链,保证文件和对应的特征值对应管理,防止外部用户非法调用或者恶意篡改数据,保证非结构化数据的可追溯性和不可篡改性。在读取文件后,还通过对文件进行校验的第三云函数校验该文件,保证文件的可靠性,实现文件的可靠存储。Further, when operating (such as reading, storing or modifying) unstructured data, the file information and user's operation behavior are written into the blockchain to ensure the corresponding management of files and corresponding feature values, preventing external users from illegally calling or maliciously calling Tamper with data to ensure traceability and immutability of unstructured data. After the file is read, the file is also verified by a third cloud function that verifies the file, so as to ensure the reliability of the file and realize reliable storage of the file.
应该理解,本发明并不局限于上述实施方式,凡是对本发明的各种改动或变型不脱离本发明的精神和范围,倘若这些改动和变型属于本发明的权利要求和等同技术范围之内,则本发明也意味着包含这些改动和变型。It should be understood that the present invention is not limited to the above-mentioned embodiments, and any changes or modifications of the present invention do not depart from the spirit and scope of the present invention, if these changes and modifications belong to the claims of the present invention and the equivalent technical scope, then The present invention is also meant to encompass these modifications and variations.
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202010255693.4ACN111460436B (en) | 2020-04-02 | 2020-04-02 | A blockchain-based unstructured data operation method and system |
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202010255693.4ACN111460436B (en) | 2020-04-02 | 2020-04-02 | A blockchain-based unstructured data operation method and system |
| Publication Number | Publication Date |
|---|---|
| CN111460436Atrue CN111460436A (en) | 2020-07-28 |
| CN111460436B CN111460436B (en) | 2023-07-28 |
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202010255693.4AActiveCN111460436B (en) | 2020-04-02 | 2020-04-02 | A blockchain-based unstructured data operation method and system |
| Country | Link |
|---|---|
| CN (1) | CN111460436B (en) |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN111970338A (en)* | 2020-07-30 | 2020-11-20 | 腾讯科技(深圳)有限公司 | Request processing method and device based on cloud function and computer readable medium |
| CN113961977A (en)* | 2021-12-22 | 2022-01-21 | 中国电子科技集团公司第二十八研究所 | Non-centralized city information interaction system |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20160335274A1 (en)* | 2015-05-14 | 2016-11-17 | Oracle Financial Services Software Limited | Facilitating application processes defined using application objects to operate based on structured and unstructured data stores |
| CN108256353A (en)* | 2018-01-11 | 2018-07-06 | 武汉斗鱼网络科技有限公司 | A kind of data integrity verifying method, apparatus and client |
| US20190050400A1 (en)* | 2017-08-11 | 2019-02-14 | Wipro Limited | Method and system for data conversion and data model optimization |
| US20190057379A1 (en)* | 2017-08-21 | 2019-02-21 | American Express Travel Related Services Company, Inc. | Systems and methods for data file transfer balancing and control on blockchain |
| CN109491968A (en)* | 2018-11-13 | 2019-03-19 | 浙江鲸腾网络科技有限公司 | A kind of document handling method, device, equipment and computer readable storage medium |
| CN109669916A (en)* | 2018-12-21 | 2019-04-23 | 浪潮软件集团有限公司 | A kind of distributed objects storage architecture and platform based on CMSP and KUDU |
| CN109767190A (en)* | 2018-12-29 | 2019-05-17 | 中国工商银行股份有限公司 | Across mechanism workflow processing method, platform and system based on block chain |
| CN110138733A (en)* | 2019-04-03 | 2019-08-16 | 华南理工大学 | Object storage system based on block chain is credible to deposit card and access right control method |
| US20190305957A1 (en)* | 2018-04-02 | 2019-10-03 | Ca, Inc. | Execution smart contracts configured to establish trustworthiness of code before execution |
| US20190332781A1 (en)* | 2018-04-27 | 2019-10-31 | EMC IP Holding Company LLC | Serverless solution for continuous data protection |
| WO2019233614A1 (en)* | 2018-06-07 | 2019-12-12 | Coinfirm Blockchain Lab Sp. Z O.O. | A method for registration of data in a blockchain database and a method for verifying data |
| CN110851449A (en)* | 2019-11-11 | 2020-02-28 | 云南电网有限责任公司电力科学研究院 | A method and device for unstructured document management based on blockchain technology |
| WO2020056458A1 (en)* | 2018-09-18 | 2020-03-26 | Newsouth Innovations Pty Limited | A block chain-based system for multi-party, multistage process verification |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US20160335274A1 (en)* | 2015-05-14 | 2016-11-17 | Oracle Financial Services Software Limited | Facilitating application processes defined using application objects to operate based on structured and unstructured data stores |
| US20190050400A1 (en)* | 2017-08-11 | 2019-02-14 | Wipro Limited | Method and system for data conversion and data model optimization |
| US20190057379A1 (en)* | 2017-08-21 | 2019-02-21 | American Express Travel Related Services Company, Inc. | Systems and methods for data file transfer balancing and control on blockchain |
| CN108256353A (en)* | 2018-01-11 | 2018-07-06 | 武汉斗鱼网络科技有限公司 | A kind of data integrity verifying method, apparatus and client |
| US20190305957A1 (en)* | 2018-04-02 | 2019-10-03 | Ca, Inc. | Execution smart contracts configured to establish trustworthiness of code before execution |
| US20190332781A1 (en)* | 2018-04-27 | 2019-10-31 | EMC IP Holding Company LLC | Serverless solution for continuous data protection |
| WO2019233614A1 (en)* | 2018-06-07 | 2019-12-12 | Coinfirm Blockchain Lab Sp. Z O.O. | A method for registration of data in a blockchain database and a method for verifying data |
| WO2020056458A1 (en)* | 2018-09-18 | 2020-03-26 | Newsouth Innovations Pty Limited | A block chain-based system for multi-party, multistage process verification |
| US20210288814A1 (en)* | 2018-09-18 | 2021-09-16 | Newsouth Innovations Pty Limited | A block chain-based system for multi-party, multistage process verification |
| CN109491968A (en)* | 2018-11-13 | 2019-03-19 | 浙江鲸腾网络科技有限公司 | A kind of document handling method, device, equipment and computer readable storage medium |
| CN109669916A (en)* | 2018-12-21 | 2019-04-23 | 浪潮软件集团有限公司 | A kind of distributed objects storage architecture and platform based on CMSP and KUDU |
| CN109767190A (en)* | 2018-12-29 | 2019-05-17 | 中国工商银行股份有限公司 | Across mechanism workflow processing method, platform and system based on block chain |
| CN110138733A (en)* | 2019-04-03 | 2019-08-16 | 华南理工大学 | Object storage system based on block chain is credible to deposit card and access right control method |
| CN110851449A (en)* | 2019-11-11 | 2020-02-28 | 云南电网有限责任公司电力科学研究院 | A method and device for unstructured document management based on blockchain technology |
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN111970338A (en)* | 2020-07-30 | 2020-11-20 | 腾讯科技(深圳)有限公司 | Request processing method and device based on cloud function and computer readable medium |
| CN113961977A (en)* | 2021-12-22 | 2022-01-21 | 中国电子科技集团公司第二十八研究所 | Non-centralized city information interaction system |
| Publication number | Publication date |
|---|---|
| CN111460436B (en) | 2023-07-28 |
| Publication | Publication Date | Title |
|---|---|---|
| EP3776208B1 (en) | Runtime self-correction for blockchain ledgers | |
| JP7710448B2 (en) | Partially Ordered Blockchain | |
| US11151236B2 (en) | File verification database system | |
| CN101809566B (en) | Efficient file hash identifier computation | |
| US11139960B2 (en) | File redaction database system | |
| US10862672B2 (en) | Witness blocks in blockchain applications | |
| US11025430B2 (en) | File provenance database system | |
| CN101308471B (en) | Method and device for data restoration | |
| CN107832062A (en) | A kind of method for updating program and terminal device | |
| CN114564757A (en) | Data auditing method, device and equipment of block chain and readable storage medium | |
| US20200021602A1 (en) | Trace-based transaction validation and commitment | |
| US20230281321A1 (en) | Secure application development using distributed ledgers | |
| CN111460436B (en) | A blockchain-based unstructured data operation method and system | |
| WO2024183280A1 (en) | Blockchain consensus method and apparatus, and computer device, medium and product | |
| CN112713996B (en) | Block chain-based fault verification method, server and terminal | |
| CN106203179A (en) | A kind of completeness check system and method to file | |
| CN111291001B (en) | Computer file reading method, device, computer system and storage medium | |
| US12418427B2 (en) | Systems and methods for dynamic asset tokens on a distributed ledger | |
| CN114201370B (en) | Webpage file monitoring method and system | |
| CN115935414A (en) | Block chain based data verification method and device, electronic equipment and storage medium | |
| US12314244B1 (en) | Systems and methods for blockchain-based cloud storage document integrity | |
| CN115828237A (en) | Software package security checking method, device and system | |
| CN114925227A (en) | Repetitive picture detection method based on Git Hooks and related equipment | |
| CN118740828A (en) | A file integrity and file duplication processing method, system, device and medium | |
| CN114611113A (en) | Vulnerability repairing method and device, computer equipment and storage medium |
| Date | Code | Title | Description |
|---|---|---|---|
| PB01 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| GR01 | Patent grant | ||
| GR01 | Patent grant | ||
| CP03 | Change of name, title or address | Address after:510000 Guangdong Province Guangzhou City Tianhe District Sicheng Road No. 45 Patentee after:GUANGZHOU BINGO SOFTWARE CO.,LTD. Country or region after:China Address before:510000 building G1, No. 17, software Road, Guangzhou, Guangdong, Tianhe District Patentee before:GUANGZHOU BINGO SOFTWARE CO.,LTD. Country or region before:China | |
| CP03 | Change of name, title or address |