A method for data packaging in the construction field based on blockchain

By adopting blockchain-based data packaging methods in the construction industry, the shortcomings of data digitization and security management in the construction industry are solved, and data privacy protection, regulatory transparency and transaction efficiency are improved.

CN114218596BActive Publication Date: 2025-06-17GUANYUAN (SHANGHAI) TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111619321.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-28
Publication Date
2025-06-17
Estimated Expiration
2041-12-28

AI Technical Summary

Technical Problem

The lack of effective data digitization and security management in the construction industry has led to time-consuming data sorting and prone to data tampering. The existing blockchain technology still has flaws in data security, usage efficiency and supervision.

Method used

A blockchain-based data packaging method is adopted to collect data to be chained through the business system module, and the block packaging service module is used to clean, encrypt and package data, and finally send the data to the blockchain system. This method includes HTTPS module, transaction pool module, block template management module, data packaging module, database module, key management module and GRPC module to ensure data privacy, regulatory transparency and transaction efficiency.

Benefits of technology

Ensure data privacy through symmetric encryption algorithms, authorize regulatory authorities to achieve penetrating control, reduce interaction with blockchain, shorten transaction confirmation time, and achieve rapid retrieval through data labels, improving the efficiency and security of data management.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114218596B_ABST
    Figure CN114218596B_ABST
Patent Text Reader

Abstract

The present invention discloses a method for data packaging in the construction field based on blockchain, which includes a business system module, a block packaging service module, and a blockchain system; the block packaging service module includes an HTTPS module, a transaction pool module, a block template management module, a data packaging module, a database module, a key management module, and a GRPC module. The present invention extracts business data and submits on-chain parameters; generates fields such as unique identifiers, business types, data tags, etc. for classification or retrieval for the data; the packaging service generates a symmetric key and encrypts the private data to be put on the chain; uses the public key of the person putting data on the chain and the public key of the supervisor to encrypt the symmetric key respectively, and puts the encrypted ciphertext on the chain; assembles transactions and sends them to the blockchain network. Through the above steps, data security, penetrative supervision, immutability, and efficient query are ensured.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of blockchain, and in particular to a method for data packaging in the field of construction based on blockchain. Background Art

[0002] Currently in the construction industry, many construction companies still use paper data recording methods, which makes it impossible to digitize construction data, and data collation requires a lot of manpower; although a few construction companies use digital methods to record data, the data is still only retained within the company, and the company has all the operating rights of the data, which is prone to data tampering; for the very few data recording systems that use blockchain, although the problems of data digitization and anti-tampering are solved, there are still defects in data security, efficiency of use, and supervision. Therefore, we make improvements to this and propose a method for data packaging in the construction field based on blockchain. Summary of the invention

[0003] In order to solve the above technical problems, the present invention provides the following technical solutions:

[0004] The present invention discloses a method for data packaging in the field of construction based on blockchain, comprising a business system module, a block packaging service module and a blockchain system; the business system module collects data to be uploaded to the blockchain in the construction enterprise, and then sends the data to the block packaging service module, and uses the block packaging service module to package the data to be uploaded to the blockchain, and then sends the packaged data to the blockchain into the blockchain system;

[0005] The block packaging service module includes an HTTPS module, a transaction pool module, a block template management module, a data packaging module, a database module, a key management module and a GRPC module, specifically the following steps:

[0006] Step 1: For the data that needs to be uploaded to the chain, clean the data according to the business type of the data to form the original data for uploading to the chain;

[0007] Step 2: Submit the original data to be uploaded to the block packaging service module through the data upload interface provided by the HTTPS module; then the HTTPS module stores the verified data to be uploaded to the transaction pool;

[0008] Step 3: The HTTPS module notifies the packaging module that there are pending transactions in the transaction pool. The packaging module obtains a block template through the block template management module. The template management module periodically obtains status information from the blockchain and assembles the template; then it obtains the transactions to be uploaded from the transaction pool;

[0009] Step 4: The packaging module operates on each transaction retrieved from the transaction pool one by one, generates a symmetric key for each transaction, encrypts the transaction content with this symmetric key to obtain the ciphertext, encrypts the original transaction, assembles the on-chain transaction data structure, and adds it to the block;

[0010] Step 5: The packaging module calls the key management module to perform a digital signature on the assembled block to complete the block assembly work; the packaging module returns the transactions that have not been packed into the block to the transaction pool, updates the block template, and adds the newly chained block to the parent block field of the template;

[0011] Step 6: The packaging module sends the assembled block to the corresponding blockchain node of this participant through the GRPC module and sends it into the blockchain system for data consensus.

[0012] As a preferred technical solution of the present invention, the HTTPS module performs a simple verification on the data submitted by the user, including whether the parameters of the original data are complete, whether the original data conforms to the business logic; checks whether the original data of the request is a duplicate submission; and whether the original data is legal.

[0013] As a preferred technical solution of the present invention, after the original transaction is encrypted, the encrypted symmetric key is encrypted with the public key of this participant; finally, the symmetric key is encrypted with the public key of the regulatory department, and the encrypted transaction ciphertext, the symmetric key ciphertext encrypted with the public key of the participant and the symmetric key ciphertext encrypted with the public key of the regulatory department, the business type to which the transaction belongs, and the transaction data label are assembled into the on-chain transaction data structure and added to the transaction area of the block; check whether the block size exceeds the limit. If it does not exceed, the packaging module continues to operate on each transaction retrieved from the transaction pool one by one and adds the next transaction to the block. If it exceeds, the loop exits and enters Step 5.

[0014] As a preferred technical solution of the present invention, the packaging module checks whether there is still data to be chained in the transaction pool. If so, the process of data packaging is repeated until all the data in the transaction pool is packed.

[0015] As a preferred technical solution of the present invention, the original data should include: the business type of the data, the unique identifier of the data, the version number of the data, and optionally the data label.

[0016] As a preferred technical solution of the present invention, the transactions in the transaction pool are stored separately according to the unique identifiers of the signers, realizing data isolation for different signers; the block template management module queries the latest status from the blockchain node every 3 seconds to update the block template; and when a new blockchain is packaged, the Hash of the new block is put into the parent block field of the template, replacing an earlier block Hash in the parent block field.

[0017] As a preferred technical solution of the present invention, the key management module is used to manage the public and private keys of the node, manage the digital certificates of all known on-chain users, and is used when authorizing data access; secondly, the key management module also provides functions such as generation, encryption and decryption of symmetric keys, encryption and decryption of asymmetric keys, signature, and signature verification.

[0018] As a preferred technical solution of the present invention, the method of obtaining the transactions to be put on the chain from the transaction pool is to obtain the transactions to be put on the chain of the same signer each time.

[0019] As a preferred technical solution of the present invention, the business system module is used to collect the data to be put on the chain in construction enterprises, and generate a unique data identifier, data version, data type and data label that meet its own application requirements for the data.

[0020] The updated block template is used to replace an existing parent block in the template with the Hash of the new block, realizing the reference to the historical block.

[0021] The beneficial effects of the present invention are:

[0022] This method of data packaging in the construction field based on blockchain ensures the privacy of on-chain data through the symmetric encryption algorithm; by authorizing the regulatory agency, it ensures that the regulatory node can conduct penetrative control over the on-chain data; in addition, the packaging service obtains the on-chain status once every period of time, assembles the block version, and updates the block template according to the real-time packaging situation within this period, thereby reducing the interaction with the blockchain, and being able to quickly confirm the transaction by referring to the blocks sent before by itself during the transaction peak, shortening the transaction confirmation time; the present invention also sets data labels for the on-chain data, and users can customize labels for the data when putting it on the chain. The labels are stored in plain text, and the data can be quickly retrieved through the labels when using the data later. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] The drawings are used to provide a further understanding of the present invention, and constitute a part of the specification. Together with the embodiments of the present invention, they are used to explain the present invention, and do not constitute a limitation to the present invention. In the drawings:

[0024] Figure 1 is a flowchart of a method for data packaging in the construction field based on blockchain according to the present invention;

[0025] Figure 2 is a system block diagram of a method for data packaging in the construction field based on blockchain according to the present invention;

[0026] Figure 3 is a deployment architecture diagram of the method for data packaging in the construction field based on blockchain in Embodiment 2;

[0027] In the figure: 1. Business system module; 2. Block packaging service module; 3. Blockchain system; 4. HTTPS module; 5. Transaction pool module; 6. Block template management module; 7. Data packaging module; 8. Database module; 9. Key management module; 10. GRPC module. Specific embodiments

[0028] The following describes the preferred embodiments of the present invention with reference to the accompanying drawings. It should be understood that the preferred embodiments described herein are only used to illustrate and explain the present invention, and are not used to limit the present invention.

[0029] Embodiment 1: As shown in and, a method for data packaging in the construction field based on blockchain according to the present invention includes a business system module 1, a block packaging service module 2, and a blockchain system 3; the business system module 1 is used to collect the data to be chained in a construction enterprise, and then send it to the block packaging service module 2. The block packaging service module 2 is used to package and chain the data to be chained, and send the chained data after packaging and chaining to the blockchain system 3.

[0030] Embodiment 1: As Figure 1 and Figure 2 shown, a method for data packaging in the construction field based on blockchain according to the present invention includes a business system module 1, a block packaging service module 2, and a blockchain system 3; the business system module 1 is used to collect the data to be chained in a construction enterprise, and then send it to the block packaging service module 2. The block packaging service module 2 is used to package and chain the data to be chained, and send the chained data after packaging and chaining to the blockchain system 3.

[0031] The block packaging service module 2 includes an HTTPS module 4, a transaction pool module 5, a block template management module 6, a data packaging module 7, a database module 8, a key management module 9, and a GRPC module 10. Specifically, the steps are as follows: Transactions in the transaction pool are stored separately according to the unique identifier of the signer to achieve data isolation for different signers; The block template management module queries the latest status from the blockchain node every 3 seconds to update the block template; And when a new blockchain is packaged, the Hash of the new block is placed in the parent block field of the template, replacing an earlier block Hash in the parent block field. The key management module is used to manage the public and private keys of the node and manage the digital certificates of all known on-chain users for use in data access authorization; Secondly, the key management module also provides functions such as the generation, encryption, and decryption of symmetric keys, the encryption and decryption of asymmetric keys, signature, and signature verification. The method of obtaining transactions to be uploaded to the chain from the transaction pool is to obtain transactions to be uploaded to the chain of the same signer each time. The business system module is used to collect data to be uploaded to the chain in construction enterprises and generate unique data identifiers, data versions, data types, and data tags that meet its own application requirements for the data; The updated block template is used to replace an existing parent block in the template with the Hash of the new block to achieve a reference to the historical block.

[0032] Step 1: For the data to be uploaded to the chain, perform data cleaning according to the business type of the data to form the original data for uploading to the chain; The HTTPS module performs simple verification on the data submitted by the user, including whether the parameters of the original data are complete, whether the original data conforms to the business logic; Check whether the original data of the request is a duplicate submission; And whether the original data is legal;

[0033] Step 2: Through the data upload interface provided by the HTTPS module, submit the original data to be uploaded to the chain to the block packaging service module; Then the HTTPS module stores the verified data to be uploaded to the chain in the transaction pool;

[0034] Step 3: The HTTPS module notifies the packaging module, informing the packaging module that there are transactions to be processed in the transaction pool. The packaging module obtains a block template through the block template management module. The template management module will regularly obtain status information from the blockchain and assemble the template; Then obtain the transactions to be uploaded to the chain from the transaction pool;

[0035] Step 4: The packaging module operates on each transaction retrieved from the transaction pool one by one, generates a symmetric key for each transaction, encrypts the transaction content with this symmetric key to obtain the ciphertext, realizes the encryption of the original transaction, assembles the on-chain transaction data structure, and adds it to the block; after the encryption of the original transaction is completed, the encrypted symmetric key is encrypted with the public key of this participant; finally, the symmetric key is encrypted with the public key of the regulatory department, and the encrypted transaction ciphertext, the encrypted symmetric key encrypted with the public key of the participant, the symmetric key ciphertext encrypted with the public key of the regulatory department, the business type to which the transaction belongs, and the transaction data label are assembled into the on-chain transaction data structure and added to the transaction area of the block; check whether the block size exceeds the limit. If it does not exceed, the packaging module continues to operate on each transaction retrieved from the transaction pool one by one and adds the next transaction to the block. If it exceeds, exit the loop and enter Step 5.

[0036] Step 5: The packaging module calls the key management module to digitally sign the assembled block to complete the assembly work of the block; the packaging module returns the transactions that have not been packaged into the block to the transaction pool, updates the block template, and adds the newly chained block to the parent block domain of the template;

[0037] Step 6: The packaging module sends the assembled block to the blockchain node corresponding to this participant through the GRPC module and sends it into the blockchain system for data consensus.

[0038] When the packaging module checks whether there is still data to be chained in the transaction pool, if there is, repeat the process of data packaging until all the data in the transaction pool is packaged.

[0039] Embodiment 2, as Figure 3 shown, is the deployment architecture diagram of the entire system. Each server in the figure represents a service node; among them, N1, N2, G1, and Ni are blockchain nodes, where N1, N2, and Ni represent ordinary construction companies, and G1 represents the national regulatory department; P1 represents the data packaging service corresponding to N1, and B1 represents the business system service corresponding to N1; generally, N1, P1, and B1 are deployed in the same intranet, and N1, N2, Ni, and G1 are in the external network environment. Attached Figure 2 is the architecture diagram of the packaging service. Each box in the figure represents a sub-module; Attached Figure 3 is the flowchart of the data packaging service. Each box in the figure represents a code operation.

[0040] The following will describe the present invention in detail with reference to the attached Figure 3 drawings.

[0041] Suppose there is a piece of attendance data in the business system corresponding to N1 waiting to be uploaded to the blockchain. First, B1 constructs a unique data identifier, data version, attendance content, and data label for this piece of data. Suppose the constructed request body is as follows: {"dataId":"RECORD_101","dataVersion":"101","bizCode":"1001","dataContent":"Name: Zhang San Attendance Address: No. XX, XX Street, XX City, XX Province Attendance Time: October 8, 2021 06:30:28","indexes":{"project":"Project101"}};

[0042] B1 calls the http interface provided by P1 and submits the transaction TX1 to be uploaded to the blockchain;

[0043] After receiving the request sent by B1, P1 executes the following steps:

[0044] Step S1001 verifies whether the parameters submitted by B1 are legal and whether they include the data identifier, data version, business type, and data content. If the parameters are legal and include the required mandatory items, proceed to the next step; otherwise, return an error message;

[0045] Step S1002 verifies whether the parameters submitted by B1 have been uploaded to the blockchain. If a request with the same parameters has been processed, directly return the processing success; if not, proceed to the next step;

[0046] Step S1003 puts the transaction TX1 into the transaction pool;

[0047] Step S1004 calculates MsgHash = Hash("RECORD_101" + "101") and records MsgHash in the database for subsequent duplicate verification;

[0048] Step S1005 notifies the data packaging module that there is a new transaction waiting to be uploaded to the blockchain;

[0049] After receiving the notification, in step S1006, the packaging module obtains a block template T1 from the block template management module. T1 has already been filled with the block timestamp, the list of referenced parent blocks, etc.;

[0050] Step S1007 retrieves the attendance data TX1 to be uploaded from the transaction pool;

[0051] Step S1008 uses a random number generation algorithm to generate a symmetric key CipherKey;

[0052] Step S1009 encrypts the attendance data using a symmetric key and calculates: EncData = Cipher("Name: Zhang San, Attendance Address: No. XX, XX Street, XX City, XX Province, Attendance Time: October 8, 2021, 06:30:28", CipherKey);

[0053] Step S1010 encrypts the symmetric key using the N1 public key and calculates EncCipherKeyN1 = Encrypt(CipherKey, PublicKeyN1);

[0054] Step S1011 encrypts the symmetric key using the G1 public key and calculates EncCipherKeyG1 = Encrypt(CipherKey, PublicKeyG1);

[0055] Step S1012 assembles dataId, dataVersion, bizCode, EncData, EncCipherKeyN1, EncCipherKeyG1, and the data label Indexes into a blockchain transaction;

[0056] Step S1013 adds the assembled blockchain transaction to the block template;

[0057] Step S1014 determines whether the current block exceeds the 4M limit. If it does, execute S1015; if not, determine whether there is a transaction of the signer in the transaction pool. If there is, execute S1007; if not, execute A1015;

[0058] Step S1015 digitally signs the assembled block using the private key of N1 and calculates: sign = PublicSign(T1, PrivateKeyN1)

[0059] Step S1016 sends the assembled T1 to the blockchain node N1;

[0060] Step S1017 calculates the hash value of the block, BlockHash = Hash(T1), and places BlockHash into the parent block field of the template to form a new block template T2 for use in the next packaging;

[0061] Return the result of data uploading to the blockchain and end.

[0062] After the packaging service, the plaintext data submitted by the business side B1 is encrypted into ciphertext EncData, ensuring the privacy of the data; the encryption key is encrypted with the public keys of N1 and G1 to ensure that N1 and G1 have access rights to the data; when the data is uploaded to the blockchain, bizCode and Indexes are stored in plaintext, so that in subsequent operations such as queries, classification can be performed through BizCode, and efficient query of the data can be achieved through the Indexes data tags.

[0063] Finally, it should be noted that the above are only the preferred embodiments of the present invention and are not used to limit the present invention. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art can still modify the technical solutions described in the foregoing embodiments or perform equivalent replacements for some of the technical features. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A method for data packaging in the construction field based on blockchain, characterized in that: It includes a business system module (1), a block packaging service module (2), and a blockchain system (3); the business system module (1) is used to collect the data to be chained in a construction enterprise, and then send it to the block packaging service module (2). The block packaging service module (2) is used to package and chain the data to be chained, and send the chained data after packaging to the blockchain system (3). The block packaging service module (2) includes an HTTPS module (4), a transaction pool module (5), a block template management module (6), a data packaging module (7), a database module (8), a key management module (9), and a GRPC module (10). The method of data packaging is specifically the following steps: Step 1: Clean the data to be chained according to the business type of the data to form the original data for chaining. Step 2: Through the data chaining interface provided by the HTTPS module, submit the original data to be chained to the block packaging service module; then the HTTPS module stores the data to be chained that has passed the verification in the transaction pool. Step 3: The HTTPS module notifies the packaging module, informing the packaging module that there are transactions to be processed in the transaction pool. The packaging module obtains a block template through the block template management module. The template management module will regularly obtain the status information from the blockchain and assemble the template; then obtain the transactions to be chained from the transaction pool. Step 4: The packaging module operates on the transactions obtained from the transaction pool one by one, generates a symmetric key for each transaction, encrypts the transaction content with this symmetric key to obtain the ciphertext, realizes the encryption of the original transaction, assembles the on-chain transaction data structure, and adds it to the block. Step 5: The packaging module calls the key management module to digitally sign the assembled block to complete the assembly work of the block. The packaging module returns the transactions that have not been packaged into the block to the transaction pool, updates the block template, and adds the newly chained block to the parent block field of the template. Step 6: The packaging module sends the assembled block to the corresponding blockchain node of the participant through the GRPC module and sends it into the blockchain system for data consensus. After the encryption of the original transaction is completed, the encrypted symmetric key is encrypted with the public key of the participant; finally, the symmetric key is encrypted with the public key of the regulatory department. The encrypted transaction ciphertext, the symmetric key ciphertext encrypted with the public key of the participant, the symmetric key ciphertext encrypted with the public key of the regulatory department, the business type to which the transaction belongs, and the transaction data label are assembled into the on-chain transaction data structure and added to the transaction area of the block; check whether the block size exceeds the limit. If it does not exceed, the packaging module continues to operate on the transactions obtained from the transaction pool one by one and adds the next transaction to the block. If it exceeds, the loop exits and enters Step 5. Transactions in the transaction pool are stored separately according to the unique identifier of the signer, realizing data isolation for different signers; the block template management module queries the latest status from the blockchain node every 3 seconds to update the block template; and then packages a new blockchain, puts the Hash of the new block into the parent block field of the template, and replaces an earlier block Hash in the parent block field.

2. The method for data packaging in the construction field based on blockchain according to claim 1, characterized in that, The HTTPS module performs simple verification on the data submitted by the user, including whether the parameters of the original data are complete, whether the original data conforms to the business logic; checks whether the original data of the request is a duplicate submission; and whether the original data is legal.

3. The method for data packaging in the construction field based on blockchain according to claim 1, characterized in that, The packaging module checks whether there is still data to be chained in the transaction pool. If so, it repeats the process of data packaging until all the data in the transaction pool is packaged.

4. The method for data packaging in the construction field based on blockchain according to claim 1, characterized in that, The original data should include: the business type of the data, the unique identifier of the data, the version number of the data, and the data label.

5. The method for data packaging in the construction field based on blockchain according to claim 1, characterized in that, The key management module is used to manage the public and private keys of the node and manage the digital certificates of all known on-chain users for use in data access authorization; secondly, the key management module also provides functions for generating, encrypting and decrypting symmetric keys, encrypting and decrypting asymmetric keys, signing, and verifying signatures.

6. The method for data packaging in the construction field based on blockchain according to claim 1, characterized in that, The method of obtaining transactions to be chained from the transaction pool is to obtain transactions to be chained of the same signer each time.

7. The method for data packaging in the construction field based on blockchain according to claim 1, characterized in that, The business system module is used to collect data to be chained in construction enterprises and generate a unique data identifier, data version, data type and data label that meet its own application requirements for the data.

8. The method for data packaging in the construction field based on blockchain according to claim 1, characterized in that, The updated block template is used to replace an existing parent block in the template with the Hash of the new block to realize the reference to historical blocks.

Citation Information

Patent Citations

  • Electric power blockchain data management system

    CN113065961A

  • Block chain cross-chain information interaction method

    CN113628046A