A ledger error correction method based on blockchain technology
Through the combination of blockchain and deep learning, a decentralized ledger management system is built to automatically identify and correct ledger errors, solving the problems of inefficient and high cost of traditional ledger error correction, and achieving efficient and secure ledger data processing.
Patent Information
- Application Number
- CN202410921972.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-10
- Publication Date
- 2025-08-08
- Estimated Expiration
- 2044-07-10
AI Technical Summary
Traditional ledger error correction methods rely on manual labor, are inefficient, expensive and have the risk of artificial tampering, making it difficult to achieve efficient and accurate ledger data processing in large financial systems.
Blockchain technology is used to build a ledger blockchain, combine smart contracts and deep learning models, and automatically identify and correct ledger errors through hash comparison and deep error correction models to build a decentralized ledger management system.
It improves the efficiency and accuracy of ledger error correction, reduces labor costs, ensures data integrity and security, reduces human errors, and realizes a highly automated and intelligent error correction mechanism.
Smart Images

Figure CN118965447B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of blockchain and deep learning technology, and in particular to a ledger error correction method based on blockchain technology. Background Art
[0002] In the financial sector, especially for financial institutions such as banks, ledger error correction technology is crucial to the entire industry. Traditional ledger error correction is often done manually, which faces many problems:
[0003] (1) For transaction data in the ledger, it is necessary to be able to accurately identify errors in the ledger, and at the same time, ensure the integrity and consistency of the ledger when correcting errors. This requires strict requirements for manual work. It is necessary to carefully review the accounts, be able to check the accounts, and know the relevant financial regulations and standards to ensure the accuracy of error correction;
[0004] (2) In a financial system, bookkeeping error correction is very time-consuming, especially for large or complex financial systems with a large number of transactions and account records. Therefore, traditional manual error correction has no advantage in error correction efficiency and requires a large amount of manpower to correct errors.
[0005] (3) For traditional manual error correction, there are also huge problems with the security of error correction: on the one hand, manual error correction methods may lead to deliberate human tampering. The way to solve such problems is usually to have multiple people review and correct one account book, which further increases the labor cost and makes it inefficient; on the other hand, for a large financial system, error correction of account books is a very energy-consuming task. People's energy is limited. If the staff is in error correction work for a long time, they will cause errors in the error correction process.
[0006] Blockchain is a distributed database technology used to store data and record the history of transactions and events. Blockchain has many unique features, including: it is not dependent on a single central authority but rather is maintained by multiple nodes in a network; once data is added to the blockchain, it is virtually impossible to modify or delete. Each block contains a hash of the previous block, making it virtually impossible to change the information in one block without also changing the information in all subsequent blocks; and it can be used to create distributed ledgers that record the transaction history of data. Based on these various characteristics, applying blockchain to ledger error correction can effectively address the current inefficiencies and high costs of ledger data processing.
[0007] Based on the above background, there is a need for a method that can accurately identify erroneous data in ledgers and effectively correct and store ledger data to improve the efficiency of ledger data processing and reduce labor costs. Summary of the Invention
[0008] In view of this, the purpose of the present invention is to provide a ledger error correction method based on blockchain technology, which can be prepared to identify erroneous data in the ledger and effectively correct it, so as to build a correct financial blockchain for the enterprise.
[0009] One of the objectives of the present invention is achieved through the following technical solutions:
[0010] A ledger error correction method based on blockchain technology, comprising the following steps:
[0011] Step S1: Build a ledger blockchain based on the ledger records of different departments, and receive the ledger error correction request sent by the requester;
[0012] Step S2: Obtain the information corresponding to the target ledger based on the ledger’s unique identifier, call the accounting detail analysis logic declared in the smart contract, and create the corresponding accounting detail record;
[0013] Step S3: Compare the hash values of the current accounting details with those of the same category of blocks to obtain an output result indicating whether the account information is correct;
[0014] Step S4: Determine whether the output ledger information is correct. If the ledger information is correct, the corresponding accounting details are published to the blockchain. If not, the accounting details are input into the deep error correction model for error correction, and the error correction results are obtained. Based on the error correction results, the corresponding accounting details in the target ledger are modified and published to the blockchain, and a corresponding ledger error report result is generated at the same time.
[0015] Furthermore, the step S1 includes:
[0016] Step S101: The collector obtains the account book records of each department and generates a corresponding array;
[0017] Step S102: Constructing a ledger blockchain based on the obtained ledger record arrays of each department;
[0018] Step S103: Receive the ledger error correction request sent by the requesting party;
[0019] Step S104: Obtain the latest block from the blockchain, and obtain transaction data from the latest block as the root of the error correction requester's authority verification tree RT;
[0020] Step S105: Construct an RT tree using the root of the RT tree, obtain the permission information corresponding to the error correction requester from the RT tree, and determine whether the error correction requester has permission based on the permission information;
[0021] Step S106: After the requester authentication passes, receive and store the error correction request sent by the requester;
[0022] Step S107: Perform an identification operation on the error correction request and record the error correction request as RID n , where RID i is the identification number of the error correction request, and i is the unique number of the identification number.
[0023] Furthermore, the specific process of constructing the RT tree in step S105 is as follows:
[0024] (1) Take out n transaction data TD from TransactionsData i ;
[0025] (2) Add the n transaction data TD to the bottom layer of the RT tree as the root of the RT tree;
[0026] (3) Perform a hash operation on the data block, Block i =Hash(TD i ), where 1≤i≤n;
[0027] (4) Concatenate three adjacent Block blocks and then perform a hash operation;
[0028] (5) Block ((k+1) / 2) =Hash(Block (k-1) +Block k +Block (k+1) ), and k = 1, 3, 5, 7,..., n - 1;
[0029] (6) Take the calculated Block ((k+1) / 2) , transaction data n>}, where TD1 is the first transaction data, TD2 is the second transaction data, TD i is the i-th transaction data, n is the total amount of transaction data; Hash() is the method for calculating the sha-256 value; Block is the corresponding block in the blockchain.
[0032] Further, the step S2 includes:
[0033] Step S201: Based on the unique identifier RID of the account book i , detect the block where the current ledger is located, and obtain the accounting rules and account information corresponding to the target ledger from the block;
[0034] Step S202: Calling the accounting details analysis logic declared in the smart contract;
[0035] Step S203: Create corresponding accounting details records according to the accounting rules and accounting information corresponding to the target account book.
[0036] Furthermore, the specific process and formula for creating the corresponding accounting details record in step S203 are as follows:
[0037] (1) Obtain the unique address of the smart contract on the blockchain based on the contract deployment transaction;
[0038] (2) According to the current block, obtain the specified parameters, and then pass the parameters to the contract function to perform the operation. The formula for calling the contract function is:
[0039] tranTypeRules=fun_trule(p1,p2,…,p i ,…,p n )
[0040] amountItems=fun_amount(p1,p2,…,p i ,…,p n )
[0041] dateRules=fun_drule(p1,p2,…,p i ,…,p n )
[0042] accountRules=fun_arule(p1,p2,…,p i ,…,p n )
[0043] analysisLogicInfo={tranTypeRules,amountItems,dateRules,accountRules}
[0044] Among them, the fun_trule() function is used to obtain the rules of the current account book transaction type, tranTypeRules is the classification rule of the transaction type, the fun_amount() function is used to obtain the number of amount items in the current account book, amountItems is the number of amount items in the account book, the fun_drule() function is used to obtain the date rules, dateRules is the date rule, the fun_arule() function is used to obtain the classification rules of the current account book, accountRules is the account book classification rule, p i is the i-th parameter, n represents the number of parameters, and analysisLogicInfo is the returned accounting detail analysis logic information;
[0045] tranTypeRules=extract_r(analysisLogicInfo)
[0046] dateRules=extract_d(analysisLogicInfo)
[0047] tranRules={tranTypeRules,dateRules}
[0048] transactionDataType=typeAnalysis(tranRules,accountBookInfo)
[0049] The extract_r() function is used to extract the transaction type classification rules tranTypeRules from the accounting detail analysis logic information analysisLogicInfo. The extract_d() function is used to extract the date rules dateRules from the accounting detail analysis logic information analysisLogicInfo. tranRules is a set of transaction data type rules, accountBookInfo is the account book accounting information, and typeAnalysis() is a transaction data classification function. This function classifies each transaction information according to the input transaction data type rules. transactionDataType is the transaction data type.
[0050] amountItems=extract_am(analysisLogicInfo)
[0051] accountRules=extract_ac(analysisLogicInfo)
[0052] accRules={amountItems,accountRules,dateRules}
[0053] accountBookCategory=categorize(transactionDataType,accRules,accountBookInfo)
[0054] The extract_am() function is used to extract the number of ledger amount items (amountItems) from the accounting detail analysis logic information (analysisLogicInfo). The extract_ac() function is used to extract the account classification rules (accountRules) from the accounting detail analysis logic information (analysisLogicInfo). accRules is a set of account category rules. categorize() is a account classification function. Its main function is to assign the classified transaction data type (transactionDataType) and account book information (accountBookInfo) to the account book according to specific rules, and return the account book category information (accountBookCategory).
[0055] actorRules={dateRules,transactionDataType,accountBookCategory}
[0056] acterInfo=accountAssign(acterRules,accountBookInfo)
[0057] accountingRecord={transactionDataType,accountBookCategory,acterInfo,accountBookInfo}
[0058] Among them, actorRules is the account classification rule set, and accountAssign() is the account assignment function. This function assigns specific ledgers and transactions to the corresponding users based on the input account classification rule set actorRules and account book accounting information accountBookInfo, and returns the account person information. actorInfo is the assigned account person information;
[0059] Among them, accountingRecord is the accounting detail record.
[0060] Further, the step S3 includes:
[0061] Step S301: Based on the account book accounting information in the current accounting details record, a hash operation is performed on it to obtain a hash value h x ;
[0062] Step S302: Based on the account book category information of the currently verified block, find the block of the same category in the blockchain, and perform a hash operation on the account book information in the account record of the block to obtain the hash value h y ;
[0063] Step S303: h x With h y Compare the two hash values. If the two hash values are the same, the accounting details in the verified block are correct and the record is True. If the two hash values are different, the accounting details in the verified block are incorrect and the record is False.
[0064] Furthermore, the specific process of performing hash operation on the accounting details record in step S301 is as follows:
[0065] (1) Split and fill the account book information in the current account record to generate N 256-bit information blocks M (i) ;
[0066] (2) Use the SHA-256 encryption algorithm to encrypt the information block M (i) Perform cyclic calculations to achieve encryption;
[0067] (3)h x The value is calculated as follows:
[0068] h (i) =sha_256(M (i) )
[0069] h x =h (1) ||h (2) ||h (3) …||h (i)
[0070] Among them, h (i) is the hash value returned after hash encryption of the i-th information block, sha_256() is the called SHA-256 function, h x The hash value generated for the ledger information of the verified block, || is a concatenation operation.
[0071] Furthermore, the specific process of performing hash operation on the accounting information of blocks of the same category in step S302 is as follows:
[0072] (1) Extract the account book category information accountBookCategory from the current accounting detail record to be verified;
[0073] (2) Based on the extracted account book category information accountBookCategory, find the block b with the same account book category on the chain y ;
[0074] (3) According to the discovered block b y , extract the account book information accountBookInfo_b of this block y ;
[0075] (4) Record the account book information of this block as accountBookInfo_b y Use the SHA-256 algorithm to encrypt and get the corresponding hash value h y , h y The value is calculated as follows:
[0076] h (i) =sha_256(M (i) )
[0077] h y =h (1) ||h (2) ||h (3) …||h (i)
[0078] Among them, h (i) is the hash value returned after hash encryption of the i-th information block, sha_256() is the called SHA-256 function, h y The hash value generated for the ledger information of the identified blocks of the same category, || is a concatenation operation.
[0079] Further, the step S4 includes:
[0080] Step S401: Based on the output result of the ledger information, if the result record is True, then the corresponding accounting details record is published to the blockchain;
[0081] Step S402: If the result record is False, the accounting details record is input into the preset deep error correction model for error correction processing, and the error correction result is obtained;
[0082] Step S403: Based on the correct accounting information obtained, the corresponding accounting details in the target account book are modified;
[0083] Step S404: Publish the corrected target ledger to the blockchain and generate a corresponding ledger error report result.
[0084] Furthermore, the specific process of inputting the accounting details into the preset deep error correction model for error correction in step S402 is as follows:
[0085] (1) Extract the account book information accountBookInfo from the accounting details record, pre-process the account book information, and obtain the data set ac_datas;
[0086] (2) Vectorize the data set ac_datas to obtain a vector representation of the training data:
[0087] d i =data_embeding(y i )+row_embedding(y i )+site_embedding(y i )
[0088] Among them, d i Represents the training data vector, y i represents the i-th character in the accounting information, data_embedding() is the function for obtaining the data embedding vector, row_embedding() is the function for obtaining the row embedding vector, and site_embedding() is the function for obtaining the position embedding vector;
[0089] (3) For the training data vector d i Perform mask connection preprocessing to obtain embedded data, the embedded data d i The calculation formula is as follows:
[0090]
[0091] Among them, d i ' is the embedded data, ρ is the variance coefficient, * is the multiplication operator, P a is the bias term in the fully connected layer, Q a is the weight matrix in the fully connected layer, is the matrix inner product operation, is the encoding hidden vector, d mask is the embedded "mask" special data, d e is the vector with errors in the training vector;
[0092] (4) The embedded data is encoded using the repair network of the error correction model to obtain the hidden state of the middle coding layer in the multiple coding layers. The hidden state and the embedded data are differentially connected to obtain the connection value, which is then input into the fully connected layer. The posterior probability of the connection value is calculated using the activation function in the fully connected layer. The posterior probability is compared with the error correction tolerance. When the posterior probability is less than the error correction tolerance, the error correction result is judged to be wrong. When the posterior probability is greater than or equal to the error correction tolerance, the error correction result is judged to be correct. The posterior probability calculation formula is as follows:
[0093] cv i '=hd i +d i '
[0094] P i (x i =k|X)=activate(cv i ')*100%
[0095] Among them, cv i ' is the connection value, hd i is the hidden state, d i ' is the embedded data, P i (x i =k|X) is the character x i The posterior probability of being corrected to character k, X is the sample space of the text to be corrected, activate() is the activation function in the fully connected layer, and * is the multiplication operator;
[0096] (5) Calculate the logarithmic loss value of the error correction model based on the error correction result, adjust the model parameters of the deep error correction model based on the logarithmic loss value, and output the standard error correction model. The logarithmic loss value calculation formula of the error correction model is as follows:
[0097]
[0098] Where L is the logarithmic loss value of the error correction model, p is the error correction rate, q is the preset detection rate, k is the preset fixed weight, and n is the total amount of data;
[0099] (6) The bookkeeping information is input into the predetermined deep error correction model, and the correct bookkeeping information after error correction is obtained through a preset multi-round error correction mechanism.
[0100] The beneficial effects of the present invention include:
[0101] (1) Based on blockchain technology, the present invention combines the ledger information of different departments into a blockchain, making the management of the ledger more decentralized and not relying solely on a single management entity. This increases the credibility and stability of the ledger and facilitates the management of the ledger.
[0102] (2) The present invention proposes an RT tree, which combines the characteristics of the Merkle tree and the prefix tree. It is a data structure for efficient data storage and retrieval, and is suitable for the ledger error correction scenario of the blockchain. It makes the verification of data integrity more efficient and the judgment of the error correction request authority more accurate. Its flexibility and verifiability can make the storage and modification of ledger transaction data more secure.
[0103] (3) The present invention only needs to perform hash processing on the same category of ledgers in the blockchain. The correctness of the ledger is determined by comparing the hash values of two blocks, which improves the efficiency and accuracy of error correction. At the same time, automated data verification can effectively reduce the need for manual intervention, thereby reducing the cost of manual maintenance and operation.
[0104] (4) The present invention further enhances the accuracy of ledger data by invoking blockchain smart contracts to obtain detailed records. Through the distributed nature of blockchain and smart contracts, transactions can be automatically executed, reducing human errors and human changes to data.
[0105] (5) The present invention uses the ledger as a block, which can provide the data tamper-proof feature, ensuring that the data on the ledger is not maliciously tampered with, and helps to improve the integrity and transparency of the data; at the same time, based on the SHA-256 encryption technology and using block encryption to encrypt the ledger information, it further enhances the security of the ledger and can reduce the risk of data tampering and attack;
[0106] (6) The present invention adopts a combination of smart contracts and deep error correction models to realize an efficient ledger error correction mechanism; the smart contract extracts the data required by the model according to the accounting rules and specified parameters, and then transmits the data to the deep learning model for deep error correction processing. The advantage of this error correction mechanism is that it is highly automated and intelligent, and can quickly and effectively discover and correct errors, thereby improving the efficiency and accuracy of error correction. Compared with the traditional natural language error correction model, this method is more suitable for the high security requirements of ledger data, can better adapt to the needs of ledger management, and ensure the accuracy and security of data;
[0107] (7) The masked connection preprocessing proposed in the present invention allows the model to ignore uncertain data, which enhances the model's robustness to noise or missing data. At the same time, due to the use of encoded hidden vectors, the model is able to consider the contextual information of the input data, which helps to better understand and process the data. By connecting the error vectors, the formula can directly process and correct errors in the data during the training process, thereby improving the accuracy of the output data.
[0108] (8) The logarithmic loss calculation formula of the deep error correction model proposed in the present invention is highly flexible. Compared with other loss function calculation formulas, this method can fine-tune the loss function for specific error types or data imbalance problems by adjusting the fixed weight k. At the same time, the formula takes into account the error correction probability p and the preset detection probability q, which helps the model to better balance the relationship between the predicted results and the actual results in practical applications, thereby improving the robustness of the model.
[0109] Other advantages, objects, and features of the present invention will be described in part in the following description and, in part, will be apparent to those skilled in the art upon examination of the following or may be learned from practice of the present invention. The objects and other advantages of the present invention may be realized and obtained through the following description and the preceding claims. BRIEF DESCRIPTION OF THE DRAWINGS
[0110] In order to make the purpose, technical solutions and advantages of the present invention more clear, the present invention will be further described in detail below with reference to the accompanying drawings, in which:
[0111] Figure 1 This is a flowchart of a ledger error correction method based on blockchain technology of the present invention;
[0112] Figure 2 This is an example diagram of an array of account book records of the finance department, procurement department, sales department, and tax department obtained by the data collector in an embodiment of the present invention;
[0113] Figure 3 This is an example diagram of the ledger blockchain in an embodiment of the present invention;
[0114] Figure 4 This is an example diagram of a transaction data set in the tax department block according to an embodiment of the present invention;
[0115] Figure 5 This is an example diagram of a transaction data set for the finance department block in an embodiment of the present invention;
[0116] Figure 6 This is an example diagram of the RT tree structure according to an embodiment of the present invention;
[0117] Figure 7 This is an example diagram of information blocks after segmentation and filling of accounting information in the tax department's account book according to an embodiment of the present invention;
[0118] Figure 8 This is an example diagram of generating a hash value by hashing the tax department information block according to an embodiment of the present invention;
[0119] Figure 9 This is an example diagram of information blocks after segmentation and filling of accounting information in the account book of the finance department according to an embodiment of the present invention;
[0120] Figure 10 This is an example diagram of generating hash values by hashing the information block of the finance department according to an embodiment of the present invention;
[0121] Figure 11 This is an example diagram of the deep error correction model error correction process for some transaction details in an embodiment of the present invention. DETAILED DESCRIPTION
[0122] The specific embodiments of the present invention are described below to facilitate understanding of the present invention by those skilled in the art. However, it should be clear that the present invention is not limited to the scope of the specific embodiments. For those skilled in the art, as long as various changes are within the spirit and scope of the present invention as defined and determined by the appended claims, these changes are obvious, and all inventions and creations utilizing the concepts of the present invention are protected.
[0123] The present invention provides a ledger error correction method based on blockchain technology, such as Figure 1 As shown, the following steps are included:
[0124] Step S1: Build a ledger blockchain based on the ledger records of different departments, and receive the ledger error correction request sent by the requester;
[0125] Step S2: Obtain the information corresponding to the target ledger based on the ledger’s unique identifier, call the accounting detail analysis logic declared in the smart contract, and create the corresponding accounting detail record;
[0126] Step S3: Compare the hash values of the current account details with those of the same category of blocks to obtain an output result indicating whether the account information is correct;
[0127] Step S4: Determine whether the output ledger information is correct. If the ledger information is correct, the corresponding accounting details are published to the blockchain. If not, the accounting details are input into the deep error correction model for error correction, and the error correction results are obtained. Based on the error correction results, the corresponding accounting details in the target ledger are modified and published to the blockchain, and a corresponding ledger error report result is generated at the same time.
[0128] The specific steps of the above method will be further described below through a specific embodiment.
[0129] In this embodiment, step S1 specifically includes the following steps:
[0130] Step S101: The collector obtains the account book records of each department and generates a corresponding array;
[0131] In step S101, the data collected by the data collector is as follows: Figure 2As shown, after the collector obtains the ledger records of the finance department, procurement department, sales department, and tax department, the generated array format is as follows: The finance department array FinanceDept = {FDR1, FDR2, …, FDR i}, the procurement department array ProcurementDept = {PDR1, PDR2, …, PDR j}, the sales department array SalesDept = {SDR1, SDR2, …, SDR k}, the tax department array TaxDept = {TDR1, TDR2, …, TDR x}, where FinanceDept represents the array storing all ledger records of the finance department, FDR1 represents the finance department ledger record 1, FDR2 represents the finance department ledger record 2, FDR i represents the finance department ledger record i, ProcurementDept is the array storing all ledger records of the procurement department, PDR1 represents the procurement department ledger record 1, PDR2 represents the procurement department ledger record 2, PDR j represents the procurement department ledger record j, SalesDept is the array storing all ledger records of the sales department, SDR1 represents the sales department ledger record 1, SDR2 represents the sales department ledger record 2, SDR k represents the sales department ledger record k, TaxDept represents the array storing all ledger records of the tax department, TDR1 represents the tax department ledger record 1, TDR2 represents the tax department ledger record 2, TDR x represents the tax department ledger record x.
[0132] Step S102: Construct a ledger blockchain based on the obtained ledger record arrays of each department;
[0133] Step S102 constructs a ledger blockchain AccountChain with the finance department array FinanceDept, procurement department array ProcurementDept, sales department array SalesDept, and tax department array TaxDept as nodes. The constructed ledger blockchain is as Figure 3 shown, the ledger blockchain AccountChain = {<Block1, block 1>: <Block2, block 2>: …: <Block i , block i>: …: <Block n , block n>}, where AccountChain represents the ledger blockchain storing all smart contracts, Block1 represents block 1, Block2 represents block 2, Block iDenote the block as i and n as the total number of blocks. Each Block is composed of a set, Block = {<BlockVersion, the version number of the block header> : <PrevBlockHash, the Hash value of the previous block of this block> : <MerkleRootHash, the hash value of the Merkle root of the transactions in the block> : <TimeStamp, the creation timestamp of this block> : <WorkDifficultyTarget, the proof-of-work difficulty target of this blockchain> : <WorkNonce, the calculation parameter used to prove the workload> : <DealNumTransactionsBytes, the number of bytes occupied by the number of transactions> : <DealNumTransactions, the number of transactions in the block> : <TransactionsData i , a set of multiple transaction data in the block memory> : <RT, the hash value of the transaction permission verification tree in the block>};
[0134] Among them, BlockVersion is the version number of the block header, PrevBlockHash is the Hash value of the previous block of this block, MerkleRootHash is the hash value of the Merkle root of the transactions in the block, TimeStamp is the creation timestamp of this block, WorkDifficultyTarget is the proof-of-work difficulty target of this blockchain, WorkNonce is the calculation parameter used to prove the workload, DealNumTransactionsBytes is the number of bytes occupied by the number of transactions, DealNumTransactions is the number of transactions in the block, TransactionsData i is a set of multiple transaction data in the memory of block i, and RT is the hash value of the transaction permission verification tree in the block.
[0135] Step S103: Receive the ledger error correction request sent by the requester;
[0136] In step S103, the requester tax department issues a ledger error correction request ErrorRequestInfo.
[0137] Step S104: Obtain the latest block from the blockchain and obtain the transaction data from the latest block as the root of the RT tree;
[0138] Step S105: Construct an RT tree using the root of the RT tree, obtain the permission information corresponding to the error correction requester from the RT tree, and determine whether the error correction requester has permission according to the permission information;
[0139] The specific process of constructing the RT tree in step S105 is as follows:
[0140] (1) Take out n transaction data TD from TransactionsData i ;
[0141] (2) Add the n transaction data TD to the bottom layer of the RT tree as the root of the RT tree;
[0142] (3) Perform a hash operation on the data block, Block i [[ID=1十一]]=Hash(TD i ), where 1 ≤ i ≤ n;
[0143] (4) Concatenate three adjacent Block blocks and then perform a hash operation;
[0144] (5) Block ((k+1) / 2) =Hash(Block (k-1) +Block k +Block (k+1) ), and k = 1, 3, 5, ⑦,..., n - 1;
[0145] (6) Take the calculated Block ((k+1) / 2) as the new leaf node;
[0146] z (7) Repeat the calculation process of Block until a complete RT tree is generated;
[0147] Among them, TransactionsData i is the set of multiple transaction data in the memory of block i, TransactionsData i ={<TD1, transaction data 1>: <TD2, transaction data 2>:...: <TD i , transaction data i>:...: <TD n , transaction data n>}, where TD1 is the first transaction data, TD2 is the second transaction data, TD i is the i-th transaction data, and n is the total amount of transaction data; Hash() is the method for calculating the sha-256 value; Block is the corresponding block in the blockchain;
[0148] In this implementation, Figure 4 is an example diagram of the transaction data set of the tax department block, Figure 5 is an example diagram of the transaction data set of the financial department block, where the transaction data of both departments is 3 copies, Figure 6 is an example diagram of the RT tree construction.
[0149] Step S106: After the requester is authenticated, receive and store the error correction request sent by the requester;
[0150] It should be noted that there are some unclear or incorrect expressions in the original text, such as "TD i 为第i份交易数据" where the variable naming and connection are a bit chaotic. This translation tries to be as faithful as possible to the original while making the best sense of it.Step S107: perform an identification operation on the error correction request and record the error correction request as RID i , where RID i is the identification number of the error correction request, and i is the unique number of the identification number.
[0151] Step S2: Obtain the information corresponding to the target ledger based on the unique ledger identifier, call the accounting detail analysis logic declared in the smart contract, and create the corresponding accounting detail record;
[0152] In this embodiment, S2 specifically includes the following steps:
[0153] Step S201: Based on the unique identifier RID of the account book i , detect the block where the current ledger is located, and obtain the accounting rules and account information corresponding to the target ledger from the block;
[0154] Step S202: Calling the accounting details analysis logic declared in the smart contract;
[0155] Step S203: Create corresponding accounting details records according to the accounting rules and accounting information corresponding to the target account book.
[0156] The specific method for creating the corresponding accounting details record in step S203 is:
[0157] (1) Obtain the unique address of the smart contract on the blockchain based on the contract deployment transaction;
[0158] (2) According to the current block, obtain the specified parameters, and then pass the parameters to the contract function to perform the operation. The formula for calling the contract function is:
[0159] tranTypeRules=fun_trule(p1,p2,…,p i ,…,p n )
[0160] amountItems=fun_amount(p1,p2,…,p i ,…,p n )
[0161] dateRules=fun_drule(p1,p2,…,p i ,…,p n )
[0162] accountRules=fun_arule(p1,p2,…,p i ,…,p n )
[0163] analysisLogicInfo={tranTypeRules,amountItems,dateRules,accountRules}
[0164] Among them, the fun_trule() function is used to obtain the rules of the current account book transaction type, tranTypeRules is the classification rule of the transaction type, the fun_amount() function is used to obtain the number of amount items in the current account book, amountItems is the number of amount items in the account book, the fun_drule() function is used to obtain the date rules, dateRules is the date rule, the fun_arule() function is used to obtain the classification rules of the current account book, accountRules is the account book classification rule, p i is the i-th parameter, n represents the number of parameters, and analysisLogicInfo is the returned accounting detail analysis logic information;
[0165] tranTypeRules=extract_r(analysisLogicInfo)
[0166] dateRules=extract_d(analysisLogicInfo)
[0167] tranRules={tranTypeRules,dateRules}
[0168] transactionDataType=typeAnalysis(tranRules,accountBookInfo)
[0169] The extract_r() function is used to extract the transaction type classification rules tranTypeRules from the accounting detail analysis logic information analysisLogicInfo. The extract_d() function is used to extract the date rules dateRules from the accounting detail analysis logic information analysisLogicInfo. tranRules is a set of transaction data type rules, accountBookInfo is the account book accounting information, and typeAnalysis() is a transaction data classification function. This function classifies each transaction information according to the input transaction data type rules. transactionDataType is the transaction data type.
[0170] amountItems=extract_am(analysisLogicInfo)
[0171] accountRules=extract_ac(analysisLogicInfo)
[0172] accRules={amountItems,accountRules,dateRules}
[0173] accountBookCategory=categorize(transactionDataType,accRules,accountBookInfo)
[0174] The extract_am() function is used to extract the number of ledger amount items (amountItems) from the accounting detail analysis logic information (analysisLogicInfo). The extract_ac() function is used to extract the account classification rules (accountRules) from the accounting detail analysis logic information (analysisLogicInfo). accRules is a set of account category rules. categorize() is a account classification function. Its main function is to assign the classified transaction data type (transactionDataType) and account book information (accountBookInfo) to the account book according to specific rules, and return the account book category information (accountBookCategory).
[0175] actorRules={dateRules,transactionDataType,accountBookCategory}
[0176] acterInfo=accountAssign(acterRules,accountBookInfo)
[0177] accountingRecord={transactionDataType,accountBookCategory,acterInfo,accountBookInfo}
[0178] Among them, actorRules is the account classification rule set, and accountAssign() is the account assignment function. This function assigns specific ledgers and transactions to the corresponding users based on the input account classification rule set actorRules and account book accounting information accountBookInfo, and returns the account person information. actorInfo is the assigned account person information;
[0179] Among them, accountingRecord is the accounting detail record;
[0180] In this embodiment, the parameters p provided by the block where the tax department is located are: p1 = TaxSender, p2 = TaxValue, p3 = TaxBlock, p4 = TaxState. By inputting the parameters into the fun_trule() function, fun_amount() function, fun_drule() function, and fun_arule() function, the parameters TaxtranTypeRules, TaxamountItems, TaxdateRules, TaxaccountRules, and the accounting detail analysis logic information TaxanalysisLogicInfo of the block where the tax department is located can be obtained. Among them, TaxSender is the address information of the sender, TaxValue is the amount of currency transferred to the contract by the sender, and TaxBlock is the information set of the block where the tax department is located, which includes the timestamp of the block, random TaxState is the state variable of the contract that the contract function needs to access or modify. TaxtranTypeRules is the ledger transaction type rule of the block where the tax department is located, which is returned by calling the fun_trule() function. TaxamountItems is the number of ledger amount entries of the block where the tax department is located, which is returned by calling the fun_amount() function. TaxdateRules is the date rule of the block where the tax department is located, which is returned by calling the fun_drule() function. TaxaccountRules is the ledger classification rule of the block where the tax department is located, which is returned by calling the fun_arule() function. Parameter TaxanalysisLogicInfo = {TaxtranTypeRules,TaxamountItems,TaxdateRules,TaxaccountRules};
[0181] Input TaxanalysisLogicInfo into the extract_r() function and extract_d() function, and return the parameters TaxtranTypeRules, TaxdateRules, and TaxtranRules, where the parameter TaxtranRules = {TaxtranTypeRules, TaxdateRules}; input TaxaccountBookInfo and TaxtranRules into the typeAnalysis() function, and return TaxtransactionDataType, where TaxaccountBookInfo is the account book information provided by the block where the tax department is located, and TaxtransactionDataType is the transaction data type of the block where the tax department is located;
[0182] Input TaxanalysisLogicInfo into the extract_am() and extract_ac() functions, and return the parameters TaxamountItems, TaxaccountRules, and TaxaccRules, where the parameter TaxaccRules = {TaxamountItems, TaxaccountRules, TaxdateRules}. Input TaxaccountBookInfo, TaxaccRules, and TaxtransactionDataType into the categorize() function, and return TaxaccountBookCategory, where TaxaccountBookCategory is the account book category of the block where the tax department is located.
[0183] The above-obtained parameters TaxdateRules, TaxtransactionDataType, and TaxaccountBookCategory are combined to obtain the parameter TaxacterRules, where TaxacterRules is the account classification rule set for the block where the tax department is located. Input actorRules and TaxaccountBookInfo into the accountAssign() function, and return TaxacterInfo, where TaxacterInfo is the account information for the block where the tax department is located. The parameter TaxaccountingRecord = {TaxtransactionDataType, TaxaccountBookCategory, TaxacterInfo, TaxaccountBookInfo}, where TaxaccountingRecord is the accounting details record for the block where the tax department is located.
[0184] Step S3: Compare the hash values of the current accounting details with those of the same category of blocks to obtain the output result of whether the account book information is correct.
[0185] In this embodiment, S3 specifically includes the following steps:
[0186] Step S301: Based on the account book accounting information in the current accounting details record, a hash operation is performed on it to obtain a hash value h x ;
[0187] In step S301, the specific process of performing a hash operation on the accounting detail record is as follows:
[0188] (1) Split and fill the account book information in the current account record to generate N 256-bit information blocks M (i) ;
[0189] (2) Use the SHA-256 encryption algorithm to encrypt the information block M (i) Perform cyclic calculations to achieve encryption;
[0190] (3)h x The value is calculated as follows:
[0191] h (i) =sha_256(M (i) )
[0192] h x =h (1) ||h (2) ||h (3) …||h (i)
[0193] Among them, h (i) is the hash value returned after hash encryption of the i-th information block, sha_256() is the called SHA-256 function, h x The hash value generated for the ledger information of the verified block, || is a concatenation operation;
[0194] In this embodiment, according to the current accounting record set TaxaccountingRecord, the current account book accounting information TaxaccountBookInfo is extracted from it, and the split and fill method split_and_fill() in the hashlib library is called to generate three 256-bit information blocks M (i) ,like Figure 7 As shown, then the information block M (i) Perform cyclic calculation and hash encryption using the SHA-256 algorithm to calculate h (1) 、h (2) 、h (3) The value of h x , the generation process is as follows Figure 8 shown.
[0195] Step S302: Based on the account book category information of the currently verified block, find the block of the same category in the blockchain, and perform a hash operation on the account book information in the account record of the block to obtain the hash value h y ;
[0196] In step S302, the specific process of performing hash operations on the accounting information of blocks of the same category is as follows:
[0197] (1) Extract the account book category information accountBookCategory from the current accounting detail record to be verified;
[0198] (2) Based on the extracted account book category information accountBookCategory, find the block b with the same account book category on the chain y ;
[0199] (3) According to the discovered block b y , extract the account book information accountBookInfo_b of this block y ;
[0200] (4) Record the account book information of this block as accountBookInfo_b y Use the SHA-256 algorithm to encrypt and get the corresponding hash value h y , h y The value is calculated as follows:
[0201] h (i) =sha_256(M (i) )
[0202] h y =h (1) ||h (2) ||h (3) …||h (i)
[0203] Among them, h (i) is the hash value returned after hash encryption of the i-th information block, sha_256() is the called SHA-256 function, h y The hash value generated for the ledger information of the identified blocks of the same category, || is a concatenation operation;
[0204] In this embodiment, the current account book category information TaxaccountBookCategory is extracted from the current accounting detail record set TaxaccountingDetailsRecord. The same account book category block is found on the chain based on the current account book category information, that is, the block where the finance department is located. Based on the block where the finance department is located, the account book accounting information FinaccountBookInfo of the block where the finance department is located is extracted. The account book accounting information FinaccountBookInfo of the block where the finance department is located is split and filled to generate three 256-bit information blocks M (i) ,like Figure 9 As shown, for information block M (i) Perform cyclic calculation and hash encryption with SHA-256 algorithm, and finally get h y , the generation process is as follows Figure 10 shown.
[0205] Step S303: h x With h y Compare the two hash values. If the two hash values are the same, the detailed accounting records in the verified block are correct and the record is True. If the two hash values are different, the detailed accounting records in the verified block are incorrect and the record is False.
[0206] In this embodiment, h x Value and h y If the values are different, the accounting details record in the verified block is wrong and is recorded as False.
[0207] Step S4: Determine whether the output ledger information is correct. If the ledger information is correct, the corresponding accounting details are published to the blockchain. If not, the accounting details are input into the deep error correction model for error correction, and the error correction results are obtained. Based on the error correction results, the corresponding accounting details in the target ledger are modified and published to the blockchain, and a corresponding ledger error report result is generated at the same time.
[0208] In this embodiment, S4 specifically includes the following steps:
[0209] Step S401: Based on the output result of the ledger information, if the result record is True, then the corresponding accounting details record is published to the blockchain;
[0210] Step S402: If the result record is False, the accounting details record is input into the preset deep error correction model for error correction processing, and the error correction result is obtained;
[0211] Step S403: Based on the correct accounting information obtained, the corresponding accounting details in the target account book are modified;
[0212] Step S404: Publish the corrected target ledger to the blockchain and generate a corresponding ledger error report result;
[0213] In step S402, the specific process of inputting the accounting details into the preset deep error correction model for error correction is as follows:
[0214] (1) Extract the account book information accountBookInfo from the accounting details record, pre-process the account book information, and obtain the data set ac_datas;
[0215] (2) Vectorize the data set ac_datas to obtain a vector representation of the training data:
[0216] d i =data_embeding(y i )+row_embedding(y i )+site_embedding(y i )
[0217] Among them, d i Represents the training data vector, y i represents the i-th character in the accounting information, data_embedding() is the function for obtaining the data embedding vector, row_embedding() is the function for obtaining the row embedding vector, and site_embedding() is the function for obtaining the position embedding vector;
[0218] (3) For the training data vector d i Perform mask connection preprocessing to obtain embedded data, the embedded data d i The calculation formula is as follows:
[0219]
[0220] Among them, d i ' is the embedded data, ρ is the variance coefficient, * is the multiplication operator, P a is the bias term in the fully connected layer, Q a is the weight matrix in the fully connected layer, is the matrix inner product operation, is the encoding hidden vector, d mask is the embedded "mask" special data, d e is the vector with errors in the training vector;
[0221] (4) The embedded data is encoded using the repair network of the error correction model to obtain the hidden state of the middle coding layer in the multiple coding layers. The hidden state and the embedded data are differentially connected to obtain the connection value, which is then input into the fully connected layer. The posterior probability of the connection value is calculated using the activation function in the fully connected layer. The posterior probability is compared with the error correction tolerance. When the posterior probability is less than the error correction tolerance, the error correction result is judged to be wrong. When the posterior probability is greater than or equal to the error correction tolerance, the error correction result is judged to be correct. The posterior probability calculation formula is as follows:
[0222] cv i '=hd i +d i '
[0223] P i (x i =k|X)=activate(cv i ')*100%
[0224] Among them, cv i ' is the connection value, hd i is the hidden state, d i ' is the embedded data, P i (x i =k|X) is the character x i The posterior probability of being corrected to character k, X is the sample space of the text to be corrected, activate() is the activation function in the fully connected layer, and * is the multiplication operator;
[0225] (5) Calculate the logarithmic loss value of the error correction model based on the error correction result, adjust the model parameters of the deep error correction model based on the logarithmic loss value, and output the standard error correction model. The logarithmic loss value calculation formula of the error correction model is as follows:
[0226]
[0227] Where L is the logarithmic loss value of the error correction model, p is the error correction rate, q is the preset detection rate, k is the preset fixed weight, and n is the total amount of data;
[0228] (6) Inputting the bookkeeping information into the predetermined deep error correction model, and obtaining the correct bookkeeping information after error correction through a preset multi-round error correction mechanism;
[0229] In this embodiment, the tax department account book information TaxaccountBookInfo is preprocessed to obtain a data set Datas, and Datas is vectorized to obtain a training data vector Datas i , Datas i Perform mask preprocessing to obtain embedded data Datas i ', the posterior probability is calculated by the posterior probability formula: P i =96.96%;
[0230] Knowing that the error correction margin is 95.00%, the posterior probability P i If the error correction result is greater than the error correction tolerance, the error correction result is determined to be correct. The logarithmic loss value of the Bert error correction model is calculated based on the error correction result: L = 0.03564. The error correction process of some transaction details is as follows: Figure 11 shown.
[0231] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowcharts and / or block diagrams, as well as combinations of processes and / or blocks in the flowcharts and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowcharts and / or block diagrams. Figure 1 a process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0232] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.
[0233] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0234] Specific embodiments are used in the present invention to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core ideas. At the same time, for those skilled in the art, according to the ideas of the present invention, there may be changes in the specific implementation methods and application scopes. In summary, the contents of this specification should not be understood as limiting the present invention.
[0235] Those skilled in the art will appreciate that the embodiments described herein are intended to help readers understand the principles of the present invention, and it should be understood that the scope of protection of the present invention is not limited to such specific descriptions and embodiments. Those skilled in the art can make various other specific variations and combinations based on the technical teachings disclosed in the present invention without departing from the essence of the present invention, and such variations and combinations are still within the scope of protection of the present invention.
Claims
1. A ledger error correction method based on blockchain technology, characterized by: The method comprises the following steps: Step S1: Construct a ledger blockchain based on the ledger records of different departments, and simultaneously receive a ledger error correction request sent by the requesting party; Step S1 specifically includes: Step S101: The collector obtains the account book records of each department and generates a corresponding array; Step S102: Constructing a ledger blockchain based on the obtained ledger record arrays of each department; Step S103: Receive the ledger error correction request sent by the requesting party; Step S104: Obtain the latest block from the blockchain, and obtain transaction data from the latest block as a leaf node of the error correction requester authority verification RT tree; Step S105: construct an RT tree using the leaf nodes of the RT tree, obtain the permission information corresponding to the error correction requester from the RT tree, and determine whether the error correction requester has the permission based on the permission information; the specific process of constructing the RT tree in step S105 is as follows: (1) From TransactionsData r Take out n pieces of transaction data TD; (2) Add n pieces of transaction data TD to the bottom layer of the RT tree as leaf nodes of the RT tree; (3) Perform hash operation on the data block, Block i =Hash(TD i ), where 1≤i≤n; (4) Connect three adjacent blocks in series and then perform hash operation; (5)Block ((k+1) / 2) = Hash(Block (k-1) + Block k + Block (k+1) ), and k = 1, 3, 5, 7, …, n - 1; (6) The Block obtained by calculation ((k+1) / 2) As a new child node; (7) Repeat the calculation process of steps (4) to (6) until a complete RT tree is generated; Among them, TransactionsData r is a set of multiple transaction data in the memory of block r. TransactionsData r = {<TD1, transaction data 1>: <TD2, transaction data 2>: …: <TD i , transaction data i>: …: <TD n , transaction data n>}, where TD1 is the first transaction data, TD2 is the second transaction data, TD i is the i-th transaction data, and n is the total amount of transaction data; Hash() is a method for calculating the sha-256 value; Step S106: After the requesting party passes the authentication, the error correction request sent by the requesting party is received and stored; Step S107: perform an identification operation on the error correction request and record the error correction request as RID i’ , where RID i’ is the identification number of the error correction request, i' is the unique number of the identification number; Step S2: Obtain the information corresponding to the target ledger based on the identification number of the ledger error correction request, call the accounting detail analysis logic declared in the smart contract, and create the corresponding accounting detail record; Step S3: Based on the current accounting details, compare the hash value with the blocks of the same category to obtain the output result of whether the account information is correct; Step S3 specifically includes: Step S301: Based on the account book accounting information in the current accounting details record, a hash operation is performed on it to obtain a hash value h x ; Step S302: Based on the account book category information of the currently verified block, find the block of the same category in the blockchain, and perform a hash operation on the account book information in the account record of the block to obtain the hash value h y ; Step S303: h x With h y Compare the two hash values. If the two hash values are the same, the detailed accounting records in the verified block are correct and the record is True. If the two hash values are different, the detailed accounting records in the verified block are incorrect and the record is False. Step S4: Determine whether the account book information is correct. If the account book information is correct, the corresponding accounting details record is published to the blockchain. If it is incorrect, the accounting details record is input into the deep error correction model for error correction processing, and the error correction result is obtained. According to the error correction result, the corresponding accounting details record in the target account book is changed and published to the blockchain, and the corresponding account book error report result is generated at the same time.
2. The blockchain-based ledger error correction method according to claim 1, characterized in that: The step S2 specifically includes: Step S201: Based on the identification number RID of the ledger error correction request i’ , detect the block where the target ledger is located, and obtain the accounting rules and account information corresponding to the target ledger from the block; Step S202: Calling the accounting details analysis logic declared in the smart contract; Step S203: Create corresponding accounting details records according to the accounting rules and accounting information corresponding to the target account book.
3. The blockchain-based account book error correction method according to claim 2, characterized in that: The specific method for creating the corresponding accounting details record in step S203 is: (1) Obtain the unique address of the smart contract on the blockchain based on the contract deployment transaction; (2) According to the current block, obtain the specified parameters, and then pass the parameters to the contract function to perform the operation. The formula for calling the contract function is: tranTypeRules=fun_trule(p1,p2,…,p s …,p t ) amountItems=fun_amount(p1,p2,…,p s ,…,p t ) dateRules=fun_drule(p1,p2,…,p s ,…,p t ) accountRules=fun_arule(p1,p2,…,p s ,…,p t ) analysisLogicInfo={tranTypeRules,amountItems,dateRules,accountRules} Among them, the fun_trule() function is used to obtain the rules of the current account book transaction type, tranTypeRules is the classification rule of the transaction type, the fun_amount() function is used to obtain the number of amount items in the current account book, amountItems is the number of amount items in the account book, the fun_drule() function is used to obtain the date rules, dateRules is the date rule, the fun_arule() function is used to obtain the classification rules of the current account book, accountRules is the account book classification rule, p s is the sth parameter, t represents the number of parameters, and analysisLogicInfo is the returned accounting detail analysis logic information; tranTypeRules=extract_r(analysisLogicInfo) dateRules=extract_d(analysisLogicInfo) tranRules={tranTypeRules,dateRules} transactionDataType=typeAnalysis(tranRules,accountBookInfo) The extract_r() function is used to extract the transaction type classification rules tranTypeRules from the accounting detail analysis logic information analysisLogicInfo. The extract_d() function is used to extract the date rules dateRules from the accounting detail analysis logic information analysisLogicInfo. tranRules is a set of transaction data type rules, accountBookInfo is the account book accounting information, and typeAnalysis() is a transaction data classification function. This function classifies each transaction information according to the input transaction data type rules. transactionDataType is the transaction data type. amountItems=extract_am(analysisLogicInfo) accountRules=extract_ac(analysisLogicInfo) accRules={amountItems,accountRules,dateRules} accountBookCategory=categorize(transactionDataType,accRules,accountBookInfo) The extract_am() function is used to extract the number of ledger amount items (amountItems) from the accounting detail analysis logic information (analysisLogicInfo). The extract_ac() function is used to extract the account classification rules (accountRules) from the accounting detail analysis logic information (analysisLogicInfo). accRules is a set of account category rules. categorize() is a account classification function. Its main function is to assign the classified transaction data type (transactionDataType) and account book information (accountBookInfo) to the account book according to specific rules, and return the account book category information (accountBookCategory). actorRules={dateRules,transactionDataType,accountBookCategory} acterInfo=accountAssign(acterRules,accountBookInfo) accountingRecord={transactionDataType,accountBookCategory,acterInfo,accountBookInfo} Among them, actorRules is the account classification rule set, and accountAssign() is the account assignment function. This function assigns specific ledgers and transactions to the corresponding users based on the input account classification rule set actorRules and account book accounting information accountBookInfo, and returns the account person information. actorInfo is the assigned account person information; Among them, accountingRecord is the accounting detail record.
4. The blockchain-based ledger error correction method according to claim 1, characterized in that: The specific process of performing hash operation on the account book accounting information in the accounting detail record in step S301 is as follows: (1) Split and fill the account book information in the current account record to generate N 256-bit information blocks M (u) ; (2) Use the SHA-256 encryption algorithm to encrypt the information block M (u) Perform cyclic calculations to achieve encryption; (3)h x The value is calculated as follows: h (u) =sha_256(M (u) ) h x =h (1) ||h (2) ||h (3) …||h (u) Among them, h (u) is the hash value returned after hash encryption of the u-th information block, sha_256() is the SHA-256 function called, and h x The hash value generated for the ledger information of the verified block, || is a concatenation operation.
5. The blockchain-based account book error correction method according to claim 4, characterized in that: The specific steps of performing hash operation on the accounting information of blocks of the same category in step S302 are: (1) Extract the account book category information accountBookCategory from the current accounting detail record to be verified; (2) Based on the extracted account book category information accountBookCategory, find the block b with the same account book category on the chain y ; (3) According to the discovered block b y , extract the account book information accountBookInfo_b of this block y ; (4) Record the account book information of this block as accountBookInfo_b y Use the SHA-256 algorithm to encrypt and get the corresponding hash value h y , h y The value is calculated as follows: h (u) =sha_256(M (u) ) h y =h (1) ||h (2) ||h (3) …||h (u) Among them, h (u) is the hash value returned after hash encryption of the u-th information block, sha_256() is the SHA-256 function called, and h y The hash value generated for the ledger information of the identified blocks of the same category, || is a concatenation operation.
6. The blockchain-based ledger error correction method according to claim 1, characterized in that: The step S4 specifically includes: Step S401: Output the result based on whether the account information is correct. If the result is True, the corresponding accounting details are published to the blockchain; Step S402: If the result record is False, the accounting details record is input into the preset deep error correction model for error correction processing, and the error correction result is obtained; Step S403: According to the obtained error correction result, the corresponding accounting details in the target account book are modified; Step S404: Publish the corrected target ledger to the blockchain and generate a corresponding ledger error report result.
7. The blockchain-based ledger error correction method according to claim 6, characterized in that: The specific process of inputting the accounting details into the preset deep error correction model for error correction in step S402 is as follows: (1) Extract the account book information accountBookInfo from the accounting details record, pre-process the account book information, and obtain the data set ac_datas; (2) Vectorize the data set ac_datas to obtain a vector representation of the training data: d v =data_embeding(y v )+row_embedding(y v )+site_embedding(y v ) Among them, d v Represents the training data vector, y v represents the vth character in the accounting information, data_embedding() is a function for obtaining a data embedding vector, row_embedding() is a function for obtaining a row embedding vector, and site_embedding() is a function for obtaining a position embedding vector; (3) For the training data vector d v Perform mask connection preprocessing to obtain embedded data, the embedded data d' v The calculation formula is as follows: Among them, d' v is the embedded data, ρ is the variance coefficient, * is the multiplication operator, P a is the bias term in the fully connected layer, Q a is the weight matrix in the fully connected layer, is the matrix inner product operation, is the encoding hidden vector, d mask For embedded "mask" special data, d e is the vector with errors in the training vector; (4) The embedded data is encoded using the repair network of the error correction model to obtain the hidden state of the middle coding layer in the multiple coding layers. The hidden state and the embedded data are differentially connected to obtain the connection value, which is then input into the fully connected layer. The posterior probability of the connection value is calculated using the activation function in the fully connected layer. The posterior probability is compared with the error correction tolerance. When the posterior probability is less than the error correction tolerance, the error correction result is judged to be wrong. When the posterior probability is greater than or equal to the error correction tolerance, the error correction result is judged to be correct. The posterior probability calculation formula is as follows: cv' v =hd v +d' v P v (x v =k’|X)=activate(cv' v )*100% Among them, cv' v is the connection value, hd v is the hidden state, d' v To embed data, P v (x v =k'|X) is the character x v The posterior probability of being corrected to character k', X is the sample space of the text to be corrected, activate() is the activation function in the fully connected layer, and * is the multiplication operator; (5) Calculate the logarithmic loss value of the error correction model based on the error correction result, adjust the model parameters of the deep error correction model based on the logarithmic loss value, and output the standard error correction model. The logarithmic loss value calculation formula of the error correction model is as follows: Where L is the logarithmic loss value of the error correction model, p is the error correction rate, q is the preset detection rate, w is the preset fixed weight, and z is the total amount of data; (6) Inputting the bookkeeping information into the deep error correction model, and obtaining the correct bookkeeping information after error correction through a preset multi-round error correction mechanism.
Citation Information
Patent Citations
Accounting method and accounting system based on block chain
CN111339567A
Text fixed-length error correction method and device, equipment and storage medium
CN113887201A
Multi-account book consensus method for oracle machine
CN116340418A