CN113268490A - Account book processing method, device, equipment and storage medium based on intelligent contract - Google Patents

Account book processing method, device, equipment and storage medium based on intelligent contract Download PDF

Info

Publication number
CN113268490A
CN113268490A CN202110822043.8A CN202110822043A CN113268490A CN 113268490 A CN113268490 A CN 113268490A CN 202110822043 A CN202110822043 A CN 202110822043A CN 113268490 A CN113268490 A CN 113268490A
Authority
CN
China
Prior art keywords
account book
data
preset
intelligent contract
change
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.)
Granted
Application number
CN202110822043.8A
Other languages
Chinese (zh)
Other versions
CN113268490B (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.)
Guangdong Zhuoqi Cloud Chain Technology Co ltd
Original Assignee
Guangdong Zhuoqi Cloud Chain Technology Co ltd
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 Guangdong Zhuoqi Cloud Chain Technology Co ltd filed Critical Guangdong Zhuoqi Cloud Chain Technology Co ltd
Priority to CN202110822043.8A priority Critical patent/CN113268490B/en
Publication of CN113268490A publication Critical patent/CN113268490A/en
Application granted granted Critical
Publication of CN113268490B publication Critical patent/CN113268490B/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/23Updating
    • G06F16/2372Updates performed during offline database operations
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3003Monitoring arrangements specially adapted to the computing system or computing system component being monitored
    • G06F11/302Monitoring arrangements specially adapted to the computing system or computing system component being monitored where the computing system component is a software system
    • 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/389Keeping log of transactions for guaranteeing non-repudiation of a transaction
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/50Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols using hash chains, e.g. blockchains or hash trees

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Databases & Information Systems (AREA)
  • General Physics & Mathematics (AREA)
  • Computing Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Business, Economics & Management (AREA)
  • Data Mining & Analysis (AREA)
  • Accounting & Taxation (AREA)
  • Quality & Reliability (AREA)
  • Strategic Management (AREA)
  • General Business, Economics & Management (AREA)
  • Finance (AREA)
  • Mathematical Physics (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The application provides an account book processing method, an account book processing device, account book processing equipment and a storage medium based on an intelligent contract, wherein the method comprises the following steps: acquiring an account book occupation variable of a preset account book; carrying out atomic write operation on the occupation variable value of the account book occupation variable; if the atomic write operation of the occupied variable values is successful, changing the state data of the account book of the preset account book based on a preset account book state changing function to obtain target metadata after the preset account book changing operation and operation data during the preset account book changing operation; and writing the target metadata into the ledger change historical data of the preset ledger, and returning the operation data to the target local database. In the embodiment, a data processing strategy of separating the account book from the upper chain to the lower chain is adopted, the detailed operation of the account book during each change is locally saved by an operator, and simple fields, even only metadata such as summary information, are stored in the main network, so that the privacy protection granularity is accurate to the variable level and even the field level, and the privacy security of the account book is improved.

Description

Account book processing method, device, equipment and storage medium based on intelligent contract
Technical Field
The application relates to the technical field of computers, in particular to an account book processing method, device, equipment and storage medium based on an intelligent contract.
Background
The block chain technology is a key technology for realizing the trusted internet, and records non-falsifiable block data through a chain structure so as to completely trace the online behavior. But the blockchain has the characteristics of full network disclosure, so that privacy protection is difficult. In the related art, the blocks are expanded based on a "tree" data structure, and the privacy of the user is protected to some extent by separating the tree from the tree root, but the privacy protection granularity is not fine enough.
For example, smart contracts represented by etherhouses and Merkle Patricia Tree (MPT) data structures used therein are technologies that effectively improve data privacy at present. The method comprises the steps of opening up a storage space based on MPT for each intelligent contract, changing the value of a member variable in the intelligent contract by a caller through calling a member function of the intelligent contract, storing the variable to a leaf node of an MPT data structure in a key value pair mode, solving the hash value of the node from bottom to top sequentially until the root node, and finally storing the hash value of the root node to a block header. And when the privacy of the user needs to be protected, only broadcasting the tree root in the whole network, otherwise, broadcasting the whole tree in the whole network. Therefore, the technology can only store the whole tree or only the tree root, and cannot be accurate to the privacy protection control of the variable level.
Disclosure of Invention
An object of the embodiment of the present application is to provide an intelligent contract-based ledger processing method, apparatus, device and storage medium, which aim to solve the problem that the privacy protection granularity of the current intelligent contract is not fine enough.
In a first aspect, an embodiment of the present application provides an account book processing method based on an intelligent contract, including:
acquiring an account book occupation variable of a preset account book;
carrying out atomic write operation on the occupation variable value of the account book occupation variable;
if the atomic write operation of the occupied variable values is successful, changing the state data of the account book of the preset account book based on a preset account book state changing function to obtain target metadata after the preset account book changing operation and operation data during the preset account book changing operation;
and writing the target metadata into the ledger change historical data of the preset ledger, and returning the operation data to the target local database.
In the embodiment, the account book occupation variable of the preset account book is obtained, and the atomic write operation is performed on the occupation variable value of the account book occupation variable, so that only one intelligent contract member and only one intelligent contract member are ensured to change the account book at the same time, and the accuracy of the change process of the account book is ensured; if the write operation of the occupied variable value atom is successful, based on a preset account book state change function, change operation is performed on account book state data of a preset account book, target metadata after the change operation of the preset account book and operation data during the change operation of the preset account book are obtained, finally, the target metadata are written into account book change history data of the preset account book, and the operation data are transmitted back to a target local database.
In one embodiment, performing an atomic write operation on an occupancy variable value of an account book occupancy variable includes:
monitoring whether the account book occupation variable is occupied or not;
and if the account book occupation variable is not occupied, changing the occupation variable value into the user identification of the target user, wherein the target user is an intelligent contract member for carrying out change operation on the account book state data of the preset account book.
In this embodiment, by monitoring and changing the account book occupation variable, only one intelligent contract member changes the account book at the same time, and the accuracy and the legality of the account book change result are ensured.
In an embodiment, writing the target metadata into the ledger change history data of the preset ledger, and returning the operation data to the target local database includes:
if the change operation meets the preset confidentiality condition, writing first metadata into the account book change history data, wherein the first metadata comprises the hash value of the state data of the account book after the change operation;
if the change operation does not meet the preset confidentiality condition, writing second metadata into the account book change history data, wherein the second metadata comprises the account book state data after the change operation;
and returning the operation data to the target local database, and releasing the account book occupation variable, wherein the operation data comprises plaintext data of the first metadata or the second metadata.
In this embodiment, based on the privacy requirement of the change operation, different types of metadata are selected to be stored in the blockchain, so that controllability of privacy protection is achieved, the operation data is stored in the local database, and privacy safety of a user is guaranteed.
In an embodiment, before obtaining the ledger occupation variable of the preset ledger, the method further includes:
configuring an account book state change function of a preset account book, and initializing the state data of the account book to obtain the preset account book;
the method comprises the steps that a preset account book is issued to a block chain main network through an account book administrator, wherein the account book administrator is one of a plurality of intelligent contract members;
controlling a plurality of intelligent contract members to perform signature operation on a preset account book on a block chain main network to obtain first signature data;
and storing the first signature data into account book member data of a preset account book.
In this embodiment, the account book is published to the blockchain main network and is confirmed by the members of the intelligent contract, so that the account book can be operated by the members in the intelligent contract.
Further, after the account book administrator issues the preset account book to the block chain main network, the method further comprises the following steps:
if an administrator replacement request initiated by a target intelligent contract member is monitored, second signature data of a plurality of intelligent contract members are obtained;
and if the number of the intelligent contract members corresponding to the second signature data is larger than a preset value, updating the data of the account book members based on the second signature data, and taking the target intelligent contract members as new account book managers.
In this embodiment, the change of the ledger administrator is achieved by reaching a certain number of intelligent contract member signature confirmations.
In an embodiment, after writing the target metadata into the ledger change history data of the preset ledger and returning the operation data to the target local database, the method further includes:
if an audit request of an auditor is monitored, obtaining operation data of each intelligent contract member according to the historical data of the account book change;
and assembling the operation data into a business data chain, and returning the business data chain to the auditor.
In the implementation, the account book changing process is traced based on the historical account book changing data, the operation data of each member in the account book changing process is obtained, the operation data is assembled into a complete business data chain of the account book changing process for auditing by an auditing party, the user privacy is protected, and auditing can be completed.
In an embodiment, the method further comprises:
monitoring a function change request initiated by an intelligent contract member, wherein the function change request comprises an account book state change function and a new account book state change function;
and if a function change request initiated by the intelligent contract member is monitored, sending a new account state change function to the account manager, wherein the new account state change function takes effect after the account manager passes the audit.
In this embodiment, the account book administrator reviews the new account book state change function, so that the account book state change function can be customized, and the problem that the function is disordered due to random replacement of the function by an intelligent contract member can be avoided.
In a second aspect, an embodiment of the present application provides an account book processing apparatus based on an intelligent contract, including:
the acquisition module is used for acquiring account book occupation variables of preset account books;
the atomic write module is used for carrying out atomic write operation on the occupation variable value of the account book occupation variable;
the change module is used for carrying out change operation on the state data of the preset account book based on a preset account book state change function if the atomic write operation of the occupied variable value is successful, so as to obtain target metadata after the preset account book change operation and operation data during the preset account book change operation;
and the writing module is used for writing the target metadata into the ledger change historical data of the preset ledger and transmitting the operation data back to the target local database.
In a third aspect, an embodiment of the present application provides a computer device, including a memory and a processor, where the memory is used to store a computer program, and the processor runs the computer program to make the computer device execute the intelligent contract-based ledger processing method according to the first aspect.
In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, which stores a computer program, and the computer program, when executed by a processor, implements the intelligent contract-based ledger processing method according to the first aspect.
It should be noted that, for the beneficial effects of the second aspect to the fourth aspect, reference is made to the description of the first aspect, and details are not repeated here.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are required to be used in the embodiments of the present application will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present application and therefore should not be considered as limiting the scope, and that those skilled in the art can also obtain other related drawings based on the drawings without inventive efforts.
Fig. 1 is a schematic flowchart of a method for processing an account book based on an intelligent contract according to an embodiment of the present application;
fig. 2 is a schematic flow chart of a method for processing an intelligent contract-based ledger processing according to another embodiment of the present application;
fig. 3 is a schematic structural diagram of an intelligent contract-based ledger processing apparatus according to an embodiment of the present application;
fig. 4 is a schematic structural diagram of a computer device according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be described below with reference to the drawings in the embodiments of the present application.
It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, it need not be further defined and explained in subsequent figures. Meanwhile, in the description of the present application, the terms "first", "second", and the like are used only for distinguishing the description, and are not to be construed as indicating or implying relative importance.
In the related art, the blocks are expanded based on a "tree" data structure, and the privacy of the user is protected to some extent by separating the tree from the tree root, but the privacy protection granularity is not fine enough. For example, smart contracts represented by etherhouses and Merkle Patricia Tree (MPT) data structures used therein are technologies that effectively improve data privacy at present. The method comprises the steps of opening up a storage space based on MPT for each intelligent contract, changing the value of a member variable in the intelligent contract by a caller through calling a member function of the intelligent contract, saving the variable to a leaf node of an MPT data structure in a key value pair mode, solving the hash value of the node from bottom to top in sequence, saving the hash value to a superior father node until the root node, and saving the hash value of the root node to a block header. And when the privacy of the user needs to be protected, only broadcasting the tree root in the whole network, otherwise, broadcasting the whole tree in the whole network. Therefore, the technology can only store the whole tree or only the tree root, and cannot be accurate to the privacy protection control of the variable level.
In addition, the statistical flexibility of information on the "tree" cannot be guaranteed by the "tree" data structure, which usually stores data in asymmetric key value pairs, for example, fields such as name, age, and sex need to be stored, only one of the fields is used as a key, and other fields are used as values.
The problem of excessive storage overhead exists in the structure of a "tree", which usually contains a root node, intermediate nodes and leaf nodes, a traditional block chain usually only uses the leaf nodes to store useful data, and a large amount of overhead is spent on the intermediate auxiliary nodes.
The intelligent contract usually stores the interaction process record of a certain user or a plurality of users, is inconvenient to disclose unconditionally, and can only perform operations such as encryption, hash, chaining and the like on private data frequently based on the current technology, so that the process is complicated, the system performance is greatly reduced, and the statistical analysis of the data by related users is also not facilitated.
In order to solve the problems in the prior art, the application provides an account book processing method based on intelligent contracts, which includes the steps of obtaining account book occupation variables of preset account books, and performing atomic write operation on the occupation variable values of the account book occupation variables, so that only one intelligent contract member and only one intelligent contract member are enabled to change the account book at the same time, and accuracy of an account book changing process is guaranteed; and if the write operation of the occupied variable value atom is successful, changing the state data of the account book of the preset account book based on a preset account book state changing function to obtain target metadata after the change operation of the preset account book and operation data during the change operation of the preset account book, finally writing the target metadata into the change history data of the account book of the preset account book, and returning the operation data to the target local database.
In the embodiment, a data processing strategy of chain up-chain down separation is adopted, detailed operation of the ledger when the ledger is changed is locally stored by an operator every time, great autonomy is given to the operator, and simple fields are stored on the main network even only metadata such as summary information of the fields, so that the privacy protection granularity is accurate to variable and even field level, and the privacy safety of the ledger is improved. The state of the changed account book is stored on the chain by using the metadata array, and the most common operations of searching, deleting, summing and the like are very convenient and fast; and a local database is used for storing under the chain, so that various data statistics operations are more convenient and faster. When the account book state is changed, only one hash operation is needed or even no operation is needed (for example, when the privacy requirement of the operation is not high), and the concurrency performance is obviously improved.
Referring to fig. 1, fig. 1 is a schematic diagram illustrating an implementation flow of an intelligent contract-based ledger processing method according to an embodiment of the present application. The intelligent contract-based ledger processing method described in the embodiment of the present application can be applied to computer devices, including but not limited to tablet computers, desktop computers, supercomputers, physical servers, cloud servers, and other computer devices. The intelligent contract-based ledger processing method in the embodiment of the application includes steps S101 to S104, which are detailed as follows:
and S101, acquiring an account book occupation variable of a preset account book.
In this step, the preset account book is a distributed account book based on the intelligent contract, and the account book occupation variable is an internal variable of the account book, which is a voucher for the intelligent contract member (user/account book user) to perform change operation on the state data of the account book.
And step S102, performing atomic write operation on the occupation variable value of the account book occupation variable.
In this step, the occupancy variable value is used to represent the user who is currently writing the account book, and the value thereof may be null, that is, the account book occupancy variable is not occupied, or may be a user identifier, that is, the account book is occupied by the user corresponding to the user identifier. An atomic write operation is an operation in which only one user can update a variable value at the same time. It can be understood that, for a certain intelligent contract member, if the member needs to change the state data of the account book, the account book occupation variable needs to be acquired first, and the occupation variable value of the account book occupation variable is changed into the user identifier of the member.
Step S103, if the atomic write operation of the occupied variable values is successful, changing operation is carried out on the state data of the account book of the preset account book based on a preset account book state changing function, and target metadata after the preset account book changing operation and operation data during the preset account book changing operation are obtained.
In this step, the ledger state change function is a business logic function for implementing ledger business, which may be a user-defined function, and corresponding logic functions and data structures are compiled according to business requirements of different users. The target metadata is a metadata array obtained after the preset account book is changed, such as a current state value of the account book, a signature result of the user of the account book, a user public key and a hash value of the operation user, and the like. The operation data is original plaintext data when the ledger state change function is executed. It is to be appreciated that the atomic write operation is successful when the computer device completes execution as the atomic write operation.
Illustratively, the ledger state change function is executed on the local computer equipment of the user, the value of the ledger state data is changed based on the business logic of the ledger state change function, the final result of the current change operation (namely the current state value of the ledger state data) and the operator information are used as the metadata array, and the data of the ledger state change function execution process is used as the operation.
And step S104, writing the target metadata into the ledger change history data of the preset ledger, and returning the operation data to the target local database.
In this step, the ledger change history data is change history data of a preset ledger, which includes an operation user in the change process and a final result of the change operation. Information such as 'final result (namely current state value of the state data of the account book) and operation users' of each change operation is stored in the block chain to be disclosed, and specific execution details of the state change function of the account book (namely detailed operation process of the variable of the account book) are kept in a local database by the operation users without being connected with the block chain, so that the purposes of public and private separation and key information hiding are achieved, and the privacy protection granularity of the account book is accurate to the variable level.
In an embodiment, based on the embodiment shown in fig. 1, the step S102 specifically includes: monitoring whether the account book occupation variable is occupied or not; and if the account book occupation variable is not occupied, changing the occupation variable value into the user identification of the target user, wherein the target user is an intelligent contract member for carrying out change operation on the account book state data of the preset account book.
In this embodiment, when the account book occupies the variable, it indicates that the account book is occupied, and therefore to satisfy the condition of atomic write operation, whether the account book occupies the variable is occupied is monitored in a circulating manner, until the account book occupies the variable is unoccupied, the value of the occupied variable is changed into the user identifier of the intelligent contract member prepared for changing the account book.
In an implementation manner, on the basis of the embodiment shown in fig. 1, the step S104 specifically includes: if the change operation meets the preset confidentiality condition, writing first metadata into the account book change history data, wherein the first metadata comprises the hash value of the state data of the account book after the change operation; if the change operation does not meet the preset confidentiality condition, writing second metadata into the account book change history data, wherein the second metadata comprises the account book state data after the change operation; and returning the operation data to the target local database, and releasing the account book occupation variable, wherein the operation data comprises plaintext data of the first metadata or the second metadata.
In this embodiment, the target metadata may be first metadata or second metadata, and the first metadata and the second metadata further contain user information of the operation user, and the like. The preset security condition may be a condition selected by the user in advance or in real time, for example, if the user selects to secure the current change operation, the change operation meets the preset security condition, that is, the current change operation is secured.
It can be understood that, in order to enable other members to also change the account book, when the change operation is completed, the account book occupation variable is released, that is, the occupation variable value of the account book occupation variable is updated to be a null value or a preset value.
It should be noted that, when the change operation meets the preset confidentiality condition, the embodiment only needs to perform the hash operation once, and the hash value of the ledger state data after the change operation is obtained; and when the change operation does not meet the preset security condition, the hash operation is not needed. Compared with the prior art that a large amount of hash operations are needed in the processes of generating MPTs, inserting nodes, updating nodes and the like, the calculation amount is smaller, the consumed time is shorter, and the efficiency of the ledger change process is improved.
In an embodiment, on the basis of the example shown in fig. 1, fig. 2 shows a flowchart of another implementation of the ledger processing method based on intelligent contracts, and as shown in fig. 2, the step S101 further includes: configuring an account book state change function of a preset account book, and initializing the state data of the account book to obtain the preset account book; the method comprises the steps that a preset account book is issued to a block chain main network through an account book administrator, wherein the account book administrator is one of a plurality of intelligent contract members; controlling a plurality of intelligent contract members to perform signature operation on a preset account book on a block chain main network to obtain first signature data; and storing the first signature data into account book member data of a preset account book.
In this embodiment, the account book initialization operation includes: the intelligent contract member appoints an initial manager, writes a function of a manager rotation or election rule and an account book state change function, and initializes current account book state data. And the current account book administrator issues the account book to the block chain main network, each member carries out signature confirmation on the account book respectively, and a confirmation result is reserved on the data of the members of the account book. This embodiment is through publishing the account book to block chain major network to confirm jointly by intelligent contract member, each member in order to realize intelligent contract can operate the account book jointly.
Optionally, as shown in fig. 2, after the ledger administrator issues the preset ledger to the blockchain main network, the method further includes: if an administrator replacement request initiated by a target intelligent contract member is monitored, second signature data of a plurality of intelligent contract members are obtained; and if the number of the intelligent contract members corresponding to the second signature data is larger than a preset value, updating the data of the account book members based on the second signature data, and taking the target intelligent contract members as new account book managers.
In this embodiment, each member monitors whether an administrator replacement request initiated by another member exists, if it is monitored that a target intelligent contract member initiates an administrator replacement request, it is necessary to perform signature confirmation on users exceeding a preset number, update data variables of account book members, and change the target intelligent contract member into a new account book administrator after the update is completed. By means of the mode of updating the data of the account book member through the signature data, the credibility of the replacement process of the administrator is guaranteed by utilizing the characteristics that the signature cannot be repudiated and cannot be forged.
In one embodiment, as shown in fig. 2, the step S104 is followed by: if an audit request of an auditor is monitored, obtaining operation data of each intelligent contract member according to the historical data of the account book change; and assembling the operation data into a business data chain, and returning the business data chain to the auditor.
In this embodiment, since a complete state change process is not stored in the block chain, only the latest state value is stored, and a complete change process is required during auditing, a sub-thread is opened in this embodiment, an auditing request of a third-party auditing mechanism is monitored, when an auditing request is monitored, a current account book administrator initiates data requests to related intelligent contract members in sequence according to account book change history data, the intelligent contract members return corresponding operation data to the account book administrator, and the account book administrator connects all received operation data in series to form a service data chain and returns the service data chain to the auditing mechanism.
In one embodiment, as shown in fig. 2, the method further comprises: monitoring a function change request initiated by an intelligent contract member, wherein the function change request comprises an account book state change function and a new account book state change function; and if a function change request initiated by the intelligent contract member is monitored, sending a new account state change function to the account manager, wherein the new account state change function takes effect after the account manager passes the audit.
In this embodiment, a sub-thread is started, a function change request initiated by a user is monitored, if a user needs to issue a new custom operation, a code of a corresponding new ledger state change function is directly sent to an ledger administrator, and after the ledger administrator checks, the new ledger state change function takes effect. The account book manager is used for auditing a new account book state change function, so that the account book state change function can be customized, and the problem that the function is disordered due to random replacement of the function by an intelligent contract member can be avoided.
In order to execute the method corresponding to the above method embodiment to achieve the corresponding function and technical effect, the following provides an intelligent contract-based ledger processing apparatus. Referring to fig. 3, fig. 3 is a block diagram of a structure of an intelligent contract-based ledger processing apparatus according to an embodiment of the present application. For convenience of explanation, only the parts related to the present embodiment are shown, and the ledger processing apparatus based on intelligent contracts provided in the embodiment of the present application includes:
an obtaining module 301, configured to obtain an account book occupancy variable of a preset account book;
an atomic write module 302, configured to perform an atomic write operation on an occupancy variable value of an account book occupancy variable;
a changing module 303, configured to, if the atomic write operation of the occupied variable value is successful, perform a changing operation on the book state data of the preset book based on a preset book state changing function, to obtain target metadata after the changing operation of the preset book and operation data during the changing operation of the preset book;
the writing module 304 is configured to write the target metadata into the ledger change history data of the preset ledger, and return the operation data to the target local database.
In one embodiment, the atomic write module 302 includes:
the monitoring unit is used for monitoring whether the account book occupation variable is occupied or not;
and the change unit is used for changing the occupied variable value into the user identifier of a target user if the account book occupied variable is not occupied, and the target user is an intelligent contract member for changing the state data of the account book of the preset account book.
In one embodiment, the writing module 304 includes:
the first writing unit is used for writing first metadata into the account book change history data if the change operation meets the preset confidentiality condition, wherein the first metadata comprises a hash value of the state data of the account book after the change operation;
the second writing unit is used for writing second metadata into the ledger change history data if the change operation does not meet the preset confidentiality condition, wherein the second metadata comprises ledger state data after the change operation;
and the return unit is used for returning the operation data to the target local database and releasing the account book occupation variable, wherein the operation data comprises plaintext data of the first metadata or the second metadata.
In one embodiment, the ledger processing apparatus further includes:
the configuration module is used for configuring an account book state change function of a preset account book and initializing the state data of the account book to obtain the preset account book;
the issuing module is used for issuing a preset account book to a block chain main network through an account book administrator, wherein the account book administrator is one of a plurality of intelligent contract members;
the control module is used for controlling a plurality of intelligent contract members to perform signature operation on a preset account book on a block chain main network to obtain first signature data;
and the storing module is used for storing the first signature data into the account book member data of the preset account book.
Optionally, the ledger processing apparatus further includes:
the second acquisition module is used for acquiring second signature data of a plurality of intelligent contract members if an administrator replacement request initiated by a target intelligent contract member is monitored;
and the updating module is used for updating the data of the account book members based on the second signature data if the number of the intelligent contract members corresponding to the second signature data is greater than a preset value, and taking the target intelligent contract as a new account book manager.
In one embodiment, the ledger processing apparatus further includes:
the third acquisition module is used for acquiring the operation data of each intelligent contract member according to the historical data of the account book change if the audit request of the auditor is monitored;
and the return module is used for assembling the operation data into a service data chain and returning the service data chain to the auditor.
In an embodiment, the ledger processing apparatus further includes:
the monitoring module is used for monitoring a function change request initiated by an intelligent contract member, wherein the function change request comprises an account book state change function and a new account book state change function;
and the sending module is used for sending the new account state change function to the account administrator if a function change request initiated by the intelligent contract member is monitored, and the new account state change function takes effect after the account administrator passes the audit.
The intelligent contract-based ledger processing apparatus may implement the intelligent contract-based ledger processing method of the above method embodiment. The alternatives in the above-described method embodiments are also applicable to this embodiment and will not be described in detail here. The rest of the embodiments of the present application may refer to the contents of the above method embodiments, and in this embodiment, details are not described again.
Fig. 4 is a schematic structural diagram of a computer device according to an embodiment of the present application. As shown in fig. 4, the computer device 4 of this embodiment includes: at least one processor 40 (only one shown in fig. 4), a memory 41, and a computer program 42 stored in the memory 41 and executable on the at least one processor 40, the processor 40 implementing the steps of any of the method embodiments described above when executing the computer program 42.
The computer device 4 may be a tablet computer, a desktop computer, a supercomputer, a personal digital assistant, a physical server, a cloud server, or other computing device. The computer device may include, but is not limited to, a processor 40, a memory 41. Those skilled in the art will appreciate that fig. 4 is merely an example of the computer device 4 and does not constitute a limitation of the computer device 4, and may include more or less components than those shown, or combine certain components, or different components, such as input output devices, network access devices, etc.
The Processor 40 may be a Central Processing Unit (CPU), and the Processor 40 may be other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic device, discrete hardware component, or the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The memory 41 may in some embodiments be an internal storage unit of the computer device 4, such as a hard disk or a memory of the computer device 4. The memory 41 may also be an external storage device of the computer device 4 in other embodiments, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like, which are provided on the computer device 4. Further, the memory 41 may also include both an internal storage unit and an external storage device of the computer device 4. The memory 41 is used for storing an operating system, an application program, a BootLoader (BootLoader), data, and other programs, such as program codes of the computer program. The memory 41 may also be used to temporarily store data that has been output or is to be output.
In addition, an embodiment of the present application further provides a computer-readable storage medium, where a computer program is stored, and when the computer program is executed by a processor, the computer program implements the steps in any of the method embodiments described above.
The embodiments of the present application provide a computer program product, which when executed on a computer device, enables the computer device to implement the steps in the above method embodiments.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus and method can be implemented in other ways. The apparatus embodiments described above are merely illustrative, and for example, the flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods and computer program products according to various embodiments of the present application. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
In addition, functional modules in the embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
The functions, if implemented in the form of software functional modules and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application or portions thereof that substantially contribute to the prior art may be embodied in the form of a software product stored in a storage medium and including instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
The above description is only an example of the present application and is not intended to limit the scope of the present application, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, improvement and the like made within the spirit and principle of the present application shall be included in the protection scope of the present application. It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, it need not be further defined and explained in subsequent figures.
The above description is only for the specific embodiments of the present application, but the scope of the present application is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present application, and shall be covered by the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, 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, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.

Claims (10)

1. An account book processing method based on intelligent contracts is characterized by comprising the following steps:
acquiring an account book occupation variable of a preset account book;
carrying out atomic write operation on the occupation variable value of the account book occupation variable;
if the atomic write operation of the occupied variable values is successful, changing the state data of the account book of the preset account book based on a preset account book state changing function to obtain target metadata after the preset account book changing operation and operation data during the preset account book changing operation;
and writing the target metadata into the book change history data of the preset book, and returning the operation data to a target local database.
2. The book processing method based on the intelligent contract according to claim 1, wherein the performing an atomic write operation on the holding variable value of the book holding variable includes:
monitoring whether the account book occupation variable is occupied or not;
and if the account book occupation variable is not occupied, changing the value of the occupation variable into a user identifier of a target user, wherein the target user is an intelligent contract member for carrying out change operation on the state data of the account book of the preset account book.
3. The intelligent contract-based ledger processing method of claim 1, wherein the writing of the target metadata into ledger change history data of the preset ledger and the returning of the operation data to a target local database comprises:
if the change operation meets a preset confidentiality condition, writing first metadata into the account book change history data, wherein the first metadata comprises a hash value of the state data of the account book after the change operation;
if the change operation does not meet the preset confidentiality condition, writing second metadata into the account book change history data, wherein the second metadata comprises the state data of the account book after the change operation;
and returning the operation data to the target local database, and releasing the account book occupation variable, wherein the operation data comprises plaintext data of the first metadata or the second metadata.
4. The intelligent contract-based ledger processing method according to claim 1, wherein before the obtaining of ledger occupation variables of preset ledger, further comprising:
configuring an account book state change function of the preset account book, and initializing the state data of the account book to obtain the preset account book;
the preset account book is issued to a block chain main network through an account book administrator, wherein the account book administrator is one of a plurality of intelligent contract members;
controlling a plurality of intelligent contract members to perform signature operation on a preset account book on the block chain main network to obtain first signature data;
and storing the first signature data into account book member data of the preset account book.
5. The smart contract-based ledger processing method according to claim 4, wherein after the ledger administrator issues the preset ledger to the blockchain main network, further comprising:
if an administrator replacement request initiated by a target intelligent contract member is monitored, second signature data of a plurality of intelligent contract members are obtained;
and if the number of the intelligent contract members corresponding to the second signature data is larger than a preset value, updating the data of the account book members based on the second signature data, and taking the target intelligent contract members as new account book managers.
6. The intelligent contract-based ledger processing method of claim 1, wherein after writing the target metadata into ledger change history data of the preset ledger and returning the operation data to a target local database, further comprising:
if an audit request of an auditor is monitored, obtaining the operation data of each intelligent contract member according to the historical data of the account book change;
and assembling the operation data into a service data chain, and returning the service data chain to the auditor.
7. The intelligent contract-based ledger processing method according to claim 1, characterized in that the method further comprises:
monitoring a function change request initiated by an intelligent contract member, wherein the function change request comprises the ledger state change function and a new ledger state change function;
and if a function change request initiated by the intelligent contract member is monitored, sending the new account state change function to an account manager, wherein the new account state change function takes effect after the account manager passes the audit.
8. An account book processing device based on intelligent contracts is characterized by comprising:
the acquisition module is used for acquiring account book occupation variables of preset account books;
the atomic write module is used for carrying out atomic write operation on the occupation variable value of the account book occupation variable;
the change module is used for carrying out change operation on the account book state data of the preset account book based on a preset account book state change function if the atomic write operation of the occupied variable value is successful, so as to obtain target metadata after the change operation of the preset account book and operation data during the change operation of the preset account book;
and the writing module is used for writing the target metadata into the ledger change historical data of the preset ledger and transmitting the operation data back to a target local database.
9. A computer device comprising a memory for storing a computer program and a processor for executing the computer program to cause the computer device to perform the intelligent contract-based ledger processing method of any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that it stores a computer program which, when executed by a processor, implements the intelligent contract-based ledger processing method of any one of claims 1 to 7.
CN202110822043.8A 2021-07-21 2021-07-21 Account book processing method, device, equipment and storage medium based on intelligent contract Active CN113268490B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110822043.8A CN113268490B (en) 2021-07-21 2021-07-21 Account book processing method, device, equipment and storage medium based on intelligent contract

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110822043.8A CN113268490B (en) 2021-07-21 2021-07-21 Account book processing method, device, equipment and storage medium based on intelligent contract

Publications (2)

Publication Number Publication Date
CN113268490A true CN113268490A (en) 2021-08-17
CN113268490B CN113268490B (en) 2021-10-12

Family

ID=77236963

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110822043.8A Active CN113268490B (en) 2021-07-21 2021-07-21 Account book processing method, device, equipment and storage medium based on intelligent contract

Country Status (1)

Country Link
CN (1) CN113268490B (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107257961A (en) * 2014-12-26 2017-10-17 英特尔公司 Data consistency is realized in equipment room
CN109493072A (en) * 2018-10-24 2019-03-19 杭州趣链科技有限公司 A method of the privacy contract protection based on alliance's block chain
US20200050386A1 (en) * 2018-08-07 2020-02-13 International Business Machines Corporation Private and fault-tolerant storage of segmented data
CN111078795A (en) * 2019-12-20 2020-04-28 北京艾摩瑞策科技有限公司 Method and device for storing social data of internet on block chain
CN111767556A (en) * 2019-01-31 2020-10-13 阿里巴巴集团控股有限公司 Method for realizing privacy protection in block chain, node and storage medium
CN111831671A (en) * 2019-12-20 2020-10-27 北京艾摩瑞策科技有限公司 Method and device for storing internet advertisement data on block chain

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107257961A (en) * 2014-12-26 2017-10-17 英特尔公司 Data consistency is realized in equipment room
US20200050386A1 (en) * 2018-08-07 2020-02-13 International Business Machines Corporation Private and fault-tolerant storage of segmented data
CN109493072A (en) * 2018-10-24 2019-03-19 杭州趣链科技有限公司 A method of the privacy contract protection based on alliance's block chain
CN111767556A (en) * 2019-01-31 2020-10-13 阿里巴巴集团控股有限公司 Method for realizing privacy protection in block chain, node and storage medium
CN111078795A (en) * 2019-12-20 2020-04-28 北京艾摩瑞策科技有限公司 Method and device for storing social data of internet on block chain
CN111831671A (en) * 2019-12-20 2020-10-27 北京艾摩瑞策科技有限公司 Method and device for storing internet advertisement data on block chain

Also Published As

Publication number Publication date
CN113268490B (en) 2021-10-12

Similar Documents

Publication Publication Date Title
US11720711B2 (en) System and method for interaction object management in a blockchain environment
AU2020261982B2 (en) Extracting data from a blockchain network
EP3729287B1 (en) Systems and methods for generating and maintaining immutable digital meeting records within distributed network nodes
JP6730520B2 (en) Immutable database supported by a cryptographically protected ledger
JP7417677B2 (en) Technology for file sharing
US11917051B2 (en) Systems and methods for storage, generation and verification of tokens used to control access to a resource
US20200389309A1 (en) Systems and methods for accessing digital assets in a blockchain using owner consent contracts
EP3776250B1 (en) Performing map iterations in blockchain-based system
US11018853B2 (en) Workflow management via distributed ledgers and smart contracts
US11314885B2 (en) Cryptographic data entry blockchain data structure
WO2022007548A1 (en) Blockchain implementation to securely store information off-chain
CN112000632A (en) Ciphertext sharing method, medium, sharing client and system
WO2020154616A1 (en) Blockchain payroll system
US11943360B2 (en) Generative cryptogram for blockchain data management
JP6685968B2 (en) Data management system, data management method, and data management program
CN113268490B (en) Account book processing method, device, equipment and storage medium based on intelligent contract
US20230267220A1 (en) Privacy preserving asset token exchange
Alizadeh Saveh A PERMISSIONED BLOCKCHAIN-BASED MODEL FOR DIGITAL FORENSICS
WO2022046524A1 (en) Systems and methods for accessing digital assets in a blockchain using owner consent contracts
WO2024013578A1 (en) Api management for batch processing
GB2603589A (en) Consensus algorithm for distributed ledger technology
CN114579585A (en) Block chain selective world state database

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