A tamper-proof electronic certification system and implementation method thereof
Through improved consensus mechanism and hierarchical design, combined with practical Byzantine fault tolerance algorithm and entropy method, the main nodes are selected, and the problems of data tampering and low throughput in the electronic proof system are solved, and an efficient and reliable electronic proof system is realized, reducing the Resource waste and consensus delay.
Patent Information
- Application Number
- CN202111315335.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-08
- Publication Date
- 2024-12-06
- Estimated Expiration
- 2041-11-08
AI Technical Summary
The existing electronic proof system has the problems of data tampering risks and low system throughput. The traditional system design method is not reliable enough in the proof process, and the smart contract design is bloated, resulting in a large number of files being transmitted during the consensus process, which increases the on-chain burden.
Adopt an improved consensus mechanism and hierarchical design, and use on-chain smart contracts to be responsible for data storage and verification, and off-chain logical calculations. Combining the improved practical Byzantine fault tolerance algorithm and entropy method, select the master node, optimize the consensus process, and reduce the chain Strength to increase system throughput.
A tamper-proof electronic proof system is realized, which improves data consistency and system efficiency, reduces consensus delay, enhances system reliability and throughput, and reduces resource waste.
Smart Images

Figure CN114117545B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of blockchain, and in particular relates to a method for realizing a tamper-proof electronic certification system using an improved consensus mechanism. Background Art
[0002] As Bitcoin and other encrypted digital currencies have received widespread attention, blockchain technology has gradually entered the public eye and become the focus of public attention. Blockchain is a shared, unchangeable ledger that is decentralized, secure and reliable. Anything of value can be tracked and traded on the blockchain network, thereby reducing risks and costs in all aspects. According to the different technical architectures of blockchain, blockchain can be divided into public blockchain, alliance blockchain and private blockchain. In the alliance blockchain, only specific allowed nodes can access the network, which has excellent characteristics such as low-cost operation and maintenance, achievable supervision, and fast transaction speed.
[0003] There are several concepts in the blockchain system: First, there are blocks, which include block headers and block bodies. The block header records the generation time of the block, the hash of the block body, and the hash of the previous block. Block hash means that the information contained in the block header is used to generate a string of uniform length and unique string from strings of different lengths through a hash algorithm. Second, there is the consensus mechanism. The main role of the consensus mechanism in the blockchain is to coordinate the consistency of node accounts in the blockchain network. Commonly used consensus mechanisms include proof of work (POW), delegated proof of stake (DPOS), and practical Byzantine fault tolerance (PBFT). Since the PBFT algorithm causes the network communication volume to increase exponentially with the increase in the number of nodes during the consensus process, and the time to reach a consensus is extended, this system uses the improved practical Byzantine fault tolerance algorithm as the core consensus layer; third, there is the smart contract. A smart contract is a piece of code running on the blockchain. Once an event triggers a condition specified in the contract, the code will automatically run and output the result.
[0004] In daily life, we often need to use various certificates, such as academic certificates, resignation certificates, work experience certificates, medical certificates, etc. If paper certificates are used, there may be cumbersome procedures for issuing certificates, fraud in the issuance process, and difficulty in third-party verification; at the same time, the large-scale use of paper certificates will also waste a lot of resources. In today's popular paperless office, there is an urgent need for an electronic certificate information system. The existing electronic certificate system has the following problems: using traditional system design methods, data may be tampered with during the certification process, and the reliability of the certificate is not high; relying on blockchain, but the system design is unreasonable, the designed smart contract is bloated, all operations are performed on the chain, and a large number of files are transmitted during the consensus process, resulting in low system throughput. Therefore, combining the characteristics of blockchain that cannot be forged, tampered, and traceable with traditional software design methods, combining the chain and the off-chain, the chain focuses on reaching consensus and ensuring the consistent reliability of data, and the off-chain is responsible for logical calculations to reduce the burden on the chain, so that a tamper-proof electronic certificate system can be constructed. Summary of the invention
[0005] The present invention aims to solve the above problems of the prior art. A tamper-proof electronic certification system and its implementation method are proposed. The technical solution of the present invention is as follows:
[0006] A tamper-proof electronic certification system, comprising:
[0007] The presentation layer is used to interact with users, who manage files, issue certificates, and verify certificates through browsers or mobile applications.
[0008] The service layer includes the on-chain smart contract module and the off-chain service module. The on-chain smart contract module is the smart contract, which is responsible for the identification and storage of electronic information and address verification. The identification and storage adopts an improved consensus mechanism, which mainly improves the selection method of the master node. The improved method of selecting the master node is to select the node with the highest score as the master node through the scoring mechanism;
[0009] The off-chain service module is responsible for account management, organization management, and operation log management of system users; the infrastructure layer includes blockchain and data storage modules. The blockchain module includes a consistency management module and a state synchronization management module. The consistency management module is used to coordinate the consistency of node accounts in the blockchain network and adopts an improved consensus mechanism for processing; the state synchronization management module is used for blockchain to broadcast the length of the local blockchain and receive and store missing blocks; the data storage module is used for users to save log information generated by the system and user account information.
[0010] Furthermore, the on-chain smart contract module implements the identification and storage of electronic information, specifically including the following steps:
[0011] Step 1: Use hash to calculate the digital fingerprint of the certificate file uploaded by the logged-in authenticated user. The generated digital fingerprint uniquely represents the file.
[0012] Step 2: Through the improved consensus mechanism, the data of each node is consistent to form a new block. The improved consensus algorithm mainly optimizes the way of selecting the master node;
[0013] Step 3: After the submitted information forms a new block, the file is synchronously uploaded to the file resource server through the file service and the corresponding download address link is returned.
[0014] Furthermore, the consensus process also includes the following steps:
[0015] At the beginning of the consensus, all nodes are given an initial score, and then the resource configuration of each node is counted. The weight of each resource is calculated by the entropy method, and finally a ranking of service quality is obtained, and the best node is selected as the master node;
[0016] Packing blocks. After the master node is selected, the transaction information is packaged into blocks, which contain the block generation time, initiator information, and digital fingerprint information of the proof materials;
[0017] Transaction broadcast, Practical Byzantine Fault Tolerance (PBFT) adopts a three-stage protocol broadcast method, which consists of three stages: Pre-Prepare, Prepare, and Commit.
[0018] Furthermore, the three-stage broadcast communication of Pre-Prepare, Prepare and Commit specifically includes:
[0019] After receiving the client request, the master node assigns a sequence number n to the request and broadcasts a prepare message to all replicas; Prepare phase: If the replica's prepare message is true, it accepts the prepare message and broadcasts the prepare message to other replicas; Commit phase: If a replica receives 2f (including itself) prepare messages that are identical to the prepare message, it enters the commit phase, where f represents the number of Byzantine nodes, and broadcasts a confirmation message to all replicas; Reply phase: If a replica receives 2f+1 identical confirmation messages, it replies to the client with a response message. If the client receives f+1 identical response messages, the request is executed.
[0020] Furthermore, in step 1: using hash to calculate the digital fingerprint of the certification file uploaded by the logged-in authenticated user, the generated digital fingerprint uniquely represents the file;
[0021] The formula for obtaining the digital fingerprint by hash calculation is: β=SHA256(Φ), where β represents the digital fingerprint of the file, Φ represents the input file, and SHA256 is the hash calculation function.
[0022] Furthermore, the implementation of the address verification specifically includes the following steps:
[0023] Step 1: Calculate the digital fingerprint of the downloaded user-uploaded certification file;
[0024] Step 2: Obtain the digital fingerprint of the corresponding block based on the unique key value of the user file;
[0025] Step 3: Compare the digital fingerprint of the downloaded file with the digital fingerprint on the chain. If they are consistent, the received file is correct and complete. If they are inconsistent, the received file has been tampered with and is not credible.
[0026] Furthermore, the presentation layer can be implemented through a web browser, WeChat applet or App application.
[0027] A method for implementing any of the above systems, wherein the proof document is uploaded to the chain specifically comprises the following steps:
[0028] Step 1: Register users and institutions; applicants log in to the system and apply for corresponding certification documents according to their needs and the corresponding institutions;
[0029] Step 2: The institution receives the application, issues certification documents and supporting materials, uploads the documents, and requests blockchain services;
[0030] Step 3: The blockchain service receives the request to upload to the chain, verifies the institution information and file information through the smart contract, calculates the digital fingerprint of the file, and reaches a consensus through the consensus mechanism to generate a new block;
[0031] Step 4: After the block is generated, both the institution and the applicant will receive feedback and obtain the storage address of the certification document, which will be encrypted using the applicant’s private key;
[0032] Step 5: The verifier obtains the file through the corresponding file address.
[0033] Furthermore, the process of document verification specifically includes:
[0034] Step 1: The verifier logs in to the system, parses the real file address through the public key, and downloads the file;
[0035] Step 2: The verifier will verify the obtained file on the chain through the smart contract, and compare the digital fingerprint of the downloaded file with the digital fingerprint existing on the chain to see if they are consistent. If they are consistent, the certification file is valid, otherwise it is invalid.
[0036] The advantages and beneficial effects of the present invention are as follows:
[0037] (1) The present invention uses blockchain technology to solve the problem of forged certification documents in the existing certification process. It uses the tamper-proof characteristics of blockchain and the convenience of information systems to reduce unnecessary steps in the certification process, save time for both parties involved in the certification, and achieve paperless office.
[0038] (2) The system design is modular and layered, which is conducive to the expansion of functions according to needs in the future;
[0039] (3) On-chain smart contracts are combined with off-chain business logic. The on-chain is only responsible for transaction verification and uploading of key information, while the off-chain is responsible for specific business logic calculations. Through streamlined contracts and minimized data, the on-chain transaction burden is reduced and the consensus speed is accelerated.
[0040] (4) Use an improved consensus mechanism to reach consensus. Existing improvement solutions include combining delegated proof of stake with improved encryption methods using elliptic curves. These methods have the problem of a single method for selecting the master node and the easy generation of power concentration. This improved mechanism fully considers factors such as the computing power and bandwidth of each node, calculates the optimal node as the master node, reduces consensus latency, and improves system throughput. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] Figure 1 This is a diagram of the overall design architecture of the preferred embodiment system provided by the present invention;
[0042] Figure 2 It is a three-stage broadcast protocol diagram;
[0043] Figure 3 Schematic diagram of document chain upload and verification. DETAILED DESCRIPTION
[0044] The following will describe the technical solutions in the embodiments of the present invention in detail in conjunction with the accompanying drawings in the embodiments of the present invention. The described embodiments are only part of the embodiments of the present invention.
[0045] The technical solution of the present invention to solve the above technical problems is:
[0046] A method for implementing a tamper-proof electronic proof system. The system is mainly divided into a display layer, a service layer, and an infrastructure layer. It uses on-chain evidence verification and off-chain electronic proof query management to quickly and effectively realize the electronicization of proof materials. Figure 1 The specific description is as follows:
[0047] 1. The presentation layer is mainly used to interact with users. Users can register, log in, manage files, issue certificates, and verify certificates through browsers or mobile applications. Each function in the presentation layer calls the services provided by the service layer through interfaces to achieve specific functions.
[0048] 2. The service layer includes on-chain code and off-chain service parts. The on-chain code is the smart contract, which is responsible for the identification, storage and address verification of electronic information.
[0049] There are several steps to identify the certificate:
[0050] Step 1: Calculate the digital fingerprint of the certificate file uploaded by the logged-in authenticated user. Here, the hash method is used for processing. The generated digital fingerprint uniquely represents the file. Any change to the file will cause the digital fingerprint to change.
[0051] Step 2: Through the improved consensus mechanism, the data of each node is consistent to form a new block. The improved consensus algorithm mainly optimizes the way of selecting the master node. The consensus process is described as follows:
[0052] (1) Selecting the master node. The original PBFT consensus algorithm performs a modulo operation on the total number of nodes based on the current view number. For example, if the current view number is 1 and the total number of nodes is 50, the master node will be the node numbered 1 after the modulo operation. Because the blockchain consumes a lot of network bandwidth or computing resources in the process of generating blocks, the selection of the master node may result in the selection of a malicious master node or the master node may have low bandwidth, memory, and other configurations, resulting in unnecessary view switching, which reduces the system throughput.
[0053] Through analysis, the improved way to select the master node is to calculate the service quality score of each node and select the node with the highest score as the master node, so as to ensure the reliability of the selected master node. At the beginning of the consensus, all nodes are given an initial score, and then the resource configuration of each node is counted, and the weight of each resource is calculated by the entropy method. Finally, a service quality ranking is obtained, and the best node is selected as the master node.
[0054] (2) Packaging blocks: After the master node is selected, the transaction information needs to be packaged into blocks. The blocks contain the block generation time, initiator information, and digital fingerprint information of the proof materials.
[0055] (3) Transaction broadcast: The PBFT algorithm uses a three-stage protocol broadcast method, which consists of three stages: Pre-Prepare, Prepare, and Commit. Figure 2 As shown. After receiving the client request, the master node assigns a sequence number n to the request and broadcasts a pre-prepare message to all replicas; Prepare phase: If the replica pre-prepare message is true, it accepts the pre-prepare message and broadcasts the prepare message to other replicas; Commit phase: If the replica receives 2f (including itself) prepare messages that are the same as the pre-prepare message, it enters the commit phase and broadcasts a confirmation message to all replicas; Reply phase: If the replica receives 2f+1 identical confirmation messages, it replies a response message to the client. If the client receives f+1 identical response messages, the request is executed.
[0056] Step 3: After the submitted information forms a new block, the file is synchronously uploaded to the file resource server through the file service and the corresponding download address link is returned.
[0057] Address verification has the following steps:
[0058] Step 1: Calculate the digital fingerprint of the downloaded user-uploaded certification file;
[0059] Step 2: Obtain the digital fingerprint of the corresponding block based on the unique key value of the user file;
[0060] Step 3: Compare the digital fingerprint of the downloaded file with the digital fingerprint on the chain. If they are consistent, the received file is correct and complete. If they are inconsistent, the received file has been tampered with and is not credible.
[0061] The off-chain code is responsible for user management, organization management, document services, electronic certificate management, and operation log management.
[0062] User management and organization management are responsible for the login and registration of corresponding users or organizations;
[0063] Any operation performed by the user in the system will be recorded in the database through operation log management, including operations such as user login, registration, file download, file upload, and search, which facilitates the monitoring of system operations;
[0064] The file service provides file upload and download operations. Users can upload files to the file server through this service, and download files to the corresponding files according to the file address;
[0065] The electronic certificate management service provides electronic certificate query, chain upload and verification functions.
[0066] 3. The infrastructure layer includes the blockchain environment and the data storage environment. The blockchain environment has consistency management and state synchronization management. The consistency management mainly coordinates the consistency of node accounts in the blockchain network, which is processed using an improved consensus mechanism; the state synchronization management is mainly used for blockchain broadcasting the length of the local blockchain and receiving and storing missing blocks. The data storage user saves the log information generated by the system, user account information, and file storage, etc.
[0067] Proof of document upload and verification Figure 3 As an example, the following describes a specific use case process of putting a proof document on the chain:
[0068] Precondition: users and institutions have registered;
[0069] Step 1: Applicants log in to the system and apply for corresponding certification documents according to their needs and the corresponding institutions;
[0070] Step 2: The institution receives the application, issues certification documents and supporting materials, uploads the documents, and requests blockchain services;
[0071] Step 3: The blockchain service receives the request to upload to the chain, verifies the institution information and file information through the smart contract, calculates the digital fingerprint of the file, and reaches a consensus through the consensus mechanism to generate a new block;
[0072] Step 4: After the block is generated, both the institution and the applicant will receive feedback and obtain the storage address of the certification document, which will be encrypted using the applicant’s private key;
[0073] Step 4: The verifier obtains the file through the corresponding file address.
[0074] The following describes a specific use case process for document verification:
[0075] Step 1: The verifier logs in to the system, parses the real file address through the public key, and downloads the file;
[0076] Step 2: The verifier will verify the obtained file on the chain through the smart contract, and compare the digital fingerprint of the downloaded file with the digital fingerprint existing on the chain to see if they are consistent. If they are consistent, the certification file is valid, otherwise it is invalid.
[0077] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, the computer may be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
[0078] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0079] The above embodiments should be understood to be only used to illustrate the present invention and not to limit the protection scope of the present invention. After reading the contents of the present invention, technicians can make various changes or modifications to the present invention, and these equivalent changes and modifications also fall within the scope defined by the claims of the present invention.
Claims
1. A tamper-proof electronic certification system, characterized in that: include: The presentation layer is used to interact with users, who manage files, issue certificates, and verify certificates through browsers or mobile applications. The service layer includes the on-chain smart contract module and the off-chain service module. The on-chain smart contract module is the smart contract, which is responsible for the identification and storage of electronic information and address verification. The identification and storage adopts an improved consensus mechanism and an improved method for selecting the master node. The improved method for selecting the master node is to select the node with the highest score as the master node through the scoring mechanism; The off-chain service module is responsible for account management, organization management, and operation log management of system users; Infrastructure layer: The infrastructure layer includes blockchain and data storage modules. The blockchain module includes consistency management module and state synchronization management module. The consistency management module is used to coordinate the consistency of node accounts in the blockchain network and adopts an improved consensus mechanism for processing; the state synchronization management module is used for blockchain to broadcast the length of the local blockchain and receive and store missing blocks; the data storage module is used for users to save the log information generated by the system and user account information; The on-chain smart contract module implements the identification and storage of electronic information, which specifically includes the following steps: Step 1: Use hash to calculate the digital fingerprint of the certificate file uploaded by the logged-in authenticated user. The generated digital fingerprint uniquely represents the file. Step 2: Through the improved consensus mechanism, the data of each node is consistent to form a new block. The improved consensus algorithm optimizes the way of selecting the master node; Step 3: After the submitted information forms a new block, the file is uploaded to the file resource server synchronously through the file service and the corresponding download address link is returned; The consensus process also includes the following steps: At the beginning of the consensus, all nodes are given an initial score, and then the resource configuration of each node is counted. The weight of each resource is calculated by the entropy method, and finally a ranking of service quality is obtained, and the best node is selected as the master node; Packing blocks. After the master node is selected, the transaction information is packaged into blocks, which contain the block generation time, initiator information, and digital fingerprint information of the proof materials; Transaction broadcast, the Practical Byzantine Fault Tolerance algorithm PBFT adopts a three-stage protocol broadcast method, which includes Pre-Prepare, Prepare, and Commit. The three-stage broadcast communication of Pre-Prepare, Prepare and Commit specifically includes: After receiving the client request, the master node assigns a sequence number n to the request and broadcasts a pre-prepare message to all replicas; Prepare phase: If the replica pre-prepare message is true, it accepts the pre-prepare message and broadcasts the prepare message to other replicas; Commit phase: If the replica receives 2f prepare messages that are the same as the pre-prepare message, it enters the commit phase, where f represents the number of Byzantine nodes, and broadcasts a confirmation message to all replicas; Reply phase: If the replica receives 2f+1 identical confirmation messages, it replies a response message to the client. If the client receives f+1 identical response messages, the request is executed. Step 1: using hash to calculate the digital fingerprint of the certification file uploaded by the logged-in authenticated user, the generated digital fingerprint uniquely represents the file; The formula for obtaining the digital fingerprint by hash calculation is: β = SHA256(Φ), where β represents the digital fingerprint of the file, Φ represents the input file, and SHA256 is the hash calculation function; The implementation of the addressing verification specifically includes the following steps: Step 1: Calculate the digital fingerprint of the downloaded user-uploaded certification file; Step 2: Obtain the digital fingerprint of the corresponding block based on the unique key value of the user file; Step 3: Compare the digital fingerprint of the downloaded file with the digital fingerprint on the chain. If they are consistent, the received file is correct and complete. If they are inconsistent, the received file has been tampered with and is not credible.
2. The tamper-proof electronic certification system according to claim 1, characterized in that: The presentation layer can be implemented through a web browser, WeChat applet or App application.
3. A method for implementing the system according to any one of claims 1 to 2, characterized in that: The specific steps of putting the certification documents on the chain include: Step 1: Register users and institutions; applicants log in to the system and apply for corresponding certification documents according to their needs and the corresponding institutions; Step 2: The institution receives the application, issues certification documents and supporting materials, uploads the documents, and requests blockchain services; Step 3: The blockchain service receives the request to upload to the chain, verifies the institution information and file information through the smart contract, calculates the digital fingerprint of the file, and reaches a consensus through the consensus mechanism to generate a new block; Step 4: After the block is generated, both the institution and the applicant will receive feedback and obtain the storage address of the certification document, which will be encrypted using the applicant’s private key; Step 5: The verifier obtains the file through the corresponding file address.
4. The implementation method according to claim 3, characterized in that: The use case process of document verification specifically includes: Step 1: The verifier logs in to the system, parses the real file address through the public key, and downloads the file; Step 2: The verifier will verify the obtained file on the chain through the smart contract, and compare the digital fingerprint of the downloaded file with the digital fingerprint existing on the chain to see if they are consistent. If they are consistent, the certification file is valid, otherwise it is invalid.
