Web3.0 online transaction method based on zk-SNARKs
The Web3.0 online transaction method using zk-SNARKs and smart contracts addresses malicious shopping and opaque prices by verifying unique user identities and encrypting data, improving security and transparency in online transactions.
Patent Information
- Application Number
- CN202411250085.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-06
- Publication Date
- 2025-01-03
AI Technical Summary
Existing online trading platforms face challenges such as malicious shopping and opaque prices, particularly in Web3.0 environments, where users can use multiple accounts to make purchases, compromising security and transparency.
A Web3.0 online transaction method based on zk-SNARKs, utilizing zero-knowledge proof technology to verify user identities and smart contracts to ensure each user uses a unique account, combined with data encryption and attribute-based encryption to protect privacy and secure transactions.
This method effectively prevents malicious shopping while maintaining user privacy, enhancing transaction security, efficiency, and transparency by ensuring each user has a unique account and protecting personal information.
Smart Images

Figure CN119250924A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of network security technology, and in particular to a Web3.0 online transaction method based on zk-SNARKs. Background Art
[0002] In modern society, online transactions are an indispensable part of people's daily lives, involving transportation, entertainment, tourism and other aspects. However, with the development of technology and the growth of user demand, the field of online transactions faces a series of challenges, such as the shortage of goods, personal privacy protection and price opacity. The emergence of these problems has prompted people to seek more efficient, secure and transparent online transaction solutions. Web3.0, as a new generation of Internet architecture, builds a decentralized network environment based on blockchain technology and the achievements of Web2.0. The emergence of this technology provides new possibilities for solving problems in the field of online transactions. Under the framework of Web3.0, the application of blockchain technology has penetrated into many fields such as games, medical care, file storage, etc., showing its unique advantages. Web3.0 online transactions have won wide attention and application with its decentralization and transparency, but they also face some challenges, especially in preventing users from using multiple accounts to maliciously purchase goods, and the existing online trading platforms have problems such as malicious shopping and price opacity. Summary of the invention
[0003] Aiming at the problems of malicious shopping and opaque prices existing in existing online trading platforms, the present invention proposes a Web3.0 online trading method based on zk-SNARKs, which adopts a zero-knowledge proof technology called zk-SNARKs. zk-SNARKs is a concise non-interactive zero-knowledge proof technology that allows the prover to prove to the verifier that a statement is correct without revealing any useful information. In Web3.0 online transactions, this technology can be used to verify the true identity behind the account, ensuring that each user can only use one account to purchase goods, thereby effectively preventing malicious shopping behavior. By introducing zk-SNARKs, it is possible to determine whether multiple accounts are controlled by the same person without infringing user privacy. In this way, not only the fairness of online transactions is guaranteed, but also the security and transparency of transactions are maintained. By introducing Web3.0 and zk-SNARKs technology, the online transactions involved can effectively solve the problems of purchasing goods with multiple accounts while protecting user privacy, further improving the security and efficiency of online transactions.
[0004] In order to achieve the above object, the present invention adopts the following technical solutions:
[0005] A Web3.0 online transaction method based on zk-SNARKs, the method is based on the Web3.0 framework, including:
[0006] Step 1: The user enters identity information, uploads an attribute set to obtain his or her attribute-based encryption key, and generates corresponding zero-knowledge proof information based on the identity information;
[0007] Step 2: Obtain product information and deploy smart contracts based on the product information;
[0008] Step 3: The user selects the product he needs based on the uploaded product information on the client and verifies whether the product can be purchased based on his own zero-knowledge proof information during the purchase process;
[0009] Step 4: The server distributes the goods purchased by the client to the corresponding users according to the transaction situation;
[0010] Step 5: After the transaction information is uploaded to the blockchain, data encryption and privacy protection solutions are implemented.
[0011] Furthermore, the step 1 comprises:
[0012] Step 1.1: The user enters his / her identity information on the client to create an account. At the same time, the user uploads his / her attribute set to the notary center. The notary center uses key generation technology to generate a key for the user and distributes it.
[0013] Step 1.2: Based on the identity information entered by the user, use zk-SNARKs technology to perform zero-knowledge proof verification on the user’s identity;
[0014] Step 1.3: Users who pass the zero-knowledge proof verification accept the key generated by the notary center. This ensures the authenticity and uniqueness of each user without revealing specific personal identity information.
[0015] Furthermore, the step 2 comprises:
[0016] Step 2.1: Obtain product information. The administrator enters the product information to be sold and ensures that the entered product information is accurate; product information includes name, picture, product price, product quantity, etc.
[0017] Step 2.2: Write a smart contract based on the product information and deploy it to the blockchain; create a code that runs on the blockchain, and write the sales rules and logic of the product into the code, such as product price, purchase limit, etc.; deploy the correctly written smart contract to the blockchain network to ensure automatic execution of the contract and data cannot be tampered with;
[0018] Step 2.3: Update the client interface according to the deployed product information; after the product information and smart contract are deployed to the blockchain, the client interface is automatically updated to display the new product information and purchase options.
[0019] Furthermore, the step 3 comprises:
[0020] Step 3.1: The user selects the product of interest for purchase through the client interface (by name, picture, product price, etc.); and a product locking mechanism is provided to prevent duplicate bookings;
[0021] Step 3.2: Check whether the user's account balance meets the conditions according to the pre-set price. If it does, continue the operation. If it does not, interrupt the processing. After the user selects the product, the wallet account balance is automatically checked to ensure that there is enough money to complete the subsequent steps. At the same time, recharge and payment options are provided when the balance is insufficient.
[0022] Step 3.3: Use the zero-knowledge proof information provided by the client to verify whether the user meets the purchase conditions of the product; the user provides the zero-knowledge proof information to the server for inspection to verify whether the user is eligible to purchase the product, such as whether the purchase quantity has not exceeded the limit, whether the account information identity is repeated, and whether the user has specific purchase qualifications, etc., while ensuring that the user's identity information will not be leaked;
[0023] Step 3.4: After the user qualification verification is passed, the server automatically checks the purchase logic in the smart contract, including whether the purchase limit conditions are met, whether there are remaining goods, etc. After the purchase logic is met, the corresponding funds are deducted from the user's account and the selected goods are locked;
[0024] Step 3.5: After the purchase process is completed, the server sends a notification of successful purchase to the user, including the product order number, product information and product instructions.
[0025] Furthermore, the step 4 comprises:
[0026] Step 4.1: After the transaction is completed, the server triggers the smart contract to automatically transfer the ownership of the product from the platform to the user account and records the ownership change on the blockchain;
[0027] Step 4.2: The server will distribute the sold goods according to the commodity transaction information and ownership information, and automatically generate an electronic transaction certificate containing all necessary commodity information. The electronic transaction certificate will be sent to the user via email or a download link within the platform; arrange for the mailing service of the physical certificate and provide mailing tracking information to ensure the safe delivery of the certificate.
[0028] Furthermore, the step 5 comprises:
[0029] Step 5.1: Before uploading user transaction information to the blockchain, use encryption algorithms to encrypt sensitive information to ensure the security of data during transmission and storage. The encrypted data is stored in multiple nodes of the blockchain to enhance the data's anti-attack capability and recoverability.
[0030] Step 5.2: Use attribute-based encryption algorithms to encrypt transaction information uploaded to the blockchain and control access to encrypted data based on user attributes and policies.
[0031] Furthermore, the attribute-based encryption algorithm adopts the CP-ABE algorithm.
[0032] Compared with the prior art, the present invention has the following beneficial effects:
[0033] By introducing Web3.0 and zk-SNARKs technology, the online transactions involved in this invention can effectively solve the problem of purchasing goods with multiple accounts while protecting user privacy, further improving the security and efficiency of online transactions. The present invention realizes a safe, transparent, and decentralized commodity sales environment while protecting the privacy and rights of users. This method is applicable to various online commodity sales scenarios and has broad application prospects and social value. BRIEF DESCRIPTION OF THE DRAWINGS
[0034] Figure 1 This is a flow chart of a Web3.0 online transaction method based on zk-SNARKs in an embodiment of the present invention;
[0035] Figure 2 A schematic diagram of the platform architecture provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0036] The present invention will be further explained below with reference to the accompanying drawings and specific embodiments:
[0037] like Figure 1 As shown, a Web3.0 online transaction method based on zk-SNARKs is suitable for online transaction scenarios that require high security and privacy protection. Through the application of the embodiments of the present invention, users can enjoy more secure and reliable identity authentication services when conducting online transactions, while protecting personal privacy from being leaked. This method is not only suitable for the fields of financial services and e-commerce, but can also be widely used in any occasions that require strict identity authentication and privacy protection, such as online medical care, education and government services. The implementation of the present invention provides an innovative solution for the field of online identity authentication, which effectively responds to the challenges currently facing network security. The method specifically includes the following steps:
[0038] S1, the user enters identity information and uploads a set of attributes to obtain his own attribute-based encryption key.
[0039] S11, create a user account and obtain a key.
[0040] When a user visits the client for the first time and decides to create an account, they will be guided through a series of intuitive steps to complete the registration. This includes not only filling in basic information, such as username and password settings, but also providing contact information and some basic identity information. In order to ensure the authenticity of the user's identity and the overall security of the platform, the platform has introduced advanced biometric technology, requiring users to authenticate their identities through facial recognition or fingerprint recognition. The user then sends his or her attribute set to the notary center, which runs an attribute-based encryption key generation algorithm to generate a key and distribute it to the user. The key generation algorithm is Where S is the set of user attributes. r is a randomly selected secret exponent. D = g (α+r) / β It is a component of the private key. is an element of the private key associated with attribute j. is another element in the private key that is related to attribute j.
[0041] S12, perform zero-knowledge proof verification on the user’s identity.
[0042] After the user completes the basic identity information submission and biometric verification, this information is used to generate a zero-knowledge proof. Zero-knowledge proof is a cryptographic technology that allows users to prove that the user has certain specific attributes or meets certain conditions without revealing any actual information. The generated zero-knowledge proof will then be verified. Once the verification is passed, the user's account will be activated and the user can start purchasing goods.
[0043] It should be noted that the succinct non-interactive zero-knowledge proof zk-SNARKs is used here. In the traditional zero-knowledge proof method, the prover and the verifier need to communicate for multiple rounds, while the non-interactive zero-knowledge proof does not require such back-and-forth interaction. The prover generates the proof once, and the verifier judges the correctness of the statement based on this proof. The use of zk-SNARKs can reduce communication overhead, improve efficiency and scalability, making it more attractive in modern computing environments.
[0044] The zk-SNARKs algorithm consists of three algorithm components: (PK, VK)←KEYGEN(1 λ,C) is a key generation algorithm that uses a predefined security parameter λ and arithmetic circuit C to generate a proof key PK and a verification key vk; π←PROVE(PK,x,W) is a proof generation algorithm that generates a proof π based on the proof key PK, input x, and witness W; 1 / 0←VERIFY(VK,x,π) is a proof verification algorithm that accepts or rejects π with vk, x, and π as input and output.
[0045] Through this identity creation and verification process that combines zero-knowledge proof and biometric technology, the Web3.0 online transaction method based on zk-SNARKs not only improves the accuracy of user identity authentication, but also enhances user privacy protection. This method ensures that users can enjoy convenient services while their personal information is effectively protected.
[0046] S2, obtains product information and deploys smart contracts based on the product information.
[0047] S21, obtaining product information.
[0048] In Web3.0 online transactions, obtaining product information and deploying smart contracts based on product information are key steps to ensure the automation and transparency of the product sales process. The administrator is responsible for uploading the information of the products to be sold. This includes detailed information such as the name, picture, price, quantity, etc. The administrator needs to ensure that the input data is accurate, because this information will directly affect the user's purchasing experience and the sales effect of the product. And due to the tamper-proof nature of the blockchain, once this information is uploaded to the chain, it will be difficult to modify, and the losses caused by errors will be difficult to recover.
[0049] S22, write and deploy smart contracts for the acquired product information.
[0050] Smart contracts are written based on product information. Smart contracts are a piece of code that runs on the blockchain and is used to automatically execute predefined sales rules. Smart contracts contain all the logic of product sales, such as price setting, purchase quantity limits for each user, refund policies, and resale conditions. Once deployed on the blockchain, these rules will become unchangeable, thus ensuring the fairness and transparency of the sales process. Smart contracts can also set up dynamic pricing mechanisms based on actual conditions, dynamically adjust prices based on the demand for products, or automatically process refunds when products are cancelled. Smart contracts can effectively prevent hoarding and unfair purchasing behaviors, promote the fairness and transparency of product transactions, and are conducive to the better development of the online trading industry.
[0051] S23, automatically update the client interface.
[0052] The client interface is updated according to the deployed product information, and users can browse the new product information. The user interface will display detailed information about the product, including price, quantity, and purchase conditions. Users can make purchases through a friendly interface, and all transactions will be automatically executed through smart contracts.
[0053] Throughout the listing and contract deployment process, multiple measures are taken to protect the security of user data and transactions. All sensitive information will be encrypted and only verified users and contracts can access this information. In addition, abnormal behavior will be monitored to prevent potential security threats such as unauthorized access or fraud. Through these detailed steps, the Web3.0 online transaction method based on zk-SNARKs ensures that the listing and sales process of goods is not only efficient and transparent, but also safe and reliable. The use of smart contracts greatly reduces the need for manual intervention and reduces the risk of errors and fraud, while increasing user trust and satisfaction.
[0054] S3: The client selects the product he needs to purchase based on the uploaded product information, and verifies whether the purchase is allowed based on his own zero-knowledge proof information during the purchase process.
[0055] S31, using the updated client to select the desired product, and purchasing the selected product.
[0056] After the client interface is updated, users first browse various upcoming product sales events through the client, which include detailed information such as product name, picture, quantity, price, etc. Users can use the filtering function to find the required products according to their interests and needs. Once the required products are found, users can view the product information, select the product model they like, and make a purchase.
[0057] S32, checking whether the account balance meets the conditions according to the preset price, and continuing the operation if it meets the conditions, and interrupting the processing if it does not meet the conditions.
[0058] After the user decides to purchase a product, the client guides the purchaser into the checkout process. During this process, the user's account balance is first checked to ensure that the user has sufficient funds to pay for the selected product. If the user's account balance is insufficient, the user will be provided with the option of recharging or other payment methods so that the user can continue to complete the purchase. If the user cannot provide sufficient funds, the user will be prompted with insufficient balance and the purchase process will be interrupted. After the user provides sufficient funds, the purchase operation can be continued directly on the interruption page. This ensures the smooth progress of the transaction and also avoids transaction failures due to insufficient funds.
[0059] S33, using the zero-knowledge proof information provided by the client to verify whether the user meets the purchase conditions.
[0060] After the user balance check is passed, in order to protect the user's privacy and ensure the security of the transaction, zero-knowledge proof technology is used here. During the purchase process, the user needs to provide a zero-knowledge proof to verify whether he is eligible to purchase, such as proving that the user's purchase does not exceed the user's purchase identity specified in the smart contract. In this way, the user can complete the purchase without revealing any personal sensitive information. Automatically verify the zero-knowledge proof provided by the user. Once the verification is passed, the smart contract will automatically execute the transaction, deduct the corresponding funds from the user's account, and lock the selected goods.
[0061] It should be noted that the zero-knowledge proof used here can be the zero-knowledge proof generated by the second step of user identity verification in step S1. Blockchain ensures that there is no duplicate purchase by storing the information of each transaction and comparing the transaction information passed by the zero-knowledge proof with the historical transaction. It prevents the occurrence of hoarding and unfair purchasing behavior.
[0062] S34, after confirming that the transaction is completed, a purchase success notification is sent to the client.
[0063] After the balance check and eligibility check, the smart contract automatically executes to complete the purchase. After the purchase is successful, a purchase success notification is sent to the user. At the same time, the remaining product information is checked and changed in time to prevent the phenomenon of sold-out products still being sold to users. If this error occurs without timely changes, the impact on online transactions will be huge, which will greatly affect user trust.
[0064] Through this detailed purchase process, the Web3.0 online transaction method based on zk-SNARKs not only ensures that users can conveniently purchase the goods they need, but also protects the privacy of users and the security of transactions. The use of smart contracts improves the efficiency and trust of transactions, while zero-knowledge proof technology provides users with a secure authentication method, making the entire purchase experience smoother and more reliable.
[0065] S4, the server distributes the goods purchased by the client to each user based on the transaction situation.
[0066] S41, transferring the commodity ownership to the user according to the commodity transaction situation.
[0067] After the server completes the transaction, the client will receive a purchase completion notification sent by the blockchain. This means that the user's payment is verified on the blockchain, automatically triggering the smart contract to execute the transfer of commodity ownership. At this point, the ownership of the commodity is completely transferred to the user. This process not only ensures the irreversibility of the transaction, but also allows all parties involved to track and confirm the change of ownership through the transparency of the blockchain. With the successful transfer of ownership, the status of the commodity will be updated in the blockchain and clearly marked as "sold", thereby preventing the possibility of duplicate sales.
[0068] It is important to note that the successful purchase notification not only confirms the user's purchase behavior, but also contains key information about the product, such as a digital identifier or serial number. This information is crucial for users because it will serve as proof of ownership of the product. In addition, the notification may also contain other important information about the transaction, such as the transaction amount, the two parties to the transaction, etc.
[0069] S42, distributing the goods to each user according to the transaction information.
[0070] After the transaction is completed, the server automatically generates an electronic certificate containing all necessary transaction information and sends it to the user's email address or provides a download link. It also provides a secure mailing service for users who need physical proof. These certificates are accompanied by a unique QR code or barcode, which allows users to quickly verify their ownership of the goods. The method is continuously optimized based on user feedback, providing technical support and personalized services to enhance the user experience. In addition, customized product management services may be provided based on the user's purchase history and preferences, such as reminding users of upcoming sales or providing other information related to the event to enhance the user's participation experience. These comprehensive measures together ensure the efficient distribution of goods and smooth user participation, building a reliable and user-friendly online transaction method.
[0071] Throughout the entire process of product confirmation and distribution, the server is committed to optimizing the user experience. The service will be continuously improved based on user feedback to ensure that any problems encountered by users during the purchase and participation in activities can be solved in a timely manner. Through these detailed steps, the Web3.0 online transaction method based on zk-SNARKs not only ensures that users can easily purchase the required goods, but also protects the user's privacy and the security of transactions. The use of smart contracts improves the efficiency and trust of transactions. These measures together enhance the user's purchasing experience and ensure that users can smoothly enjoy the expected activities. The Web3.0 online transaction method based on zk-SNARKs provides users with a safe, efficient and user-friendly purchasing platform, allowing users to easily enjoy a variety of exciting activities.
[0072] S5, after the transaction information is uploaded to the blockchain, data encryption and privacy protection schemes are implemented.
[0073] S51, encrypting the transaction information before uploading to the blockchain.
[0074] To ensure the security and privacy of users’ authentication information and transaction data, the platform uses end-to-end encryption technology. All user data is encrypted before being uploaded to the blockchain. This means that from the moment a user submits their personal information, the information is converted into ciphertext that can only be decrypted by authorized users and the platform. Even if the data is intercepted during transmission, attackers cannot read or understand the content of the information. In addition, the distributed nature of the blockchain further enhances data security because the data is not stored in a single location, but is distributed across multiple nodes throughout the network.
[0075] S52, encrypting the transaction information uploaded to the blockchain using an attribute-based encryption algorithm.
[0076] The platform specifically uses the attribute-based encryption (ABE) algorithm to further strengthen the protection of user information. The ABE algorithm allows fine-grained control over access to data, ensuring that only users with specific attributes or who meet specific conditions can decrypt and access sensitive information. For example, it can be set that relevant transaction information can only be decrypted when the user verifies that their attributes will not harm the interests of both parties to the transaction. This encryption method not only protects the privacy of users, but also provides an additional layer of security for online trading platforms. Through the ABE algorithm, the platform can effectively manage who can access what data, while ensuring that the data is not leaked without authorization.
[0077] It should be noted that attribute-based encryption is divided into Ciphertext Policy Attribute-Based Encryption (CP-ABE) and Key Policy Attribute-Based Encryption (KP-ABE). In CP-ABE, the access policy is related to the ciphertext, the user attributes are embedded in the user key, and any user with the correct attribute set can decrypt the given ciphertext. In the KP-ABE system, the access control policy is defined by the authorized agency in the user's private key. Users can only decrypt ciphertexts allowed by their own private key policies. CP-ABE is more suitable for scenarios where data owners need to flexibly define access policies, while KP-ABE is suitable for environments that require centralized management of access rights. Here we use CP-ABE.
[0078] The initialization algorithm of CP-ABE will select a bilinear group G0 of prime order p with a generator g. Next it will randomly select two exponents α, β∈Z p The master key MK is (β, g α ).
[0079]
[0080] where g is The generator of is a special element in the group that can be used to generate other elements in the group. β It is a component of the public key and is obtained by exponentiation β from the generator g. f = g 1 / β is another component of the public key and is the inverse of h. α is another randomly chosen secret exponent used for encryption and key generation.
[0081] Encryption Algorithm Let Y be the set of leaf nodes in T. Then construct the ciphertext by given the tree access structure T and calculation.
[0082]
[0083] Where T represents the tree of access structures, which defines the set of attributes required to decrypt the text. It is a component of the ciphertext, where M is the original message and s is the randomly selected secret exponent during encryption. C = h s It is another component of the ciphertext, obtained by exponentiation s from h. Y represents the set of all leaf nodes in the visited tree T. It is a component of the ciphertext related to the leaf node y. It is another component of the ciphertext related to the leaf node y. H is a hash function, and att(y) is the attribute related to the node y.
[0084] The key generation algorithm will accept a set of attributes S as input and output a key identified with that set of attributes. The algorithm first randomly selects r∈Z for each attribute j∈s p , and then randomly select r j ∈Z p , and then calculate the key as
[0085]
[0086] Where S is the set of user attributes. r is a randomly selected secret exponent used to generate a component of the private key. D = g (α+r) / β It is a component of the private key. is an element of the private key associated with attribute j. is another element in the private key that is related to attribute j.
[0087] The authorization algorithm accepts a secret key SK applicable to a set of attributes S and a The key The algorithm creates a new secret key as
[0088]
[0089] in Indicates the subset of properties to be delegated. Represents a randomly chosen secret exponent used to generate a component of the delegation private key. is an element in the delegated private key associated with attribute k, is the random index associated with attribute k. It is another element in the delegation private key that is related to attribute k.
[0090] By implementing these data security and privacy protection measures, the Web3.0 online transaction method based on zk-SNARKs provides users with a safe and reliable purchasing environment. Users can trade on the platform with confidence, knowing that their personal information is strongly protected. These measures together maintain user trust and promote the healthy development of online trading platforms.
[0091] The basic framework structure of the platform can be referred to Figure 2 , Figure 2 It is a framework design diagram of the platform.
[0092] The embodiment of the present invention integrates Web3.0, concise non-interactive zero-knowledge proof and attribute-based encryption algorithm. A Web3.0 online transaction method based on zk-SNARKs is obtained. The method realizes the protection of user privacy and the refined management of commodity access control. This method not only improves the security of the system, but also enhances the user experience and ensures the fairness and transparency of commodity sales.
[0093] The above is only a preferred embodiment of the present invention. It should be pointed out that a person skilled in the art can make several improvements and modifications without departing from the principle of the present invention. These improvements and modifications should also be regarded as within the scope of protection of the present invention.
Claims
1. A Web3.0 online transaction method based on zk-SNARKs, characterized in that: The method is based on the Web3.0 framework and includes: Step 1: The user enters identity information, uploads an attribute set to obtain his or her attribute-based encryption key, and generates corresponding zero-knowledge proof information based on the identity information; Step 2: Obtain product information and deploy smart contracts based on the product information; Step 3: The user selects the product he needs based on the uploaded product information on the client and verifies whether the product can be purchased based on his own zero-knowledge proof information during the purchase process; Step 4: The server distributes the goods purchased by the client to the corresponding users according to the transaction situation; Step 5: After the transaction information is uploaded to the blockchain, data encryption and privacy protection solutions are implemented.
2. The Web3.0 online transaction method based on zk-SNARKs according to claim 1, characterized in that: The step 1 comprises: Step 1.1: The user enters his / her identity information on the client to create an account. At the same time, the user uploads his / her attribute set to the notary center. The notary center uses key generation technology to generate a key for the user and distributes it. Step 1.2: Based on the identity information entered by the user, use zk-SNARKs technology to perform zero-knowledge proof verification on the user’s identity; Step 1.3: The user who passes the zero-knowledge proof verification accepts the key generated by the notary center.
3. The Web3.0 online transaction method based on zk-SNARKs according to claim 1, characterized in that: The step 2 comprises: Step 2.1: Obtain product information. The administrator enters the product information to be sold and ensures that the entered product information is accurate; Step 2.2: Write a smart contract based on the product information and deploy it on the blockchain; Step 2.3: Update the client interface based on the deployed product information.
4. The Web3.0 online transaction method based on zk-SNARKs according to claim 1, characterized in that: The step 3 comprises: Step 3.1: The user selects the product of interest for purchase through the client interface; Step 3.2: Check whether the user account balance meets the conditions according to the pre-set price. If it meets the conditions, continue the operation. If not, interrupt the operation. Step 3.3: Use the zero-knowledge proof information provided by the client to verify whether the user meets the purchase conditions of the product; Step 3.4: After the user qualification verification is passed, the server automatically checks the purchase logic in the smart contract. If the purchase logic is met, the corresponding funds are deducted from the user account and the selected product is locked; Step 3.5: After the purchase process is completed, the server sends a notification to the user that the purchase is successful.
5. The Web3.0 online transaction method based on zk-SNARKs according to claim 1, characterized in that: The step 4 comprises: Step 4.1: After the transaction is completed, the server triggers the smart contract to automatically transfer the ownership of the product from the platform to the user account and records the ownership change on the blockchain; Step 4.2: The server will issue the sold goods according to the commodity transaction information and ownership information, and automatically generate an electronic transaction certificate containing all necessary commodity information.
6. The Web3.0 online transaction method based on zk-SNARKs according to claim 1, characterized in that: The step 5 comprises: Step 5.1: Before uploading the user transaction information to the blockchain, the sensitive information is encrypted using an encryption algorithm, and the encrypted data is stored in multiple nodes of the blockchain; Step 5.2: Encrypt the transaction information uploaded to the blockchain using an attribute-based encryption algorithm.
7. The Web3.0 online transaction method based on zk-SNARKs according to claim 6, characterized in that: The attribute-based encryption algorithm adopts the CP-ABE algorithm.
