CN117057806B - Data processing method and device based on block chain and related equipment - Google Patents

Data processing method and device based on block chain and related equipment Download PDF

Info

Publication number
CN117057806B
CN117057806B CN202311311594.3A CN202311311594A CN117057806B CN 117057806 B CN117057806 B CN 117057806B CN 202311311594 A CN202311311594 A CN 202311311594A CN 117057806 B CN117057806 B CN 117057806B
Authority
CN
China
Prior art keywords
account
sub
transaction
state information
main
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
CN202311311594.3A
Other languages
Chinese (zh)
Other versions
CN117057806A (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.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen 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 Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN202311311594.3A priority Critical patent/CN117057806B/en
Publication of CN117057806A publication Critical patent/CN117057806A/en
Application granted granted Critical
Publication of CN117057806B publication Critical patent/CN117057806B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • 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
    • 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
    • G06Q40/00Finance; Insurance; Tax strategies; Processing of corporate or income taxes
    • G06Q40/04Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange

Abstract

The embodiment of the application discloses a data processing method, a device and related equipment based on a blockchain, which can be applied to the technical field of blockchains. The method comprises the following steps: acquiring a first business transaction sent by a business object through a target main account address; determining a main sub-account management contract when the first business transaction is detected to be an account management transaction; calling a main sub-account management contract to read main account state information matched with a target main account address from target account state information on a blockchain, and determining the read main account state information as first main account state information; n sub-account state information is obtained from the first main account state information, the N sub-account state information is subjected to state update, target account state information is updated based on the sub-account state information after the state update, and the account management transaction is uplink to the blockchain. By adopting the embodiment of the application, the management efficiency of the account on the blockchain is improved.

Description

Data processing method and device based on block chain and related equipment
Technical Field
The present disclosure relates to the field of blockchain technologies, and in particular, to a blockchain-based data processing method, apparatus, and related devices.
Background
Currently, in a blockchain scenario, a service object (such as user a) may be configured with a pair of public and private keys (i.e., a key pair), where a pair of public and private keys may correspond to an account on a blockchain, and user a may perform service processing, such as participating in the invocation of an on-chain contract, transferring on-chain resources, and so on, by creating a key pair for the account.
In practice, the inventor finds that, if a business object (such as user a) needs to perform different business processes through different accounts, for example, user a wants to perform business 1 through one account and business 2 through another account, multiple different account numbers can be created through different key pairs, and further different business can be processed through different key pairs used for creating the accounts, which means that once the accounts created for the user a are too many, the user a needs to manage more key pairs, which easily causes disorder of account and key management, so that the management efficiency of the accounts on the blockchain is reduced.
Disclosure of Invention
The embodiment of the application provides a data processing method, a data processing device and related equipment, which can manage accounts of sub-account addresses through main account addresses, and are beneficial to improving the management efficiency of the accounts on a blockchain.
In one aspect, an embodiment of the present application provides a data processing method based on a blockchain, where the method includes:
acquiring a first business transaction sent by a business object through a target main account address;
when the first business transaction is detected to be an account management transaction for account management, determining a main sub-account management contract deployed on the blockchain based on contract calling parameters in the account management transaction;
calling a main sub-account management contract to read main account state information matched with a target main account address from target account state information on a blockchain, and determining the read main account state information as first main account state information; the first main account state information comprises N sub-account state information corresponding to N sub-account addresses configured for the service object; n is a positive integer; one sub-account address corresponds to one sub-account status information; the N sub-account addresses are determined based on a main sub-account management contract and a target main account address, and the target main account address and the N sub-account addresses are associated with the same key pair held by the business object;
and calling a main sub-account management contract to acquire N sub-account state information from the first main account state information, carrying out state update on the N sub-account state information based on the account management transaction, updating target account state information based on the sub-account state information after the state update, and uploading the account management transaction to a blockchain based on the target account state information after the update.
In one aspect, an embodiment of the present application provides a data processing apparatus based on a blockchain, where the apparatus includes:
the transaction acquisition module is used for acquiring a first business transaction sent by a business object through a target main account address;
the contract determining module is used for determining a main sub-account management contract deployed on the blockchain based on contract calling parameters in the account management transaction when the first business transaction is detected to be the account management transaction for account management;
the state information acquisition module is used for calling the main and sub account management contracts to read main account state information matched with the target main account address from target account state information on the blockchain, and determining the read main account state information as first main account state information; the first main account state information comprises N sub-account state information corresponding to N sub-account addresses configured for the service object; n is a positive integer; one sub-account address corresponds to one sub-account status information; the N sub-account addresses are determined based on a main sub-account management contract and a target main account address, and the target main account address and the N sub-account addresses are associated with the same key pair held by the business object;
The information updating module is used for calling the main sub-account management contract to acquire N sub-account state information from the first main account state information, carrying out state updating on the N sub-account state information based on the account management transaction, updating the target account state information based on the sub-account state information after the state updating, and uploading the account management transaction to the blockchain based on the target account state information after the updating.
In one aspect, the present application provides a computer readable storage medium storing a computer program adapted to be loaded and executed by a processor, so that a computer device having the processor performs the method provided in the embodiments of the present application.
In one aspect, the present application provides a computer program product or computer program comprising computer instructions stored in a computer readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device performs the method provided in the embodiments of the present application.
In this embodiment of the present application, the service object may initiate a service transaction (e.g., a first service transaction) based on a main account address (e.g., a target main account address), and when the first service transaction is an account management transaction, update account status information of N sub-account addresses (N is a positive integer) under the main account address through a main sub-account management contract. Therefore, the account of the sub-account address can be managed through one main account address, and the management efficiency of the accounts on the blockchain is improved. And, a main account address and N sub-account addresses under the main account address are associated to the same key pair, so that the business object is equivalent to realize the management of a plurality of accounts (namely, the main account address and the N sub-account addresses) by grasping one key pair, thereby being beneficial to improving the management efficiency of the accounts on the blockchain.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings needed in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present application, and other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a schematic diagram of a block chain based data processing system according to an embodiment of the present application;
FIG. 2 is a schematic view of a scenario of data interaction provided in an embodiment of the present application;
FIG. 3 is a flowchart of a data processing method based on a blockchain according to an embodiment of the present disclosure;
FIG. 4 is a schematic diagram of a business transaction according to an embodiment of the present application;
FIG. 5 is a schematic diagram of the effect of a primary and secondary account management contract provided by an embodiment of the present application;
FIG. 6 is a schematic diagram of a transaction processing process provided by an embodiment of the present application;
FIG. 7 is a flow chart of another method for processing data based on blockchain according to an embodiment of the present application;
fig. 8 is a schematic diagram of an effect of account status information according to an embodiment of the present application;
FIG. 9 is a flow chart of yet another data processing method based on blockchain according to an embodiment of the present application;
FIG. 10 is a schematic diagram of another transaction processing process provided by embodiments of the present application;
FIG. 11 is a schematic diagram of a block chain based data processing apparatus according to an embodiment of the present application;
fig. 12 is a schematic structural diagram of a computer device according to an embodiment of the present application.
Detailed Description
The following description of the embodiments of the present application will be made clearly and fully with reference to the accompanying drawings, in which it is evident that the embodiments described are only some, but not all, of the embodiments of the present application. All other embodiments, which can be made by one of ordinary skill in the art based on the embodiments herein without making any inventive effort, are intended to be within the scope of the present application.
Referring to FIG. 1, FIG. 1 is a block chain based data processing system according to one embodiment of the present application. The data processing system may include a cluster of terminal devices and a blockchain network. As shown in fig. 1, the terminal device cluster may be the terminal device cluster 100a shown in fig. 1, and the blockchain network may be the blockchain network 200a shown in fig. 1.
It will be appreciated that one or more terminal devices may be included in the terminal device cluster 100a shown in fig. 1. The number of terminal devices in the cluster of terminal devices 100a will not be limited here. As shown in fig. 1, the terminal devices in the terminal device cluster 100a may include terminal device 110a, terminal devices 110b, …, terminal device 110n, and so on.
It is to be appreciated that the blockchain network 200a as shown in fig. 1 can include a plurality of blockchain nodes, the number of blockchain nodes in the blockchain network 200a will not be limited herein. As shown in FIG. 1, the plurality of blockchain link points in the blockchain network 200a may specifically include blockchain nodes 11a, blockchain nodes 11b, blockchain nodes 11c, blockchain nodes 11d, and so forth. The blockchain nodes in the blockchain network may be used to collectively maintain blockchains, e.g., the blockchain stored on each node in the blockchain network 200a (e.g., blockchain nodes 11a, 11b, 11c, and 11 d) is blockchain 11e.
As shown in fig. 1, the terminal devices (e.g., terminal device 110 a) in the terminal device cluster 100a may be in network connection with the blockchain nodes such as blockchain node 11a, blockchain node 11b, blockchain node 11c, blockchain node 11d, etc. to perform data interaction with the blockchain nodes in the blockchain network 200a in the case that the terminal devices in the terminal device cluster 100a access the blockchain network 200 a. For example, the terminal device 110a may serve as a service terminal, and the service object may send a data query request to the blockchain network through the service terminal, and then the blockchain node in the blockchain network may determine a request result based on the data query request, and then return the request result to the corresponding service terminal.
It should be understood that the blockchain according to the embodiments of the present application is a novel application mode of computer technologies such as distributed data storage, peer-to-peer transmission, a consensus mechanism, and an encryption algorithm, and is mainly used for sorting data according to a time sequence, encrypting an account book, so that the account book cannot be tampered and forged, and meanwhile, performing verification, storage, and update of data. The blockchain is essentially a decentralised database, which is a series of data blocks generated by cryptographic methods, each data block containing a batch of information of network transactions for verifying the validity (anti-counterfeiting) of the information and generating the next block. The blockchain may include a blockchain underlying platform, a platform product services layer, and an application services layer. The Block chain comprises a series of blocks (blocks) which are mutually connected according to the sequence of the generated time, and the blocks record Block data packed and submitted by Block chain nodes in the Block chain system. The blockchain underlying platform may include processing modules for object management, basic services, smart contracts, and operations management. The object management module is responsible for identity information management of all blockchain participants, including maintenance of public and private key generation (account management), key management, maintenance of corresponding relation between real identities of users and blockchain addresses (authority management), etc., and under the condition of authorization, supervision and audit of transaction conditions of certain real identities, and provision of rule configuration (wind control audit) of risk control; the basic service module is deployed on all block chain node devices, is used for verifying the validity of a service request, recording the service request on a storage after the effective request is identified, for a new service request, the basic service firstly analyzes interface adaptation and authenticates the interface adaptation, encrypts service information (identification management) through an identification algorithm, and transmits the encrypted service information to a shared account book (network communication) in a complete and consistent manner, and records and stores the service information; the intelligent contract module is responsible for registering and issuing contracts, triggering contracts and executing contracts, a developer can define contract logic through a certain programming language, issue the contract logic to a blockchain (contract registering), invoke keys or other event triggering execution according to the logic of contract clauses to complete the contract logic, and simultaneously provide a function of registering contract upgrading; the operation management module is mainly responsible for deployment in the product release process, modification of configuration, contract setting, cloud adaptation and visual output of real-time states in product operation, for example: alarms, managing network conditions, managing node device health status, etc. The platform product service layer provides basic capabilities and implementation frameworks of typical applications, and developers can complete the blockchain implementation of business logic based on the basic capabilities and the characteristics of the superposition business. The application service layer provides the application service based on the block chain scheme to the business participants for use.
It will be appreciated that a blockchain (e.g., blockchain 11 e) may be composed of a plurality of blocks, wherein an originating block (also referred to as an originating block, i.e., a first block in the blockchain) includes a block header and a block body, wherein the block header stores an input information characteristic value, a version number, a timestamp and a difficulty value, and the block body stores input information; the next block of the starting block takes the starting block as a father block, the next block also comprises a block head and a block main body, the block head stores the input information characteristic value of the current block, the block head characteristic value of the father block, the version number, the timestamp and the difficulty value, and the like, so that the block data stored in each block in the block chain are associated with the block data stored in the father block, and the safety of the input information in the block is ensured. It is understood that each block in the blockchain may correspond to a block height, which refers to the number of blocks between the block and the created block in the blockchain. It should be noted that the block height of the created block is 0 and the block height of the next block of the created block is 1.
It should be appreciated that one or more smart contracts may be deployed on a blockchain (e.g., blockchain 11 e) of the blockchain network (e.g., blockchain network 200 a) described above, which may be distinguished by contract identification, which may include one or more of the following: the contract calling address, contract identification number (Identity document, ID) or contract name can also be carried in the business transaction initiated by the user client, so as to specify the intelligent contract to be operated. In embodiments of the present application, the intelligent contracts deployed on the blockchain may include a master sub-account management contract and a business contract. A primary sub-account management contract refers to an intelligent contract for managing primary account addresses, sub-account addresses under the primary account addresses, and status queries (e.g., permission queries). The business contracts may be contracts on the blockchain for conducting business processes, for example, intelligent contracts for conducting electronic ticket invoices, intelligent contracts for conducting lottery transactions, contracts for conducting virtual resource conversions in game scenarios, and the like, without limitation.
For ease of understanding, further, please refer to fig. 2, fig. 2 is a schematic view of a scenario of data interaction provided in an embodiment of the present application. As shown in fig. 2, the terminal device 20a may be any terminal device in the terminal device cluster in the embodiment corresponding to fig. 1 (e.g. the terminal device 110a, the terminal device 110b, etc.) and the service object a may initiate a transaction TX1 based on the primary account address a1 (step S21), where the transaction type of the transaction TX1 may be the first transaction type. It will be appreciated that the transaction TX1 may be for transmission to the blockchain network 200a, and that each blockchain node in the blockchain network 200a (e.g., blockchain node 11 c) may have a primary and secondary account management contract deployed therein and target account status information stored therein. The processing of transaction TX1 by a blockchain node is described herein as blockchain node 11c in blockchain network 200 a.
The blockchain node 11c performs step S22: the main account status information b1 of the main account address a1 is acquired from the target account status information through the main sub-account management contract. It will be appreciated that the blockchain node 11c performing step S22 may be performed when the transaction TX1 is an account management transaction, which is a transaction for managing a main account address and a sub-account address under the main account address. It may be appreciated that the transaction TX1 carries a contract call parameter, and further, a main sub-account management contract may be determined based on the contract call parameter, and the main sub-account management contract may be called to obtain the target account status information.
The target account status information may be account status information of the blockchain that is required to be acquired when executing the transaction TX 1. As shown in fig. 2, the target account status information may include a plurality of primary account status information, such as primary account status information b1, primary account status information b2, primary account status information b3, and the like, which are not limited herein. The main account status information b1 is main account status information corresponding to the main account address a1, the main account status information b2 is main account status information corresponding to the main account address a2, and the main account status information b3 may be main account status information corresponding to the main account address a 3. The main account address a1 is a main account address corresponding to the service object a, the main account address a2 is a main account address corresponding to the service object B, the main account address a3 is a main account address corresponding to the service object C, and the service object a, the service object B and the service object C may be the same service object or different service objects. Alternatively, one business object may manage multiple primary account addresses, each of which may be configured with multiple sub-account addresses. In some scenarios, each primary account address may be used to process a different primary service, with sub-accounts under the primary account address up to being used to process sub-services under the corresponding primary service. It will be appreciated that if a sub-account address is configured for a certain main account address, sub-account status information may be included in the main account status information. For example, as shown in fig. 2, sub-account state information b11 and sub-account state information b12 may be included in the main account state information b1, sub-account state information b21 may be included in the main account state information b2, and sub-account state information b31 and sub-account state information b32 may be included in the main account state information b 3. If a sub-account address is not configured in a certain main account address, the sub-account state information in the corresponding main account state information is null.
Further, the blockchain node 11c performs step S23: the target account status information is updated based on transaction TX 1. Wherein updating the target account status information based on transaction TX1 may include: and calling the main sub-account management contract to update sub-account state information corresponding to the sub-account address under the main account address a1, and updating the target account state information based on the updated sub-account state information. The updating of the sub-account status information corresponding to the sub-account address under the main account address a1 may include adding the sub-account status information corresponding to the sub-account address, deleting the sub-account status information corresponding to the designated sub-account address, adjusting the account authority information of the sub-account address, and the like.
According to the embodiment of the application, the business object can initiate business transaction (such as first business transaction) based on the main account address (such as target main account address), and when the first business transaction is account management transaction, the account state information of N sub-account addresses (N is a positive integer) under the main account address is updated through the main sub-account management contract. Therefore, the account of the sub-account address can be managed through one main account address, and the management efficiency of the accounts on the blockchain is improved. And, a main account address and N sub-account addresses under the main account address are associated to the same key pair, so that the business object is equivalent to realize the management of a plurality of accounts (namely, the main account address and the N sub-account addresses) by grasping one key pair, thereby being beneficial to improving the management efficiency of the accounts on the blockchain. In addition, the business object only needs to manage one private key, so that the complexity of private key management is reduced, and the security of the account is improved. When a transaction is initiated through each sub-account, the business object can be signed through the private key associated with the main account address without switching different accounts, so that the business object can be signed through the private keys corresponding to different accounts, and the business object is beneficial to improving the transaction efficiency aiming at different businesses. In addition, the authority of each sub-account address can be configured through the main account address, namely, a plurality of sub-account addresses can be managed in a centralized way through one main account address, so that the controllability of the sub-account addresses for different services is improved.
It can be appreciated that the embodiments of the present application may be applied in an enterprise management scenario. For example, an enterprise employee may perform processing of various services, such as an billing service, a red-flush service, etc., and then the enterprise employee needs to create different accounts to perform processing of the services, so that in this embodiment of the present application, a sub-account address may be configured for the employee (i.e. a service object), and rights management may be performed on the configured sub-account address, or the configured sub-account address may be deleted, which is not limited herein. Each sub-account address can be used for different business processes (such as sub-account address 1 is used for an billing business, sub-account address 2 is used for a red-burst business), the different sub-account addresses are provided with corresponding account rights (such as sub-account address 1 has call rights for business contracts for the billing business, sub-account address 2 has call rights for business contracts for the red-burst business), and enterprise staff only needs to manage one key pair to conduct business processes based on a plurality of account addresses (including a main account address and configured sub-account addresses), so that account management efficiency is improved.
It is appreciated that embodiments of the present application may be applied in a gaming scenario. For example, a business object (such as a game player) may perform processing of various services in a game, such as a recharge service in the game, a game lottery service, and so on, in order to avoid that an account number is directly marked and locked by a game platform, the game player may create different accounts for performing processing of the services, and further, in this embodiment of the present application, configure a sub-account address for the game player (i.e. the business object), and perform authority management on the configured sub-account address, or delete the configured sub-account address, and so on, which is not limited herein. Each sub-account address may be used for different business processes (e.g., sub-account address 1 for the recharge business, sub-account address 2 for the lottery by the game), respectively, with the different sub-account addresses being provided with corresponding account permissions (e.g., sub-account address 1 having call permissions for business contracts for the recharge business, sub-account address 2 having call permissions for business contracts for the game recharge business). In addition, the game player can realize business processing based on a plurality of account addresses (including a main account address and a configured sub-account address) by only managing one key pair, thereby being beneficial to improving the efficiency of account management.
For another example, in some scenarios, the business object may be a ledger, the ledger may store resources of the business party, and each business party may query the number of resources of the ledger existing in the business party, and if the ledger needs to display the corresponding number of assets for each business party, the ledger needs to determine a plurality of accounts, where each account is used to store resources of a different business party. Based on this, a plurality of sub-account addresses can be configured for the account separating party according to the embodiment of the present application, and the number of resources stored in each sub-account address is the number of resources stored in the account separating party by a service party, so that the service party can query the number of resources of the account separating party existing by itself through the sub-account address provided by the service party. In addition, when the business party requests to transfer out the resources from the sub-account addresses, the business object can directly transfer the resources from the corresponding sub-account addresses. In this scenario, the sub-account address may be configured for the service object, and the configured sub-account address may be subjected to rights management, or the configured sub-account address may be deleted, which is not limited herein. In addition, the account separating party can realize business processing based on a plurality of account addresses (including a main account address and configured sub-account addresses) by only managing one key pair, thereby being beneficial to improving the efficiency of account management and further improving the efficiency of account separating management.
It will be appreciated that the blockchain nodes (e.g., any blockchain node in the blockchain network 200a described above) according to the embodiments of the present application may be computer devices, and the computer devices may be servers, or terminal devices, or other devices that perform data processing, which are not limited herein. The server may be an independent physical server, a server cluster or a distributed system formed by a plurality of physical servers, or a cloud server providing cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDNs, basic cloud computing services such as big data and artificial intelligent platforms, and the like, which is not limited herein.
The terminal devices (e.g., any one of the terminal device clusters 100 a) according to the embodiments of the present application may include, but are not limited to, a mobile phone, a computer, an intelligent voice interaction device, an intelligent home appliance, a vehicle-mounted terminal, an aircraft, an intelligent sound box, an intelligent home appliance, and the like.
It can be understood that the above scenario is merely an example, and does not constitute a limitation on the application scenario of the technical solution provided in the embodiments of the present application, and the technical solution of the present application may also be applied to other scenarios. For example, as one of ordinary skill in the art can know, with the evolution of the system architecture and the appearance of new service scenarios, the technical solutions provided in the embodiments of the present application are equally applicable to similar technical problems.
Further, referring to fig. 3, fig. 3 is a flow chart of a data processing method based on a blockchain according to an embodiment of the present application. The method may be performed by a blockchain node, such as any of the blockchain nodes in blockchain network 200a described above. The method may comprise at least the following steps S101-S104.
S101, acquiring a first business transaction sent by a business object through a target main account address.
The first business transaction may refer to a transaction with a transaction type of the first business transaction type for business processing. It is to be appreciated that transactions for conducting business processes can be collectively referred to as business transactions (or transactions), such as the first business transaction herein. Wherein the first transaction type may be a transaction type for account management or rights inquiry.
It will be appreciated that the transaction parameters of the first business transaction include a transaction type field, in other words, the first business transaction carries a field value of the transaction type field. The transaction type field may be a field for indicating a transaction type of the first business transaction. It will be appreciated that different field values in the transaction type field represent different transaction types. It will be appreciated that the first transaction type may be identified by a specific field value, for example, the field value of the transaction type field corresponding to the first transaction type may be 99, in other words, if the field value of the transaction type field in a service transaction is 99, it indicates that the transaction type of the service transaction is the first transaction type.
It will be appreciated that the transaction parameters in the first business transaction include signature information, in other words, the first business transaction carries signature information. The signature information is obtained by signing a transaction to be signed constructed by the business object by a private key held by the business object. It can be appreciated that the signature information is obtained by the resource management client signing the transaction to be signed based on the private key, and further the resource management client can determine the transaction to be processed based on the transaction to be signed and the signature information, and send the transaction to be processed to the blockchain node. The blockchain node may determine the pending transaction as a first business transaction when the received pending transaction is successfully checked and the transaction type of the pending transaction is the first transaction type. It will be appreciated that the transaction to be processed for determining the first business transaction may be referred to as a first transaction to be processed (for example, may be the transaction TX1 in fig. 2), the transaction to be signed for determining the first transaction to be processed may be referred to as a first transaction to be signed, and the signature information in the first business transaction may be referred to as first signature information.
It may be appreciated that the transaction parameters of the first service transaction may further include a source address field of the transaction, in other words, the first service transaction may carry a source address, and since the first service transaction is sent through the target main account address, a field value of the source address field in the first service transaction is the target main account address.
It will be appreciated that a variety of parameter fields may be included in the transaction parameters in the first business transaction, and that the transaction structure of the business transaction (e.g., the first business transaction) on the blockchain is described herein in connection with the illustration. Referring to fig. 4, fig. 4 is a schematic structural diagram of a business transaction according to an embodiment of the present application. As shown in fig. 4, the transaction structure of the business transaction on the blockchain may include one or more of the following: a transaction type field, a transaction count field, a transaction fee field, a source address field, a transaction resource quantity field, a transaction append field, a destination address field, transaction signature information, and so forth.
Wherein, the transaction type field is used for recording the transaction type of the business transaction initiated by the business object. It may be understood that the field value of the transaction type field in the embodiments of the present application may be a field value for indicating a first transaction type, or may be a field value for indicating a second transaction type, where the field values corresponding to different transaction types are different. Wherein the second transaction type may be a transaction type for performing general business such as resource transfer, contract call, contract creation, etc., in other words, the second transaction type may include a resource transfer sub-type, a contract call sub-type, and a contract creation sub-type. Wherein the resource transfer sub-type may be a transaction sub-type for making a resource transfer, the contract invoking sub-type may be a transaction sub-type for invoking a business contract on the blockchain, and the contract creating sub-type may be a transaction type for creating a business contract on the blockchain. For example, the field value of the first transaction type may be 99, the field value of the resource transfer subtype included in the second transaction type may be 0, the field value of the contract call subtype included in the second transaction type may be 1, and the field value of the contract creation subtype included in the second transaction type may be 2.
The transaction count field is used to record a serial number of a transaction initiated by the transaction object, in other words, to indicate what number of transactions the transaction initiated by the transaction initiation object. For example, if the field value of the transaction count field of the transaction tx1 is 10, this indicates that the serial number of the transaction tx1 is 10.
The transaction fee field is used to record the fee spent executing the transaction. For example, the transaction fee field may include a transaction consumption fee price (e.g., the resource price (in wei) that the business object is willing to pay for initiating the exchange), a transaction consumption fee amount (i.e., the maximum resource amount that the business object is willing to pay for initiating the exchange). It will be appreciated that the transaction cost of a business transaction may be the transaction cost price of the transaction consumption costThe transaction consumes a fee amount.
The source address field is used to record the account address from which the business transaction was initiated. The destination address field is used to record the destination address of the business transaction. It will be appreciated that if the transaction type of the business transaction is the first transaction type, the field value of the destination address field is the contract address of the main sub-account management contract, in other words, the destination address of the transaction is the contract address of the main sub-account management contract. If the transaction type of the business transaction is the resource transfer sub-type included in the second transaction type, the field value of the destination address field is the account address to which the resource is to be transferred, in other words, the destination address of the transaction is the account address to which the resource is to be transferred. If the transaction type of the business transaction is the contract calling sub-type included in the second transaction type, the field value of the destination address field is the contract address of the business contract to be called, in other words, the destination address of the transaction is the contract address of the business contract to be called. If the transaction type of the business transaction is a contract creation sub-type included in the second transaction type, the field value of the destination address field is a null value, in other words, the destination address of the transaction is a null value.
The transaction resource quantity field is used for recording the quantity of resources to be transferred in the business transaction. It will be appreciated that the transaction resource number field may be the number of resources to be transferred when the transaction is of a resource transfer subtype included in the second transaction type. The transaction resource quantity field may be null when the transaction is of a transaction type for invoking an intelligent contract (e.g., a contract invocation subtype or a contract creation subtype included in the first transaction type or the second transaction type).
The transaction additional field may be used to record additional information required to perform a business transaction. When the transaction is a contract call sub-type included in the first transaction type or the second transaction type, the transaction additional field may include a method name of a contract method to be called in a contract to be called (such as a main sub-account management contract or a business contract), some other field information, and the like, which is not limited herein. The transaction additional field may be a null value when the transaction is of a resource transfer subtype included in the second transaction type.
The signature information is obtained by carrying out transaction signature on the transaction to be signed constructed by the business object through the private key. The block chain link point can carry out signature verification on the signature information through the public key, and when the signature verification is successful, the business transaction is determined to be sent by the business object, and the content is not tampered, so that the safety and the reliability of the transaction data are ensured.
Specifically, the target main account address is determined by a public key corresponding to a private key held by the business object; the private key and the public key held by the business object are used for forming a key pair; then, acquiring the first business transaction sent by the business object through the target primary account address may include the steps of: acquiring a first transaction to be processed, which is sent by a business object through a target main account address; the first transaction to be processed is obtained by carrying out transaction signature on the first transaction to be signed constructed by the business object based on a private key held by the business object; conducting transaction verification on the first transaction to be processed through a public key corresponding to a private key held by the service object, acquiring a field value of a transaction type field from a transaction field of the first transaction to be processed when the first transaction to be processed is verified, and determining the acquired field value as a first field value; determining a transaction type of the first transaction to be processed based on the first field value; and determining the first transaction to be processed as the first business transaction when the transaction type of the first transaction to be processed is the first transaction type.
The target primary account address refers to a primary account address corresponding to the service object, and the generation mode of the target primary account address may refer to the above description related to the generation of the account address based on the private key of the service object, which is not described herein.
It will be appreciated that a key pair includes a public key and a private key. The public key is determined by the private key, but the acquisition of the public key cannot be reversed to derive the private key. The private key of the service object is kept by the service object itself, for example, the private key is kept by the resource management client corresponding to the service object. The public key of the service object can be issued to the outside and further used for signing verification of signature information generated based on the private key.
The first transaction to be processed may be a transaction initiated by the business object through the resource management client. The source address of the first pending transaction is the target primary account address. Wherein the first transaction to be signed is a transaction to be signed constructed by the business object. It can be appreciated that the resource management client performs transaction signing on the first transaction to be signed through the private key held by the service object to obtain signature information (i.e., the first signature information), so that the first transaction to be processed can be combined into the first transaction to be processed through the first transaction to be signed and the first signature information, and the first transaction to be processed is sent to the blockchain node. The blockchain node may sign the first pending transaction with the public key.
Wherein, the resource management client performs transaction signing on the first transaction to be signed through the private key may include: carrying out hash calculation on the first transaction to be signed through a hash algorithm to obtain a reference document abstract corresponding to the first transaction to be signed, and carrying out encryption processing on the reference document abstract through a private key to obtain first signature information; the first transaction to be processed is composed based on the first signature information and the first transaction to be signed. The reference document abstract refers to information obtained by carrying out hash calculation on a first transaction to be signed in the process of generating signature information.
The performing the transaction verification on the first to-be-processed transaction through the public key held by the business object may include: and the blockchain node decrypts the signature information through the public key to obtain a decrypted document abstract. Carrying out hash calculation on a first to-be-signed transaction in the first to-be-processed transactions through a hash algorithm to obtain document abstracts to be compared corresponding to the first to-be-signed transactions; comparing the to-be-compared document abstract with the reference document abstract to obtain a comparison result, and indicating that the first to-be-processed transaction verification is successful when the comparison result indicates that the to-be-compared document abstract is consistent with the reference document abstract; and when the comparison result indicates that the document abstract to be compared is inconsistent with the reference document abstract, the first transaction to be processed fails to be checked. The document abstract to be compared refers to information obtained by carrying out hash calculation on a first transaction to be signed in the process of verifying signature information.
It will be appreciated that the transaction type of the first transaction to be processed may be detected when the verification of the first transaction to be processed is successful, and the first transaction to be processed is determined to be the first business transaction when the transaction type of the first transaction to be processed is detected as the first transaction type. It may be appreciated that detecting the transaction type of the first transaction to be processed may include acquiring a field value of a transaction type field from the transaction field of the first transaction to be processed, and determining the acquired field value as the first field value; a transaction type of the first pending transaction is determined based on the first field value. Wherein the first field value refers to a field value of a transaction type field of the first transaction to be processed. For example, if the field value corresponding to the first transaction type is 99, when the field value (i.e., the first field value) of the transaction type field of the first transaction to be processed is 99, determining that the transaction type of the first transaction to be processed is the first transaction type, and determining that the first transaction to be processed is the first business transaction.
It may be appreciated that in the embodiment of the present application, after the first to-be-processed transaction is checked successfully, the first to-be-processed transaction may be stored in the transaction pool of the blockchain node, so that the blockchain node may package the transaction in the transaction pool to obtain the block including the to-be-processed transaction. It is to be understood that the step of detecting the transaction type of the first to-be-processed transaction may be performed before the first to-be-processed transaction is stored in the transaction pool, after the first to-be-processed transaction is packed into the block, or before the first to-be-processed transaction in the block is executed, which is not limited herein.
S102, when the first business transaction is detected to be an account management transaction for account management, determining a main sub account management contract deployed on the blockchain based on contract calling parameters in the account management transaction.
The account management transaction is a transaction for managing a main account address and a sub account address under the main account address. It will be appreciated that the account management transaction may include a sub-account creation transaction for configuring a sub-account address for a business object, a sub-account deletion transaction for deleting a sub-account address configured for a business object, and a transaction for adjusting account permissions corresponding to the sub-account address (i.e., adjusting account permission information included in sub-account status information). In other words, the business object may configure the sub-account address, delete the sub-account address, and account permissions for the sub-account address by initiating the business transaction. It will be appreciated that the timing of the step of determining the primary and secondary account management contracts to be deployed on the blockchain may be when executing the first business transaction, based on contract invocation parameters in the account management transaction.
It is understood that the contract invocation parameter may be a parameter indicating a contract invoked by a business transaction. For example, as shown in connection with FIG. 4, the contract call parameters may be destination address fields in a business transaction. The parameter value of the contract invocation parameter may be a contract identification of a main sub-account management contract, which is used to uniquely identify the main sub-account management contract on the blockchain, e.g., the contract identification may be a contract address, a contract name, etc. of the main sub-account management contract.
It is understood that a primary sub-account management contract refers to an intelligent contract for managing a primary account address, sub-account addresses under the primary account address, and status queries (e.g., permission queries). Various contract methods (also referred to as contract functions) for main sub-account management may be included in the main sub-account management contract, and the contract methods in the main sub-account management contract may include: a sub-account creation method for adding sub-account status information (i.e., for configuring (also referred to as creating) a new sub-account address under a main account address) to the main account status information, a sub-account deletion method for deleting sub-account status information included in the main account status information (i.e., for deleting a sub-account address under the main account address), a right management method for adjusting account right information included in the sub-account status information, a right inquiry method for inquiring account right information corresponding to the sub-account address (also referred to as a sub-account right inquiry method), and the like. It will be appreciated that in a main sub-account management contract, each contract method corresponds to a method name, and that the method names of different contract methods may be different, in other words, the method names are used to uniquely identify a contract method in the main sub-account management contract. It will be appreciated that upon acquiring a business transaction for invoking a primary sub-account management contract, a corresponding contract method in the primary sub-account management contract may be invoked for processing, and the method name of the contract method to be invoked may be recorded in a transaction additional field in the business transaction.
For example, referring to fig. 5, fig. 5 is an effect schematic diagram of a main sub account management contract according to an embodiment of the present application. As shown in fig. 5, the main sub-account management contract may include a sub-account creation method, a sub-account deletion method, a right management method, a right inquiry method.
It is appreciated that detecting the first business transaction as an account management transaction for account management may include: determining the transaction type of the first business transaction based on the field value of the transaction type field in the transaction parameter of the first business transaction, acquiring the method name of the contract method to be called in the transaction additional field of the first business transaction when the transaction type of the first business transaction is the first transaction type, and determining the first business transaction as the account management transaction when the method name of the contract method to be called is the method name of the sub-account creation method, the method name of the sub-account deletion method or the method name of the authority management method.
S103, calling a main sub-account management contract to read main account state information matched with a target main account address from target account state information on a blockchain, and determining the read main account state information as first main account state information; the first main account state information comprises N sub-account state information corresponding to N sub-account addresses configured for the service object; n is a positive integer; one sub-account address corresponds to one sub-account status information; the N sub-account addresses are each determined based on the master sub-account management contract and the target master account address, and the target master account address and the N sub-account addresses are each associated with the same key pair held by the business object.
The target account state information may be account state information of a blockchain that is required to be acquired when the first business transaction is executed. The target account status information may be understood as account status information when the target main account status information includes sub-account status information corresponding to the N sub-account addresses. The target account status information is used for recording status information of an account on the blockchain (namely, status information corresponding to an account address), and the account can comprise a main account (namely, an account corresponding to the main account address) and a sub-account (namely, an account corresponding to the sub-account address). It will be appreciated that the account status information of the blockchain acquired at different times may be different, and the account status information required when executing each business transaction is the account status information corresponding to that time.
It will be appreciated that in the target account status information, master account status information for each master account address on the blockchain may be included. It will be appreciated that reading the primary account status information that matches the target primary account address from the target account status information on the blockchain may include: analyzing the target main account address from the account management transaction, traversing each main account address in the target account state information, and determining the main account state information corresponding to the main account address consistent with the target main account address as the main account state information matched with the target main account address.
It may be appreciated that the blockchain may include a plurality of primary account addresses, each primary account address having corresponding primary account status information, and each primary account status information may include sub-account status information corresponding to sub-account addresses configured for corresponding business objects. It will be appreciated that the sub-account address configured for the business object may also be described as the sub-account address under the main account address corresponding to the business object. It can be understood that if a sub-account address is not configured under one main account address, sub-account status information included in main account status information corresponding to the main account address is null.
It will be appreciated that the first primary account status information may be primary account status information that matches the target primary account address read from the target account status information when the first business transaction is performed. It can be understood that the first main account status information includes a target main account address and N sub-account status information corresponding to N sub-account addresses under the target main account address. One sub-account address corresponds to one sub-account status information. It will be appreciated that, when the first service transaction is executed, the number of sub-account addresses under the main account address may be a positive integer, that is, N is a positive integer, in other words, at least one (i.e., N) sub-account addresses are configured for the target main account address before the first service transaction is executed, so that the configured N sub-account status information may be managed by the first service. It may be appreciated that, before the first service transaction, the transaction may be created by initiating other sub-accounts for configuring sub-account addresses for the service object, where the N sub-account addresses are configured under the target main account address, that is, sub-account status information of the N sub-account addresses is added in the main account status information corresponding to the target main account address. It will be appreciated that the N sub-account state information may be configured by one sub-account creation transaction, e.g., n=1, the one sub-account state may be configured by one sub-account creation transaction, e.g., N >1, the plurality of sub-account states may be configured in batch by one sub-account creation transaction; the plurality of sub-account status information may also be configured separately by a plurality of sub-account creation transactions when N >1, as not limited herein.
It will be appreciated that the sub-account addresses are each determined based on the primary sub-account management contract and the target primary account address. For example, the business object may send the sub-account creation transaction to the blockchain node through the target main account address, and the blockchain node may add sub-account status information corresponding to the sub-account address to be configured to the main account status information corresponding to the target main account address when acquiring the sub-account address to be configured determined based on the target main account address.
It will be appreciated that the sub-account address may comprise a sub-account identifier, a main account address, a separator, a sub-account identification. The sub-account identifier is used to indicate that an account address is a sub-account address, and may be composed of a plurality of characters, such as "sub". The separator is used to split the primary account address and the sub-account identification, and may be represented by special symbols, such as "/" \ "-", etc., as defined herein. The sub-account identifier is used to uniquely identify a sub-account under a main account, for example, the sub-account identifier may be a serial number of 1, 2, 3, or the like, or a hash value of a serial number of 1, 2, 3, or the like, or may be generated based on other manners, which is not limited herein. For example, a sub-account address may be expressed as: "sub" + primary account address + separator + sub account identification.
It may be appreciated that the primary account status information may further include a transaction number (nonce) corresponding to the primary account address, a resource number (Balance), and the like, which are not limited herein.
It will be appreciated that account rights information for a sub-account may be included in one sub-account status information, and may include contract invocation rights information and resource transfer rights information. The contract invoking authority information may be used to indicate a service contract (i.e., a white list of service contracts) for which the service object has invoking authority, or may be used to indicate a service contract (i.e., a black list of service contracts) for which the service object does not have invoking authority. The resource transfer rights information may be used to indicate whether the service object has rights for resource transfer or a threshold of the number of resources (i.e., the maximum number of resources that the service object can transfer) that indicates the resource transfer rights that the service object has.
It may be appreciated that the sub-account status information may further include a transaction number (nonce) corresponding to the sub-account address, a resource number (Balance), and the like, which are not limited herein.
It will be appreciated that, based on the above description, a primary account address and a sub-account address under the primary account address each correspond to the same key pair, and the primary account address is generated based on the public key corresponding to the private key in the key pair. And when the subsequent business object initiates business transaction through the main account address or the sub account address, the private key in the key pair is used for carrying out transaction signature, and the blockchain node carries out signature verification on the business transaction through the public key in the key pair.
S104, calling a main sub-account management contract to acquire N sub-account state information from the first main account state information, carrying out state update on the N sub-account state information based on the account management transaction, updating target account state information based on the sub-account state information after the state update, and uploading the account management transaction to the blockchain based on the target account state information after the update.
It will be appreciated that, for example, the status update of the N sub-account status information may include any of the following: adding sub-account state information into the N sub-account state information, deleting the sub-account state information in the N sub-account state information, and adjusting account authority information included in the sub-account state information in the N sub-account state information. In other words, updating the sub-account status information corresponding to the sub-account address under the main account address may include adding sub-account status information corresponding to the new sub-account address, deleting sub-account status information corresponding to the original sub-account address, and adjusting account authority information in the sub-account status information corresponding to the existing sub-account address.
Specifically, the account management transaction includes a sub-account deletion transaction for deleting a sub-account address configured for the business object; the main sub-account management contract comprises a sub-account deleting method; the sub-account deletion transaction carries a method name of a sub-account deletion method and a first sub-account address to be deleted; the first sub-account address belongs to N sub-account addresses; the step of carrying out state update on the N sub-account state information comprises the step of deleting the sub-account state information in the N sub-account state information; then, invoking the main sub-account management contract to obtain N sub-account status information from the first main account status information, and performing status update on the N sub-account status information based on the account management transaction may include the steps of: based on the method name of the sub-account deleting method, calling the sub-account deleting method in the main sub-account management contract, and acquiring N sub-account state information from the first main account state information; determining sub-account state information corresponding to a first sub-account address in the N sub-account state information as first sub-account state information; and deleting the first sub-account state information in the N sub-account state information.
The sub-account deletion transaction is a transaction for deleting a sub-account address configured for a service object in an account management transaction, in other words, the sub-account deletion transaction is used for deleting sub-account state information corresponding to a designated sub-account address in main account state information. The sub-account deletion method may be a method for deleting sub-account addresses in the main sub-account management contract, also referred to as a sub-account deletion function.
It may be understood that the method name of the sub-account deletion method carried by the sub-account deletion transaction may be recorded in the transaction additional field, and the first sub-account address to be deleted carried by the sub-account deletion transaction may also be recorded in the transaction additional field, so that the method name of the sub-account deletion method and the first sub-account address to be deleted may be determined from the field value of the transaction additional field included in the transaction parameter of the sub-account deletion transaction. The first sub-account address refers to a sub-account address to be deleted in a sub-account deletion transaction.
It may be appreciated that, based on the method name of the sub-account deletion method, invoking the sub-account deletion method in the main sub-account management contract to obtain N sub-account status information from the first main account status information may include: analyzing the sub-account deleting transaction to obtain the method name of the sub-account deleting method to be called, acquiring the sub-account deleting method from the main sub-account management contract based on the method name of the sub-account deleting method, calling the sub-account deleting method, and acquiring N sub-account state information from the first main account state information.
It is understood that the first sub-account status information may be sub-account status information corresponding to the first sub-account address. It may be appreciated that determining sub-account state information corresponding to the first sub-account address in the N sub-account state information as the first sub-account state information may include: traversing each main account address in the N sub-account addresses, determining sub-account state information corresponding to the sub-account addresses consistent with the first sub-account address as sub-account state information corresponding to the first sub-account address, and determining sub-account state information corresponding to the first sub-account address as first sub-account state information.
It will be appreciated that the deletion process is performed on a first sub-account status information of the N sub-account status information, that is, one way to perform a status update on the N sub-account status information based on the account management transaction. Further, updating the target account status information based on the sub-account status information after the status update may include: updating the first main account state information based on the sub-account state information after deleting the first sub-account state information, and updating the target account state information based on the updated first main account state information. In other words, the updated target account state information no longer includes the first sub-account state information.
Specifically, the N sub-account status information includes account authority information; the account management transaction includes a rights management transaction for adjusting account rights information included in the sub-account status information; the main sub account management contract comprises a right management method; the right management transaction carries the method name of the right management method, the address of the second sub-account to be subjected to right management and right adjustment information; the second sub-account address belongs to N sub-account addresses; the step of carrying out state update on the N sub-account state information comprises the step of adjusting account authority information included in the sub-account state information in the N sub-account state information; then, invoking the main sub-account management contract to obtain N sub-account status information from the first main account status information, and performing status update on the N sub-account status information based on the account management transaction may include the steps of: based on the method name of the authority management method, invoking the authority management method in the main sub-account management contract, and acquiring N sub-account state information from the first main account state information; determining sub-account state information corresponding to a second sub-account address in the N sub-account state information as second sub-account state information; and adjusting account authority information included in the second sub-account state information based on the authority adjustment information.
The permission management transaction refers to a transaction for adjusting account permission corresponding to the sub-account address, that is, a transaction for adjusting account permission information included in the sub-account state information. The rights management method may be a method for adjusting account rights of sub-account addresses in a main sub-account management contract, which is also called a rights management function.
It can be understood that the method name of the sub-account deletion method, the second sub-account address to be subjected to the authority management, and the authority adjustment information are determined from the field value of the transaction additional field included in the transaction parameter of the authority management transaction. The second sub-account address refers to a sub-account address of the right to be adjusted in the right management transaction. The rights adjustment information may be used to indicate how to adjust contract call rights information, such as to indicate increasing call rights of the second sub-account address to the specified business contract or decreasing call rights of the second sub-account address to the specified business contract. The permission adjustment information may be used to indicate adjustment of resource transfer permission information, such as a threshold value for indicating a number of resources of the resource transfer permission of the second sub-account address after adjustment, from having the resource transfer permission to not having the resource transfer permission, or from not having the resource transfer permission to having the resource transfer permission.
It may be appreciated that, based on the method name of the rights management method, invoking the rights management method in the main sub-account management contract, and acquiring N sub-account status information from the first main account status information may include: analyzing from the rights management transaction to obtain the method name of the rights management method to be called, acquiring the rights management method from the main sub-account management contract based on the method name of the rights management method, calling the rights management method, and acquiring N sub-account state information from the first main account state information.
It is understood that the second sub-account status information may be sub-account status information corresponding to the second sub-account address. It may be appreciated that determining sub-account state information corresponding to the second sub-account address in the N sub-account state information as the second sub-account state information may include: traversing each main account address in the N sub-account addresses, determining sub-account state information corresponding to the sub-account addresses consistent with the second sub-account address as sub-account state information corresponding to the second sub-account address, and determining sub-account state information corresponding to the second sub-account address as second sub-account state information.
It will be appreciated that the account authority information included in the second sub-account status information of the N sub-account status information is adjusted, i.e. a way to perform status update of the N sub-account status information based on the account management transaction. Further, updating the target account status information based on the sub-account status information after the status update may include: updating the first main account state information based on the sub-account state information after the account authority information in the second sub-account state information is adjusted, and updating the target account state information based on the updated first main account state information. In other words, in the updated target account status information, the account authority included in the second sub-account status information is changed.
It can be understood that, in this application, contract calling rights are configured for a sub-account address (such as sub-account 1) through the main account address, for example, the sub-account address is configured with the calling rights (also referred to as access rights) for the service contract a, which indicates that the sub-account address has the rights of calling the service transaction of the service contract a, however, when verifying that the sub-account address has the rights of calling the service contract a, the blockchain node determines whether the transaction for calling the service contract can be executed or not, and also depends on the rights of the sub-account address for the manager of the service contract a, and if the service contract a indicates that the sub-account address does not have the calling rights, the transaction initiated by the sub-account address for calling the service contract a cannot be executed correctly.
Specifically, the account management transaction includes a first sub-account creation transaction for configuring a sub-account address for a business object; the main sub-account management contract comprises a sub-account creation method; the first sub-account creation transaction carries a method name of a sub-account creation method; the updating of the state of the N sub-account state information comprises adding the sub-account state information to the N sub-account state information; then. Invoking the main sub-account management contract to obtain N sub-account status information from the first main account status information, and performing status update on the N sub-account status information based on the account management transaction may include the steps of: based on the method name of the sub-account creating method, calling the sub-account creating method in the main sub-account management contract, and acquiring N sub-account state information from the first main account state information; when a third sub-account address to be configured, which is determined based on the target main account address, is acquired, sub-account state information corresponding to the third sub-account address is added in the N sub-account state information.
The first sub-account creation transaction refers to a transaction for configuring a sub-account address for a business object in an account management transaction, in other words, the sub-account creation transaction is used for adding sub-account state information corresponding to the sub-account address in main account state information. The sub-account creation method may be a method for configuring sub-account addresses in a master sub-account management contract, also referred to as a sub-account creation function.
It will be appreciated that the method name of the sub-account creation method carried by the sub-account creation transaction (e.g., the first sub-account creation transaction) may be recorded in a transaction additional field, and the method name of the sub-account creation method may be determined from the field value of the transaction additional field included in the transaction parameters of the sub-account creation transaction.
It may be appreciated that, based on the method name of the sub-account creation method, invoking the sub-account creation method in the main sub-account management contract, and acquiring N sub-account status information from the first main account status information may include: analyzing the first sub-account creation transaction to obtain the method name of the sub-account creation method to be called, acquiring the sub-account creation method from the main sub-account management contract based on the method name of the sub-account creation method, calling the sub-account creation method, and acquiring N sub-account state information from the first main account state information.
The third sub-account address refers to a sub-account address to be configured. It will be appreciated that the third sub-account address is determined based on the target main account address. Determining the third sub-account address based on the target main account address may include: the sub-account identification is obtained and a third sub-account address is determined based on the sub-account identifier, the target main account address, the separator, and the sub-account identification. The representation of the third sub-account address may refer to the above description of the sub-account address, and will not be described herein. Optionally, the third sub-account address may be determined when the transaction object constructs the transaction to be signed, in other words, the first transaction carries the sub-account address to be configured (e.g. the third sub-account address), for example, the sub-account address to be configured is recorded in a transaction additional field of the first transaction, and then the blockchain node may parse the transaction (i.e. the first sub-account creation transaction herein) to obtain the sub-account address to be configured (e.g. the third sub-account address). Alternatively, the third sub-account address may be determined by the blockchain node, in other words, the first service transaction may not carry the sub-account address to be configured (e.g., the third sub-account address), and the blockchain node may generate the sub-account address to be configured (e.g., the third sub-account address) from the target main account address (e.g., the target main account address) based on the main account address.
It can be understood that the sub-account status information corresponding to the third sub-account address is added to the N sub-account status information, that is, a manner of performing status update on the N sub-account status information based on the account management transaction. It may be appreciated that adding sub-account state information corresponding to the third sub-account address in the N sub-account state information may include: the method comprises the steps of obtaining initialized sub-account state information, determining the initialized sub-account state information as sub-account address information corresponding to a third sub-account address, and adding the sub-account address information corresponding to the third sub-account address to main account state information corresponding to a target main account address. The initialized sub-state address information may be preset initialized sub-account state information. The transaction number (nonce) corresponding to the sub-account address included in the initialized sub-state address information may be initialized to 0, the resource number (Balance) may be initialized to 0, the account authority information may be initialized to have no call authority for all service transactions, or have call authority for some preset service contracts, etc., which is not limited herein. The state information of the initialized sub-account can be determined according to actual requirements. Optionally, in some scenarios, the sub-account creation transaction carries initialization configuration information, and when the third sub-account address is acquired, sub-account status information of the third sub-account address may be determined directly based on the initialization configuration information, where the initialization configuration information may specify account authority information of the newly configured sub-account address (such as the third sub-account address herein).
It will be appreciated that the number of third sub-account addresses may be single, so that configuration of a single sub-account address may be made. The number of the third sub-account addresses can also be multiple, so that batch configuration of multiple sub-account addresses can be realized. If the number of the third sub-account addresses is a plurality of, the sub-account identification in each third sub-account address is different.
Further, updating the target account status information based on the sub-account status information after the status update may include: and updating the first main account state information based on the sub-account state information after the sub-account state information corresponding to the third sub-account address is added, and updating the target account state information based on the updated first main account state information. In other words, the updated target account state information includes sub-account state information corresponding to the newly added third sub-account address.
The process of initiating an account management transaction via a primary account address is described herein with reference to the drawings. Referring to fig. 6, fig. 6 is a schematic diagram of a transaction processing procedure according to an embodiment of the present application. The business object may initiate a pending transaction (e.g., the first pending transaction described above) based on the target primary account address. The service node may then send the pending transaction to the blockchain node (step S61). The blockchain node can then conduct transaction verification and identification of the transaction type for the transaction to be processed. It will be appreciated that the transaction verification and identification of the transaction type may refer to the description of step S101, and when the verification is successful and the transaction type is identified as the first transaction type, the transaction to be processed may be determined as a service transaction (e.g. the first service transaction). Further, the blockchain node may run a primary sub-account management contract (step S62), and the specific process of running the primary sub-account management contract may refer to the relevant descriptions of steps S101-S104. Further, the blockchain node may perform S63: and updating the target account state information. Wherein, updating the target account status information can be described with reference to the above. That is, sub-account state information included in the main account state information corresponding to the target main account address is updated, and the target account state information is updated based on the updated sub-account state information.
Further, referring to fig. 7, fig. 7 is a flowchart of another data processing method based on blockchain according to an embodiment of the present application. The method may be performed by a blockchain node. The method may include at least the following step S201 to step S209.
S201, acquiring a second business transaction sent by a business object through a target main account address; the transaction time of the second business transaction is earlier than the transaction time of the first business transaction; the transaction type of the second business transaction is consistent with the transaction type of the first business transaction.
Wherein the second business transaction may refer to a business transaction having a transaction type of the first transaction type prior to the first business transaction. It will be appreciated that the transaction time may be the time of the acquired business transaction. It will be appreciated that the transaction time of the second business transaction is earlier than the time of the first business transaction, e.g. the transaction time of the first business transaction is t1 and the transaction of the second business transaction is t2, then t2< t1.
It will be appreciated that the second business transaction is consistent with the first business transaction in terms of transaction type, and as described above, the first business transaction is of the first transaction type, which means that the second business transaction is also of the first transaction type.
It will be appreciated that the transaction structure of the second business transaction may refer to the related description of fig. 4, which is not described herein. It can be understood that, in the second service transaction, the field value of the transaction type field is the field value corresponding to the first transaction type, the field value of the destination address field is the contract address of the main-sub account management contract, the field value of the source address field is the target main account address, and the transaction signature information of the second service transaction is also obtained by performing the transaction signature through the private key held by the service object.
It can be appreciated that the method for determining the second service transaction may refer to the method for determining the first service transaction described above, which is not described herein. That is, when the verification of the transaction to be processed is successful and the transaction type is the first transaction type, the transaction to be processed is determined to be the second business transaction.
S202, when detecting that a second business transaction is a second sub-account creation transaction for configuring a sub-account address for a business object, determining a main sub-account management contract based on contract calling parameters in the second sub-account creation transaction; the second sub-account creation transaction carries the method name of the sub-account creation method.
Wherein the second sub-account creation transaction refers to a transaction for configuring a sub-account address for the business object prior to the first business transaction. It is to be appreciated that the second sub-account creation transaction and the second sub-account creation transaction may both be collectively referred to as sub-account creation transactions. It will be appreciated that the method name of the sub-account creation method carried by the second sub-account creation transaction is recorded in a transaction additional field included in the transaction parameters of the second business transaction. It will be appreciated that the second sub-account creation transaction may be used to configure one or more of the N sub-account addresses included in the first main account status information of the target account status information, and is not limited herein. It will be appreciated that the second sub-account creation transaction may be used to configure one of the N sub-account addresses under the target main account address when n=1, or to configure one of the N sub-account addresses under the target main account address when N >1, or in bulk.
It is appreciated that detecting that a second business transaction creates a transaction for a second sub-account for configuring a sub-account address for a business object may include: determining a transaction type of the second business transaction based on a field value of a transaction type field in a transaction parameter of the second business transaction, acquiring a method name of a contract method to be called in a transaction additional field of the second business transaction when the transaction type of the second business transaction is the first transaction type, and determining that the second business transaction creates a transaction for the second sub-account when the method name of the contract method to be called is a method name of a sub-account creation method for configuring a sub-account address for a business object.
It may be appreciated that, the determining the main sub-account management contract based on the contract call parameter in the second sub-account creation transaction may refer to the contract call parameter in the first sub-account creation transaction, and the relevant description of the main sub-account management contract may be determined, which is not described herein.
S203, based on the method name of the sub-account creation method, calling the sub-account creation method in the main sub-account management contract, reading main account state information matched with the target main account address from the initial account state information on the blockchain, and determining the read main account state information as initial main account state information.
The initial account state information may be account state information of a blockchain that is required to be acquired when the second business transaction is executed. Because the transaction time of the second business transaction is earlier than the first business transaction, the initial account state information is the account state information of the blockchain before the target account state information.
It can be understood that, from the primary account state information on the blockchain, the primary account state information matched with the target primary account address is read, and the read primary account state information is determined as the primary account state information. It may be appreciated that the number of sub-account state information corresponding to the sub-account address included in the primary main account state information herein is smaller than N, in other words, the sub-account state information in the primary main account state information may be null, or may include sub-account state information corresponding to K sub-account addresses, where K is a positive integer smaller than N.
S204, when the target sub-account address to be configured determined based on the target main account address is obtained, calling a sub-account creation method, adding sub-account state information corresponding to the target sub-account address into sub-account state information included in the initial main account state information, and determining N sub-account state information corresponding to the N sub-account addresses based on the sub-account state information corresponding to the target sub-account address.
It will be appreciated that the target sub-account address may be a sub-account address to be configured in a second business transaction. The number of target sub-account addresses may be one or more, in other words, one sub-account address may be created by the second sub-account creation transaction, or multiple sub-account addresses may be created in bulk.
It can be appreciated that, the method for acquiring the target sub-account address to be configured determined based on the target main account address may refer to the above description related to acquiring the third sub-account address determined based on the target main account address, which is not described herein.
It may be understood that, in the sub-account status information included in the initial main account status information, the method for adding the sub-account status information corresponding to the target sub-account address may refer to the above description of adding the sub-account status information corresponding to the third sub-account address in the N sub-account status information, which is not described herein.
It may be appreciated that determining N sub-account status information corresponding to N sub-account addresses based on sub-account status information corresponding to the target sub-account address may be directly determining sub-account status information corresponding to the target sub-account address as 1 sub-account status information corresponding to 1 sub-account address. Optionally, determining N sub-account status information corresponding to the N sub-account addresses based on the sub-account status information corresponding to the target sub-account address may include: and determining the sub-account state information corresponding to the target sub-account address as sub-account address information corresponding to part of sub-account addresses in the N sub-account state information. It may be appreciated that, after the transaction time of the second service transaction and before the execution of the first service transaction, the state update may be continuously performed on the sub-account state information of the sub-account address under the target main account address (such as configuring a new sub-account address, deleting the configured sub-account address, and performing authority adjustment on the sub-account address), until, when the first service transaction is executed, the first main account state information including N sub-account state information corresponding to the N sub-account addresses is obtained. It will be appreciated that the blockchain node may update the sub-account status information under the target primary account address each time a sub-account creation transaction, a sub-account deletion transaction, or a rights management transaction associated with the sub-account address under the target primary account address is performed.
S205, updating the primary account state information based on the N sub-account state information, and determining the target account state information based on the updated primary account state information.
It will be appreciated that updating the primary account state information based on the N sub-account state information may include: based on the N sub-account state information, the primary main account state information is updated, the primary account state information is updated based on the updated primary main account state information, and the target account state information is determined based on the updated primary account state information.
It may be appreciated that, after the transaction time of the second service transaction and before the execution of the first service transaction, the sub-account status information of the sub-account address under the target main account address may be continuously updated (e.g. a new sub-account address is configured, a configured sub-account address is deleted, and authority adjustment is performed on the sub-account address), so that, when the first service transaction is executed, the obtained account status information is the account status information of the main account status information corresponding to the target main account address, where the account status information includes N sub-account status information corresponding to the N sub-account addresses.
S206, acquiring a first business transaction sent by the business object through the target main account address.
S207, when the first business transaction is detected to be an account management transaction for account management, determining a main sub account management contract deployed on the blockchain based on contract calling parameters in the account management transaction.
It is understood that steps S206-S207 may refer to the relevant descriptions of steps S101-S102, and will not be described herein.
S208, calling a main sub-account management contract to read main account state information matched with a target main account address from target account state information on a blockchain, and determining the read main account state information as first main account state information; the first main account state information comprises N sub-account state information corresponding to N sub-account addresses configured for the service object; n is a positive integer; one sub-account address corresponds to one sub-account status information; the N sub-account addresses are each determined based on the master sub-account management contract and the target master account address, and the target master account address and the N sub-account addresses are each associated with the same key pair held by the business object.
It can be understood that the target account status information may be recorded in the form of an account status tree, may be recorded in the form of a table, or may be recorded in the form of a simple key value pair, which is not described herein.
Specifically, the target account state information is an account state tree, and leaf nodes included in the account state tree are used for recording main account state information corresponding to a main account address on a blockchain; then, invoking the master sub-account management contract to read master account status information matching the target master account address from the target account status information on the blockchain may include the steps of: calling a main sub account management contract to acquire an account state tree on a blockchain; and acquiring leaf nodes corresponding to the target main account address from the account state tree based on the target main account address, and determining the main account state information recorded by the acquired leaf nodes as main account state information matched with the target main account address.
The account state tree may be a tree on a blockchain for recording state information of an account, and the account state tree may also be called a world state tree. It will be appreciated that a plurality of nodes may be included in the account state tree, which may be extension nodes, branch nodes, and leaf nodes. The extension node refers to a node with only one child node, the branch node refers to a node with a plurality of child nodes, and the leaf node refers to a node without child nodes. It will be appreciated that a root node may also be included in the account state tree, where a root node refers to the topmost node in the account state tree, and one account state tree has only one root node. For ease of description, the root node of the account state tree may be designated as the primary root node and the leaf nodes in the account state tree may be designated as the primary leaf nodes.
It will be appreciated that in the account status tree, leaf nodes are used to record primary account status information. In the account state tree, the path from the main root node to the main leaf node is used for recording a complete main account address, and the main account state information recorded by the main leaf node is the main account state information corresponding to the main account address recorded by the path from the main root node to the main leaf node.
It will be appreciated that the primary account state information recorded by the leaf node (i.e., the primary leaf node) in the account state tree includes the root hash value of the sub-account state tree; the leaf nodes included in the sub-account state tree are used for recording sub-account state information corresponding to the sub-account addresses. It will be appreciated that a sub-account status tree may be a tree for recording sub-account status information corresponding to sub-account addresses under a main account address. It will be appreciated that a sub-account state tree may include a plurality of nodes, which may be extension nodes, branch nodes, and leaf nodes. It will be appreciated that a root node may also be included in the sub-account state tree, where a root node refers to the topmost node in the sub-account state tree, and that one sub-account state tree has only one root node. For ease of description, the root node in the sub-account state tree may be referred to as a child root node, and the leaf nodes in the sub-account state tree may be referred to as child leaf child nodes. It will be appreciated that in the sub-account status tree, the sub-leaf child nodes are used to record sub-account status information corresponding to the sub-account addresses. In the sub-account state tree, the path from the sub-root node to the sub-leaf sub-node is used for recording a complete sub-account address, and the sub-account state information recorded by the sub-leaf sub-node is sub-account state information corresponding to the sub-account address recorded by the path from the sub-root node to the sub-leaf sub-node.
It may be appreciated that the root hash value of the sub-account state tree may be a hash value obtained by performing a hash calculation on data recorded by the root node of the sub-account state tree. And then may index into the corresponding sub-account state tree based on the root hash value.
For example, referring to fig. 8, fig. 8 is a schematic diagram illustrating an effect of account status information according to an embodiment of the present application. As shown in fig. 8, the account status information may be an account status tree, and the blockchain may include a main account address 1, a main account address 2, a main account address 3, a main account address 4, and the like, where the main account status information corresponding to the main account address 1 is the main account status information 1, the main account status information corresponding to the main account address 2 is the main account status information 2, the main account status information corresponding to the main account address 3 is the main account status information 3, and the main account status information corresponding to the main account address 4 is the main account status information 4. The account status tree may include a plurality of leaf nodes therein, each service node for recording primary account status information, e.g., primary account status information 1, primary account status information 2, primary account status information 3, primary account status information 4, etc. The content of the main account status information is described here by taking the main account status information 1 as an example. The main account status information 1 may include the number of transactions, the number of resources, and the root hash value of the sub-account status tree corresponding to the main account address 1.
The root hash value of the sub-account state tree refers to the hash value of data recorded by the root node (i.e., sub-root node) of the sub-account state tree. The main account address 1 is configured with sub-account address 1, sub-account address 2, sub-account address 3, and so on. In the sub-account status tree associated with the main account address 1, a plurality of leaf nodes may be included, each for recording sub-account status information, e.g., sub-account status information 1, sub-account status information 2, sub-account status information 3, etc. The sub-account state information 1 is a sub-account address corresponding to the sub-account address 1, the sub-account state information 2 is a sub-account address corresponding to the sub-account address 2, and the sub-account state information 3 is a sub-account address corresponding to the sub-account address 3. The sub-account status information 1 is taken as an example here, and the contents of the sub-account status information are described. The sub-account status information 1 may include the number of transactions, the number of resources, and account authority information corresponding to the sub-account address 1.
Alternatively, the target account status information may also be stored directly in the form of a key value pair, for example, a key (key) is set by using a main account address as a key, the corresponding main account status information is a value (value), and the main account status information recorded in the value (value) of the key value pair includes address status information corresponding to the configured sub-account address. To record status information of accounts on the blockchain. Optionally, the target account status information may also be stored according to a table, for example, a first column of the table is used for storing a main account address, a second column is used for storing corresponding main account status information, and the main account status information includes address status information corresponding to the configured sub-account address.
S209, calling a main sub-account management contract to acquire N sub-account state information from the first main account state information, carrying out state update on the N sub-account state information based on the account management transaction, updating target account state information based on the sub-account state information after the state update, and uploading the account management transaction to the blockchain based on the target account state information after the update.
Specifically, the target account state information is an account state tree, and leaf nodes included in the account state tree are used for recording main account state information corresponding to a main account address on a blockchain; the main account state information comprises a root hash value of the sub-account state tree; the leaf nodes included in the sub-account state tree are used for recording sub-account state information corresponding to the sub-account addresses; then, invoking the main sub-account management contract to obtain N sub-account status information from the first main account status information may include: calling a main sub-account management contract to determine a root hash value of a sub-account state tree from the first main account state information, and determining the determined root hash value of the sub-account state tree as a target root hash value; acquiring a sub-account state tree associated with the first main account state information based on the target root hash value, and determining N sub-account state information based on the sub-account state tree associated with the first main account state information; the N sub-account status information is recorded by leaf nodes included in the sub-account status tree associated with the first main account status information.
As described above, the root hash value of the sub-account state tree is included in the main account state information in the account state tree. The target root hash value refers to the root hash value of the sub-account state tree associated with the main account state information (i.e., the first main account state information) corresponding to the target main account address. It can be understood that, if one main account address is not configured with a sub-account address, a field for recording a root hash value of the sub-account state tree in the main account state information corresponding to the main account address is a null value.
It will be appreciated that N leaf nodes may be included in the sub-account status tree associated with the first primary account status information, and that determining N sub-account status information based on the sub-account status tree associated with the first primary account status information may include: n sub-account status information is determined based on sub-account status information recorded by N leaf nodes included in a sub-account status tree associated with the first main account status information.
It may be appreciated that when the target account status information is an account status tree, performing status update on the N sub-account status information based on the account management transaction, and updating the target account status information based on the sub-account status information after the status update may include: determining a sub-account state tree associated with the first main account state information as a target sub-account state tree, deleting leaf nodes corresponding to a first sub-account address to be deleted in the target sub-account state tree when deleting sub-account state information in the N sub-account state information, updating the target sub-account state tree based on the target sub-account state tree after deleting the leaf nodes corresponding to the first sub-account address, calculating a root hash value of the updated sub-account state tree, updating the root hash value of the sub-account state tree in the first main account state information based on the calculated root hash value, and updating the target account state information based on the first main account state information after updating the root hash value. When the account authority information included in the sub-account state information in the N sub-account state information is adjusted, determining a leaf node corresponding to a second sub-account address to be subjected to authority management in a target sub-account state tree, adjusting the account authority information included in the sub-account state information recorded by the determined leaf node, updating the target sub-account state tree based on the target sub-account state tree after the account authority information of the second sub-account address is adjusted, calculating a root hash value of the updated sub-account state tree, updating the root hash value of the sub-account state tree in the first main account state information based on the calculated root hash value, and updating the target account state information based on the first main account state information after the root hash value is updated. When sub-account state information is added in N sub-account state information, adding leaf nodes corresponding to a third account address to be configured in a target sub-account state tree, updating the target sub-account state tree based on the target sub-account state tree with the leaf nodes corresponding to the third account address added, calculating a root hash value of the updated sub-account state tree, updating the root hash value of the sub-account state tree in the first main account state information based on the calculated root hash value, and updating the target account state information based on the first main account state information with the updated root hash value.
It can be understood that the first business transaction may also be a transaction for inquiring account authority, so that the account authority corresponding to the configured sub-account address can be inquired based on the first business transaction, so that the account authority of each sub-account can be mastered, and the account authority of the sub-account authority can be more reasonably configured.
Specifically, the main sub-account management contract comprises a sub-account authority inquiry method; the N sub-account state information comprises account authority information; then, the embodiment of the application further includes: when the first business transaction is detected to be a first authority inquiry transaction for carrying out sub-account authority inquiry, determining a main sub-account management contract based on contract calling parameters in the first authority inquiry transaction; the first authority inquiry transaction carries the method name of the sub-account authority inquiry method; further, based on the method name of the sub-account authority query method, calling the sub-account authority query method in the main sub-account management contract, and reading the first main account state information from the target account state information; further, when the first sub-account address to be queried is obtained from the first authority query transaction, sub-account state information of the first sub-account address to be queried is obtained from the first main account state information; further, account authority information of the first sub-account address to be queried is obtained from the sub-account state information of the first sub-account address to be queried, and the obtained account authority information of the first sub-account address to be queried is sent to the service object.
The first authority inquiry transaction refers to a transaction for performing authority inquiry of the sub-account address, which is referred to by the first business transaction. The sub-account authority query method can be a method for querying account authority in sub-account state information in a main sub-account management contract, and is also called a sub-account authority query function and an account authority query method. It may be appreciated that the first sub-account address to be queried may be a sub-account address to be queried for permissions determined based on the first permission query transaction, where the first sub-account address to be queried belongs to N sub-account addresses under the target main account address.
It will be appreciated that the first permission query transaction carries a first sub-account address to be queried and a method name of the sub-account permission query method to be invoked. The first sub-account address to be queried and the method name of the sub-account authority query method to be invoked, which are carried by the first authority query transaction, can be recorded in a transaction additional field, and then the first sub-account address to be queried and the method name of the sub-account authority query method to be invoked can be determined from the field value of the transaction additional field included in the transaction parameter of the first authority query transaction.
It may be appreciated that, based on the method name of the sub-account permission query method, invoking the sub-account permission query method in the main sub-account management contract, and reading the first main account status information from the target account status information may include: analyzing the first authority inquiry transaction to obtain the method name of the sub-account authority inquiry method to be called, acquiring the sub-account authority inquiry method from the main sub-account management contract based on the method name of the sub-account authority inquiry method, calling the sub-account authority inquiry method, and reading the first main account state information from the target account state information. It can be appreciated that, the method for reading the first main account status information from the target account status information may refer to the above description, and will not be described herein.
It may be appreciated that obtaining sub-account status information of the first sub-account address to be queried from the first main account status information may include: traversing each main account address in the N sub-account addresses, and determining sub-account state information corresponding to the sub-account address consistent with the first sub-account address as sub-account state information of the first sub-account address to be queried.
It may be understood that the obtained account authority information of the first sub-account address to be queried is sent to the service object, and specifically may be that the obtained account authority information of the first sub-account address to be queried is sent to a terminal device where the resource management client for initiating the first service transaction is located.
It may be understood that, based on the above-mentioned first sub-account authority query transaction, the account authority corresponding to the sub-account address may be queried through the main account address, and in this embodiment of the present application, the transaction may also be initiated through the sub-account address to query the transaction of the account authority corresponding to the sub-account address.
Specifically, the N sub-account status information includes account authority information; the transaction type of the first business transaction is a first transaction type; the main sub-account management contract comprises a sub-account authority inquiry method; then, the embodiment of the application may further include the following steps: acquiring a fourth business transaction sent by the business object through the second sub-account address to be queried; the transaction type of the fourth business transaction is consistent with the transaction type of the first business transaction; the transaction time of the fourth business transaction is later than the transaction time of the first business transaction; further, when the fourth business transaction is detected to be a second authority inquiry transaction for carrying out sub-account authority inquiry, determining a main sub-account management contract based on contract calling parameters in the second authority inquiry transaction; the second authority inquiry transaction carries the method name of the sub-account authority inquiry method; further, a target main account address is obtained through analysis from the second sub-account address to be queried, a sub-account authority query method in a main sub-account management contract is called based on the method name of the sub-account authority query method, main account state information matched with the target main account address is read from updated target account state information, and the read main account state information is determined to be second main account state information; further, sub-account state information of a second sub-account address to be queried is obtained from the second main account state information; further, account authority information of the second sub-account address to be queried is obtained from the sub-account state information of the second sub-account address to be queried, and the obtained account authority information of the second sub-account address to be queried is sent to the service object.
It will be appreciated that the fourth business transaction refers to a business transaction for which the transaction type acquired after the first business transaction is the first transaction type. It will be appreciated that the transaction time of the fourth business transaction is earlier than the time of the first business transaction. The second sub-account address to be queried refers to the sub-account address to be queried for authority for initiating the fourth business transaction. The second sub-account address to be queried and the first sub-account address to be queried can be collectively called as sub-account addresses to be queried, and the second sub-account address to be queried and the first sub-account address to be queried can be the same sub-account address or different sub-account addresses. It will be appreciated that the second sub-account address to be queried belongs to any of the sub-account addresses associated with the second main account status information.
It will be appreciated that the second permission query transaction refers to a transaction for permission query of the sub-account address that is performed by the fourth business transaction. The second authority inquiry transaction and the second authority inquiry transaction can be collectively called as an authority inquiry transaction, and the authority inquiry transaction can be a transaction for inquiring the account authority corresponding to the sub-account address.
It will be appreciated that the second permission query transaction carries the second sub-account address to be queried and the method name of the sub-account permission query method to be invoked. The second sub-account address to be queried carried by the second authority query transaction can be recorded in the source address of the second authority query transaction; the method name of the sub-account authority query method to be invoked, carried by the second authority query transaction, may be recorded in the transaction additional field, and further, the method name of the sub-account authority query method to be invoked may be determined from a field value of the transaction additional field included in the transaction parameter of the second authority query transaction.
It will be appreciated that in the second sub-account address to be queried, a target main account address may be included. Resolving the target main account address from the second sub-account address to be queried may include: traversing each character in the second sub-account address to be queried, and determining the target main account address based on the characters before the sub-account identifier and the separator. For example, the second sub-account address to be queried is "sub 2489375894\12", where the sub-account identifier is "sub", and the separator is "\", and then the target main account address in the second sub-account to be queried may be a character string formed by characters between "sub" and "\", that is, the target main account address is "a2489375894".
It may be understood that, from the updated target account status information, the main account status information that matches the target main account address may be read, and the description related to the main account status information that matches the target main account address may be read with reference to the above-mentioned target account status information, which is not described herein.
It may be understood that the sub-account status information of the second sub-account address to be queried is obtained from the second main account status information, the related description of the sub-account status information of the first sub-account address to be queried may be referred to above, the account authority information of the second sub-account address to be queried is obtained from the sub-account status information of the second sub-account address to be queried, the obtained account authority information of the second sub-account address to be queried is sent to the service object, the account authority information of the first sub-account address to be queried may be referred to above, and the obtained account authority information of the first sub-account address to be queried is sent to the related description of the service object, which is not described herein.
It will be appreciated that the business object may initiate a rights inquiry transaction at any time based on the primary account address or the sub-account address to inquire about the account rights of the sub-account address. It will be appreciated that the business object may also initiate a status query transaction (i.e., a transaction for querying account status information for a specified account address) based on the primary or secondary account address to query account status information for the primary or secondary account address, such as to query the number of resources of the account, the number of transactions, and so forth.
Further, referring to fig. 9, fig. 9 is a flowchart of another data processing method based on blockchain according to an embodiment of the present application. The method may be performed by a blockchain node. The method may include at least the following step S301 to step S313.
S301, acquiring a second business transaction sent by a business object through a target main account address; the transaction time of the second business transaction is earlier than the transaction time of the first business transaction; the transaction type of the second business transaction is consistent with the transaction type of the first business transaction.
S302, determining a main sub-account management contract based on contract calling parameters in a second sub-account creation transaction when detecting that a second business transaction is the second sub-account creation transaction for configuring a sub-account address for a business object; the second sub-account creation transaction carries the method name of the sub-account creation method.
S303, based on the method name of the sub-account creation method, calling the sub-account creation method in the main sub-account management contract, reading main account state information matched with the target main account address from the initial account state information on the blockchain, and determining the read main account state information as initial main account state information.
S304, when the target sub-account address to be configured determined based on the target main account address is obtained, calling a sub-account creation method, adding sub-account state information corresponding to the target sub-account address into sub-account state information included in the initial main account state information, and determining N sub-account state information corresponding to the N sub-account addresses based on the sub-account state information corresponding to the target sub-account address.
S305, updating the primary account state information based on the N sub-account state information, and determining target account state information based on the updated primary account state information.
The steps S301 to S305 may refer to the descriptions related to the steps S201 to S205, which are not described herein.
S306, acquiring a third business transaction sent by the business object through the target sub-account address; the transaction type of the third business transaction is a second transaction type; the transaction time of the third business transaction is later than the transaction time of the second business transaction.
The third business transaction refers to business transaction with the transaction type being the second transaction type initiated by the target sub-account address. It will be appreciated that the target sub-account address belongs to N sub-account addresses.
It will be appreciated that, as described above, the second transaction type may be a transaction type for conducting general transactions such as resource transfers, contract invocations, contract creation, and the like. It may be appreciated that the transaction time of the third service transaction is later than the transaction time of the second service transaction, and further, the third service transaction may be later than the first service transaction, in other words, when the third service transaction is executed, the acquired account status information on the blockchain is the target account status information including N sub-account status information corresponding to N sub-account addresses in the main account status information corresponding to the target main account address, that is, the acquired main account status information of the target main account address is the first main account status information.
It will be appreciated that the process of determining the third business transaction may be referred to above in determining the relevant description of the first business transaction.
Specifically, the target main account address is determined by a public key corresponding to a private key held by the business object; the private key and the public key held by the business object are used for forming a key pair; then, acquiring the third business transaction sent by the business object through the target sub-account address may include the steps of: acquiring a second transaction to be processed, which is sent by the business object through the target main account address; the second transaction to be processed is obtained by carrying out transaction signature on the second transaction to be signed constructed by the business object based on the private key held by the business object; conducting transaction verification on the second to-be-processed transaction through a public key corresponding to the private key held by the service object, acquiring a field value of a transaction type field from a transaction field of the second to-be-processed transaction when the second to-be-processed transaction verification is successful, and determining the acquired field value as a second field value; determining a transaction type of the second pending transaction based on the second field value; and when the transaction type of the second to-be-processed transaction is the second transaction type, determining the second to-be-processed transaction as a third business transaction.
It will be appreciated that the second pending transaction may be a transaction initiated by the business object via the resource management client. The second pending transaction is different from the first pending transaction, and the source address of the second pending transaction is the target sub-account address. The second to-be-signed transaction is a transaction to be signed constructed by the business object, the second to-be-signed transaction being different from the first to-be-signed transaction. It can be appreciated that the resource management client performs transaction signing on the second transaction to be signed through the private key held by the service object to obtain signature information (i.e., second signature information), so that the second transaction to be signed and the second signature information can be combined into a second transaction to be processed, and the second transaction to be processed is sent to the blockchain node. The blockchain node can conduct transaction verification on the second to-be-processed transaction through the public key.
It can be understood that the process of signing the second to-be-signed transaction and the process of signing the second to-be-processed transaction may refer to the process of signing the first to-be-signed transaction and the related description of signing the first to-be-processed transaction, which will not be described herein.
It will be appreciated that the transaction type of the second pending transaction may be detected when the verification of the second pending transaction is successful, and the second pending transaction is determined to be the third business transaction when the transaction type of the second pending transaction is detected to be the second transaction type. It may be appreciated that detecting the transaction type of the second pending transaction may include obtaining a field value of the transaction type field from the transaction field of the second pending transaction, and determining the obtained field value as the first field value; a transaction type of the second pending transaction is determined based on the second field value. Wherein the second field value refers to a field value of a transaction type field of the second pending transaction. For example, if the field value corresponding to the second transaction type is a value of 0, 1 or 2, when the field value (i.e., the first field value) of the transaction type field of the first transaction to be processed is any one of 0, 1 or 2, the transaction type of the second transaction to be processed is determined to be the second transaction type, and the second transaction to be processed is determined to be the third business transaction.
S307, when the target main account address is obtained through analysis from the target sub-account address, the first main account state information is read from the target account state information based on the target main account address, and sub-account state information of the target sub-account address is determined from the first main account state information.
It will be appreciated that resolving the target primary account address from the target secondary account address may include: traversing each character in the target sub-account address, determining the target main account address based on the sub-account identifier and the character preceding the spacer.
It may be appreciated that, the first main account status information may be read from the target account status information, and the description related to determining the first main account status information may be referred to above, which is not described herein. The sub-account status information of the target sub-account address is determined from the first main account status information, and the description related to the sub-account status information of the first sub-account address to be queried obtained from the first main account status information may be referred to, which is not described herein.
S308, determining account authority information of the target sub-account address from the sub-account state information of the target sub-account address, and performing authority detection on the third business transaction based on the account authority information of the target sub-account address to obtain an authority detection result.
It may be appreciated that the sub-account status information of the target sub-account address may include account authority information of the target sub-account address, and the account authority information of the target sub-account address may be determined from the target sub-account status information.
The permission detection result may be used to indicate that the target sub-account address has the execution permission for the third service transaction, or to indicate that the target sub-account address does not have the execution permission for the third service transaction. It will be appreciated that, as described above, the account rights information may include one or more of contract invocation rights information and resource transfer rights information. Then, performing authority detection on the third service transaction based on the account authority information of the target sub-account address to obtain an authority detection result, which may include: acquiring the subtype of the third business transaction in the second transaction type; when the third business transaction belongs to the contract calling sub-type, carrying out authority detection on the third business transaction based on contract calling authority information of the target sub-account address to obtain an authority detection result; and when the third business transaction belongs to the resource transfer sub-type, performing authority detection on the third business transaction based on the resource transfer authority information of the target sub-account address to obtain an authority detection result. Optionally, the account authority information may further include contract creation authority information, where the contract creation authority information may be used to indicate whether the sub-account address has authority for creating a service contract, and when the third service transaction belongs to a contract calling sub-type, performing authority detection on the third service transaction based on the contract calling authority information of the target sub-account address, to obtain an authority detection result.
Specifically, the account authority information includes contract invoking authority information; the contract calling authority information comprises contract identification of a business contract with calling authority of a target sub-account address; the third business transaction is used for indicating to call the target business contract to conduct business processing; then, performing authority detection on the third service transaction based on the account authority information of the target sub-account address to obtain an authority detection result, which may include the following steps: acquiring a contract identifier of a target business contract from the third business transaction, and determining the contract identifier of the target business contract as a target contract identifier; searching a contract identifier matched with a target contract identifier in contract identifiers of business contracts included in contract calling permission information, and determining a permission detection success result associated with a third business transaction based on a searching result of the searched contract identifier when the contract identifier matched with the target contract identifier is searched; and determining the authority detection result based on the authority detection success result.
And the third business transaction is used for indicating to call the target business contract to conduct business processing, and the third business transaction is indicated to belong to the contract call subtype. The target business contract is approximately the business contract to be invoked, and the target business contract can be any business contract deployed on the blockchain. The right detection success result may be a right detection result for indicating that the target sub-account address has the execution right for the third business transaction.
It may be appreciated that the contract invoking authority information may include a contract identifier of a service contract whose target sub-account address has invoking authority, in other words, the contract invoking authority information is a service contract whitelist, and further if the contract identifier of the target service contract is found in the contract invoking authority information, it indicates that the target sub-account address has executing authority for the third service transaction, that is, it is determined that the authority detection is successful. It is understood that the authority detection result is determined based on the authority detection success result, that is, the authority detection success result is determined as the authority detection result. And under the condition that the target sub-account address authority is smaller (namely, the number of service contracts with calling authorities required to be set is smaller), the authority detection efficiency is improved.
Optionally, when the contract identifier matching the target contract identifier is not found, determining a permission detection failure result associated with the third business transaction based on the found result of the contract identifier not found. The permission detection failure result may be a permission detection result for indicating that the target sub-account address does not have the execution permission for the third business transaction. And then the authority detection result can be determined based on the authority detection failure result. It will be appreciated that the third business transaction is not executed when the rights detection result is used to indicate that the target sub-account address does not have an execution right for the third business transaction. Alternatively, the business object may be notified that the third business transaction authentication is not passed.
Optionally, the contract invoking authority information may be a contract identifier of a service contract including the target sub-account address having no invoking authority, in other words, the contract invoking authority information may be a service contract blacklist, and if the contract identifier of the target service contract is found in the contract invoking authority information, it indicates that the target sub-account address has an executing authority for the third service transaction, that is, it determines that the authority detection is successful. It is understood that the authority detection result is determined based on the authority detection success result, that is, the authority detection success result is determined as the authority detection result. Specifically, performing authority detection on the third service transaction based on the account authority information of the target sub-account address to obtain an authority detection result, which may include the following steps: acquiring a contract identifier of a target business contract from the third business transaction, and determining the contract identifier of the target business contract as a target contract identifier; searching a contract identifier matched with a target contract identifier in contract identifiers of business contracts included in contract calling permission information, and determining a permission detection success result associated with a third business transaction based on a searching result of the contract identifier which is not searched when the contract identifier matched with the target contract identifier is not searched; and determining the authority detection result based on the authority detection success result. Determining a rights detection failure result associated with the third business transaction based on a search result of the searched contract identifier when the contract identifier matched with the target contract identifier is searched; and determining a permission detection result based on the permission detection failure result. Therefore, whether the target sub-account address has the calling authority for the target service contract can be detected based on the blacklist of the service contract, and the authority detection efficiency is improved under the condition that the target sub-account address has larger authority (namely, the number of the service contracts which are required to be set and do not have the calling authority is smaller).
Optionally, the third service transaction may be used to instruct to invoke the method to be invoked in the target service contract to perform service processing. The method to be called refers to a contract method to be called in a target business contract to be called in the third business transaction. The contract calling authority information may further include a method name of a contract method in the service contract with the target sub-account address having the calling authority, in other words, the contract calling authority information may be a white list of the contract method in the service contract, and further if the contract identification of the contract method to be called in the target service contract is found in the contract calling authority information, it indicates that the target sub-account address has the execution authority for the third service transaction, that is, it determines that the authority detection is successful. It is understood that the authority detection result is determined based on the authority detection success result, that is, the authority detection success result is determined as the authority detection result. Specifically, performing authority detection on the third service transaction based on the account authority information of the target sub-account address to obtain an authority detection result, which may include the following steps: obtaining the method name of the contract method to be called from the third service transaction, and determining the method name of the contract method to be called as the target method name; searching a method name matched with the target method name in the method names of the contract methods included in the contract calling authority information, and determining an authority detection success result associated with the third business transaction based on the searching result of the searched method name when the method name matched with the target method name is searched; and determining the authority detection result based on the authority detection success result. When the method name matched with the target method name is not found, determining a permission detection failure result associated with the third business transaction based on a finding result of the method name which is not found; and determining a permission detection result based on the permission detection failure result. Therefore, whether the target sub-account address has the calling authority of the contract method to be called in the target business contract can be detected based on the white list of the contract method, and the authority detection efficiency is improved under the condition that the authority of the target sub-account address is smaller (namely, the number of the contract methods with the calling authority required to be set is smaller).
Specifically, the account authority information includes resource transfer authority information; the third business transaction is used for indicating the resource transfer of the target sub-account address to the resource transfer destination address; then, performing authority detection on the third service transaction based on the account authority information of the target sub-account address to obtain an authority detection result, which may include the following steps: and when the resource transfer permission information indicates that the target sub-account address has the resource transfer permission, determining a permission detection success result associated with the third business transaction, and determining a permission detection result based on the permission detection success result.
The third business transaction is used for indicating the transfer of the resource of the target sub-account address to the target address, and the third business transaction is indicated to belong to the resource transfer sub-type. The resource transfer destination address refers to an account address to which the resource is to be transferred. It may be understood that, if the service object for initiating the third service transaction is determined as the first service object, the destination address of the resource transfer may be other sub-account addresses except the target sub-account address in the sub-account address corresponding to the first service object, may also be the main account address corresponding to the first service object, or may also be a main account address or sub-account address different from the main account address or sub-account address corresponding to the first service object (such as the second service object), which is not limited herein. The second business object refers to any business object that is different from the first business object. It will be appreciated that the resource transfer destination address may be recorded in the destination address field of the third business transaction.
It may be appreciated that when the resource transfer rights information indicates that the target sub-account address does not have a resource transfer right, a rights detection failure result associated with the third business transaction is determined, and a rights detection result is determined based on the rights detection failure result.
Specifically, the account authority information includes resource transfer authority information; the resource transfer permission information comprises a resource quantity threshold value of the resource transfer permission of the sub-account address; the third business transaction is used for indicating to transfer the resources in the target sub-account address to the target address; then, performing authority detection on the third service transaction based on the account authority information of the target sub-account address to obtain an authority detection result, which may include the following steps: determining the quantity of resources to be transferred to the resource transfer destination address from the third service transaction; and when the quantity of the resources to be transferred is smaller than or equal to the threshold value of the quantity of the resources, determining a right detection success result associated with the third business transaction, and determining a right detection result based on the right detection success result.
The resource transfer permission information includes a resource number threshold of the resource transfer permission of the sub-account address, which is equivalent to that whether the target sub-account address can transfer the resources within a certain resource number (i.e., a resource number threshold) can be determined by setting the resource number threshold.
It may be appreciated that when the number of resources to be transferred is greater than the threshold number of resources, a permission detection failure result associated with the third business transaction is determined, and a permission detection result is determined based on the permission detection failure result.
And S309, executing the third business transaction when the authority detection result indicates that the target sub-account address has the execution authority for the third business transaction.
It will be appreciated that if the third business transaction is of a resource transfer subtype, then the third business transaction may be performed to transfer the resource in the target sub-account address to a resource transfer destination address. If the third business transaction belongs to the contract calling sub-type, executing the third business transaction, and carrying out business processing for calling the target business contract. If the third business transaction is of a contract creation subtype, then the third business transaction is performed, which may be to create a business contract on the blockchain.
It will be appreciated that after the third business transaction is performed, the third business transaction may be uplink to the blockchain, i.e., the blocks to which the third business transaction was packaged may be written to the blockchain.
It may be appreciated that in the embodiment of the present application, the service object may also initiate a service transaction through the target main account address, so as to implement transferring the resource of the target main account address, or call a service contract based on the target main account address, or create a service contract based on the target main account address. Specifically, the blockchain node may acquire that the business object initiates a business transaction (denoted as a fifth business transaction) based on the target primary account address, where the transaction type of the fifth business transaction is the second transaction type, and further detect that the fifth business transaction may be executed. It will be appreciated that in some scenarios, the target primary account address is the highest authority account, and upon acquisition of a second transaction type of business transaction initiated based on the target primary account address, the fifth business transaction may be directly executed without detection of account authority. Optionally, the main account status information of the main account address may also include account authority information, and further may acquire account authority information included in the main account status information corresponding to the target main account address, and execute the fifth service transaction when determining, based on the account authority information, that the target main account address has an execution authority to execute the fifth service transaction. In other words, in some scenarios, the detection of account permissions may also be performed upon acquisition of a business transaction of a second transaction type initiated based on the target primary account address, and the fifth business transaction may be performed upon successful permission detection.
The process of initiating an account management transaction via a primary account address is described herein with reference to the drawings. Referring to fig. 10, fig. 10 is a schematic diagram illustrating another transaction processing procedure according to an embodiment of the present application. The business object may initiate a pending transaction (e.g., a second pending transaction as described above) based on a target sub-account address that belongs to a sub-account address that is a target primary account address. The service node may then send the pending transaction to the blockchain node (step S1001). The blockchain node can then conduct transaction verification and identification of the transaction type for the transaction to be processed. It will be appreciated that the transaction verification and identification of the transaction type for the transaction to be processed (e.g. the first transaction to be processed) may refer to the description related to step S1001, and when the verification is successful and the transaction type is identified as the second transaction type, the transaction to be processed may be determined as the service transaction (e.g. the third service transaction). Further, the blockchain node may identify the target sub-account address, and may further read the sub-account status information from the target account status information (step S1002), i.e., read the sub-account status information of the target sub-account address. For example, the main account status information of the target main account address may include sub-account status information b11 and sub-account status information b12, where the sub-account status information b11 is sub-account status information corresponding to the sub-account address a11, and the sub-account status information b12 is sub-account status information corresponding to the sub-account address a 12. If the target sub-account address is sub-account address a11, sub-account status information b11 may be read.
Further, the blockchain node may perform authority detection (step S1003), and obtain an authority detection result, where the determining process of the authority detection result may refer to the related description in step S308. Further, the blockchain node may execute the third service transaction when the authority is detected (step S1004), and the process of executing the third service transaction may refer to the related description of step S309, which is not described herein.
S310, acquiring a first business transaction sent by a business object through a target main account address.
S311, when the first business transaction is detected to be an account management transaction for account management, determining a main sub account management contract deployed on the blockchain based on contract calling parameters in the account management transaction.
S312, calling a main sub-account management contract to read main account state information matched with a target main account address from target account state information on a blockchain, and determining the read main account state information as first main account state information; the first main account state information comprises N sub-account state information corresponding to N sub-account addresses configured for the service object; n is a positive integer; one sub-account address corresponds to one sub-account status information; the N sub-account addresses are each determined based on the master sub-account management contract and the target master account address, and the target master account address and the N sub-account addresses are each associated with the same key pair held by the business object.
S313, calling a main sub-account management contract to acquire N sub-account state information from the first main account state information, carrying out state update on the N sub-account state information based on the account management transaction, updating target account state information based on the sub-account state information after the state update, and uploading the account management transaction to the blockchain based on the target account state information after the update.
Referring to fig. 11, fig. 11 is a schematic structural diagram of a data processing apparatus based on a blockchain according to an embodiment of the present application. As shown in fig. 11, the blockchain-based data processing device 1 may be a computer program (including program code) running on a blockchain node (e.g., blockchain node 11 c), such as the blockchain-based data processing device 1 being an application software; it will be appreciated that the blockchain-based data processing device 1 may be used to perform the corresponding steps in the blockchain-based data processing method provided in embodiments of the present application. As shown in fig. 11, the blockchain-based data processing device 1 may include: a first transaction acquisition module 11, a contract determination module 12, a status information acquisition module 13, an information update module 14;
A first transaction acquisition module 11, configured to acquire a first service transaction sent by a service object through a target main account address;
a contract determination module 12 for determining a main sub-account management contract deployed on the blockchain based on contract invoking parameters in the account management transaction when the first business transaction is detected as the account management transaction for account management;
the state information obtaining module 13 is configured to invoke a main sub-account management contract to read main account state information matched with a target main account address from target account state information on a blockchain, and determine the read main account state information as first main account state information; the first main account state information comprises N sub-account state information corresponding to N sub-account addresses configured for the service object; n is a positive integer; one sub-account address corresponds to one sub-account status information; the N sub-account addresses are determined based on a main sub-account management contract and a target main account address, and the target main account address and the N sub-account addresses are associated with the same key pair held by the business object;
the information updating module 14 is configured to invoke a main sub-account management contract to obtain N sub-account status information from the first main account status information, perform status updating on the N sub-account status information based on the account management transaction, update the target account status information based on the status updated sub-account status information, and uplink the account management transaction to the blockchain based on the updated target account status information.
Wherein the account management transaction includes a sub-account deletion transaction for deleting a sub-account address configured for the business object; the main sub-account management contract comprises a sub-account deleting method; the sub-account deletion transaction carries a method name of a sub-account deletion method and a first sub-account address to be deleted; the first sub-account address belongs to N sub-account addresses; the step of carrying out state update on the N sub-account state information comprises the step of deleting the sub-account state information in the N sub-account state information;
wherein the information update module 14 comprises: a first sub-state information acquisition unit 141, an account deletion unit 142;
a first sub-state information obtaining unit 141, configured to invoke a sub-account deletion method in the main sub-account management contract based on a method name of the sub-account deletion method, and obtain N sub-account state information from the first main account state information;
the first sub-account state information obtaining unit 141 determines sub-account state information corresponding to a first sub-account address in the N sub-account state information as first sub-account state information;
the account deleting unit 142 is configured to delete the first sub-account status information in the N sub-account status information.
The N sub-account state information comprises account authority information; the account management transaction includes a rights management transaction for adjusting account rights information included in the sub-account status information; the main sub account management contract comprises a right management method; the right management transaction carries the method name of the right management method, the address of the second sub-account to be subjected to right management and right adjustment information; the second sub-account address belongs to N sub-account addresses; the step of carrying out state update on the N sub-account state information comprises the step of adjusting account authority information included in the sub-account state information in the N sub-account state information;
wherein the information update module 14 comprises: a second sub-state information acquisition unit 143, a right adjustment unit 144;
a second sub-state information obtaining unit 143, configured to invoke a rights management method in the main sub-account management contract based on a method name of the rights management method, and obtain N sub-account state information from the first main account state information;
a second sub-state information obtaining unit 143, configured to determine sub-account state information corresponding to a second sub-account address in the N sub-account state information as second sub-account state information;
And the permission adjustment unit 144 is configured to adjust account permission information included in the second sub-account status information based on the permission adjustment information.
Wherein the account management transaction includes a first sub-account creation transaction for configuring a sub-account address for the business object; the main sub-account management contract comprises a sub-account creation method; the first sub-account creation transaction carries a method name of a sub-account creation method; the updating of the state of the N sub-account state information comprises adding the sub-account state information to the N sub-account state information;
wherein the information update module 14 comprises: a third sub-state information acquisition unit 145, an account creation unit 146;
a third sub-state information obtaining unit 145, configured to invoke a sub-account creation method in the main sub-account management contract based on a method name of the sub-account creation method, and obtain N sub-account state information from the first main account state information;
the account creation unit 146 is configured to add sub-account status information corresponding to the third sub-account address in the N sub-account status information when the third sub-account address to be configured, which is determined based on the target main account address, is acquired.
The target main account address is determined by a public key corresponding to a private key held by the business object; the private key and the public key held by the business object are used for forming a key pair;
The first transaction acquisition module 11 may include: a pending transaction acquisition unit 111, a transaction verification unit 112, a type identification unit 113, a business transaction determination unit 114;
a to-be-processed transaction acquiring unit 111, configured to acquire a first to-be-processed transaction sent by the business object through the target main account address; the first transaction to be processed is obtained by carrying out transaction signature on the first transaction to be signed constructed by the business object based on a private key held by the business object;
the transaction verification unit 112 is configured to perform transaction verification on a first to-be-processed transaction through a public key corresponding to a private key held by a service object, and when the first to-be-processed transaction verification is successful, acquire a field value of a transaction type field from a transaction parameter of the first to-be-processed transaction, and determine the acquired field value as a first field value;
a type identifying unit 113 for determining a transaction type of the first transaction to be processed based on the first field value;
the business transaction determining unit 114 is configured to determine the first transaction to be processed as the first business transaction when the transaction type of the first transaction to be processed is the first transaction type.
The main sub-account management contract comprises a sub-account creation method; the transaction type of the first business transaction is a first transaction type; the N sub-account addresses comprise target sub-account addresses;
Wherein, the data processing device 1 based on the block chain may further comprise: a second transaction acquisition module 15, a sub-account creation module 16;
a second transaction acquisition module 15, configured to acquire a second service transaction sent by the service object through the target main account address; the transaction time of the second business transaction is earlier than the transaction time of the first business transaction; the transaction type of the second business transaction is consistent with the transaction type of the first business transaction;
a contract determination module 12 for determining a main sub-account management contract based on contract call parameters in a second sub-account creation transaction when detecting that a second business transaction is a second sub-account creation transaction for configuring a sub-account address for a business object; the second sub-account creation transaction carries the method name of the sub-account creation method;
the state information obtaining module 13 is configured to invoke a sub-account creation method in the main sub-account management contract based on a method name of the sub-account creation method, read main account state information matched with a target main account address from initial account state information on a blockchain, and determine the read main account state information as initial main account state information;
The sub-account creation module 16 is configured to invoke a sub-account creation method when a target sub-account address to be configured determined based on the target main account address is acquired, add sub-account state information corresponding to the target sub-account address to sub-account state information included in the initial main account state information, and determine N sub-account state information corresponding to the N sub-account addresses based on the sub-account state information corresponding to the target sub-account address;
the information updating module 14 is configured to update the primary account status information based on the N sub-account status information, and determine the target account status information based on the updated primary account status information.
Wherein the transaction types further include a second transaction type, the second transaction type being different from the first transaction type; the N sub-account state information comprises account authority information;
wherein, the data processing device 1 based on the block chain may further comprise: a third transaction acquisition module 17, a sub-account status reading module 18, a right detection module 19, a transaction execution module 20;
a third transaction acquisition module 17, configured to acquire a third transaction sent by the service object through the target sub-account address; the transaction type of the third business transaction is a second transaction type; the transaction time of the third business transaction is later than the transaction time of the second business transaction;
The sub-account status reading module 18 is configured to, when resolving a target main account address from the target sub-account address, read first main account status information from target account status information based on the target main account address, and determine sub-account status information of the target sub-account address from the first main account status information;
the permission detection module 19 is configured to determine account permission information of the target sub-account address from sub-account status information of the target sub-account address, and perform permission detection on the third service transaction based on the account permission information of the target sub-account address, so as to obtain a permission detection result;
the transaction execution module 20 is configured to execute the third service transaction when the authority detection result indicates that the target sub-account address has the execution authority for the third service transaction.
The account authority information comprises contract calling authority information; the contract calling authority information comprises contract identification of a business contract with calling authority of a target sub-account address; the third business transaction is used for indicating to call the target business contract to conduct business processing;
wherein the rights detection module 19 comprises: the contract identification determination unit 191, the result determination unit 192, and the contract call right determination unit 193.
A contract identification determining unit 191, configured to obtain a contract identification of the target service contract from the third service transaction, and determine the contract identification of the target service contract as the target contract identification;
a result determining unit 192 for searching for a contract identifier matching the target contract identifier among the contract identifiers of the business contracts included in the contract call right information, and determining a right detection success result associated with the third business transaction based on the search result of the searched contract identifier when the contract identifier matching the target contract identifier is searched for;
the contract calls the rights determination unit 193 for determining a rights detection result based on the rights detection success result.
The account authority information comprises resource transfer authority information; the third business transaction is used for indicating the resource transfer of the target sub-account address to the resource transfer destination address;
wherein the rights detection module 19 comprises: a resource transfer right detecting unit 194;
and a resource transfer rights detection unit 194 for determining a rights detection success result associated with the third business transaction when the resource transfer rights information indicates that the target sub-account address has the resource transfer rights, and determining the rights detection result based on the rights detection success result.
The account authority information comprises resource transfer authority information; the resource transfer permission information comprises a resource quantity threshold value of the resource transfer permission of the sub-account address; the third business transaction is used for indicating to transfer the resources in the target sub-account address to the resource transfer destination address;
wherein the rights detection module 19 comprises: a resource transfer number determination unit 195, a resource transfer right determination unit 196;
a resource transfer amount determining unit 195, configured to determine, from the third service transaction, an amount of resources to be transferred to the resource transfer destination address;
the resource transfer rights determining unit 196 is configured to determine a rights detection success result associated with the third service transaction when the number of resources to be transferred is less than or equal to the threshold of the number of resources, and determine a rights detection result based on the rights detection success result.
The target main account address is determined by a public key corresponding to a private key held by the business object; the private key and the public key held by the business object are used for forming a key pair;
a third transaction acquisition module for:
acquiring a second transaction to be processed, which is sent by the business object through the target main account address; the second transaction to be processed is obtained by carrying out transaction signature on the second transaction to be signed constructed by the business object based on the private key held by the business object;
Conducting transaction verification on the second to-be-processed transaction through a public key corresponding to the private key held by the service object, acquiring a field value of a transaction type field from a transaction parameter of the second to-be-processed transaction when the second to-be-processed transaction verification is successful, and determining the acquired field value as a second field value;
determining a transaction type of the second pending transaction based on the second field value;
and when the transaction type of the second to-be-processed transaction is the second transaction type, determining the second to-be-processed transaction as a third business transaction.
The main sub-account management contract comprises a sub-account authority inquiry method; the N sub-account state information comprises account authority information;
wherein the blockchain-based data processing device 1 further comprises: a first account query module 21;
the first account query module 21 is specifically configured to:
when the first business transaction is detected to be a first authority inquiry transaction for carrying out sub-account authority inquiry, determining a main sub-account management contract based on contract calling parameters in the first authority inquiry transaction; the first authority inquiry transaction carries the method name of the sub-account authority inquiry method;
calling a sub-account authority query method in a main sub-account management contract based on the method name of the sub-account authority query method, and reading first main account state information from target account state information;
When a first sub-account address to be queried is acquired from a first authority query transaction, sub-account state information of the first sub-account address to be queried is acquired from first main account state information;
and acquiring account authority information of the first sub-account address to be queried from the sub-account state information of the first sub-account address to be queried, and transmitting the acquired account authority information of the first sub-account address to be queried to the service object.
The N sub-account state information comprises account authority information; the transaction type of the first business transaction is a first transaction type; the main sub-account management contract comprises a sub-account authority inquiry method;
wherein the blockchain-based data processing device 1 further comprises: a second account query module 22;
the second account query module 22 is specifically configured to:
acquiring a fourth business transaction sent by the business object through the second sub-account address to be queried; the transaction type of the fourth business transaction is consistent with the transaction type of the first business transaction; the transaction time of the fourth business transaction is later than the transaction time of the first business transaction;
when the fourth business transaction is detected to be a second authority inquiry transaction for carrying out sub-account authority inquiry, determining a main sub-account management contract based on contract calling parameters in the second authority inquiry transaction; the second authority inquiry transaction carries the method name of the sub-account authority inquiry method;
Analyzing the second sub-account address to be queried to obtain a target main account address, calling a sub-account authority query method in a main sub-account management contract based on the method name of the sub-account authority query method, reading main account state information matched with the target main account address from updated target account state information, and determining the read main account state information as second main account state information;
sub-account state information of a second sub-account address to be queried is obtained from the second main account state information;
and acquiring account authority information of the second sub-account address to be queried from the sub-account state information of the second sub-account address to be queried, and transmitting the acquired account authority information of the second sub-account address to be queried to the service object.
The target account state information is an account state tree, and leaf nodes included in the account state tree are used for recording main account state information corresponding to main account addresses on a blockchain;
the status information acquisition module 13 includes: a state tree acquisition unit 131, a state determination unit 132;
a state tree obtaining unit 131, configured to invoke a main sub account management contract to obtain an account state tree on the blockchain;
The state determining unit 132 is configured to obtain, from the account state tree, a leaf node corresponding to the target primary account address based on the target primary account address, and determine primary account state information recorded by the obtained leaf node as primary account state information matched with the target primary account address.
The target account state information is an account state tree, and leaf nodes included in the account state tree are used for recording main account state information corresponding to main account addresses on a blockchain; the main account state information comprises a root hash value of the sub-account state tree; the leaf nodes included in the sub-account state tree are used for recording sub-account state information corresponding to the sub-account addresses;
the information update module 14 includes: root hash value determination section 147 and sub-account state determination section 148;
a root hash value determining unit 147, configured to invoke the main sub-account management contract to determine a root hash value of the sub-account status tree from the first main account status information, and determine the determined root hash value of the sub-account status tree as a target root hash value;
a sub-account state determining unit 148, configured to obtain a sub-account state tree associated with the first main account state information based on the target root hash value, and determine N sub-account state information based on the sub-account state tree associated with the first main account state information; the N sub-account state information is recorded through leaf nodes included in the sub-account state tree associated with the first main account state information.
Referring to fig. 12, fig. 12 is a schematic structural diagram of a computer device according to an embodiment of the present application. As shown in fig. 12, the computer device 1000 may include: processor 1001, network interface 1004, and memory 1005, and in addition, the above-described computer device 1000 may further include: a user interface 1003, and at least one communication bus 1002. Wherein the communication bus 1002 is used to enable connected communication between these components. The user interface 1003 may include a Display (Display), a Keyboard (Keyboard), and the optional user interface 1003 may further include a standard wired interface, a wireless interface, among others. The network interface 1004 may optionally include a standard wired interface, a wireless interface (e.g., WI-FI interface). The memory 1005 may be a high-speed RAM memory or a non-volatile memory (non-volatile memory), such as at least one disk memory. The memory 1005 may also optionally be at least one storage device located remotely from the processor 1001. As shown in fig. 12, an operating system, a network communication module, a user interface module, and a device control application program may be included in the memory 1005, which is one type of computer-readable storage medium.
In the computer device 1000 shown in FIG. 12, the network interface 1004 may provide network communication functions; while user interface 1003 is primarily used as an interface for providing input to a user; the processor 1001 may be configured to invoke the device control application stored in the memory 1005 to execute the description of the data processing method in any of the foregoing embodiments, which is not described herein. In addition, the description of the beneficial effects of the same method is omitted.
Furthermore, it should be noted here that: the embodiments of the present application further provide a computer readable storage medium, in which the aforementioned computer program executed by the blockchain-based data processing device 1 is stored, and the computer program includes program instructions, when executed by a processor, capable of executing the description of the data processing method in the foregoing embodiments, and therefore will not be described in detail herein. In addition, the description of the beneficial effects of the same method is omitted. For technical details not disclosed in the embodiments of the computer-readable storage medium according to the present application, please refer to the description of the method embodiments of the present application.
The computer readable storage medium may be the data processing apparatus provided in any one of the foregoing embodiments or an internal storage unit of the computer device, for example, a hard disk or a memory of the computer device. The computer readable storage medium may also be an external storage device of the computer device, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) card, a flash card (flash card) or the like, which are provided on the computer device. Further, the computer-readable storage medium may also include both internal storage units and external storage devices of the computer device. The computer-readable storage medium is used to store the computer program and other programs and data required by the computer device. The computer-readable storage medium may also be used to temporarily store data that has been output or is to be output.
Furthermore, it should be noted here that: embodiments of the present application also provide a computer program product or computer program comprising computer instructions stored in a computer-readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions to cause the computer device to perform the method provided by any of the corresponding embodiments described above. In addition, the description of the beneficial effects of the same method is omitted. For technical details not disclosed in the computer program product or the computer program embodiments related to the present application, please refer to the description of the method embodiments of the present application.
The terms first, second and the like in the description and in the claims and drawings of the embodiments of the present application are used for distinguishing between different objects and not for describing a particular sequential order. Furthermore, the term "include" and any variations thereof is intended to cover a non-exclusive inclusion. For example, a process, method, apparatus, article, or device that comprises a list of steps or elements is not limited to the list of steps or modules but may, in the alternative, include other steps or modules not listed or inherent to such process, method, apparatus, article, or device.
Those of ordinary skill in the art will appreciate that the elements and algorithm steps described in connection with the embodiments disclosed herein may be embodied in electronic hardware, in computer software, or in a combination of the two, and that the elements and steps of the examples have been generally described in terms of function in the foregoing description to clearly illustrate the interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
The foregoing disclosure is only illustrative of the preferred embodiments of the present application and is not intended to limit the scope of the claims herein, as the equivalent of the claims herein shall be construed to fall within the scope of the claims herein.

Claims (19)

1. A method of blockchain-based data processing, the method performed by blockchain link points, the method comprising:
acquiring a first business transaction sent by a business object through a target main account address; the field value of the transaction type field carried by the first business transaction is a first field value; the first field value is used for identifying that the transaction type of the first business transaction is a first transaction type; the first transaction type is a transaction type for account management or authority inquiry;
determining a main sub-account management contract deployed on a blockchain based on contract invoking parameters in the account management transaction when detecting that the first business transaction is the account management transaction for account management based on a transaction additional field in the first business transaction; the main sub account management contract refers to an intelligent contract for managing a plurality of main account addresses on the blockchain, sub account addresses under each main account address in the plurality of main account addresses and inquiring authority; the contract calling parameter is a destination address field in the first business transaction; the management means that sub-account addresses are created under each main account address, the sub-account addresses are deleted, and account authority information corresponding to the sub-account addresses is adjusted;
Calling the main sub account management contract to read main account state information matched with the target main account address from target account state information on the blockchain, and determining the read main account state information as first main account state information; the target account state information is used for recording state information of an account on the blockchain; the state information of the account comprises the transaction times and the resource quantity of the account address corresponding to the account; the account comprises a main account corresponding to each main account address and a sub-account corresponding to the sub-account address under each main account address; the first main account state information comprises N sub-account state information corresponding to N sub-account addresses configured for the business object; n is a positive integer; one sub-account address corresponds to one sub-account status information; the N sub-account addresses are determined based on the main sub-account management contract and the target main account address, and the target main account address and the N sub-account addresses are associated with the same key pair held by the business object;
and calling the main sub-account management contract to acquire the N sub-account state information from the first main account state information, carrying out state update on the N sub-account state information based on the account management transaction, updating the target account state information based on the sub-account state information after the state update, and uploading the account management transaction to the blockchain based on the target account state information after the update.
2. The method of claim 1, wherein the account management transaction comprises a sub-account deletion transaction for deleting a sub-account address configured for the business object; the main sub-account management contract comprises a sub-account deleting method; the sub-account deletion transaction carries a method name of the sub-account deletion method and a first sub-account address to be deleted; the first sub-account address belongs to the N sub-account addresses; the step of carrying out state update on the N sub-account state information comprises the step of deleting sub-account state information in the N sub-account state information;
the calling the main sub-account management contract to acquire the N sub-account state information from the first main account state information, and performing state update on the N sub-account state information based on the account management transaction, including:
calling the sub-account deleting method in the main sub-account management contract based on the method name of the sub-account deleting method, and acquiring the N sub-account state information from the first main account state information;
determining sub-account state information corresponding to the first sub-account address in the N sub-account state information as first sub-account state information;
And deleting the first sub-account state information in the N sub-account state information.
3. The method of claim 1, wherein the N sub-account status information each includes account rights information; the account management transaction comprises an authority management transaction for adjusting account authority information included in sub-account state information; the main sub account management contract comprises an authority management method; the right management transaction carries a method name of the right management method, a second sub-account address to be subjected to right management and right adjustment information; the second sub-account address belongs to the N sub-account addresses; the step of carrying out state update on the N sub-account state information comprises the step of adjusting account authority information included in sub-account state information in the N sub-account state information;
the calling the main sub-account management contract to acquire the N sub-account state information from the first main account state information, and performing state update on the N sub-account state information based on the account management transaction, including:
calling the authority management method in the main sub-account management contract based on the method name of the authority management method, and acquiring the N sub-account state information from the first main account state information;
Determining sub-account state information corresponding to the second sub-account address in the N sub-account state information as second sub-account state information;
and adjusting account authority information included in the second sub-account state information based on the authority adjustment information.
4. The method of claim 1, wherein the account management transaction comprises a first sub-account creation transaction for configuring a sub-account address for the business object; the main sub-account management contract comprises a sub-account creation method; the first sub-account creation transaction carries a method name of the sub-account creation method; the step of carrying out state update on the N sub-account state information comprises adding sub-account state information in the N sub-account state information;
the calling the main sub-account management contract to acquire the N sub-account state information from the first main account state information, and performing state update on the N sub-account state information based on the account management transaction, including:
calling the sub-account creation method in the main sub-account management contract based on the method name of the sub-account creation method, and acquiring the N sub-account state information from the first main account state information;
When a third sub-account address to be configured, which is determined based on the target main account address, is obtained, sub-account state information corresponding to the third sub-account address is added in the N sub-account state information.
5. The method of claim 1, wherein the target primary account address is determined by a public key corresponding to a private key held by the business object; the private key and the public key held by the business object are used for forming a key pair;
the obtaining the first business transaction sent by the business object through the target main account address comprises the following steps:
acquiring a first transaction to be processed, which is sent by the business object through the target main account address; the first transaction to be processed is obtained by carrying out transaction signature on the first transaction to be signed constructed by the business object based on a private key held by the business object;
conducting transaction verification on the first transaction to be processed through a public key corresponding to a private key held by the service object, acquiring a field value of a transaction type field from a transaction parameter of the first transaction to be processed when the first transaction to be processed is verified, and determining the acquired field value as a first field value;
Determining a transaction type of the first transaction to be processed based on the first field value;
and when the transaction type of the first transaction to be processed is a first transaction type, determining the first transaction to be processed as the first business transaction.
6. The method of claim 1, wherein the main sub-account management contract includes a sub-account creation method; the transaction type of the first business transaction is a first transaction type; the N sub-account addresses comprise target sub-account addresses;
the method further comprises the steps of:
acquiring a second business transaction sent by the business object through the target main account address; the transaction time of the second business transaction is earlier than the transaction time of the first business transaction; the transaction type of the second business transaction is consistent with the transaction type of the first business transaction;
determining the main sub-account management contract based on contract calling parameters in the second sub-account creation transaction when the second business transaction is detected to be the second sub-account creation transaction for configuring sub-account addresses for the business objects; the second sub-account creation transaction carries a method name of the sub-account creation method;
Calling the sub-account creation method in the main sub-account management contract based on the method name of the sub-account creation method, reading main account state information matched with the target main account address from the initial account state information on the blockchain, and determining the read main account state information as initial main account state information;
when the target sub-account address to be configured determined based on the target main account address is obtained, invoking the sub-account creation method, adding sub-account state information corresponding to the target sub-account address in sub-account state information included in the initial main account state information, and determining the N sub-account state information corresponding to the N sub-account addresses based on the sub-account state information corresponding to the target sub-account address;
and updating the primary account state information based on the N sub-account state information, and determining the target account state information based on the updated primary account state information.
7. The method of claim 6, wherein the transaction type further comprises a second transaction type, the second transaction type being different from the first transaction type; the N sub-account state information comprises account authority information;
The method further comprises the steps of:
acquiring a third business transaction sent by the business object through the target sub-account address; the transaction type of the third business transaction is the second transaction type; the transaction time of the third business transaction is later than the transaction time of the second business transaction;
when the target main account address is obtained by resolving the target sub-account address, reading the first main account state information from the target account state information based on the target main account address, and determining sub-account state information of the target sub-account address from the first main account state information;
determining account authority information of the target sub-account address from sub-account state information of the target sub-account address, and performing authority detection on the third business transaction based on the account authority information of the target sub-account address to obtain an authority detection result;
and executing the third business transaction when the authority detection result indicates that the target sub-account address has the execution authority for the third business transaction.
8. The method of claim 7, wherein the account rights information includes contract invocation rights information; the contract calling authority information comprises contract identification of a business contract with calling authority of the target sub-account address; the third business transaction is used for indicating to call a target business contract to conduct business processing;
The authority detection is performed on the third business transaction based on the account authority information of the target sub-account address to obtain an authority detection result, and the method comprises the following steps:
acquiring a contract identifier of the target business contract from the third business transaction, and determining the contract identifier of the target business contract as a target contract identifier;
searching a contract identifier matched with the target contract identifier in the contract identifiers of the business contracts included in the contract calling permission information, and determining a permission detection success result associated with the third business transaction based on the searching result of the searched contract identifier when the contract identifier matched with the target contract identifier is searched;
and determining the right detection result based on the right detection success result.
9. The method of claim 7, wherein the account rights information includes resource transfer rights information; the third business transaction is used for indicating to transfer the resources of the target sub-account address to a resource transfer destination address;
the authority detection is performed on the third business transaction based on the account authority information of the target sub-account address to obtain an authority detection result, and the method comprises the following steps:
And when the resource transfer permission information indicates that the target sub-account address has the resource transfer permission, determining a permission detection success result associated with the third business transaction, and determining the permission detection result based on the permission detection success result.
10. The method of claim 7, wherein the account rights information includes resource transfer rights information; the resource transfer permission information comprises a resource quantity threshold value of the resource transfer permission of the sub-account address; the third business transaction is used for indicating to transfer the resources in the target sub-account address to a resource transfer destination address;
the authority detection is performed on the third business transaction based on the account authority information of the target sub-account address to obtain an authority detection result, and the method comprises the following steps:
determining the quantity of resources to be transferred to the resource transfer destination address from the third service transaction;
and when the quantity of the resources to be transferred is smaller than or equal to the resource quantity threshold, determining a right detection success result associated with the third business transaction, and determining the right detection result based on the right detection success result.
11. The method of claim 7, wherein the target primary account address is determined by a public key corresponding to a private key held by the business object; the private key and the public key held by the business object are used for forming a key pair;
the obtaining the third business transaction sent by the business object through the target sub-account address includes:
acquiring a second transaction to be processed, which is sent by the business object through the target main account address; the second transaction to be processed is obtained by carrying out transaction signature on the second transaction to be signed constructed by the business object based on a private key held by the business object;
conducting transaction verification on the second to-be-processed transaction through a public key corresponding to a private key held by the service object, acquiring a field value of a transaction type field from a transaction parameter of the second to-be-processed transaction when the second to-be-processed transaction verification is successful, and determining the acquired field value as a second field value;
determining a transaction type of the second pending transaction based on the second field value;
and when the transaction type of the second to-be-processed transaction is a second transaction type, determining the second to-be-processed transaction as the third business transaction.
12. The method of claim 1, wherein the main sub-account management contract includes a sub-account rights query method; the N sub-account state information comprises account authority information;
the method further comprises the steps of:
when the first business transaction is detected to be a first authority inquiry transaction for carrying out sub-account authority inquiry, determining the main sub-account management contract based on contract calling parameters in the first authority inquiry transaction; the first authority inquiry transaction carries the method name of the sub-account authority inquiry method;
calling the sub-account authority query method in the main sub-account management contract based on the method name of the sub-account authority query method, and reading the first main account state information from the target account state information;
when a first sub-account address to be queried is acquired from the first authority query transaction, sub-account state information of the first sub-account address to be queried is acquired from the first main account state information;
and acquiring account authority information of the first sub-account address to be queried from the sub-account state information of the first sub-account address to be queried, and transmitting the acquired account authority information of the first sub-account address to be queried to the service object.
13. The method of claim 1, wherein the N sub-account status information each includes account rights information; the transaction type of the first business transaction is a first transaction type; the main sub-account management contract comprises a sub-account authority inquiry method;
the method further comprises the steps of:
acquiring a fourth business transaction sent by the business object through the second sub-account address to be queried; the transaction type of the fourth business transaction is consistent with the transaction type of the first business transaction; the transaction time of the fourth business transaction is later than the transaction time of the first business transaction;
when the fourth business transaction is detected to be a second authority inquiry transaction for carrying out sub-account authority inquiry, determining the main sub-account management contract based on contract calling parameters in the second authority inquiry transaction; the second authority inquiry transaction carries the method name of the sub-account authority inquiry method;
analyzing the second sub-account address to be queried to obtain the target main account address, calling the sub-account authority query method in the main sub-account management contract based on the method name of the sub-account authority query method, reading main account state information matched with the target main account address from updated target account state information, and determining the read main account state information as second main account state information;
Acquiring sub-account state information of the second sub-account address to be queried from the second main account state information;
and acquiring account authority information of the second sub-account address to be queried from the sub-account state information of the second sub-account address to be queried, and transmitting the acquired account authority information of the second sub-account address to be queried to the service object.
14. The method of claim 1, wherein the target account state information is an account state tree, and a leaf node included in the account state tree is used for recording main account state information corresponding to a main account address on the blockchain;
the calling the main sub account management contract to read main account state information matched with the target main account address from target account state information on the blockchain comprises the following steps:
invoking the main sub account management contract to acquire an account state tree on the blockchain;
and acquiring leaf nodes corresponding to the target main account address from the account state tree based on the target main account address, and determining main account state information recorded by the acquired leaf nodes as main account state information matched with the target main account address.
15. The method of claim 1, wherein the target account state information is an account state tree, and a leaf node included in the account state tree is used for recording main account state information corresponding to a main account address on the blockchain; the main account state information comprises a root hash value of a sub-account state tree; the leaf nodes included in the sub-account state tree are used for recording sub-account state information corresponding to the sub-account addresses;
the calling the main sub-account management contract to acquire the N sub-account state information from the first main account state information comprises the following steps:
invoking the main sub-account management contract to determine a root hash value of a sub-account state tree from the first main account state information, and determining the determined root hash value of the sub-account state tree as a target root hash value;
acquiring sub-account state trees associated with the first main account state information based on the target root hash value, and determining the N sub-account state information based on the sub-account state trees associated with the first main account state information; and the N sub-account state information is recorded through leaf nodes included in the sub-account state tree associated with the first main account state information.
16. A blockchain-based data processing device, the device operating on a blockchain node, the device comprising:
the transaction acquisition module is used for acquiring a first business transaction sent by a business object through a target main account address; the field value of the transaction type field carried by the first business transaction is a first field value; the first field value is used for identifying that the transaction type of the first business transaction is a first transaction type; the first transaction type is a transaction type for account management or authority inquiry;
the contract determining module is used for determining a main sub-account management contract deployed on a blockchain based on contract calling parameters in the account management transaction when the first business transaction is detected to be the account management transaction for account management based on a transaction additional field in the first business transaction; the main sub account management contract refers to an intelligent contract for managing a plurality of main account addresses on the blockchain, sub account addresses under each main account address in the plurality of main account addresses and inquiring authority; the contract calling parameter is a destination address field in the first business transaction; the management means that sub-account addresses are created under each main account address, the sub-account addresses are deleted, and account authority information corresponding to the sub-account addresses is adjusted;
The state information acquisition module is used for calling the main and sub account management contracts to read main account state information matched with the target main account address from target account state information on the blockchain, and determining the read main account state information as first main account state information; the target account state information is used for recording state information of an account on the blockchain; the state information of the account comprises the transaction times and the resource quantity of the account address corresponding to the account; the account comprises a main account corresponding to each main account address and a sub-account corresponding to the sub-account address under each main account address; the first main account state information comprises N sub-account state information corresponding to N sub-account addresses configured for the business object; n is a positive integer; one sub-account address corresponds to one sub-account status information; the N sub-account addresses are determined based on the main sub-account management contract and the target main account address, and the target main account address and the N sub-account addresses are associated with the same key pair held by the business object;
The information updating module is used for calling the main sub-account management contract to acquire the N sub-account state information from the first main account state information, carrying out state updating on the N sub-account state information based on the account management transaction, updating the target account state information based on the sub-account state information after the state updating, and uploading the account management transaction to the blockchain based on the target account state information after the updating.
17. A computer device comprising a memory and a processor;
the memory is connected to the processor, the memory is used for storing a computer program, and the processor is used for calling the computer program to enable the computer device to execute the method of any one of claims 1-15.
18. A computer readable storage medium, characterized in that the computer readable storage medium has stored therein a computer program adapted to be loaded and executed by a processor to cause a computer device having the processor to perform the method of any of claims 1-15.
19. A computer program product comprising computer programs/instructions which, when executed by a processor, implement the method of any of claims 1-15.
CN202311311594.3A 2023-10-11 2023-10-11 Data processing method and device based on block chain and related equipment Active CN117057806B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311311594.3A CN117057806B (en) 2023-10-11 2023-10-11 Data processing method and device based on block chain and related equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311311594.3A CN117057806B (en) 2023-10-11 2023-10-11 Data processing method and device based on block chain and related equipment

Publications (2)

Publication Number Publication Date
CN117057806A CN117057806A (en) 2023-11-14
CN117057806B true CN117057806B (en) 2024-01-30

Family

ID=88663045

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311311594.3A Active CN117057806B (en) 2023-10-11 2023-10-11 Data processing method and device based on block chain and related equipment

Country Status (1)

Country Link
CN (1) CN117057806B (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112184229A (en) * 2020-10-14 2021-01-05 深圳壹账通智能科技有限公司 Block chain-based sub-account transaction processing method, system and equipment
CN112446039A (en) * 2020-11-19 2021-03-05 杭州趣链科技有限公司 Block chain transaction processing method, device, equipment and storage medium
CN112560072A (en) * 2021-02-18 2021-03-26 腾讯科技(深圳)有限公司 Key management method, device, medium and equipment based on block chain

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20200118118A1 (en) * 2018-10-12 2020-04-16 DAEX Blockchain Group Limited Method and Apparatus for Processing Digital Asset Based on Blockchain

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112184229A (en) * 2020-10-14 2021-01-05 深圳壹账通智能科技有限公司 Block chain-based sub-account transaction processing method, system and equipment
CN112446039A (en) * 2020-11-19 2021-03-05 杭州趣链科技有限公司 Block chain transaction processing method, device, equipment and storage medium
CN112560072A (en) * 2021-02-18 2021-03-26 腾讯科技(深圳)有限公司 Key management method, device, medium and equipment based on block chain

Also Published As

Publication number Publication date
CN117057806A (en) 2023-11-14

Similar Documents

Publication Publication Date Title
US11366882B2 (en) Method and system for verifying integrity of a digital asset using a distributed hash table and a peer-to-peer distributed ledger
US11601408B2 (en) Systems and methods for providing data privacy in a private distributed ledger
JP6877448B2 (en) Methods and systems for guaranteeing computer software using distributed hash tables and blockchain
US10992649B2 (en) Systems and methods for privacy in distributed ledger transactions
CN113711536B (en) Extracting data from a blockchain network
US20210111867A1 (en) System and method for implementing a resolver service for decentralized identifiers
WO2022042301A1 (en) Data processing method and apparatus, smart device and storage medium
WO2021179655A1 (en) Cross-blockchain data migration method and apparatus, device, and storage medium
KR102514325B1 (en) Model training system and method, storage medium
EP4216077A1 (en) Blockchain network-based method and apparatus for data processing, and computer device
CN112835612A (en) Electronic document version management method and device based on block chain
CN110851127B (en) Universal evidence-storing method based on blockchain
CN115114372A (en) Data processing method, device and equipment based on block chain and readable storage medium
JP2023530594A (en) Permitted Event Processing in Distributed Databases
CN113505260A (en) Face recognition method and device, computer readable medium and electronic equipment
KR102517001B1 (en) System and method for processing digital signature on a blockchain network
CN117057806B (en) Data processing method and device based on block chain and related equipment
Song et al. Smart contract-based trusted content retrieval mechanism for NDN
CN117118640A (en) Data processing method, device, computer equipment and readable storage medium
CN116070191A (en) Information processing method and device, storage medium, and program product
CN116760632B (en) Data processing method, device, equipment and readable storage medium
CN117040930B (en) Resource processing method, device, product, equipment and medium of block chain network
US20230325833A1 (en) Blockchain-based data processing method and apparatus, device, storage medium, and program product
CN117333178A (en) Data processing method and device based on block chain and related equipment
Han et al. A search optimized blockchain‐based verifiable searchable symmetric encryption framework

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