A Decentralized Data Trading Method and System Based on Ethereum and IPFS
Through the decentralized data trading methods of Ethereum and IPFS, the problems of difficulty in confirming rights, poor security, and easy collapse of centralized servers in data trading are solved, and the security, transparency and traceability of data trading are achieved.
Patent Information
- Application Number
- CN202211097923.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-08
- Publication Date
- 2025-07-04
- Estimated Expiration
- 2042-09-08
AI Technical Summary
There are problems in data transactions where data rights confirmation is difficult, poor security is poor, centralized servers are prone to crashes, and data transaction information traceability is difficult.
The decentralized data transaction method based on Ethereum and IPFS is adopted to ensure the security and traceability of data transactions through data encryption, distributed storage, smart contract control and similar data comparison.
It has achieved data rights confirmation, security guarantee and simplification of transaction processes, prevent data tampering and loss, and ensure that the transaction process is transparent and open.
Smart Images

Figure CN116012151B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of blockchain technology, and particularly to a decentralized data trading method and system based on Ethereum and IPFS. Background Art
[0002] The big data era has arrived, and the total amount of data in the world has increased exponentially. In recent years, with the development of Internet of Things devices and mobile intelligent devices, due to their small size, easy to carry and other characteristics, they are widely used and well received.
[0003] Driven by national policies and with the gradual maturity of machine learning, deep learning, neural networks and data mining technologies, the role of data in these technologies has become increasingly obvious, and data trading has gradually developed. However, there are many problems in actual data trading. Data trading is different from traditional commodity trading. Due to the low replication cost, it is difficult to confirm the right of data; data has a fast growth rate and its value is difficult to estimate; data security is difficult to guarantee; once the central server crashes or the data center is damaged due to other irresistible factors, the data and data trading information will no longer exist; the central server is also faced with the risk of hacker attacks, and the traceability of data trading information is particularly important.
[0004] Blockchain technology is a distributed database. Based on blockchain technology, it is possible to achieve traceable and unmodifiable data trading information; data encryption; intelligent contract control; distributed storage. It can well handle the problems that occur in the above data trading process. Summary of the Invention
[0005] The purpose of the present invention is to provide a decentralized data trading method and system based on Ethereum and IPFS that simplifies the trading process.
[0006] To solve the above technical problems, the present invention provides a decentralized data trading method based on Ethereum and IPFS, including the following steps:
[0007] Seller S uploads data to the data trading platform DTP;
[0008] The data trading platform DTP encrypts the uploaded data to obtain encrypted data, and sends the encrypted data to the InterPlanetary File System IPFS for storage;
[0009] Buyer B sends a trading request to the data trading platform DTP;
[0010] The data trading platform DTP calls the transfer method of the intelligent contract according to the trading request, and sends the transfer method to Buyer B;
[0011] Buyer B completes the payment according to the transfer method and updates the authorization list in the intelligent contract;
[0012] Buyer B sends a download data request to the Data Trading Platform DTP;
[0013] The Data Trading Platform DTP performs authorization verification based on the download data request and the authorization list in the smart contract. After successful verification, the Data Trading Platform DTP downloads the corresponding encrypted data from the InterPlanetary File System IPFS, decrypts the encrypted data, and sends it to Buyer B.
[0014] Preferably, the Data Trading Platform DTP encrypts the uploaded data to obtain encrypted data, which specifically includes the following steps:
[0015] The Data Trading Platform DTP calculates the Hamming distance between the uploaded data and the historical uploaded data to determine whether the uploaded data is successfully rights-confirmed;
[0016] If the rights confirmation is successful, the uploaded data is encrypted to obtain encrypted data.
[0017] Preferably, the Data Trading Platform DTP calculates the Hamming distance between the uploaded data and the historical uploaded data to determine whether the uploaded data is successfully rights-confirmed, which specifically includes the following steps:
[0018] Search for the keywords of the uploaded data in the historical database;
[0019] If similar historical uploaded data is found, calculate the hash values of the uploaded data and the similar historical uploaded data, and then calculate the Hamming distance; if the Hamming distance is less than the threshold, the rights confirmation is successful;
[0020] If no similar historical uploaded data is found, the rights confirmation is successful.
[0021] Preferably, the uploaded data and the historical uploaded data are segmented, hashed, weighted, merged, and dimension-reduced to obtain the simhash value.
[0022] Preferably, the data encryption uses a hybrid encryption of ECC and AES.
[0023] Preferably, the data encryption specifically includes the following steps:
[0024] Generate a public key PK through the AES algorithm. Use the uploaded data as the data plaintext, and encrypt the data plaintext through the public key PK and the elliptic curve algorithm ECC to generate the data ciphertext DCT;
[0025] Generate a data check value CK for the data ciphertext DCT through the MD5 hash algorithm, and then store the data ciphertext DCT as the encrypted data.
[0026] Preferably, the data decryption specifically includes the following steps:
[0027] The data ciphertext DCT is verified through the MD5 hashing algorithm and compared with the data verification value CK; if the comparison is consistent, the data ciphertext DCT is decrypted through the public key PK and the elliptic curve algorithm ECC to generate the data plaintext.
[0028] The present invention also provides a decentralized data trading system based on Ethereum and IPFS, including:
[0029] A deployment module for deploying a smart contract on a public chain, where the smart contract includes a transfer method and an authorization list;
[0030] An upload module for the seller S to upload data to the data trading platform DTP;
[0031] An encryption storage module for the data trading platform DTP to encrypt the uploaded data to obtain encrypted data and send the encrypted data to the InterPlanetary File System IPFS for storage;
[0032] A request module for the buyer B to send a transaction request to the data trading platform DTP;
[0033] A transfer module for the data trading platform DTP to call the transfer method of the smart contract according to the transaction request and send the transfer method to the buyer B;
[0034] An update module for the buyer B to complete the payment according to the transfer method and update the authorization list in the smart contract;
[0035] A transaction module for the buyer B to send a download data request to the data trading platform DTP;
[0036] A download module, where the data trading platform DTP performs authorization verification according to the download data request and the authorization list in the smart contract. After the verification passes, the data trading platform DTP downloads the corresponding encrypted data from the InterPlanetary File System IPFS, decrypts the encrypted data, and sends it to the buyer B.
[0037] Compared with the prior art, the beneficial effects of the present invention are:
[0038] The present invention establishes a decentralized trading system through blockchain, performs comparison of similar data before the trading process, and the data trading information is traceable and non-tamperable during the trading process, so as to determine the data ownership issue; uses encryption algorithms to encrypt data to ensure data security; controls the data trading process through smart contracts to prevent the buyer and seller from reneging; and distributed storage can prevent single-point failures of servers.
[0039] Specifically, there are the following advantages:
[0040] Data right confirmation: Through natural language processing (NLP) technology, similarity calculation and comparison of texts are carried out for data right confirmation to prevent others from trading the data again;
[0041] Data security: Statistical ECC and AES hybrid encryption ensures data security, and MD5 verification ensures data authenticity. Distributed storage can prevent single-point server failures, ensure data immutability, and prevent data loss.
[0042] Simplifying the trading process: Applying blockchain technology to simplify the trading process, removing human factors, and ensuring the integrity of the process: Controlling the data trading process through smart contracts. Ensuring the transparency of the data trading process: The consensus mechanism can ensure reasonable permissions for data owners and data users. Description of the Drawings
[0043] The following further elaborates on the specific implementation manners of the present invention in conjunction with the drawings.
[0044] Figure 1 is a schematic flowchart of a decentralized data trading method based on Ethereum and IPFS of the present invention;
[0045] Figure 2 is a schematic diagram of the data trading process;
[0046] Figure 3 is a flowchart of similarity calculation;
[0047] Figure 4 is a structure diagram of the trading entity;
[0048] Figure 5 is a flowchart of data encryption and decryption;
[0049] Figure 6 is a schematic diagram of the data delivery process;
[0050] Figure 7 is an architecture diagram of the data trading platform DTP. Specific Embodiment
[0051] Many specific details are set forth in the following description in order to provide a thorough understanding of the present invention. However, the present invention can be implemented in many other ways different from those described herein, and those skilled in the art can make similar extensions without departing from the connotation of the present invention. Therefore, the present invention is not limited by the specific embodiments disclosed below.
[0052] The terms used in one or more embodiments of this specification are for the purpose of describing specific embodiments only and are not intended to limit one or more embodiments of this specification. The singular forms "a", "the", and "said" used in one or more embodiments of this specification and the appended claims are also intended to include the plural forms unless the context clearly dictates otherwise. It should also be understood that the term "and / or" used in one or more embodiments of this specification refers to and encompasses any and all possible combinations of one or more of the associated listed items.
[0053] It should be understood that although the terms first, second, etc. may be used in one or more embodiments of this specification to describe various information, such information should not be limited to these terms. These terms are only used to distinguish information of the same type from each other. For example, without departing from the scope of one or more embodiments of this specification, the first may also be referred to as the second, and similarly, the second may also be referred to as the first. Depending on the context, the word "if" as used herein may be interpreted as "when" or "while" or "in response to determining".
[0054] The following combines the appended Figures 1-7 to further describe the present invention in detail:
[0055] The present invention provides a decentralized data trading method based on Ethereum and IPFS. As Figure 1 shown, it includes the following steps:
[0056] S1. Smart contract deployment: Deploy the smart contract to the public blockchain;
[0057] The smart contract includes: a transaction body TB, as well as related data acquisition methods, ETH transfer algorithms, updated authorization list algorithms, and algorithms for downloading InterPlanetary File System (IPFS) data.
[0058] S2. The seller S uploads data and encrypts the uploaded data;
[0059] The seller S uploads data on the data trading platform DTP. The data trading platform DTP identifies similar data according to the Hamming distance and calculates the Hamming distance between the uploaded data and the historical uploaded data. If the Hamming distance between the uploaded data and the historical uploaded data reaches the threshold, data encryption is performed to obtain encrypted data;
[0060] The data encryption uses a hybrid encryption of ECC and AES and performs data verification through MD5.
[0061] S3. The data trading platform DTP calls the smart contract to upload the encrypted data to Ethereum;
[0062] S4. Data storage: Ethereum stores the encrypted data in the InterPlanetary File System IPFS;
[0063] S5. Return CID: After the encrypted data is stored in the InterPlanetary File System IPFS, a corresponding return content identifier CID is generated. The return content identifier CID is sent to the data trading platform DTP through Ethereum;
[0064] S6. Return for rights confirmation: When the data trading platform DTP receives the return content identifier CID, it adds the user ID of the seller S who uploaded the dataset to the user ID array in the transaction body TB according to the content identifier CID, completing the data rights confirmation.
[0065] S7. The seller S initiates a request to sell resources, and the corresponding stored data in the InterPlanetary File System IPFS will be displayed on the data trading platform DTP.
[0066] S8. When the buyer B sees the data they need on the data trading platform DTP, they initiate a transaction request to the data trading platform DTP.
[0067] S9. The data trading platform DTP returns the corresponding transfer method to the buyer B according to the transaction request; the buyer B makes a payment according to the transfer method and calls the smart contract transfer request.
[0068] S10. The seller S's account receives the payment.
[0069] S11. Update the authorization list and return the user ID of the purchased data:
[0070] Both the buyer B's payment and the seller S's account receiving the payment are completed through smart contract transfers. After the transfer is completed, the authorization list is updated, and the user ID of the purchased data is added to the user ID.
[0071] S12. Download data request: After the buyer B completes the payment, they can download the data. Through the data trading platform DTP, fill in the ID of the data they want to download, and after clicking download, the data trading platform DTP will call the smart contract to obtain the data method of the InterPlanetary File System IPFS. First, it will verify the users in the authorization list to check whether the user has purchased the data. If the user ID exists in the authorization list, the data will be downloaded.
[0072] S13. Return the data: The buyer B downloads the corresponding data from the InterPlanetary File System IPFS.
[0073] In this embodiment, data trading means that the buyer (Buyer, B) searches for corresponding data sets on the data trading platform DTP according to his own needs. The buyer and seller make trading judgments based on the existing information, and finally realize the data flow from the seller (Seller, S) to the buyer B. First, the seller S sends a data upload request to the data trading platform DTP. After receiving the request, the data trading platform DTP conducts data right confirmation. After the data right confirmation is completed, the data is encrypted and uploaded, where the key information of the data is stored in Ethereum, and the data set is stored in the InterPlanetary File System IPFS. After the buyer B searches for the corresponding data set, a trading request is sent to the data trading platform DTP. The seller S responds to the trading request, and then completes the data transaction on the data trading platform DTP. Finally, data delivery is performed on the data trading platform DTP, and the buyer B receives the data set, as Figure 2 shown. The key operations involved in this process are: data right confirmation, data encryption and upload, data trading, and data delivery.
[0074] The data trading process mainly includes the following parts:
[0075] The first part, data right confirmation:
[0076] Through Natural Language Processing (NLP) technology, similarity calculation and comparison of texts are carried out. This is to prevent users from simply modifying the data and uploading it back to the system. Search for the keywords of the digital commodity information data of the uploaded data in the historical database. If similar data is found, calculate the hash values of the two data; if not, no comparison is made. The main six steps are: word segmentation, hash calculation, weighting, merging, dimensionality reduction, and calculating the Hamming distance. As Figure 3 shown.
[0077] Specifically, it includes the following steps:
[0078] 1.1. Word segmentation: HanLP is used in this embodiment. To reduce the influence of irrelevant words (noise reduction), punctuation and other symbols can be filtered out, and stop words can be removed, leaving only meaningful words.
[0079] 1.2. Hash calculation: The Simhash algorithm is used for data dimensionality reduction. The Simhash algorithm is an algorithm for reducing dimensions, which represents high-dimensional vectors with lower-dimensional signatures. It should be noted that it returns a Long type. If it is less than 64 bits after being converted to binary representation, it needs to be padded to 64 bits, and 0s are padded at the high position.
[0080] 1.3. Weighting: Word frequency is one of the common methods to measure a word in a sentence. In this article, word frequency is used as the weight of the word.
[0081] 1.4. Merging: Sum the weighted hash values calculated for each word bit by bit.
[0082] 1.5. Dimensionality reduction: Perform dimensionality reduction on the summed data. That is, for each bit, if the bit is greater than 0, it becomes 1, and if it is less than 0, it becomes 0, resulting in a binary number (or string), which is the final simhash value.
[0083] 1.6. Calculating the Hamming distance: Calculate the Hamming distance between the two simhash values obtained in the above steps. That is, count the number of different corresponding bits (the number of 1s after XOR) in the two 64-bit binary numbers to finally obtain the Hamming distance. If the Hamming distance is less than the threshold, then subsequently add the user ID of seller S to the transaction body TB to complete the confirmation of rights.
[0084] The present invention uses a similar statement comparison simulation system to implement similar text recognition, as Figure 3 shown.
[0085] Second part: Data encryption and upload;
[0086] The process of data encryption and upload is divided into three steps. First, the first step is data encapsulation based on the transaction body (Transaction Body, TB). The second step is data encryption. After using a hybrid encryption mechanism of ECC and AES, generate a check code for the encrypted data. The third step is to call the Interplanetary File System (IPFS) IPFS interface for data upload;
[0087] Data encryption and upload includes the following steps:
[0088] First step: Data encapsulation based on the transaction body:
[0089] The transaction body TB is an abstraction of the data transaction information throughout the data transaction process. It is a data structure composed of attributes (Attributes, AS) and tools (Tools, TS);
[0090] The attributes AS include:
[0091] Transaction body ID (Data ID, DID): A characteristic code that uniquely identifies the transaction body TB.
[0092] User ID (User ID, UID): Uniquely binds the transaction body TB to the user. The first user in the user ID is the data right confirmation user (Power User, PU), and other users are data authorized users (Authorized user, AU). The first one in the user ID array in the transaction body TB is the data owner.
[0093] Feature data (FD): Users search for data through feature descriptions, which require a significant transaction data.
[0094] Data type (Type of data, DT): The purpose of this data attribute is to indicate the nature and scope of the data to facilitate future data retrieval. This attribute is a reserved attribute for subsequent development and use.
[0095] Authorization list: The authorization list is represented in the form of a string array. The first position of the array stores the user ID of the seller S, and the second to the Nth position stores the user ID of the buyer B. If the user purchases the data, the user ID of the purchased data is stored in the authorization list. In the later data download process, the authorization list will play a verification function. In the process of data delivery, the "Get IPFS Data Method" in the transaction body is called. This method will first perform authorization list user verification to check whether the user has purchased the data. If the user ID exists, proceed to the next step.
[0096] Check value CK: The check value is generated by checking the data through the MD5 algorithm. Usage: (1) When the seller S uploads data, the data ciphertext is checked and the generated check value is stored in the transaction body. (2) When the buyer B downloads data and calls the smart contract, the data ciphertext is independently checked and the check result is sent to the user.
[0097] Tools TS includes:
[0098] Update data authorization list method; Get attribute method: Get attribute value method in attribute (AS); Set attribute method: Set attribute value in attribute (AS); Get IPFS data method; IPFS data verification method, transfer method, such as Figure 4 shown.
[0099] Step 2: Data encryption and decryption process:
[0100] The present invention adopts Java language to realize ECC and AES hybrid encryption. The ECC encryption algorithm has the advantages of simple key distribution and management, high security strength, etc., and the AES encryption algorithm has the advantages of fast speed, high strength, and easy implementation. The ECC elliptic curve algorithm encrypts and manages the AES public key, and AES is mainly used to encrypt encapsulated data. By integrating the advantages of the AES encryption algorithm and the ECC encryption algorithm, the advantages of fast encryption speed and safe and convenient key management are achieved, and the problem that speed and security cannot be taken into account in the cryptographic system is effectively solved. JDK comes with elliptic curve signatures, but does not implement elliptic curve encryption and decryption. The encryption and decryption of elliptic curves are realized by introducing the bouncycastle library.
[0101] The trading system combines blockchain and the InterPlanetary File System (IPFS), as Figure 5 shown, and specifically includes the following steps:
[0102] 2.2.1. First, the user uploads data.
[0103] 2.2.2. All data is encrypted using an asymmetric encryption method to obtain encrypted data.
[0104] 2.2.3. The encrypted data is hashed to obtain a hash value and uploaded to Ethereum.
[0105] 2.2.4. The encrypted data is uploaded to the InterPlanetary File System (IPFS).
[0106] The data is uploaded, and the process enters the data encryption process, which is completed by steps T1 and T2.
[0107] T1: First, a public key PK is generated through the AES algorithm. The data plaintext (DPT) of the uploaded data is encrypted using the public key PK and the Elliptic Curve Cryptography (ECC) algorithm to generate a data cipher text (DCT).
[0108] T2: The data cipher text DCT is verified through the MD5 hashing algorithm to generate a check value (CK). Then, the data cipher text DCT is uploaded to the InterPlanetary File System (IPFS) through Ethereum.
[0109] After the data transaction is completed, the public key PK and the check value CK are obtained, and the authorization list (AL) is updated. The process enters the data encryption process, which is completed by steps T3 and T4.
[0110] T3: First, the data cipher text DCT is verified through the MD5 hashing algorithm and compared with the check value CK. If they are consistent, it indicates that the data cipher text DCT has not been modified.
[0111] T4: The data cipher text DCT is decrypted using the public key PK and the Elliptic Curve Cryptography (ECC) algorithm to generate the data plaintext (DPT).
[0112] Third step: Data upload:
[0113] The developed data trading platform (DTP) is implemented in the Windows system. Data upload means uploading the dataset file stored locally to the data trading platform DTP.
[0114] Third part: Data trading:
[0115] Price is the basic mechanism of the market mechanism. Price refers to the formation of market price in the process of competition, which is interconnected and restricted by the market price and the supply-demand relationship. Price is the interaction between price fluctuations and supply-demand fluctuations in the market competition process. Price is the most sensitive and effective regulation in the market mechanism.
[0116] Data transactions adopt a bargaining mechanism to form an equilibrium price, so as to achieve supply-demand equilibrium in the data trading market. The supply-demand relationship is reflected in the price, and resources are allocated through the market price. The supply-demand relationship determines the market equilibrium price. When supply exceeds demand, the price drops; when demand exceeds supply, the price rises. At the same time, the price will in turn affect the supply-demand relationship. If the price is higher than the equilibrium price for a long time, the supply will surely exceed the demand, and then the price will fall; if the price is lower than the equilibrium price for a long time, the supply cannot meet the demand, and then the price will surely rise.
[0117] The buyer and seller are not restricted by the platform or other third parties and freely complete data transactions on the data trading platform DTP.
[0118] Part Four, Data Delivery:
[0119] The buyer B initiates a payment request to the data trading platform DTP, and the data trading platform DTP calls the updated authorization list in the smart contract; the seller S will send the data key to the buyer B; then the buyer B initiates a data download request on the data trading platform DTP, fills in the ID of the data to be downloaded, and clicks download. After that, the data trading platform DTP will call the smart contract and call the "Get IPFS Data Method" through the tool TS in the transaction body TB. This method will first perform authorization list user verification to check whether the user has purchased the data. If the user ID exists, the data will be downloaded. The buyer B obtains the data set, and then initiates a data verification request to the data trading platform DTP, and performs ipfs data verification by sending the MD5 code issued by the buyer B, as Figure 6 shown.
[0120] The data trading system based on Ethereum established by the present invention can achieve:
[0121] Data right confirmation: Through natural language processing NLP technology, similarity calculation and comparison of texts are carried out for data right confirmation to prevent others from trading the data again.
[0122] Data security: The combination of ECC and AES encryption is used for statistical data security, and MD5 verification is used to ensure data authenticity. Distributed storage can prevent single-point server failures, ensure data immutability, and prevent data loss.
[0123] Simplify the transaction process: Apply blockchain technology to simplify the transaction process, remove human factors, and ensure the integrity of the process: Control the data transaction process through smart contracts. Ensure the openness and transparency of the data transaction process: The consensus mechanism can ensure the reasonable permissions of data owners and data users.
[0124] In this embodiment, from the perspective of the technical architecture of the data trading platform DTP based on Ethereum, it can be divided into three parts: the client front-end, the back-end, and the database. As Figure 7 shown;
[0125] The client front-end uses Java Swing. Java Swing is a graphical user interface (GUI) toolkit designed for Java and is part of the JAVA Foundation Classes. Java Swing includes GUI components such as text boxes, buttons, split panes, and tables. It is implemented in Java and can run across platforms. It supports replaceable panels and themes, and the default unique themes of various operating systems can be used with any panel supported by JAVA on any platform. The disadvantage of lightweight components is that the execution speed is slower, and the advantage is that the same behavior can be adopted on all platforms.
[0126] The back-end uses the Maven project management tool for project construction. Maven is a project object model that can manage projects through a small piece of descriptive information. It includes a project object model, a set of standard collections, a project life cycle, a dependency management system, and the logic to run the plugin goals defined in the life cycle phases. In Maven, the InterPlanetary File System IPFS is added for distributed data storage, web3j is used for blockchain development and smart contract calls, and freetree is used for direct drawing of graphics.
[0127] The database uses a distributed database, combining the InterPlanetary File System IPFS and the blockchain.
[0128] In the data transaction process of the present invention, the entity participants include the buyer B and the seller S. The data trading platform DTP serves as a tool to facilitate the data transaction operations between the buyer and the seller and is responsible for calling smart contracts to complete data storage. The buyer uploads data, and the buyer B initiates a data transaction after viewing the data they need. Storage system: Adopt a distributed file storage system of Ethereum plus the InterPlanetary File System IPFS to ensure data security. The specific process is as Figure 4 shown.
[0129] The present invention also provides a decentralized data trading system based on Ethereum and IPFS, including:
[0130] A deployment module for deploying a smart contract on a public blockchain, where the smart contract includes a transfer method and an authorization list;
[0131] An upload module for the seller S to upload data to the Data Trading Platform DTP;
[0132] A contract module for the Data Trading Platform DTP to obtain a transaction body TB based on the uploaded data and send it to the transaction body TB of the smart contract; and also for the Data Trading Platform DTP to obtain the corresponding transaction body TB from the smart contract according to a transaction request;
[0133] An encryption storage module for the Data Trading Platform DTP to encrypt the uploaded data to obtain encrypted data for storage;
[0134] A request module for the buyer B to send a transaction request to the Data Trading Platform DTP;
[0135] A transaction module for the Data Trading Platform DTP to send the transaction body TB to the buyer B. After the buyer B completes according to the transaction body TB, the Data Trading Platform DTP decrypts the encrypted data and sends it to the buyer B.
[0136] In several embodiments provided by the present invention, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of the modules, units or components is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units, modules or components can be combined or integrated into another device, or some features can be ignored or not executed.
[0137] The unit may or may not be physically separated. The components shown as units can be a physical unit or multiple physical units, that is, they can be located in one place, or they can be distributed to multiple different places. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0138] In addition, the functional units in each embodiment of the present invention can be integrated in a processing unit, or each unit can exist physically alone, or two or more units can be integrated in one unit. The above integrated units can be implemented in the form of hardware or in the form of software functional units.
[0139] In particular, according to the embodiments disclosed in the present invention, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, an embodiment of the present disclosure includes a computer program product that includes a computer program carried on a computer-readable medium, and the computer program includes program code for performing the methods shown in the flowcharts. In such an embodiment, the computer program can be downloaded and installed from a network through a communication part, and / or installed from a removable medium. When the computer program is executed by a central processing unit (CPU), the above-described functions defined in the methods of the present invention are performed. It should be noted that the above-mentioned computer-readable medium of the present invention can be a computer-readable signal medium or a computer-readable storage medium or any combination of the two. The computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the above.
[0140] The flowcharts and block diagrams in the accompanying drawings illustrate the possible architectures, functions, and operations of systems, methods, and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagram may represent a module, a program segment, or a part of code that contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the blocks may occur in a different order than that marked in the accompanying drawings. For example, two consecutive blocks shown may actually be executed substantially in parallel, and they may sometimes be executed in the reverse order, depending on the functions involved. It should also be noted that each block in the block diagram and / or flowchart, and the combination of blocks in the block diagram and / or flowchart, can be implemented by a dedicated hardware-based system for performing the specified functions or operations, or can be implemented by a combination of dedicated hardware and computer instructions.
[0141] As described above, the above are only specific embodiments of the present invention, but the protection scope of the present invention is not limited thereto. Any changes or substitutions within the technical scope disclosed in the present invention should be covered by the protection scope of the present invention. Therefore, the protection scope of the present invention should be subject to the protection scope of the claims.
Claims
1. A decentralized data trading method based on Ethereum and IPFS, characterized in that, It includes the following steps: Deploy a smart contract on the public blockchain. The smart contract includes a transfer method and an authorization list; The seller S uploads data to the data trading platform DTP; Search for keywords of the uploaded data in the historical database; If similar historical uploaded data is found, calculate the Hamming distance after calculating the hash values of the uploaded data and the similar historical uploaded data. If the Hamming distance is less than the threshold, the confirmation of rights is successful; If the confirmation of rights is successful, generate a public key PK through the AES algorithm. Take the uploaded data as the data plaintext, and encrypt the data plaintext through the public key PK and the elliptic curve algorithm ECC to generate a data ciphertext DCT. Generate a data verification value CK through the MD5 hash algorithm for the data ciphertext DCT for data verification, and then take the data ciphertext DCT as the encrypted data; Send the encrypted data to the InterPlanetary File System IPFS for storage; The buyer B sends a transaction request to the data trading platform DTP; The data trading platform DTP calls the transfer method in the smart contract according to the transaction request and sends the transfer method to the buyer B; The buyer B makes a payment according to the transfer method. After the payment is completed, update the authorization list in the smart contract; The buyer B sends a download data request to the data trading platform DTP; The data trading platform DTP performs authorization verification according to the download data request and the authorization list in the smart contract. After the verification is passed, the data trading platform DTP downloads the corresponding encrypted data from the InterPlanetary File System IPFS, decrypts the encrypted data, and sends it to the buyer B.
2. The decentralized data trading method based on Ethereum and IPFS according to claim 1, characterized in that: The uploaded data and the historical uploaded data are segmented, hashed, weighted, merged, and dimension-reduced to obtain a simhash value.
3. A decentralized data trading method based on Ethereum and IPFS according to claim 1, characterized in that, The data decryption specifically includes the following steps: Perform data verification on the data ciphertext DCT through the MD5 hash algorithm and compare it with the data verification value CK. If the comparison is consistent, decrypt the data ciphertext DCT through the public key PK and the elliptic curve algorithm ECC to generate the data plaintext.
4. A decentralized data trading system based on Ethereum and IPFS for implementing the decentralized data trading method based on Ethereum and IPFS according to any one of claims 1-3, characterized in that, It includes: A deployment module for deploying a smart contract on the public blockchain. The smart contract includes a transfer method and an authorization list; An upload module for the seller S to upload data to the data trading platform DTP; An encryption storage module for the data trading platform DTP to encrypt the uploaded data to obtain encrypted data and send the encrypted data to the InterPlanetary File System IPFS for storage; A request module for the buyer B to send a transaction request to the data trading platform DTP; A transfer module for the data trading platform DTP to call the transfer method in the smart contract according to the transaction request and send the transfer method to the buyer B; An update module for the buyer B to complete the payment according to the transfer method and update the authorization list in the smart contract; A transaction module for the buyer B to send a download data request to the data trading platform DTP; Download module. The data trading platform DTP performs authorization verification based on the download data request and the authorization list in the smart contract. After successful verification, the data trading platform DTP downloads the corresponding encrypted data from the InterPlanetary File System (IPFS), decrypts the encrypted data, and sends it to the buyer B.