Block chain electronic receipt generation verification method and system, medium and product
By adopting multiple encryption and verification mechanisms in the electronic order return system and combining blockchain technology, the problems of insufficient privacy protection and easy data tampering in the existing system are solved, and a highly secure and trustworthy electronic order return system is realized. Improve transaction efficiency and trust.
Patent Information
- Application Number
- CN202411335046.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-24
- Publication Date
- 2025-01-14
AI Technical Summary
The existing electronic order return system lacks privacy protection during data verification, which can easily lead to the leakage of sensitive information and be easily tampered with, making it difficult to verify the integrity and uniqueness of transaction information.
Adopt multiple encryption and verification mechanisms, including secure hash algorithm processing, comprehensive blockchain identification generation, asymmetric encryption and zero-knowledge proof technology, to ensure the privacy protection and immutability of transaction data, and to pass the distributed storage of blockchain and consensus mechanisms to achieve data consistency and traceability.
It significantly improves the security and credibility of the electronic order return system, protects the privacy of all parties to the transaction, reduces the risk of fraud, improves transaction efficiency and trust, and provides a more reliable electronic order return generation verification method.
Smart Images

Figure CN119313460A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of electronic logistics receipts, and in particular to a blockchain electronic receipt generation and verification method, system, medium and product. Background Art
[0002] With the rapid development of information technology, traditional paper receipts and manual processing methods can no longer meet the speed and security requirements of modern electronic transactions. In order to improve efficiency and security, the electronic receipt system has become an important technical means to solve the problems of transaction recording, verification and archiving.
[0003] In the existing electronic receipt system, electronic receipt generation requests are usually received and processed through blockchain technology, including generating a blockchain identifier, verifying its uniqueness, and storing transaction data and identifiers in the blockchain to ensure the security and non-tamperability of the data.
[0004] However, the existing electronic receipt system still faces some challenges and limitations. For example, the privacy protection of data during the verification process is not sufficient, which may lead to the unnecessary exposure of sensitive information in some cases. Summary of the invention
[0005] The present application provides a blockchain electronic receipt generation and verification method, system, medium and product for improving the security and reliability of transaction data.
[0006] In the first aspect, the present application provides a blockchain electronic receipt generation and verification method, which is applied to an electronic receipt system, the method comprising: receiving an electronic receipt generation request, the electronic receipt generation request including multiple transaction data; processing the multiple transaction data using a secure hash algorithm to generate corresponding transaction hash values respectively; batch processing a number of transaction hash values to generate a comprehensive blockchain identifier; verifying on the blockchain whether the comprehensive blockchain identifier is unique; if so, encrypting the comprehensive blockchain identifier and the multiple transaction data using a preset public key to obtain encrypted data; after storing the encrypted data in the blockchain, verifying the encrypted data using zero-knowledge proof technology; if the verification is successful, generating an electronic receipt.
[0007] By adopting the above technical solution, the security and reliability of transaction data are improved through multiple encryption and verification mechanisms. First, the electronic receipt system processes multiple transaction data using a secure hash algorithm to generate transaction hash values corresponding to multiple transaction data, effectively protecting the privacy of the original transaction data. Secondly, the electronic receipt system batch processes multiple transaction hash values to generate a comprehensive blockchain identifier and verifies its uniqueness on the blockchain, ensuring the uniqueness and immutability of each transaction. Then, the electronic receipt system uses a preset public key to encrypt the comprehensive blockchain identifier and transaction data, further enhancing the confidentiality of the data. Finally, the electronic receipt system verifies the encrypted data through zero-knowledge proof technology to prove the validity of the data without disclosing the specific transaction content. This multi-level security mechanism not only protects the privacy of all parties to the transaction, but also greatly improves the credibility and tamper-proof ability of the electronic receipt. At the same time, the method makes full use of the distributed storage and consensus mechanism characteristics of the blockchain to ensure the consistency and traceability of the data, and provides a more secure and reliable electronic receipt generation and verification method for e-commerce, financial transactions and other fields, effectively reducing the risk of fraud and improving transaction efficiency and trust.
[0008] In combination with some embodiments of the first aspect, in some embodiments, the multiple transaction data are processed by a secure hash algorithm to generate corresponding transaction hash values, specifically including: extracting key information from the transaction data; organizing the key information to obtain transaction key information; and using a preset secure hash algorithm to perform a hash operation on the transaction key information to obtain a transaction hash value.
[0009] By adopting the above technical solution, the generation process of the electronic receipt is further optimized by finely processing the transaction data, and the efficiency and security of the electronic receipt system are improved. First, the electronic receipt system extracts key information from the transaction data, thereby effectively reducing the amount of data to be processed and improving the processing speed. Secondly, the electronic receipt system organizes the key information to obtain the key transaction information. This step can ensure that all necessary information is included in an orderly manner, which is convenient for subsequent processing and verification. Finally, the electronic receipt system uses a preset secure hash algorithm to perform a hash operation on the key transaction information to obtain a transaction hash value. This method can not only greatly reduce the data storage space, but also ensure the integrity and non-tamperability of the data, because the use of a secure hash algorithm will result in a completely different hash value even if the original data changes slightly, thereby detecting any unauthorized modification. In addition, this method can also effectively protect the privacy of the original transaction data, because only the transaction hash value is further processed and stored, and the original transaction data will not be exposed. This refined data processing method not only improves the overall performance of the electronic receipt system, but also enhances the data security and privacy protection capabilities, providing a solid foundation for the reliable operation of the electronic receipt system.
[0010] In combination with some embodiments of the first aspect, in some embodiments, the comprehensive blockchain identifier and the multiple transaction data are encrypted by a preset public key to obtain encrypted data, which specifically includes: using the preset public key to asymmetrically encrypt the comprehensive blockchain identifier to obtain an identifier ciphertext; using the preset public key to asymmetrically encrypt the multiple transaction data in sequence to obtain multiple transaction ciphertexts; and connecting the identifier ciphertext with the multiple transaction ciphertexts in a preset order to obtain the encrypted data.
[0011] By adopting the above technical solutions, the security and reliability of the electronic receipt system are significantly improved. First, the electronic receipt system uses a preset public key to asymmetrically encrypt the comprehensive blockchain identifier to generate an identification ciphertext. The use of asymmetric encryption technology ensures that even if the public key is leaked, the ciphertext cannot be easily cracked, which greatly enhances security. Secondly, the electronic receipt system also uses a preset public key to asymmetrically encrypt multiple transaction data to obtain multiple transaction ciphertexts, which not only protects the privacy of each transaction, but also ensures the integrity and non-tamperability of the transaction data. Finally, the electronic receipt system connects the identification ciphertext with multiple transaction ciphertexts in a preset order to obtain the final encrypted data. This orderly connection method not only maintains the structure of the data, facilitates subsequent storage and verification, but also increases the difficulty of data tampering. The use of asymmetric encryption technology in the entire encryption process not only ensures a high degree of security, but also realizes flexible key management, thereby effectively preventing unauthorized access and data leakage, and also provides a reliable foundation for subsequent zero-knowledge proof verification.
[0012] In combination with some embodiments of the first aspect, in some embodiments, the method further includes: obtaining the order sending time of the order sender and the order delivery time of the order recipient; and recording the order sending time and the order delivery time into a preset database.
[0013] By adopting the above technical solution, the transparency and traceability of the electronic receipt system are significantly improved by obtaining and recording the order sending time of the order sender and the order delivery time of the order receiver. It not only provides a timestamp for the entire transaction process, but also effectively monitors and optimizes the logistics process. Recording the order sending time can clarify the starting point of the transaction, and recording the order delivery time can evaluate the logistics efficiency. Recording this time information in the preset database establishes a complete timeline for the entire transaction chain, allowing all parties to the transaction to clearly track the order status.
[0014] In combination with some embodiments of the first aspect, in some embodiments, after the encrypted data is stored in the blockchain, the encrypted data is verified by zero-knowledge proof technology, specifically including: In combination with some embodiments of the first aspect, in some embodiments, after the step of generating an electronic receipt if the verification is successful, the method also includes: obtaining the electronic receipt personalized parameters of the electronic receipt requester; adjusting the format of the electronic receipt according to the electronic receipt personalized parameters to obtain a personalized electronic receipt.
[0015] By adopting the above technical solution and introducing the personalized parameters of the electronic receipt, the flexibility and user-friendliness of the electronic receipt system are greatly improved. First, the electronic receipt system obtains the personalized parameters of the electronic receipt from the electronic receipt requester, because different users or enterprises may have different requirements for the format of the electronic receipt. In this way, the electronic receipt system can accurately meet various specific requirements. Secondly, the electronic receipt system adjusts the format of the electronic receipt according to these personalized parameters of the electronic receipt to generate a personalized electronic receipt. This customized method not only improves user satisfaction, but also enhances the applicability of electronic receipts in different scenarios. For example, enterprises of different industries and sizes may need to highlight different information in the electronic receipt, or adopt a specific layout. Through this personalized setting, the practicality of the electronic receipt is improved.
[0016] In combination with some embodiments of the first aspect, in some embodiments, after the step of adjusting the format of the electronic receipt according to the personalized parameters of the electronic receipt to obtain a personalized electronic receipt, the method also includes: digitally signing the personalized electronic receipt; and sending the personalized electronic receipt with the digital signature to the electronic receipt requester.
[0017] By adopting the above technical solution, the legal effect and security of the electronic receipt are further enhanced by digitally signing the personalized electronic receipt and sending it to the electronic receipt requester. First, the electronic receipt system digitally signs the personalized electronic receipt to ensure the integrity and non-repudiation of the electronic receipt. Digital signature technology can verify whether the document has been tampered with, and also prove the source of the document, which is crucial to the legal effect of the electronic receipt. Secondly, the electronic receipt system sends the personalized electronic receipt with a digital signature to the electronic receipt requester. This process not only completes the delivery of the electronic receipt, but also ensures the security of the delivery process. Through this safe and reliable delivery mechanism, the electronic receipt system not only improves the credibility of the electronic receipt, but also provides strong electronic evidence for possible legal disputes, thereby improving the efficiency and security of transactions.
[0018] In combination with some embodiments of the first aspect, in some embodiments, after the step of generating an electronic receipt if the verification is successful, the method also includes: obtaining an operation request for the electronic receipt, the operation request including an update request and a cancellation request; if the operation request is the update request, generating an optimized electronic receipt, and writing the update operation into the transaction record of the blockchain; if the operation request is the cancellation request, deleting the electronic receipt, and writing the cancellation operation into the transaction record of the blockchain.
[0019] By adopting the above technical solution and introducing the update mechanism and revocation mechanism of the electronic receipt, the flexibility and adaptability of the electronic receipt system are greatly improved. First, the electronic receipt system can obtain operation requests for the electronic receipt, including update requests and revocation requests. This design takes into account various situations that may occur in actual business, such as transaction information needs to be revised or transactions are cancelled. For update requests, the electronic receipt system will generate an optimized electronic receipt and write the update operation into the transaction record of the blockchain, which not only ensures the timeliness and accuracy of the electronic receipt information, but also retains the complete modification history through blockchain technology, enhancing the transparency and traceability of the electronic receipt system. For revocation requests, the electronic receipt system will delete the corresponding electronic receipt and also write the revocation operation into the transaction record of the blockchain, ensuring that even if the electronic receipt is revoked, the relevant operations can still be tracked and verified. By recording all update operations and revocation operations on the blockchain, the electronic receipt system not only maintains the integrity of the data, but also provides a clear audit trail for possible disputes. This flexible operation mechanism, combined with the tamper-proof characteristics of the blockchain, not only meets the actual needs of the business, but also ensures the security and reliability of the electronic receipt system.
[0020] In a second aspect, an embodiment of the present application provides an electronic receipt system, which includes: one or more processors and a memory; the memory is coupled to the one or more processors, the memory is used to store computer program code, the computer program code includes computer instructions, and the one or more processors call the computer instructions to enable the electronic receipt system to execute the method described in the first aspect and any possible implementation method of the first aspect.
[0021] In a third aspect, an embodiment of the present application provides a computer program product comprising instructions, which, when the computer program product is run on an electronic receipt system, enables the electronic receipt system to execute the method described in the first aspect and any possible implementation method of the first aspect.
[0022] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, comprising instructions. When the instructions are executed on an electronic receipt system, the electronic receipt system executes the method described in the first aspect and any possible implementation method of the first aspect.
[0023] It can be understood that the electronic receipt system provided in the second aspect, the computer program product provided in the third aspect, and the computer storage medium provided in the fourth aspect are all used to execute the method provided in the embodiment of the present application. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding method, which will not be repeated here.
[0024] One or more technical solutions provided in the embodiments of the present application have at least the following technical effects or advantages: 1. Due to the use of multiple encryption and verification mechanisms, including secure hash algorithm processing, comprehensive blockchain identifier generation, asymmetric encryption and zero-knowledge proof technology, the present invention significantly improves the security, privacy protection and data integrity of the electronic receipt system, effectively solves the problems of electronic receipts being easily tampered with, privacy data being easily leaked, and transaction information being difficult to verify in the prior art, and thus realizes a highly secure, reliable and privacy-protective electronic receipt system. The electronic receipt system can not only resist various network attacks, but also prove the validity of data without disclosing the specific transaction content, providing a more reliable solution for e-commerce, financial transactions and other fields, greatly improving the efficiency and trust of transactions.
[0025] 2. Due to the adoption of flexible personalized parameter settings and digital signature mechanisms, including the steps of obtaining personalized parameters of electronic receipts, adjusting the format of electronic receipts, and performing digital signatures, the present invention greatly improves the applicability and legal effect of the electronic receipt system, and effectively solves the problems of the single format of electronic receipts, lack of legal binding force, and difficulty in meeting the needs of different users in the prior art, thereby realizing a highly flexible, legally effective and user-friendly electronic receipt system. The electronic receipt system can not only generate customized electronic receipts according to the needs of different users, but also ensure the non-repudiation and legal effect of electronic receipts through digital signature technology, which not only improves user satisfaction, but also promotes the widespread application of electronic receipts in all walks of life, and promotes the entire industry to develop in a more digital and intelligent direction.
[0026] 3. Due to the adoption of a complete electronic receipt lifecycle management mechanism, including functions such as recording order sending and delivery time, supporting electronic receipt update and cancellation operations, the present invention significantly improves the traceability and adaptability of the electronic receipt system, and effectively solves the problems of electronic receipts in the prior art that are difficult to track, lack flexibility, and cannot cope with complex business scenarios, thereby realizing a comprehensive, flexible and auditable electronic receipt system. The electronic receipt system can not only clearly record the key time points of the entire transaction process, but also flexibly handle the update and cancellation requirements of electronic receipts, while retaining the complete historical records of all operations through blockchain technology. This comprehensive management mechanism not only improves the transparency and traceability of the electronic receipt system, but also provides strong evidence support for resolving potential disputes, greatly enhancing the applicability and reliability of electronic receipts in complex business environments. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] Figure 1 This is a flowchart of a method for generating and verifying an electronic receipt of a blockchain in an embodiment of the present application; Figure 2 This is another flowchart of the method for generating and verifying an electronic receipt of a blockchain in an embodiment of the present application; Figure 3 It is a schematic diagram of the structure of a physical device of the electronic receipt system in the embodiment of the present application. DETAILED DESCRIPTION
[0028] The terms used in the following embodiments of the present application are only for the purpose of describing specific embodiments, and are not intended to be used as limitations to the present application. As used in the specification of the present application, the singular expressions "one", "a kind of", "above", "the" and "this" are intended to also include plural expressions, unless there is a clear indication to the contrary in the context. It should also be understood that the term "and / or" used in the present application refers to any or all possible combinations comprising one or more of the listed items.
[0029] In the following, the terms "first" and "second" are used for descriptive purposes only and are not to be understood as suggesting or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features, and in the description of the embodiments of the present application, unless otherwise specified, "plurality" means two or more.
[0030] The following is a description of the process of the method provided by this implementation. Figure 1 , which is a flow chart of the method for generating and verifying an electronic receipt of the blockchain in an embodiment of the present application.
[0031] S101, receiving an electronic receipt generation request, the electronic receipt generation request including multiple transaction data; The electronic receipt generation request refers to the request information for generating an electronic receipt initiated by the electronic receipt requester, which is used to trigger the electronic receipt system to start the process of generating an electronic receipt. The electronic receipt requester can be a user or a computer device, which is not limited here. Transaction data refers to all information related to a specific transaction, including but not limited to information about the two parties to the transaction, transaction amount, transaction time, description of transaction goods or services, etc. Multiple transaction data refers to the relevant information of multiple transactions included in one request. This batch processing method can improve efficiency.
[0032] The electronic receipt system performs this step when it receives an electronic receipt generation request sent by the electronic receipt requester. Specifically, the electronic receipt system first verifies whether the source and format of the electronic receipt generation request are legal. Then, the electronic receipt system parses the multiple transaction data contained in the electronic receipt generation request and temporarily stores these transaction data in memory or cache. The electronic receipt system also checks the integrity and validity of each transaction data to ensure that all necessary information is included. If any data is found to be missing or in an incorrect format, the electronic receipt system will immediately return an error message and require the electronic receipt requester to resubmit.
[0033] S102, performing secure hash algorithm processing on the multiple transaction data to generate corresponding transaction hash values respectively; Among them, the secure hash algorithm refers to a cryptographic hash function that compresses a message of any length into a fixed-length output. Commonly used ones include SHA-256, SHA-3, etc. The transaction hash value represents a fixed-length string obtained after processing by the secure hash algorithm, which is used to uniquely identify a transaction data. Generation refers to the process of obtaining a transaction hash value through calculation. Correspondence means that a unique transaction hash value will be generated for each transaction data.
[0034] The electronic receipt system will immediately perform this step after completing the receipt and preliminary verification of the transaction data. Specifically, the electronic receipt system will first select a preset secure hash algorithm, such as SHA-256. Then, the electronic receipt system will traverse the multiple transaction data received previously and process each transaction data as follows: First, the electronic receipt system will splice the key fields in the transaction data (such as transaction ID, transaction amount, transaction time, etc.) into a string in a preset order. Then, the electronic receipt system will use the selected secure hash algorithm to calculate this string to obtain a transaction hash value of a fixed length. This transaction hash value is the unique identifier of the transaction data. The electronic receipt system will temporarily store each transaction data and the corresponding transaction hash value in memory for subsequent processing. At the same time, the electronic receipt system will also check whether there is a conflict in the generated transaction hash value. If a conflict is found, it is necessary to adjust the splicing method of the original transaction data or select a more appropriate secure hash algorithm to recalculate.
[0035] Optionally, under normal circumstances, the multiple transaction data are processed by a secure hash algorithm to generate corresponding transaction hash values respectively, which can be achieved in the following ways: extracting key information from the transaction data; organizing the key information to obtain transaction key information; and using a preset secure hash algorithm to perform a hash operation on the transaction key information to obtain a transaction hash value.
[0036] S103, batch processing a number of transaction hash values to generate a comprehensive blockchain identifier; Among them, several means two or more quantities, specifically multiple transaction hash values. Batch processing refers to the unified operation or calculation of multiple transaction hash values at the same time. The comprehensive blockchain identifier refers to a new, higher-level identifier obtained by processing multiple transaction hash values, which is used to uniquely identify a group of transactions on the blockchain. Generation refers to the process of creating a comprehensive blockchain identifier through a specific algorithm or method.
[0037] The electronic receipt system will immediately perform this step after completing the calculation of the transaction hash value of each transaction data. Specifically, the electronic receipt system will first determine the number of transaction hash values that need to be batch processed. This number may be fixed (such as one group of 100 transaction hash values) or dynamically determined according to time intervals or other conditions, which is not limited here. Then, the electronic receipt system will arrange these selected transaction hash values in a specific order (such as time order or hash value dictionary order). Next, the electronic receipt system may use the Merkle tree algorithm to process these transaction hash values: first merge the two adjacent transaction hash values, and calculate the hash value again to obtain the hash value of the previous layer, and repeat this process until a root hash value is finally obtained. This root hash value is then combined with other information (such as timestamp, electronic receipt system identifier, etc.) to finally generate a comprehensive blockchain identifier, which will be used for subsequent uniqueness verification and data storage on the blockchain. The electronic receipt system will also establish a mapping relationship between this comprehensive blockchain identifier and all the original transactions it contains for subsequent query and verification.
[0038] S104, verifying on the blockchain whether the comprehensive blockchain identifier is unique; Blockchain refers to a distributed ledger technology used to store and verify the integrity and consistency of data. Verification refers to the process of checking or confirming the authenticity or correctness of a piece of information. Uniqueness means that an identifier or value is unique in the entire electronic receipt system and there is no duplication.
[0039] The electronic receipt system performs this step immediately after generating the comprehensive blockchain identifier. Specifically, the electronic receipt system will first connect to the preset blockchain network. Then, the electronic receipt system will construct a special transaction or query request, and include the generated comprehensive blockchain identifier as a parameter. This transaction or query request will be broadcast to the entire blockchain network. After receiving it, the nodes in the blockchain network will search for the same identifier in their respective local ledgers. If no node reports the existence of the same identifier, then the comprehensive blockchain identifier is considered unique. If a duplication is found, the electronic receipt system will immediately generate a new comprehensive blockchain identifier and re-verify it. Once the uniqueness is confirmed, the electronic receipt system will record the verification result and may formally write this unique comprehensive blockchain identifier into the blockchain. This process may need to wait for the consensus confirmation of the blockchain network to ensure the reliability of the verification result.
[0040] S105. If yes, encrypt the comprehensive blockchain identifier and the multiple transaction data using a preset public key to obtain encrypted data; The preset public key refers to a pre-determined public key used for encryption, which is usually part of an asymmetric encryption algorithm. Encryption refers to the process of converting plaintext information into ciphertext to protect the confidentiality of the information. Encrypted data refers to information that has been encrypted and can only be decrypted and viewed with the corresponding private key.
[0041] The electronic receipt system performs this step immediately after completing the uniqueness verification of the comprehensive blockchain identifier. Specifically, the electronic receipt system first obtains the preset public key from the key management library. The preset public key is usually generated and securely stored by a trusted third party or the administrator of the electronic receipt system. Then, the electronic receipt system combines the comprehensive blockchain identifier and the multiple transaction data received previously into a data packet. Next, the electronic receipt system selects a high-strength asymmetric encryption algorithm, such as RSA or ECC. Using the algorithm and public key described above, the electronic receipt system encrypts the entire data packet. After encryption, the electronic receipt system generates a new data structure containing the encrypted data and possible other metadata (such as the encryption algorithm identifier used, timestamp, etc.). This new data structure is the final encrypted data. The electronic receipt system temporarily stores this encrypted data and ensures that the encrypted version is always used in subsequent processing to protect the security of the original information.
[0042] Optionally, under normal circumstances, the comprehensive blockchain identifier and the multiple transaction data are encrypted by a preset public key, and obtaining the encrypted data can be achieved in the following ways: using the preset public key, asymmetrically encrypting the comprehensive blockchain identifier to obtain an identifier ciphertext; using the preset public key, asymmetrically encrypting the multiple transaction data in sequence to obtain multiple transaction ciphertexts; connecting the identifier ciphertext with the multiple transaction ciphertexts in a preset order to obtain the encrypted data.
[0043] S106. After storing the encrypted data in the blockchain, verify the encrypted data using zero-knowledge proof technology; Zero-knowledge proof technology refers to a cryptographic method that allows one party (the prover) to prove to another party (the verifier) that a statement is true without revealing any information other than the fact that the statement is true. Verification here refers to confirming the validity and integrity of encrypted data without decrypting or exposing the contents of the original data.
[0044] The electronic receipt system performs this step immediately after completing the data encryption. Specifically, the electronic receipt system will first select a suitable zero-knowledge proof protocol, such as zk-SNARKs or zk-STARKs. Then, the electronic receipt system will generate a proof that contains certain statements about the encrypted data, such as "these encrypted data do contain a certain number of valid transactions" or "the total amount of transactions contained in these encrypted data is within a certain range." Next, the electronic receipt system will run the zero-knowledge proof protocol to generate a concise proof. This proof can be verified by anyone, but will not disclose any specific information about the original transaction data. The verification process usually includes checking the mathematical correctness of the proof and whether the proof meets the predefined constraints. If the verification passes, the electronic receipt system will generate a verification result indicating that the encrypted data does meet the declared properties without decrypting the data. This verification result may be recorded on the blockchain or used in subsequent processing steps. If the verification fails, the electronic receipt system will mark the batch of data as suspicious and may trigger additional review processes.
[0045] S107. If the verification is successful, an electronic receipt is generated.
[0046] Among them, an electronic receipt refers to a transaction voucher in electronic form, which is used to prove the occurrence and details of a transaction or transactions. Generation refers to the process of creating or generating an electronic receipt. An electronic receipt usually contains key information of the transaction, such as the transaction parties, amount, time, etc., as well as possible encryption information and verification information.
[0047] The electronic receipt system performs this final step after completing the zero-knowledge proof verification of the encrypted data. Specifically, the electronic receipt system will first start to build the basic structure of the electronic receipt based on the predefined electronic receipt template. Then, the electronic receipt system will extract the necessary information from the previously processed data, such as transaction summary, comprehensive blockchain identification, zero-knowledge proof verification results, etc., and fill it into the electronic receipt template. For sensitive information, the electronic receipt system may only include its transaction hash value or encrypted data to protect privacy. Next, the electronic receipt system will generate a unique electronic receipt number and add it to the electronic receipt.
[0048] By adopting the above technical solution, the security and reliability of transaction data are improved through multiple encryption and verification mechanisms. First, the electronic receipt system processes multiple transaction data using a secure hash algorithm to generate transaction hash values corresponding to multiple transaction data, effectively protecting the privacy of the original transaction data. Secondly, the electronic receipt system batch processes multiple transaction hash values to generate a comprehensive blockchain identifier and verifies its uniqueness on the blockchain, ensuring the uniqueness and immutability of each transaction. Then, the electronic receipt system uses a preset public key to encrypt the comprehensive blockchain identifier and transaction data, further enhancing the confidentiality of the data. Finally, the electronic receipt system verifies the encrypted data through zero-knowledge proof technology to prove the validity of the data without disclosing the specific transaction content. This multi-level security mechanism not only protects the privacy of all parties to the transaction, but also greatly improves the credibility and tamper-proof ability of the electronic receipt. At the same time, the method makes full use of the distributed storage and consensus mechanism characteristics of the blockchain to ensure the consistency and traceability of the data, and provides a more secure and reliable electronic receipt generation and verification method for e-commerce, financial transactions and other fields, effectively reducing the risk of fraud and improving transaction efficiency and trust.
[0049] The following is a more detailed description of the process of the method provided by this implementation. Figure 2 , which is another flow chart of the method for generating and verifying an electronic receipt of the blockchain in an embodiment of the present application.
[0050] After step S107, the following steps may or may not be performed, which is not limited here: S201, obtaining an operation request for the electronic receipt, the operation request including an update request and a cancellation request; Among them, an electronic receipt refers to a transaction voucher in electronic form, which is used to prove the completion of a transaction or service. An operation request is an instruction to modify or delete an already generated electronic receipt. An update request is a request to modify or supplement the content of an electronic receipt, such as correcting erroneous information or adding new transaction details. A cancellation request is a request to invalidate an already generated electronic receipt and delete it from the electronic receipt system, which is usually used to process completely erroneous or no longer valid electronic receipts.
[0051] This step is performed at any time point after the electronic receipt is generated and stored in the electronic receipt system. Specifically, the electronic receipt system will continuously monitor possible operation requests through the API interface or user interface. When the electronic receipt system receives an operation request, it will first verify the identity and authority of the initiator of the operation request to ensure that only authorized users can update or revoke the electronic receipt. Then, the electronic receipt system will parse the content of the operation request, determine whether it is an update request or a cancellation request, and extract relevant operation parameters, such as the specific fields that need to be updated or the reason for the cancellation.
[0052] S202. If the operation request is the update request, an optimized electronic receipt is generated, and the update operation is written into the transaction record of the blockchain; The optimized electronic receipt refers to a new version of the electronic receipt obtained by modifying the original electronic receipt according to the update request, which contains the latest and most accurate transaction information. The transaction record here represents a detailed log of the update operation on the electronic receipt, including the update time, update content, operator and other information.
[0053] This step is executed after the electronic receipt system confirms that what is received is an update request. It is used to process the content update of the electronic receipt and ensure the traceability of the update operation. Specifically, the electronic receipt system will first modify the original electronic receipt according to the specific content in the update request, which may include correcting erroneous information, adding new transaction details, updating transaction status, etc. The electronic receipt system will generate a new version number to distinguish the electronic receipt before and after the update. While generating the optimized electronic receipt, the electronic receipt system will record detailed update operations, including the specific content of the update, timestamp, operator ID and other information. Then, the electronic receipt system will call the blockchain interface to package these update operations into a new block and add it to the existing blockchain. This not only ensures that the latest status of the electronic receipt can be reflected in a timely manner, but also ensures the immutability and traceability of each update operation through blockchain technology, effectively preventing unauthorized modifications and potential fraud. Finally, the electronic receipt system will return confirmation information of the successful update to the initiator of the update request, and may trigger relevant notification mechanisms, such as sending notifications to other relevant parties that the electronic receipt has been updated.
[0054] S203. If the operation request is a cancellation request, the electronic receipt is deleted, and the cancellation operation is written into the transaction record of the blockchain; Among them, the revocation request refers to the instruction to invalidate the generated electronic receipt and delete it from the electronic receipt system. This step is executed after the electronic receipt system receives the revocation request and verifies its legitimacy, and is used to process the electronic receipt that needs to be completely abolished. Specifically, the electronic receipt system will first verify the user rights of the initiator of the revocation request to ensure that only authorized personnel can perform this operation. Then, the electronic receipt system will mark the original electronic receipt as "revoked" and remove it, but will not physically delete the original data to facilitate possible subsequent audit requirements. At the same time, the electronic receipt system will generate a detailed revocation record, including the reason for revocation, operation time, operator ID and other information. This revocation record will be packaged into a new block and added to the blockchain. By recording the revocation operation on the blockchain, the electronic receipt system ensures the immutability and traceability of the operation, effectively preventing unauthorized revocation. Finally, the electronic receipt system will send a revocation notification to the initiator of the revocation request to ensure that all stakeholders understand that the electronic receipt is no longer valid.
[0055] S204, obtaining the electronic receipt personalized parameters of the electronic receipt requester; The electronic receipt personalization parameters refer to a series of setting options used to customize the electronic receipt display mode, content layout or additional information. The electronic receipt personalization parameters may include but are not limited to: company logo, font style, color scheme, additional fields, etc.
[0056] This step is usually performed at the initial stage of the electronic receipt generation process to meet the personalized needs of different users for the format and content of the electronic receipt. Specifically, the electronic receipt system will first identify the identity of the electronic receipt requester, which may be through user login information, API keys or other authentication methods. Then, the electronic receipt system will query the electronic receipt personalized parameters associated with the electronic receipt requester. These electronic receipt personalized parameters may be stored in the user configuration database or transmitted in real time through the API. If it is the first request or there are no preset parameters, the electronic receipt system may provide a default parameter set or guide the electronic receipt requester to set the parameters. The obtained electronic receipt personalized parameters may include: the font and size of the document title, the position and size of the company logo, whether to include a watermark, custom footer information, specific data field display order, etc. The electronic receipt system will verify these electronic receipt personalized parameters to ensure that they meet the specifications and security requirements of the electronic receipt system. The purpose of this step is to ensure that the generated electronic receipt is not only accurate in content, but also meets the brand display and information presentation requirements of the electronic receipt requester, and improves user experience and satisfaction.
[0057] S205, adjusting the format of the electronic receipt according to the personalized parameters of the electronic receipt to obtain a personalized electronic receipt; Among them, format adjustment means modifying the layout, style and content of the electronic receipt according to these electronic receipt personalized parameters. Personalized electronic receipt refers to an electronic receipt that has been customized to meet the specific needs of the electronic receipt requester.
[0058] This step is performed after obtaining the personalized parameters of the electronic receipt, and is used to generate a customized electronic receipt that meets the needs of the electronic receipt requester. Specifically, the electronic receipt system applies the obtained personalized parameters of the electronic receipt one by one, which may include adjusting the overall layout of the document, such as the position and content of the header and footer; modifying the font style and size; inserting the company logo of the electronic receipt requester; adjusting the display order and format of the data fields; adding a customized background watermark, etc. The electronic receipt system will ensure that these adjustments will not affect the core information and legal effect of the electronic receipt. When applying these personalized parameters of the electronic receipt, the electronic receipt system will also perform a compatibility check to ensure that the adjusted electronic receipt can be displayed correctly on different devices and platforms.
[0059] S206. Digitally sign the personalized electronic receipt; Among them, digital signature refers to the process of signing a personalized electronic receipt using encryption technology, which is used to verify the authenticity and integrity of the personalized electronic receipt. This step is performed immediately after the personalized electronic receipt is generated to ensure the legal effect and non-tamperability of the electronic receipt. Specifically, the electronic receipt system will first calculate the hash value of the personalized electronic receipt, which can uniquely represent the content of the personalized electronic receipt. Then, the electronic receipt system uses the preset private key to encrypt this hash value and generate a digital signature. The signing process will also include timestamp information to prove the specific time of the digital signature.
[0060] S207, sending the personalized electronic receipt with digital signature to the electronic receipt requester; Among them, a personalized electronic receipt with a digital signature refers to an electronic transaction voucher that has been customized and has a digital signature added. The electronic receipt requester refers to the individual, enterprise or system that initially initiated the request to generate the electronic receipt. This step is performed immediately after the electronic receipt is digitally signed, and is used to deliver the final generated personalized electronic receipt with a digital signature to the electronic receipt requester. Specifically, the electronic receipt system will first confirm the integrity of the electronic receipt, including checking whether the personalized content and digital signature are correctly attached. Then, the electronic receipt system will select an appropriate sending channel based on the receiving method pre-specified by the electronic receipt requester, which may include direct transmission through a secure API interface, sending encrypted emails, or uploading documents to a designated secure file sharing platform. During the sending process, the electronic receipt system will use encryption protocols (such as TLS) to ensure the security of data transmission.
[0061] S208, obtaining the order sending time of the order sender and the order delivery time of the order receiver; The order sender is usually the party that sends the order, such as a buyer or a supermarket; the order sending time refers to the specific time when the order is sent from the order sender. The order receiver refers to the party that receives the order, such as a seller or a supplier; the order delivery time refers to the specific time when the goods or services are actually delivered to the order sender.
[0062] This step is usually performed after the order is delivered and is used to record the key time nodes of the order's entire life cycle. Specifically, the electronic receipt system will first connect with the order management system to obtain the order's unique identifier. Then, the electronic receipt system will query the order sender's logistics system to obtain the order sending time. Next, the electronic receipt system will query the order recipient's confirmation information or logistics system to obtain the order delivery time and actual delivery time. In the process of obtaining these two time points, the electronic receipt system will unify the data format to ensure the accuracy and consistency of the time information.
[0063] S209: Record the order sending time and order delivery time into a preset database.
[0064] The preset database is specifically used to store order time information. Recording means saving the acquired time information in a specific format into the preset database. Order sending time and order delivery time refer to timestamps related to two key nodes in the order processing process.
[0065] This step is executed immediately after successfully obtaining the order sending time and order delivery time. It is used to save these key time information for calculating order processing efficiency, generating statistical reports, and supporting customer inquiry and complaint handling.
[0066] The implementation of this method, due to the use of multiple encryption and verification mechanisms, including secure hash algorithm processing, comprehensive blockchain identifier generation, asymmetric encryption and zero-knowledge proof technology, the present invention significantly improves the security, privacy protection and data integrity of the electronic receipt system, effectively solves the problems of electronic receipts being easily tampered with, privacy data being easily leaked, and transaction information being difficult to verify in the prior art, thereby realizing a highly secure, reliable and privacy-protecting electronic receipt system. The electronic receipt system can not only resist various network attacks, but also prove the validity of data without leaking the specific transaction content, providing a more reliable solution for e-commerce, financial transactions and other fields, greatly improving the efficiency and trust of transactions. Due to the use of flexible personalized parameter settings and digital signature mechanisms, including the steps of obtaining personalized parameters of electronic receipts, adjusting the format of electronic receipts, and performing digital signatures, the present invention greatly improves the applicability and legal effect of the electronic receipt system, effectively solves the problems of the single format of electronic receipts, lack of legal binding force, and difficulty in meeting the needs of different users in the prior art, thereby realizing a highly flexible, legally effective and user-friendly electronic receipt system. The electronic receipt system can not only generate customized electronic receipts according to the needs of different users, but also ensure the non-repudiation and legal effect of electronic receipts through digital signature technology, which not only improves user satisfaction, but also promotes the widespread application of electronic receipts in all walks of life, and promotes the entire industry to develop in a more digital and intelligent direction. Due to the adoption of a complete electronic receipt life cycle management mechanism, including recording order sending and delivery time, supporting electronic receipt update and cancellation operations, etc., the present invention significantly improves the traceability and adaptability of the electronic receipt system, effectively solves the problems of electronic receipts being difficult to track, lacking flexibility, and unable to cope with complex business scenarios in the prior art, and thus realizes a comprehensive, flexible and auditable electronic receipt system. The electronic receipt system can not only clearly record the key time points of the entire transaction process, but also flexibly handle the update and cancellation requirements of electronic receipts, while retaining the complete historical records of all operations through blockchain technology. This all-round management mechanism not only improves the transparency and traceability of the electronic receipt system, but also provides strong evidence support for resolving potential disputes, greatly enhancing the applicability and reliability of electronic receipts in complex business environments.
[0067] The following describes the electronic receipt system in the embodiment of the present invention from the perspective of hardware processing. Figure 3 , which is a schematic diagram of a physical device structure of the electronic receipt system in an embodiment of the present application.
[0068] It should be noted that Figure 3 The structure of the electronic receipt system shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0069] like Figure 3 As shown, the electronic receipt system includes a central processing unit (CPU) 301, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 302 or the program loaded from the storage part 308 to the random access memory (RAM) 303, such as executing the method described in the above embodiment. In RAM 303, various programs and data required for system operation are also stored. CPU 301, ROM 302 and RAM 303 are connected to each other through bus 304. Input / output (I / O) interface 305 is also connected to bus 304.
[0070] The following components are connected to the I / O interface 305: an input section 306 including an audio input device, a button switch, etc.; an output section 307 including a liquid crystal display (LCD) and an audio output device, an indicator light, etc.; a storage section 308 including a hard disk, etc.; and a communication section 309 including a network interface card such as a LAN (Local Area Network) card, a modem, etc. The communication section 309 performs communication processing via a network such as the Internet. A drive 310 is also connected to the I / O interface 305 as needed. A removable medium 311, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 310 as needed so that a computer program read therefrom is installed into the storage section 308 as needed.
[0071] In particular, according to an embodiment of the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present invention includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a computer program for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through the communication part 309, and / or installed from a removable medium 311. When the computer program is executed by the central processing unit (CPU) 301, various functions defined in the present invention are performed.
[0072] It should be noted that specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM), a flash memory, an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in combination with an instruction execution system, apparatus, or device.
[0073] The flowcharts and block diagrams in the accompanying drawings illustrate the possible architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present invention. Each box in the flowchart or block diagram may represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for implementing the specified logical functions. It should also be noted that in some alternative implementations, the functions marked in the box may also occur in an order different from that marked in the accompanying drawings.
[0074] Specifically, the electronic receipt system of this embodiment includes a processor and a memory, and a computer program is stored in the memory. When the computer program is executed by the processor, the blockchain electronic receipt generation and verification method provided in the above embodiment is implemented.
[0075] As another aspect, the present invention further provides a computer-readable storage medium, which may be included in the electronic receipt system described in the above embodiment; or may exist independently without being assembled into the electronic receipt system. The above storage medium carries one or more computer programs, and when the above one or more computer programs are executed by a processor of the electronic receipt system, the electronic receipt system implements the blockchain electronic receipt generation and verification method provided in the above embodiment.
[0076] As described above, the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present application.
[0077] As used in the above embodiments, the term "when..." may be interpreted to mean "if..." or "after..." or "in response to determining..." or "in response to detecting...", depending on the context. Similarly, the phrases "upon determining..." or "if (the stated condition or event) is detected" may be interpreted to mean "if determining..." or "in response to determining..." or "upon detecting (the stated condition or event)" or "in response to detecting (the stated condition or event)", depending on the context.
[0078] Those skilled in the art can understand that to implement all or part of the processes in the above-mentioned embodiments, the processes can be completed by computer programs to instruct related hardware, and the programs can be stored in computer-readable storage media. When the programs are executed, they can include the processes of the above-mentioned method embodiments. The aforementioned storage media include: ROM or random access memory RAM, magnetic disk or optical disk and other media that can store program codes.
Claims
1. A blockchain electronic receipt generation and verification method, characterized in that: Applied to an electronic receipt system, the method includes: receiving an electronic receipt generation request, wherein the electronic receipt generation request includes a plurality of transaction data; Processing the plurality of transaction data using a secure hash algorithm to generate corresponding transaction hash values respectively; Batch process several transaction hash values to generate a comprehensive blockchain identifier; Verifying on the blockchain whether the comprehensive blockchain identifier is unique; If so, encrypting the comprehensive blockchain identifier and the multiple transaction data by using a preset public key to obtain encrypted data; After storing the encrypted data in the blockchain, verifying the encrypted data by using zero-knowledge proof technology; If the verification is successful, an electronic receipt will be generated.
2. The method according to claim 1, characterized in that: The performing of secure hash algorithm processing on the plurality of transaction data to generate corresponding transaction hash values respectively specifically includes: Extract key information from transaction data; Organizing the key information to obtain key transaction information; A preset secure hash algorithm is used to perform a hash operation on the key transaction information to obtain a transaction hash value.
3. The method according to claim 1, characterized in that The encrypting the comprehensive blockchain identifier and the multiple transaction data by using a preset public key to obtain encrypted data specifically includes: Using a preset public key, asymmetrically encrypting the comprehensive blockchain identifier to obtain an identifier ciphertext; Using the preset public key, asymmetrically encrypting the multiple transaction data in sequence to obtain multiple transaction ciphertexts; The identification ciphertext is connected with the multiple transaction ciphertexts in a preset order to obtain the encrypted data.
4. The method according to claim 1, characterized in that: The method further comprises: Get the order sending time of the order sender and the order delivery time of the order receiver; The order sending time and the order delivery time are recorded in a preset database.
5. The method according to claim 1, characterized in that After the step of generating an electronic receipt if the verification is successful, the method further includes: Obtain the electronic receipt personalized parameters of the electronic receipt requester; The format of the electronic receipt is adjusted according to the electronic receipt personalization parameters to obtain a personalized electronic receipt.
6. The method according to claim 5, characterized in that After the step of adjusting the format of the electronic receipt according to the electronic receipt personalization parameter to obtain a personalized electronic receipt, the method further includes: Digitally signing the personalized electronic receipt; A personalized electronic receipt with a digital signature is sent to the electronic receipt requester.
7. The method according to claim 1, characterized in that After the step of generating an electronic receipt if the verification is successful, the method further includes: Obtaining an operation request for the electronic receipt, the operation request including an update request and a cancellation request; If the operation request is the update request, an optimized electronic receipt is generated, and the update operation is written into the transaction record of the blockchain; If the operation request is the cancellation request, the electronic receipt is deleted and the cancellation operation is written into the transaction record of the blockchain.
8. An electronic receipt system, characterized in that: The electronic receipt system includes: one or more processors and a memory; the memory is coupled to the one or more processors, the memory is used to store computer program code, the computer program code includes computer instructions, and the one or more processors call the computer instructions to enable the electronic receipt system to execute the method described in any one of claims 1-7.
9. A computer-readable storage medium comprising instructions, characterized in that: When the instruction is executed on the electronic receipt system, the electronic receipt system is caused to execute the method as described in any one of claims 1 to 7.
10. A computer program product, characterized in that When the computer program product is run on an electronic receipt system, the electronic receipt system is enabled to execute the method according to any one of claims 1 to 7.