CN110390524B - Method and device for processing job data in block chain, electronic equipment and storage medium - Google Patents

Method and device for processing job data in block chain, electronic equipment and storage medium Download PDF

Info

Publication number
CN110390524B
CN110390524B CN201910700343.1A CN201910700343A CN110390524B CN 110390524 B CN110390524 B CN 110390524B CN 201910700343 A CN201910700343 A CN 201910700343A CN 110390524 B CN110390524 B CN 110390524B
Authority
CN
China
Prior art keywords
block
data
job data
verified
transaction
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201910700343.1A
Other languages
Chinese (zh)
Other versions
CN110390524A (en
Inventor
漆英
王卓成
戴丹
蓝振杰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Industrial and Commercial Bank of China Ltd ICBC
Original Assignee
Industrial and Commercial Bank of China Ltd ICBC
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Industrial and Commercial Bank of China Ltd ICBC filed Critical Industrial and Commercial Bank of China Ltd ICBC
Priority to CN201910700343.1A priority Critical patent/CN110390524B/en
Publication of CN110390524A publication Critical patent/CN110390524A/en
Application granted granted Critical
Publication of CN110390524B publication Critical patent/CN110390524B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • G06F16/2228Indexing structures
    • G06F16/2255Hash tables
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/38Payment protocols; Details thereof
    • G06Q20/382Payment protocols; Details thereof insuring higher security of transaction
    • G06Q20/3829Payment protocols; Details thereof insuring higher security of transaction involving key management

Abstract

The invention discloses a method and a device for processing operation data in a block chain, electronic equipment and a storage medium, wherein the method comprises the following steps: receiving a plurality of parallel job data, and respectively verifying the parallel job data, wherein each job data comprises an intelligent contract; performing hash operation on the successfully verified job data to generate a hash value, and sending the job data with the same hash value to the same packaging node; generating a partial block according to the operation data of the same packaging node and verifying the partial block, wherein the partial block comprises: the block body records the operation data of the same packing node, and the partial block head records the hash value of the operation data in the block body; generating a complete block according to the partial block which is successfully verified according to the block data structure, wherein the complete block comprises: the district's piece, some district's piece head and another part district's piece head, another part district's piece head includes: hash value of a previous block of the complete block; and executing corresponding operation according to the operation data in the complete block.

Description

Method and device for processing job data in block chain, electronic equipment and storage medium
Technical Field
The invention relates to the field of information processing, in particular to a method and a device for processing operation data in a block chain, electronic equipment and a storage medium.
Background
Each block in the block chain generates a data fingerprint through a hash (hash) algorithm and is embedded into a subsequent block, the fingerprint serves as a pointer of the subsequent block to a preamble block, the fingerprint or the pointer of the block is actually the hash value of the block, the firm relation ensures that the data entering the chain cannot be tampered, and a plurality of pieces of completely consistent data, namely the block chain, are arranged in the whole network through a consensus algorithm. The data in the block is mainly a plurality of transaction scripts (called intelligent contracts), the intelligent contracts are assigned with an order determined by the block and the position in the block, and the blockchain application system is a system for sequentially executing the intelligent contracts from the application level.
The current blockchain handles conflicts through a transaction ordering policy. For the federation chain, two levels of transaction ordering are employed: one level is that the blocks are ordered in the chain; second level is that the transactions are ordered in the block. The sorting of the transaction in the block is usually performed when the block is constructed, but the construction block cannot perform transaction sorting operation in parallel, because it needs the hash value of the head of the previous block, and meanwhile, voting is needed when the block is stored, so based on the above reasons, the efficiency of block chain application is low, which causes the self characteristics of some applications not to be well embodied in the infrastructure of the block chain, and also causes the technology accumulation of the applications not to be well utilized and utilized, thereby affecting the performance and efficiency of the application system.
Meanwhile, the property of tamper resistance of the block chain is urgently needed by banking business. The core function of the bank system is to process the transaction of asset transfer between accounts. Before asset transfer is actually performed, a system often performs admission judgment on related information of a transaction through a plurality of auditing subprograms, and only under the condition of admission control, a target transaction is finally performed. Therefore, the execution efficiency of the blockchain system is low, and if the admission judgment in the transaction process is also performed in the consensus algorithm of the core transaction, the efficiency is low. In addition, some transaction records which do not meet the transaction admission conditions also enter the core processing module, so that the burden of the core processing module is increased, and the hit rate of the transactions is reduced.
Disclosure of Invention
In view of the above, the present invention provides a method, an apparatus, an electronic device and a storage medium for processing job data in a block chain, so as to solve at least one of the above-mentioned problems.
According to a first aspect of the present invention, there is provided a method for processing job data in a blockchain, the method comprising: receiving a plurality of parallel job data from different users, and respectively verifying the plurality of parallel job data, wherein each job data comprises an intelligent contract; in response to the successful verification, carrying out hash operation on the verified job data to generate a hash value, and sending the verified job data with the same hash value to the same packaging node; generating a partial block according to verified operation data of the same packaging node, and verifying the partial block, wherein the partial block comprises: the block body records verified operation data of the same packaging node, and the partial block head records a hash value of the verified operation data in the block body; in response to a successful verification, generating a complete block from the partial block successfully verified according to a block data structure, the complete block comprising: the block body, the partial block head, and another partial block head, the another partial block head including: a hash value of a previous block of the complete block; and executing corresponding operation according to the operation data in the complete block.
According to a second aspect of the present invention, there is provided a job data processing apparatus in a blockchain, the apparatus comprising: a job data receiving unit for receiving a plurality of parallel job data from different users, each job data including an intelligent contract; a job data verification unit configured to verify each of the plurality of parallel job data; the job data sending unit is used for responding to successful verification, carrying out hash operation on the verified job data to generate a hash value, and sending the verified job data with the same hash value to the same packaging node; a partial block generation unit configured to generate a partial block from verified job data of the same packed node, the partial block including: the block body records verified operation data of the same packaging node, and the partial block head records a hash value of the verified operation data in the block body; a partial block verification unit for verifying the partial block; a complete block generation unit, configured to, in response to successful verification, generate a complete block from the partial blocks that are successfully verified according to the block data structure, where the complete block includes: the block body, the partial block head, and another partial block head, the another partial block head including: a hash value of a previous block of the complete block; and the operation execution unit is used for executing corresponding operation according to the intelligent contract of each operation data in the complete block.
According to a third aspect of the present invention, there is provided an electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the steps of the method for processing job data in a blockchain as described above when executing the program.
According to a fourth aspect of the present invention, the present invention provides a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements the steps of the above-described method of job data processing in a blockchain.
According to the technical scheme, the received parallel operation data which is successfully verified is subjected to Hash operation, the partial blocks are generated in advance according to the operation data with the same Hash value, when the partial blocks are successfully verified, the complete blocks are generated, corresponding operation is executed, and the problem that the efficiency of the current block chain is low when the blocks are constructed can be solved by generating the partial blocks in advance, so that the execution performance and the efficiency of a block chain system can be improved.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to these drawings without creative efforts.
FIG. 1 is a flow diagram of a method of job data processing in a blockchain according to an embodiment of the present invention;
FIG. 2 is a schematic diagram of a job data structure according to an embodiment of the present invention;
fig. 3 is a block diagram of a configuration of a job data processing apparatus in a block chain according to an embodiment of the present invention;
fig. 4 is a block diagram of the structure of the partial block generating unit 34 according to the embodiment of the present invention;
fig. 5 is a detailed configuration block diagram of a job data processing apparatus in a block chain according to an embodiment of the present invention;
FIG. 6 is an exemplary diagram of a blockchain based banking core system according to an embodiment of the present invention;
FIG. 7 is a schematic diagram of network logic of a pre-processing apparatus according to an embodiment of the present invention;
FIG. 8 is a diagram illustrating an exemplary configuration of a transaction submitting subnetwork 11 according to an embodiment of the present invention;
FIG. 9 is a diagram illustrating an exemplary configuration of a hub 12 according to an embodiment of the present invention;
fig. 10 is a schematic view of an audit subnet structure of an admission control layer according to an embodiment of the present invention;
FIG. 11 is a block chain structure diagram according to an embodiment of the invention;
FIG. 12 is a block diagram according to an embodiment of the present invention;
FIG. 13 is a schematic diagram of a block chain mid-century block in accordance with an embodiment of the present invention;
FIG. 14 is a diagram of an account state snapshot, a Merkel tree, according to an embodiment of the invention;
FIG. 15 is a diagram illustrating the arrangement of transactions in a blockchain according to an embodiment of the present invention;
FIG. 16 is a block diagram of a backup and restore apparatus according to an embodiment of the present invention;
FIG. 17 is a schematic diagram of an electronic device according to an embodiment of the invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
An embodiment of the present invention provides a method for processing operation data in a block chain, where fig. 1 is a flowchart of the method, and as shown in fig. 1, the method includes:
step 101, receiving a plurality of parallel job data from different users, and respectively verifying the plurality of parallel job data, wherein each job data comprises an intelligent contract;
102, responding to successful verification, performing hash operation on verified job data to generate a hash value, and sending the verified job data with the same hash value to the same packaging node;
103, generating a partial block according to the verified operation data of the same packaging node, and verifying the partial block, wherein the partial block comprises: the block body records verified operation data of the same packaging node, and the partial block head records a hash value of the verified operation data in the block body;
step 104, in response to successful verification, generating a complete block from the successfully verified partial block according to the block data structure, where the complete block includes: the block body, the partial block head, and another partial block head, the another partial block head including: a hash value of a previous block of the complete block;
and 105, executing corresponding operation according to the operation data in the complete block.
The received parallel operation data which is successfully verified is subjected to Hash operation, a partial block is generated in advance according to the operation data with the same Hash value, when the partial block is successfully verified, a complete block is generated, corresponding operation is executed, and the problem that the efficiency of an existing block chain is low when the block is constructed can be solved by generating the partial block in advance, so that the execution performance and the efficiency of a block chain system can be improved.
For a better understanding of embodiments of the present invention, embodiments of the present invention are described below based on a banking system.
In step 101, verifying each of the plurality of parallel job data (which may also be referred to as transaction data or business data) includes: carrying out simulation test on the intelligent contract in each operation data; and responding to the simulation test result as success, and establishing the intelligent contract in the operation data.
In actual operation, the data structure of the job data is as shown in fig. 2, and the job data includes: smart contracts 21 and signature lists 22.
The smart contract 21 may be a script for executing a specific job (or transaction), for example, in a banking system application, a script for performing accounting processing, and may specifically include a user account and a transaction to be executed (account opening and transfer are taken as examples below).
(1) Account number (acc): a client (person or organization) may first generate a pair of private and public key pairs (iKey, pKey) on a trusted platform, pKey corresponding to an account number and iKey corresponding to a password (kept by the client itself). Since pKey is a binary code and is difficult to recognize and write, pKey is usually compressed and then converted into Base58 code, and the converted account is marked as acc. The process is unidirectional, i.e., acc is easily calculated from pKey, but not in reverse, so a control mechanism from acc to pKey is required. The open transaction script requires the customer to provide information: (Open, my _ acc, pKey, type, info, Bank _ acc), where type identifies whether the account is a Bank itself or a customer of the Bank, info contains customer information (e.g., identification number, contact phone number, etc.), and Bank _ acc indicates at which Bank the account is opened; after the transaction is audited, the account chain has a record: (my _ acc, pKey, type, info, Bank _ acc). When the transaction is executed, there is a record in the accounting hierarchy: (acc, arnt 0, …), wherein arnt 0 represents a balance of 0.
(2) Transfer (Transfer) transaction: the customer may simply provide (Transfer, a acc, B acc, arnt), indicating that an arnt is to be transferred from the a account number to account B, called a transaction application, which is converted to a script: (Transfer, A _ acc, -amnt; B _ acc, + amnt, …), i.e., the balance of A _ acc will decrease by amnt and the balance of B _ acc will add amnt.
The aforementioned two transactions (account opening and transfer) may be represented in the form of:
(Open,Bank_acc,-0;my_acc,+0,…)
(Deposit,Bank_acc,-amnt;my_acc,+amnt,…)
signature list 22: the asymmetric key system technology is adopted, a private key is usually used for signing, other people verify the signature by using a public key of the private key, and the signature has the functions of tamper resistance and repudiation resistance.
Assuming that the account of customer 1 (person or organization) corresponds to a pair of private and public keys (iKey1, pKey1), the signature algorithm is f, the transaction data is message, then the transaction data block is signed with the private key to sign1 ═ f (message, iKey1), and then the signer is taken (to know who is and verified by the verifier), then the signature can be represented as (pKey1, sign 1). A transaction may be signed by multiple people. For example, a deposit transaction has a customer signature (pKey1, sign1), a bank payee signature (pKey2, sign2), and a bank rechecker signature (pKey3, sign3), which is a list of signatures.
In an embodiment of the present invention, the transaction data structure is: [ intelligent contracts; signature list ], therefore, the transaction can be represented as:
[(Deposit,Bank_acc,-amnt;my_acc,+amnt,…);
(pKey1,sign1),
(pKey2,sign2),
(pKey3,sign3)
]
in actual practice, the transaction format may be defined by a transaction (smart contract) template. The pKey in the signature (pKey, sign) is not necessarily provided by the customer, and the customer only needs to provide a corresponding account number, and the system queries the "account chain" when assembling the transaction to obtain the corresponding pKey. When the transaction is submitted, the signatures of the related parties can be continuously added, and the signatures comprise: transaction applicant, transaction confirmer(s), transaction simulation node, etc., transactions that do not meet the requirements may be discarded.
When the transaction data application is completed, i.e., when the verification is successful, a queuing operation may be performed on a plurality of successfully verified transaction data, and then step 102 is performed.
In step 102, hash operation is performed on the verified job data of the same packed node in a merkel tree structure, and the partial block header is set according to the hash operation result.
In one embodiment, a database is built from verified job data, which is discarded after a predetermined time, and its hash value. In this way, the job (transaction) can be prevented from being repeatedly submitted.
In step 103, verifying the partial block comprises: and verifying the user identity and the corresponding job performability corresponding to the verified job data in the partial block. Through the verification, the operation can be further verified, and the execution efficiency of the block chain system is further improved.
In practical operation, a block at a predetermined position in the block chain may be set as century block CnCentury section C1And the first block C of the block chain0The interval between the blocks in two centuries is X blocks, n is a positive integer greater than or equal to 1, and X is a positive integer greater than 1.
When a block is a century block CnThen, can be according to block C0And Cn-1Generating operation state snapshots of the block executed operations; thus, century Block CnFurther includes a pointer to the job state snapshot. The job details (transaction details) can be traced through the job state snapshot.
In one embodiment, the job state snapshot may be generated in a Meckel tree structure.
By the operation state snapshot, operation data and corresponding operation can be backed up and restored.
The embodiment of the present invention further provides a device for processing job data in a block chain, and preferably, the device is configured to implement the method described above. Fig. 3 is a block diagram of the apparatus, and as shown in fig. 3, the apparatus includes: a job data receiving unit 31, a job data verifying unit 32, a job data transmitting unit 33, a partial block generating unit 34, a partial block verifying unit 35, a complete block generating unit 36, and a job executing unit 37, wherein:
a job data receiving unit 31 for receiving a plurality of parallel job data from different users, each job data including a smart contract;
a job data verification unit 32 for verifying the plurality of parallel job data, respectively;
a job data sending unit 33, configured to perform a hash operation on the verified job data to generate a hash value in response to a successful verification, and send the verified job data having the same hash value to the same packing node;
a partial block generating unit 34 configured to generate a partial block from the verified job data of the same packed node, the partial block including: the block body records verified operation data of the same packaging node, and the partial block head records a hash value of the verified operation data in the block body;
the partial block verification unit 35 is configured to verify the partial block, and specifically, to verify a user identity and a job performability corresponding to the verified job data in the partial block.
A complete block generating unit 36, configured to, in response to successful verification, generate a complete block from the partial blocks that are successfully verified according to the block data structure, where the complete block includes: the block body, the partial block head, and another partial block head, the another partial block head including: a hash value of a previous block of the complete block;
and the job execution unit 37 is configured to execute a corresponding job according to the intelligent contract of each job data in the complete block.
The received parallel job data which is successfully verified is subjected to hash operation through the job data sending unit 33, the job data with the same hash value is sent to the same node, then the partial block generating unit 34 generates partial blocks in advance according to the job data of the same node, when the partial block verifying unit 35 successfully verifies the partial blocks, the complete block generating unit 36 generates complete blocks, the job executing unit 37 executes corresponding jobs, and the partial block generating unit 34 generates the partial blocks in advance, so that the problem that the current block chain is low in efficiency when the blocks are constructed can be solved, and the execution performance and the efficiency of a block chain system can be improved.
The job data verification unit includes: and the simulation testing module (not shown in the figure) is used for performing simulation testing on the intelligent contract in each piece of operation data, and the intelligent contract in the operation data is established in response to the simulation testing result being successful.
As shown in fig. 4, the partial block generating unit 34 includes: a hash operation module 341 and a partial block header setting module 342, wherein:
a hash operation module 341, configured to perform a hash operation on the verified job data of the same packed node in a meikel tree structure;
a partial block header setting module 342, configured to set the partial block header according to the hash operation result.
As shown in fig. 5, the above apparatus further includes: a database establishing unit 38, a century block setting unit 39, a job state snapshot generating unit 40 and a backup unit 41, wherein:
a database creating unit 38 for creating a database based on the job data verified by the job data verifying unit 32 and the hash value thereof, wherein the verified job data is discarded after a predetermined time. In this way, the job (transaction) can be prevented from being repeatedly submitted.
A century block setting unit 39 for setting a block of a predetermined position in the block chain as a century block CnCentury section C1And the first block C of the block chain0The interval between the blocks in two centuries is X blocks, n is a positive integer greater than or equal to 1, and X is a positive integer greater than 1.
An operation state snapshot generating unit 40 for generating a snapshot according to the block C0And Cn-1Generating operation state snapshots of the block executed operations; when a block is a century districtWhen a block, another partial block header that it generates in the complete block generation unit 36 also includes a pointer to the job state snapshot. Preferably, the job state snapshot generating unit 40 may generate the job state snapshot in a meikel tree structure.
And the backup unit 41 is configured to perform backup and recovery operations on the job data and the corresponding job according to the job state snapshot.
In practical operation, the units and the modules may be arranged singly or in combination, and the invention is not limited thereto.
For specific execution operations of the units and the modules, reference may be made to the description in the foregoing method embodiments, and details are not described here again.
For better understanding of the embodiment of the present invention, the bank system is taken as an example below, and a bank core system framework is constructed based on the block chain. Fig. 6 is an exemplary diagram of a blockchain-based bank core system according to an embodiment of the present invention, and as shown in fig. 6, the blockchain-based bank core system includes: leading preprocessing device, admission control device and accounting processing apparatus, wherein:
the pre-pretreatment device: the device can improve the effectiveness of transaction processing of the block chain and accelerate the processing efficiency of the bank core system. The device firstly verifies the validity and validity of the transaction needing to enter the accounting processing alliance chain, eliminates illegal transactions and improves the success rate of the accounting processing alliance chain. Meanwhile, for the transaction passing the verification, the transaction submitted to the system is sequenced by using a queue mechanism, so that a plurality of transactions can be processed in one consensus process, and the processing speed of the system is further increased. In the submission subnet, a plurality of transaction collection subnets 11 are deployed for receiving transactions. When the transaction quantity reaches a certain value, the transaction quantity is sequenced and then submitted to the admission control alliance chain.
An admission control device: and the admission control device is positioned in the auditing alliance chain and is used for carrying out unified auditing on the transaction information submitted by the submitted subnet. For example, the federation chain may establish a blacklist (for users) and a whitelist (for banks) with admission control over which transactions can be made to an account and which transactions cannot be made. The admission control layer also uses a consensus algorithm to judge the client's right to use the transaction. If the account in the transaction fails to pass the admission control, the transaction cannot enter the accounting processing layer.
An accounting processing device: the system is positioned in an accounting alliance chain, belongs to the core function of a bank system, and realizes account management and asset transfer among different accounts. The accounting federation chain may be formed of a federation chain 16, with an accounting block in the chain recording transactions for a set (or groups) of asset transfers. To improve the efficiency of accounting processing, the accounting processing layer introduces a century block and a transaction state snapshot. Through the century block and the transaction state snapshot, the system user can trace back the transaction details and balance of the account.
The frame system fully utilizes the advantages of the block chain to process the core accounting of the bank, and meanwhile, the efficiency of accounting processing is improved through methods such as century blocks, audit nodes and the like. Besides, the block chain is utilized to realize the access control of the core transaction, and the accuracy of core accounting processing is further improved.
The pre-processing device, the admission control device and the accounting processing device are described in detail below.
(I) pre-pretreatment device
Fig. 7 is a schematic diagram of network logic of a pre-processing apparatus, as shown in fig. 7, the pre-processing apparatus includes: a plurality of transaction submission subnets 11 for submitting transaction data; and a hub 12 including a plurality of packing nodes 126 for generating the partial chunk.
There may be multiple transaction submitting subnetworks of embodiments of the present invention. Fig. 8 is a diagram illustrating an exemplary structure of a transaction submitting sub-network 11, and as shown in fig. 8, transaction data (e.g., smart contracts) in the sub-network implement processes such as transaction application, confirmation, simulation (i.e., testing whether the smart contracts are established), and auditing, so as to confirm that the transaction is reasonable, and then submit the transaction to a transaction "centralized location". The transaction data (Tx) arriving at the 'distribution site' contains the signature of each associated node in the confirmation link, and the anti-tampering and anti-repudiation effects are achieved.
Fig. 9 is a diagram of an exemplary structure of the hub 12, and as shown in fig. 9, when a transaction 121 is submitted to the "hub", it first passes through the transaction queuing device 122 and then reaches the packing node 123 through a soft load balancing policy of routing processing. The ability to deal with high concurrency of transactions can be improved by a 'collecting and distributing' mode. In the packing node 123, partial blocks (or referred to as semi-finished blocks) are generated, and the bottleneck of the generation efficiency of the block chain can be solved by generating the semi-finished blocks in parallel.
As shown in fig. 9, "a hub" includes: a transaction queuing device 122, a packing node 123, and a anti-replay check module 124, wherein:
the transaction queuing means 122 receives the transactions generated in parallel and converts them into a serial stream. Middleware similar to MQ (Message Queue).
The packing node 123, including the packing processing module, generates a "block semi-finished product" 125 from the serial stream of the transaction, where the block semi-finished product is a solid line part of the data structure, and includes a block body (transaction data set TxS) and a block header h (TxS), where h (TxS) is a hash value of TxS and points to the transaction set TxS, and when TxS is organized in a mekel tree, h (TxS) is its root (root). The embodiment of the invention separates the parts which can be parallel in the building blocks to form a 'block semi-finished product', thereby improving the generation efficiency of the block chain.
The anti-replay check module 124, invoked by the packaging process module, prevents the transaction from being repeatedly submitted. Specifically, a database of (key h (Tx), value Tx) is created, which is periodically cleared, a time window may be established, and a time stamp (timestamp) in Tx is discarded when the window is exceeded, thereby preventing duplicate transactions from being submitted.
In a parallel environment, the blockchain handles conflicts through a transaction ordering policy. There are two types of ranking strategies: (1) the transaction is directly related to the preamble transaction (pointer mode), namely the transaction (intelligent contract) directly contains a pointer to point to the preamble transaction (such as bitcoin); (2) the transaction is indirectly related to the preamble transaction (ordering mode), i.e. the preamble transaction is not directly specified in the transaction (intelligent contract), but the context of the transaction is determined by the position of the transaction in the block chain. The embodiment of the invention adopts a strategy of transaction indirect association preamble transaction (ordering mode), and the transaction ordering is two levels: the first level is that the transaction is between blocks, and the blocks have a sequence in a chain; second level is the ordering of transactions in the block. In the prior art, the ordering of transactions in blocks is usually done when building blocks, but building blocks cannot be done in parallel per se, since it requires a hash value of the previous block header.
From the perspective of efficiency, a group of packing nodes (e.g., k) can be used to deal with highly concurrent business application systems, and concurrent transactions can be sent to each packing node in a soft load balancing strategy in a balanced manner, for example, a decentralization strategy is used: the Tx transaction is sent to the packing node with ID number hash (Tx)% k, ensuring that transactions of the same hash value are sent to the same packing node.
In the preprocessing process, the transaction number contained in the block body can be set to be a constant N, in addition, a time window can be set, when the business is low, a block semi-finished product is generated in the time window, and at the moment, if the transaction number is less than N, some empty transactions can be filled.
From the reliability perspective, each packing node can be physically configured with one or more hot standby nodes to execute the same work as the packing node, except that the block semi-finished product is not transmitted to the block chain operation subnet, and can be used for checking the block semi-finished product output by the matched working node.
The transactions received by the packaging node all contain signatures, so that the transaction content cannot be tampered, the transactions cannot be newly added, and the transactions can be lost when objective faults occur in the transactions. The loss rate is easily measured by the hot standby node, in actual operation, a threshold value can be set, when the threshold value is reached, the node is considered to be out of order, and the node can be replaced by the hot standby node according to a preset strategy.
In the specific implementation process, the transaction submitting sub-network processes transaction flow through the routing, and the packaging node broadcasts the transaction to the checking sub-network 14, wherein the transaction is mainly broadcasted to the semi-finished products of the block.
(II) Admission control device
In the embodiment of the present invention, the audit operation of the accounting processing in the banking system service is deployed in the admission control layer, the admission control layer mainly includes one or more block chains called audit chains, which are used to audit the banking transactions, and the same type of service can be executed only after the audit node 141 shown in fig. 10 completes the audit. The admission control function is to be deployed in an audit node, which may be an agent of a regulatory body, that is, each audit sub-network includes a transaction audit node, and a plurality of transaction submitting sub-networks can simultaneously submit block semi-finished products to the same transaction audit node, as shown in fig. 7. This transaction auditing subnetwork may provide transaction-specific auditing services for all transaction submitting subnetworks.
The special transactions here include the following two types:
the account adjustment type transaction mainly relates to transactions such as account opening, account selling, account information adjustment and the like. When opening an account, checking whether the subnet needs to check the authenticity of the client identity information, whether the subnet is in a blacklist, whether the subnet has opened an account, and the like; when the account information is adjusted, the identity of the client also needs to be verified, so that the client is ensured to have enough authority to adjust the account information.
Second, asset transfer type transactions, where the flow of funds in the blockchain system is closed, e.g., bitcoin generates funds from the blockchain system itself (the process of mining and dispensing), which then circulate continuously within the blockchain system. In an embodiment of the invention, the injection of funds into the blockchain system is analogous to a bank 'deposit' cash transaction. The embodiment of the invention corresponds the 'deposit' cash transaction under the chain to the on-chain deposit transaction, for example, a client A deposits 10000 yuan: (bank account, balance-10000; customer a account, balance +10000), the bank account balance being zero (at the beginning) or negative, i.e. the bank account is a special account which may be negative (corresponding to its amount of credit), in an embodiment of the invention, the system is specified to be zero conservative in the balance total, so that the system will check whether the previous account is a bank account (eligible for putting).
Fig. 10 is a schematic view of an audit subnet structure of an admission control layer, as shown in fig. 10, the structure includes:
1. the auditing node 141: the transaction review node maintains 1411 two lists: one part is a customer blacklist 1414 for controlling customer account opening; one is a bank whitelist 1413 in which the balance of the account may be negative (e.g., the bank's loan account is credited and the amount of the loan issued is indicated by the balance being negative) for auditing the customer's deposit transaction.
The transaction auditing node is typically provided by a regulatory body (the central bank), which submits the relevant procedures and performs an open transaction, thereby adding a roster of the commercial bank in the system (the transaction auditing node) and adding an account number of the commercial bank in the system (in the accounting system of the blockchain), etc.
2. The maintenance node 142: the network node is connected to a transaction auditing sub-network, and the two lists are updated and maintained through the maintenance node. For example, add/delete blacklist records, add/delete whitelist records.
3. The transaction auditing module 1412: when receiving the transaction from the transaction submitting node, the module checks the account of the opening transaction and the account stored in the transaction according to the rules and feeds back the checking information (containing the signature) to the transaction submitting node.
4. The consensus algorithm module 143 is mainly responsible for:
(1) and checking the content of the block semi-finished product in the subnet, namely submitting the transaction block semi-finished product submitted by the subnet. And the checked semi-finished blocks are further submitted to an account processing layer to form final finished blocks. If the audit is not passed, the semi-finished product is discarded in the audit subnet, and the semi-finished product cannot continuously enter the account processing layer.
(2) And (3) account management transaction admission auditing: firstly, each node of a transaction auditing sub-network participates in auditing, the existing consensus algorithm is used for achieving consensus, and newly opened accounts are recorded in an account chain; each auditing node feeds back an auditing result to the transaction submitting node, and the transaction submitting node determines whether the final auditing is passed or not according to voting conditions (the returned data is regarded as abandoning right); and thirdly, the consensus algorithm can add the successfully opened account into a white list or a black list according to the information attached to the account opening request.
(3) Asset transfer transaction admission auditing: each node of the transaction auditing sub-network participates in auditing, each auditing node feeds back an auditing result to the transaction submitting node, and the transaction submitting node determines whether the final auditing is passed or not according to voting conditions (the returned data is regarded as abandon right). The audited information may include the following:
a) the identity of the client is checked whether the client can operate the account uploaded in the transaction;
b) for example, when drawing money, the amount of money drawn needs to be pre-determined, and whether the account balance is sufficient is checked, and if the balance is negative, whether the account is a white list, whether the balance can be continuously overdrawn, and the like.
c) And the networking check can be performed with other external organizations through the block chain, so that the client information is further checked.
(III) Account processing device
And after the sub-network is audited, the passed transaction enters an accounting processing layer to complete the actual transaction processing. The accounting processing layer is composed of an account block chain, the transaction block semi-finished products generated by the submitted sub-network are converted into final complete blocks, and the transaction is completed through a consensus algorithm.
Fig. 11 is a schematic structural diagram of a block chain according to an embodiment of the present invention, and as shown in fig. 11, the structure includes:
(1) block chain 131: according to the prior art, a block chain is formed, each block contains a plurality of transactions (intelligent contracts), the intelligent contracts are sorted according to a predetermined rule, each block (except the first block) contains a pointer of a preceding block thereof, a logical chain is formed and is called a block chain, the block chain continuously grows to the right, and the data structure is characterized by corresponding to an online transaction log of a traditional bank core system.
(2) Account status table 132: a key-value database for storing transaction execution results. The "account balance table" corresponding to the traditional bank core system reflects the current balance of the customer's account. That is, the primary key is a unique index key, which can be regarded as the account ID (account number) of the customer, the value is regarded as the account balance and other status (i.e., the value may be a set of values), and the intelligent contract is continuously run, so that the (update) balance record is continuously updated. A block is made up of a plurality of ordered exchanges and the change in account status is block level, i.e. "receive a block and effect of changing the block on account status" is considered a transaction.
(3) State snapshot 133: the block chain is a special node, reflects the information in the account state table at a certain time, and corresponds to a 'day end balance table' of a traditional bank core system at the end of day. Compared with a 'daily terminal balance table' of a traditional core bank system, the account state snapshot is subjected to tamper-proof processing, the correctness of the account state table at a specific moment can be verified, a Merkel tree is established through a hash value, and a tree root (root) is embedded into a block at the specific moment.
(4) State trace 134: as previously known, the change of the account status is at a block level, and we record the track of the change of the account status in a manner to extend the (key-value) to (key, action, value), which means: the balance of the account key becomes value after the action is executed, for example, (zhang three, a1, 100), (lie four, b1, 100), the execution intelligence contract a2 is "zhang three transfers to lie four 80 yuan", and the result is: (zhangsan, a2, 20), (liquad, a2, 180). In fact, there is no need to store the smart contract because the smart contract is already stored in the block chain, and it is only necessary to find it, i.e., the action is represented as a pointer to the smart contract (the pointer points to the block where the smart contract is located + the location of the smart contract in the block). Referring to the block structure shown in fig. 12, when TxS is organized as a merkel tree, the pointer to the block is actually the hash value of the block, and the location of the smart contract (transaction) in the block can also be located by the hash value of the transaction. From the process of generating an account status track according to the block chain, as shown in fig. 11, it is obvious that (i) and (ii) are executed simultaneously, but (i) is in an update (update) manner, and (ii) is in an insert (insert) manner.
With continued reference to the block structure shown in fig. 12, in an embodiment of the present invention, the blocks may be divided into non-century blocks 1311 and century blocks 1312.
As shown in fig. 12, the data structure of the block is divided into two parts: a block header and a block body, wherein the block body is composed of a set of transactions TxS (intelligent contracts), and the set of transactions are ordered by the storage structure (such as an array structure or a tree structure), i.e., the transactions in the block are ordered. The block header is made up of some tamper-resistant mechanism and other data. The tamper-resistant mechanism also provides a retrieval mechanism, which is the role of the hash value as a fingerprint and pointer. Pointers in the block header are: h (TxS), points to transaction group TxS (when TxS is organized in a merkel tree, h (TxS) is its root, as shown in 1334 of fig. 14 below); perBlock points to the previous block, Sate points to the account state snapshot (century time) or null pointer (non-century time). Of course, the block header may also include other information, such as time-stamp, location (C)n,k)。
Fig. 13 is a schematic diagram of a century block in a block chain, as shown in fig. 13, a block in the block chain carrying a "triangle" (account state snapshot) of "special moments", we call the century block.
The blockchain can be regarded as a chain growing continuously to the right, and the embodiment of the invention divides the chain into a century from left to right by a certain span (M blocks, wherein M can be set according to actual needs and has high flexibility), namely: starting with the "century creation" block (first block), denoted C0Number right, to the M +1 th block, which is defined as the first century block C1Then with C1Starting at (as the first century), counting to the right, to the M +1 th block, which is defined as the second century block C2And by analogy, the century block sequence is: c0,C1,C2,C3… …. In the first century is [ C ]0,C1) In the second century is [ C ]1,C2) And so on. C1,C2,C3… …, is the "special moment" (century).
In general, the nth century in the examples of the present invention: symbol [ C ]n-1,Cn) Denotes C in the Block chainn-1To CnAll blocks (M) in between, packContaining the former Cn-1But does not contain the latter Cn
CnAccount state snapshot of (a) is defined as a blockchain run (executing the above intelligent contract) to CnThe previous account status is processed in a tamper-proof way, and the account status can be obtained in two ways: (1) run from [ C ]0,Cn) All intelligent contracts in between; (2) starting with a snapshot of the account state for a century block, all intelligent contracts for all centuries thereafter are run. Generally, in the way (2), and take the latest snapshot to obtain, namely: with Cn-1Account State Snapshot as Start, run [ Cn-1,Cn) All intelligent contracts in between.
When we define a chain of length M as a epoch, M is a constant that acts as a system that determines the amount of data that needs to be saved online. The value of M can be calculated by a business condition, and assuming that an application plan performs a "snapshot" once a week, and the data volume of each week generates about 10000 blocks, M can be 10000.
In embodiments of the present invention, the century date is the point of synchronization of account status correctness, and between two century dates the account status may be attacked. Under the condition of certain attack probability, the damaged number of the network nodes is considered to be related to time, and in order to ensure that the consensus mechanism does not fail in the time period between two century blocks, M must be ensured to be smaller than the failure time of the consensus mechanism under the network environment with the attack. Of course, the effectiveness of the attack may be reduced or eliminated by security measures of the network environment, thereby extending the time that the consensus mechanism fails.
An extreme special case is that M is 1, in this case, the account state table, the account state snapshot, and the account state trajectory may be unified, that is, only the account state snapshot is available, and the recorded content is expanded from (key-value) to (key, action, value). This can cope with a harsh network environment security environment. Obviously, this is extremely inefficient, as a large number of hash calculations are required.
In practice, the hash value H of a data block a is hash (a) with better "scatter" (i.e. the hash value is different for different data blocks), and a small change in a can make H change greatly. Thus, H can serve as both a's fingerprint and a's pointer (primary key for key-value pair < H, A >). With this feature, we can create a tamper-resistant account state snapshot, as follows (1) - (3):
(1) and (3) the status of the evidence correction account: the above account state snapshot is started, and the intelligent contracts in the block chain are run later, so that the account state table is updated with the data at the moment (the original account state table may be tampered with).
(2) Packaging account status data
The simplest approach is to pack the account status data into a packet a (e.g., derive and sort the account status from the database), then calculate H hash (a), and embed H into the century, as shown in fig. 12.
From an application perspective, there may be some classification requirements for the account acc (e.g., accounts with different regulatory requirements or customers in different regions, etc.), and at this time, the account status data is packaged into N data packets: each data packet has a number ID, such as 1331 in fig. 14, and the account status data within the packet is sorted by account. As shown in fig. 14, a mekerr tree of account state snapshots is built: the packets are used as leaf nodes to compute hash values, such as 1332, 1333 and 1334, layer by layer until a hash value, called root of the merkel tree, is generated and the root is embedded in the century block (shown in fig. 12).
The Meikel tree is released to the whole network together with the century block, and receives verification to reach consensus. The meikerr tree is an integral part of the block chain. The method realizes the non-tamper property of the account state snapshot: non-tampering of blockchains-century blocks non-tampering- > root non-tampering- > leaves of mekerr tree are non-tampering. Meanwhile, the retrieval of the account state in the snapshot is realized: and finding out the leaves of the tree according to the classification ID of the account, and then finding out the required data in the sorted data of the leaves.
(3) The account state snapshot is submitted, i.e., the account state snapshot is "embedded" in the blockchain, as shown at 133 in fig. 12.
"snapshots" that are frequently taken in the "century" can be regarded as "regular backups" of the global blockchain network, and each network node can also freely perform its "irregular backup", for example, in some non-century blocks (e.g., the middle of the century), the above-mentioned steps 1 and 2, or only step 3.
In the embodiment of the invention, when the network receives the block, the intelligent contracts in the block are sequentially executed to update the accounting system. Thus, transactions in the accounting system are executed in sequence, i.e., once a transaction is in-chain (blockchain), its position in the transaction sequence is determined, as shown in fig. 15, the transactions are arranged from left to right. To facilitate understanding, an example is given below, for three related transactions as follows:
a: zhang San is stored in 1000 Yuan, and the original balance is 0
B: zhang Sanzhui four turns to 800 Yuan
C: zhangzhang king five turning 600 yuan
(1) And when the sequence of the three transactions is ABC, the execution sequence of the three transactions is from left to right, as shown in (C) of FIG. 15 (the execution of other irrelevant transactions is omitted), the transaction A is successful, the transaction B is successful, and the transaction C is failed (the balance is insufficient). But both transactions B and C can pass the simulation test in the pre-preprocessing unit because transaction a has 1000 yuan after being received in the block where transaction a is located, and due to parallelism, transactions B and C are submitted (packed in one block) almost simultaneously.
(2) And when the sequence of the three transactions is BAC, the transaction B service fails (the balance is insufficient), A succeeds and C succeeds.
The embodiment of the invention maintains the accounting system by executing the intelligent contract, and has the following characteristics: firstly, the transactions in the blockchain are executed in sequence, and the execution result is fixed because the transaction sequence is fixed, namely, the blockchain is executed for N times, and the account result is consistent after each execution. Second, transactions in the blockchain are all subjected to simulation testing (testing fails and is discarded), but the transactions may still fail due to the existence of a parallelism contention condition. I.e., smart contracts that are signed by all interested parties in the blockchain, may fail to execute, with the reason for the ordering being similar to the "overwhelming factor". Third, if the packing node "does bad", then the transaction in the blockchain may be a fake transaction or a tampered transaction, which is easily recognized by the verification node of the blockchain, i.e., it is in the blockchain but it is not executed. Whether the execution of the transaction in the blockchain is successful or not is not identified, because the blockchain is tamper-proof, and the identification removal is tampering with the data. Whether the transaction execution was successful or not may be reflected in the account hierarchy, and successful transactions may be tracked in the account status trace. The execution result of the transaction in the block chain is embodied in the accounting system, and can be queried in the following three ways:
the method comprises the following steps that firstly, an account state table is real-time but not tamper-resistant, the safety is based on network and database environments, and the credibility of data can be increased by comparing data of a plurality of nodes in a severe environment;
(ii) snapshot recently, non-real-time but tamper-resistant;
and thirdly, the block chain after the latest snapshot + is real-time and tamper-proof, but contracts in the block chain are executed in sequence.
Compared with a common block chain, the block chain mechanism established in the embodiment of the invention is easy to realize the recovery of the accounting state, and as the common block chain has no snapshot, all transactions can be replayed to recover the accounting only from the century starting block of the block chain; the embodiment of the invention can restore the account state table only by the latest account state snapshot and the block chain after the snapshot, thereby enabling the account system to operate normally. The "block chain after the most recent snapshot + is the smallest data set that allows the account system to run normally, so only this smallest data set can be kept online, and the rest of the data can go offline.
In one embodiment, separate backup and restore tools may be provided. Fig. 16 is a schematic diagram of a backup and restore apparatus, as shown in fig. 16, the structure includes: data backup and cleaning module 121 and accounting data recovery module 122, wherein:
the data backup and cleaning module 121: the backup and the cleaning aim to reduce online data on the premise of not influencing the operation of the system, thereby improving the performance of the system. From the above analysis, it can be seen that the online data only needs the latest account status snapshot and the blockchain after the snapshot to satisfy the system operation requirement. Therefore, the data before the snapshot can be backed up and cleaned, mainly aiming at the block chain and the account state track data.
The data recovery module 122: the accounting data recovery module is used for recovering (if lost) or rebuilding (for example, untrusted after external attack) the local account system when the hard disk of the new machine or the old machine is damaged. The module only needs two steps for recovering the account state table: firstly, importing the latest account state snapshot into a database to form the account state during snapshot; the transactions in the blockchain after the snapshot are then replayed. When the account status snapshot of the network node or the subsequent blockchain is missing, the account status snapshot can be obtained through the P2P network of the blockchain.
In summary, the transaction execution flow based on the blockchain banking core system shown in fig. 6 includes the following steps:
the method comprises the following steps: transaction preprocessing S1
And S11, the transaction enters a submission subnet, and the subnet realizes the process links of transaction application, confirmation, simulation (namely testing whether the intelligent contract is established), auditing and the like, so that the transaction is confirmed to be reasonable, and then the transaction is submitted to a transaction 'collecting and distributing place'.
S12, the transaction is received "distributed", and the received parallel transaction is converted into a serial stream by the transaction queuing device, similar to the middleware of MQ (message queue), and then reaches the packing node by the soft load balancing strategy of routing processing.
S13, the packing node constructs the serial stream of the transaction into a 'block semi-finished product', which comprises a block body (transaction group TxS) and H (TxS) of the block head, wherein H (TxS) points to the transaction group TxS, and H (TxS) is the root when TxS is organized by a Merkel tree. And, invoking the anti-replay module prevents the transaction from being repeatedly submitted.
Step two: admission control process S2
And S21, submitting the semi-finished product of the block to an auditing subnet, wherein the auditing subnet is a alliance chain, and the auditing subnet audits the semi-finished product block by using a consensus algorithm through black and white lists and other mechanisms. If the audit is not passed, the semi-finished product block is discarded in the audit subnet, and the semi-finished product block cannot continue to enter the account processing layer. The transaction auditing node or the transaction auditing sub-network performs admission check on the legality and performability of the asset transfer service, so that the function of the accounting processing layer is purer and the efficiency is higher.
Step three: accounting processing S3
And S31, finally entering the accounting processing alliance chain after the transaction passing the audit of the audit subnet.
And S32, sorting the received transactions.
And S33, executing the transaction, taking a 'snapshot' of the account state at a specific time point, carrying out tamper-proof processing on the 'snapshot', and finally completing the transaction through a consensus algorithm.
And S34, forming M blocks, and setting the century blocks (wherein M can be set according to actual needs and has high flexibility).
As can be seen from the above description, by establishing the pre-preprocessing device, the parts that can be constructed in parallel in the block are separated to form the "block semi-finished product", which can improve the generation efficiency of the block chain and can improve the capability of dealing with high concurrency of the transaction in a distributed manner. The transaction access control device can be used for account management and transaction access confirmation, and the access control layer is responsible for auditing the validity and effectiveness of the transaction and rejecting the transaction which does not meet the execution condition. Therefore, the transaction received by the accounting processing layer is subjected to admission control and is reliable. Through the devices, the adaptability of the block chain technology and the bank system requirements can be better, and therefore the performance and the efficiency of an application system can be improved.
FIG. 17 is a schematic diagram of an electronic device according to an embodiment of the invention. The electronic device shown in fig. 17 is a general-purpose data processing apparatus including a general-purpose computer hardware structure including at least a processor 1701 and a memory 1702. The processor 1701 and the memory 1702 are connected by a bus 1703. The memory 1702 is adapted to store one or more instructions or programs that are executable by the processor 1701. The one or more instructions or programs are executed by the processor 1701 to implement the steps of the job data processing method in the block chain described above.
The processor 1701 may be a stand-alone microprocessor or a collection of one or more microprocessors. Thus, the processor 1701 implements processing of data and control of other devices by executing commands stored in the memory 1702 to thereby execute the method flow of the embodiment of the present invention as described above. The bus 1703 connects the above components together, as well as to the display controller 1704 and display device and input/output (I/O) device 1705. Input/output (I/O) device 1705 may be a mouse, keyboard, modem, network interface, touch input device, motion sensing input device, printer, and other devices known in the art. Typically, input/output (I/O) devices 1705 are connected to the system through an input/output (I/O) controller 1706.
The memory 1702 may store software components such as an operating system, a communication module, an interaction module, and an application program, among others. Each of the modules and applications described above corresponds to a set of executable program instructions that perform one or more functions and methods described in embodiments of the invention.
Embodiments of the present invention further provide a computer-readable storage medium, on which a computer program is stored, where the computer program is executed by a processor to implement the steps of the method for processing job data in the above block chain.
In summary, the embodiments of the present invention provide an application scheme of a federation blockchain based on an account status, and the application scheme is suitable for a blockchain transaction system related to asset ownership transfer applications, and is particularly suitable for a banking system. Compared with the existing block chain application system, the embodiment of the invention has the following advantages:
1. embodiments of the present invention provide a block chain-based implementation that completely replaces the traditional core banking system, and each commercial bank may join the chain in an allied fashion (by "opening an account") to form a core banking system that includes a central bank and multiple commercial banks.
2. The system has strong analogy and fusion in concept, and the building block chain engineering implementation is easy to realize, understand and verify.
3. The capacity of dealing with high concurrency of transactions is improved in a distributed mode, and the block semi-finished product strategy is generated in parallel, so that the generation efficiency bottleneck of the existing block chain is solved.
4. The embodiment of the invention combines the characteristics of the block chain and the banking business processing process, and extracts the account management and the admission audit of the asset transfer transaction into an independent block chain for completion, so that the system is more reasonable in layout and higher in processing efficiency.
5. The transaction auditing node or the transaction auditing sub-network performs admission verification on the legality and performability of the asset transfer service, so that the function of an accounting processing layer is purer and the efficiency is higher.
6. At a certain specific time point, the account state is snapshot, the snapshot is tamper-proof, the account state can be updated and verified based on the latest snapshot, the search range of data is greatly reduced, and the efficiency of the system is improved.
7. A backup and recovery mechanism is provided, the backup saves the storage space of network nodes, the system efficiency is improved, and the recovery enhances the characteristics of disaster recovery, fault tolerance and the like of the system.
The embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the hardware + program class embodiment, since it is substantially similar to the method embodiment, the description is simple, and the relevant points can be referred to the partial description of the method embodiment.
The foregoing description has been directed to specific embodiments of this disclosure. Other embodiments are within the scope of the following claims. In some cases, the actions or steps recited in the claims may be performed in a different order than in the embodiments and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing may also be possible or may be advantageous.
Although the present application provides method steps as described in an embodiment or flowchart, additional or fewer steps may be included based on conventional or non-inventive efforts. The order of steps recited in the embodiments is merely one manner of performing the steps in a multitude of orders and does not represent the only order of execution. When an actual apparatus or client product executes, it may execute sequentially or in parallel (e.g., in the context of parallel processors or multi-threaded processing) according to the embodiments or methods shown in the figures.
The systems, devices, modules or units illustrated in the above embodiments may be implemented by a computer chip or an entity, or by a product with certain functions. One typical implementation device is a computer. In particular, the computer may be, for example, a personal computer, a laptop computer, a vehicle-mounted human-computer interaction device, a cellular telephone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
The terms "comprises," "comprising," or any other variation thereof, in the embodiments of this specification are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, the presence of additional identical or equivalent elements in a process, method, article, or apparatus that comprises the recited elements is not excluded.
For convenience of description, the above devices are described as being divided into various modules by functions, and are described separately. Of course, in implementing the embodiments of the present description, the functions of each module may be implemented in one or more software and/or hardware, or a module implementing the same function may be implemented by a combination of multiple sub-modules or sub-units, and the like. The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units is only one logical division, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
Those skilled in the art will also appreciate that, in addition to implementing the controller as pure computer readable program code, the same functionality can be implemented by logically programming method steps such that the controller is in the form of logic gates, switches, application specific integrated circuits, programmable logic controllers, embedded microcontrollers and the like. Such a controller may therefore be considered as a hardware component, and the means included therein for performing the various functions may also be considered as a structure within the hardware component. Or even means for performing the functions may be regarded as being both a software module for performing the method and a structure within a hardware component.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In a typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include forms of volatile memory in a computer readable medium, Random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). Memory is an example of a computer-readable medium.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
As will be appreciated by one skilled in the art, embodiments of the present description may be provided as a method, system, or computer program product. Accordingly, embodiments of the present description may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, embodiments of the present description may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and so forth) having computer-usable program code embodied therein.
The embodiments of this specification may be described in the general context of computer-executable instructions, such as program modules, being executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform particular tasks or implement particular abstract data types. The described embodiments may also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed computing environment, program modules may be located in both local and remote computer storage media including memory storage devices.
In the description herein, references to the description of the term "one embodiment," "some embodiments," "an example," "a specific example," or "some examples," etc., mean that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of an embodiment of the specification. In this specification, the schematic representations of the terms used above are not necessarily intended to refer to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples. Furthermore, various embodiments or examples and features of different embodiments or examples described in this specification can be combined and combined by one skilled in the art without contradiction.
The above description is only an example of the embodiments of the present disclosure, and is not intended to limit the embodiments of the present disclosure. Various modifications and variations to the embodiments described herein will be apparent to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the embodiments of the present specification should be included in the scope of the claims of the embodiments of the present specification.

Claims (22)

1. A method for processing operation data in a block chain, the method comprising:
receiving a plurality of parallel job data from different users, and respectively verifying the plurality of parallel job data, wherein each job data comprises an intelligent contract;
in response to the successful verification, carrying out hash operation on the verified job data to generate a hash value, and sending the verified job data with the same hash value to the same packaging node;
generating a partial block according to verified operation data of the same packaging node, and verifying the partial block, wherein the partial block comprises: the block body records verified operation data of the same packaging node, and the partial block head records a hash value of the verified operation data in the block body;
in response to a successful verification, generating a complete block from the partial block successfully verified according to a block data structure, the complete block comprising: the block body, the partial block head, and another partial block head, the another partial block head including: a hash value of a previous block of the complete block;
and executing corresponding operation according to the operation data in the complete block.
2. The method according to claim 1, wherein verifying each of the plurality of parallel job data includes:
carrying out simulation test on the intelligent contract in each operation data;
and responding to the simulation test result as success, and establishing the intelligent contract in the operation data.
3. The method of processing job data in a blockchain according to claim 1, wherein before hashing the verified job data to generate a hash value, the method further comprises:
and queuing the plurality of verified job data which are verified successfully.
4. The method according to claim 1, wherein generating partial blocks from verified job data of the same packing node comprises:
carrying out hash operation on the verified operation data of the same packaging node by using a Meckel tree structure;
and setting the partial block header according to the Hash operation result.
5. The method of processing job data in a blockchain according to claim 1, further comprising:
setting a block at a predetermined position in a block chain as a century block CnCentury section C1And the first block C of the block chain0The interval between the blocks in two centuries is X blocks, n is a positive integer greater than or equal to 1, and X is a positive integer greater than 1.
6. The method of claim 5, wherein the complete block is century block CnThe method further comprises:
according to block C0And Cn-1Generating operation state snapshots of the block executed operations;
said century block CnFurther includes a pointer to the job state snapshot.
7. The method of claim 6, wherein the method comprises according to block C0And Cn-1Generating a job state snapshot for a block-wise execution of the job includes:
according to block C0And Cn-1The operations performed by the blocks in between generate operation state snapshots in a merkel tree structure.
8. The method of processing job data in a blockchain according to claim 7, further comprising:
and performing backup and recovery operation on the operation data and the corresponding operation according to the operation state snapshot.
9. The method of processing job data in a blockchain according to claim 1, further comprising:
a database is built from verified job data and its hash value, wherein the verified job data is discarded after a predetermined time.
10. The method of claim 1, wherein verifying the partial block comprises:
and verifying the user identity and the corresponding job performability corresponding to the verified job data in the partial block.
11. An apparatus for processing operation data in a block chain, the apparatus comprising:
a job data receiving unit for receiving a plurality of parallel job data from different users, each job data including an intelligent contract;
a job data verification unit configured to verify each of the plurality of parallel job data;
the job data sending unit is used for responding to successful verification, carrying out hash operation on the verified job data to generate a hash value, and sending the verified job data with the same hash value to the same packaging node;
a partial block generation unit configured to generate a partial block from verified job data of the same packed node, the partial block including: the block body records verified operation data of the same packaging node, and the partial block head records a hash value of the verified operation data in the block body;
a partial block verification unit for verifying the partial block;
a complete block generation unit, configured to, in response to successful verification, generate a complete block from the partial blocks that are successfully verified according to the block data structure, where the complete block includes: the block body, the partial block head, and another partial block head, the another partial block head including: a hash value of a previous block of the complete block;
and the operation execution unit is used for executing corresponding operation according to the intelligent contract of each operation data in the complete block.
12. The apparatus according to claim 11, wherein said operation data verification unit comprises:
and the simulation test module is used for performing simulation test on the intelligent contract in each operation data, and responding to the success of the simulation test result, so that the intelligent contract in the operation data is established.
13. The apparatus according to claim 11, wherein said apparatus further comprises:
and the queuing unit is used for queuing the plurality of verified job data which are verified successfully.
14. The apparatus according to claim 11, wherein said partial block generation unit comprises:
the Hash operation module is used for carrying out Hash operation on the verified operation data of the same packaging node by using a Meckel tree structure;
and the partial block head setting module is used for setting the partial block head according to the Hash operation result.
15. The apparatus according to claim 11, wherein said apparatus further comprises:
a century block setting unit for setting a block of a predetermined position in the block chain as a century block CnCentury section C1And the first block C of the block chain0The interval between the blocks in two centuries is X blocks, n is a positive integer greater than or equal to 1, and X is a positive integer greater than 1.
16. The apparatus according to claim 15, wherein said complete block is century block CnThe apparatus further comprises:
an operation state snapshot generating unit for generating a snapshot according to the block C0And Cn-1Generating operation state snapshots of the block executed operations;
said century block CnFurther includes a pointer to the job state snapshot.
17. The apparatus according to claim 16, wherein the job state snapshot generating unit is specifically configured to:
according to block C0And Cn-1The operations performed by the blocks in between generate operation state snapshots in a merkel tree structure.
18. The apparatus according to claim 17, wherein said apparatus further comprises:
and the backup unit is used for performing backup and recovery operations on the job data and the corresponding job according to the job state snapshot.
19. The apparatus according to claim 11, wherein said apparatus further comprises:
a database establishing unit for establishing a database based on the verified job data, which is discarded after a predetermined time, and the hash value thereof.
20. The apparatus as claimed in claim 11, wherein the partial block verification unit is further configured to:
and verifying the user identity and the corresponding job performability corresponding to the verified job data in the partial block.
21. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the steps of the method for processing job data in a blockchain according to any one of claims 1 to 10 are implemented when the program is executed by the processor.
22. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method for processing job data in a blockchain according to any one of claims 1 to 10.
CN201910700343.1A 2019-07-31 2019-07-31 Method and device for processing job data in block chain, electronic equipment and storage medium Active CN110390524B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910700343.1A CN110390524B (en) 2019-07-31 2019-07-31 Method and device for processing job data in block chain, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910700343.1A CN110390524B (en) 2019-07-31 2019-07-31 Method and device for processing job data in block chain, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN110390524A CN110390524A (en) 2019-10-29
CN110390524B true CN110390524B (en) 2021-10-26

Family

ID=68288095

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910700343.1A Active CN110390524B (en) 2019-07-31 2019-07-31 Method and device for processing job data in block chain, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN110390524B (en)

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111027977A (en) * 2019-11-22 2020-04-17 中汇信息技术(上海)有限公司 Data verification method and device and electronic equipment
CN111339191B (en) * 2020-02-20 2023-05-26 百度在线网络技术(北京)有限公司 Data storage method, device, equipment and medium of block chain
CN111428277B (en) * 2020-03-20 2023-08-18 中国建设银行股份有限公司 Block chain data verification method, device and system
CN112200668B (en) * 2020-03-27 2021-08-06 北京天德科技有限公司 System based on intelligent contract hybrid architecture model
CN111507720B (en) * 2020-04-22 2022-03-11 腾讯科技(深圳)有限公司 Data snapshot method and device based on block chain and computer readable storage medium
CN112347193A (en) * 2020-11-27 2021-02-09 网易(杭州)网络有限公司 Transaction packaging method and device based on block chain and electronic equipment
CN114143011A (en) * 2021-11-26 2022-03-04 中国联合网络通信集团有限公司 Test report processing method and device

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104794162A (en) * 2015-03-25 2015-07-22 中国人民大学 Real-time data storage and query method
CN108596621A (en) * 2018-04-28 2018-09-28 深圳市优学链科技有限公司 Block chain accounting nodes generation method, device, computer equipment and storage medium
CN109302405A (en) * 2018-10-31 2019-02-01 北京邮电大学 Industrial data detection block chain network framework and detection method based on edge calculations
CN109410045A (en) * 2018-08-30 2019-03-01 杭州复杂美科技有限公司 A kind of parallel chain common recognition method, equipment and storage medium
CN109447630A (en) * 2018-09-10 2019-03-08 北京安易信科技有限公司 A kind of block chain building method and system for supporting conglomerate more to apply

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109478305A (en) * 2016-03-31 2019-03-15 Tbsx3有限公司 Information system for item authentication
IL302367A (en) * 2017-01-23 2023-06-01 Kamran Hasan Syed Universal bchain e3a connections (ubec)

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104794162A (en) * 2015-03-25 2015-07-22 中国人民大学 Real-time data storage and query method
CN108596621A (en) * 2018-04-28 2018-09-28 深圳市优学链科技有限公司 Block chain accounting nodes generation method, device, computer equipment and storage medium
CN109410045A (en) * 2018-08-30 2019-03-01 杭州复杂美科技有限公司 A kind of parallel chain common recognition method, equipment and storage medium
CN109447630A (en) * 2018-09-10 2019-03-08 北京安易信科技有限公司 A kind of block chain building method and system for supporting conglomerate more to apply
CN109302405A (en) * 2018-10-31 2019-02-01 北京邮电大学 Industrial data detection block chain network framework and detection method based on edge calculations

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
区块链技术综述;张亮等;《计算机工程》;20190531;第1-12页 *

Also Published As

Publication number Publication date
CN110390524A (en) 2019-10-29

Similar Documents

Publication Publication Date Title
CN110390524B (en) Method and device for processing job data in block chain, electronic equipment and storage medium
JP6882474B2 (en) Systems and methods for detecting replay attacks
US11669811B2 (en) Blockchain-based digital token utilization
US11196542B2 (en) Checkpointing for increasing efficiency of a blockchain
US10901957B2 (en) Checkpointing for increasing efficiency of a blockchain
JP6905059B2 (en) Systems and methods for detecting replay attacks
CN110442652B (en) Cross-chain data processing method and device based on block chain
JP7352622B2 (en) Blockchain timestamp agreement
CN111382456B (en) Proposal message processing method, device, equipment and storage medium
US20200073758A1 (en) Checkpointing for increasing efficiency of a blockchain
US20200356991A1 (en) Method And Apparatus For Execution Of Atomic Transactions
Wang et al. Inter-bank payment system on enterprise blockchain platform
US11599431B2 (en) Database optimized disaster recovery orchestrator
WO2020046509A1 (en) Eligibility of a digital asset for a transaction
US11003523B2 (en) Database optimized disaster recovery testing
US11343313B1 (en) Fault tolerant periodic leader rotation for blockchain
Bao et al. A survey of blockchain consensus safety and security: State-of-the-art, challenges, and future work
Wang et al. Bft in blockchains: From protocols to use cases
CN109636605A (en) A kind of monitoring and managing method and system of digital asset exchange
Ren et al. Interoperability in blockchain: A survey
CN112995167A (en) Kafka mechanism-based power utilization information acquisition method, block chain network and user side
Guo et al. Loc: Poverty alleviation loan management system based on smart contracts
CN112102118A (en) Collaborative law enforcement and case handling method based on block chain
CN113472543A (en) Employment data processing method and device based on block chain, electronic equipment and medium
CN111598389B (en) Transaction system for preventing bill market risk based on blockchain

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant