WO2024021417A1 - Data account creation method and apparatus - Google Patents

Data account creation method and apparatus Download PDF

Info

Publication number
WO2024021417A1
WO2024021417A1 PCT/CN2022/135405 CN2022135405W WO2024021417A1 WO 2024021417 A1 WO2024021417 A1 WO 2024021417A1 CN 2022135405 W CN2022135405 W CN 2022135405W WO 2024021417 A1 WO2024021417 A1 WO 2024021417A1
Authority
WO
WIPO (PCT)
Prior art keywords
data
account
blockchain
transaction
data account
Prior art date
Application number
PCT/CN2022/135405
Other languages
French (fr)
Chinese (zh)
Inventor
俞本权
刘燕
魏长征
何家华
郭学鹏
Original Assignee
蚂蚁区块链科技(上海)有限公司
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 蚂蚁区块链科技(上海)有限公司 filed Critical 蚂蚁区块链科技(上海)有限公司
Publication of WO2024021417A1 publication Critical patent/WO2024021417A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/62Protecting access to data via a platform, e.g. using keys or access control rules
    • G06F21/6218Protecting access to data via a platform, e.g. using keys or access control rules to a system of files or objects, e.g. local or distributed file system or database
    • G06F21/6227Protecting access to data via a platform, e.g. using keys or access control rules to a system of files or objects, e.g. local or distributed file system or database where protection concerns the structure of data, e.g. records, types, queries
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/21Design, administration or maintenance of databases
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/30Authentication, i.e. establishing the identity or authorisation of security principals
    • G06F21/31User authentication
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/604Tools and structures for managing or administering access control systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/20Software design
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2221/00Indexing scheme relating to security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F2221/21Indexing scheme relating to G06F21/00 and subgroups addressing additional information or applications relating to security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F2221/2117User registration
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2221/00Indexing scheme relating to security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F2221/21Indexing scheme relating to G06F21/00 and subgroups addressing additional information or applications relating to security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F2221/2141Access rights, e.g. capability lists, access control lists, access tables, access matrices

Definitions

  • One or more embodiments of this specification relate to the field of blockchain, and in particular, to a method and device for creating a data account.
  • the invention of smart contracts has lowered the application threshold of blockchain, and the launch of alliance chain has accelerated the application of blockchain by enterprises.
  • enterprises' application of blockchain faces huge technical challenges, especially when the enterprise's business logic becomes increasingly complex and business data continues to accumulate. Due to existing technical limitations and performance bottlenecks, it usually needs to be implemented by a single smart contract. Complex business logic requires a large amount of business data to be stored under this smart contract.
  • the code amount of the smart contract is large, and may even approach the upper limit of the virtual machine used to execute the smart contract; second, if in order to reduce the code amount of the smart contract, the smart contract is split Divided into multiple sub-contracts, cross-contract calls need to be made between these multiple sub-contracts to execute the business, which will affect the execution performance of the business; thirdly, if the business logic implemented by the smart contract needs to be upgraded, it needs to be in the block To deploy a new smart contract on the chain, you need to write the upgraded business logic into the new smart contract, and copy the business data in the original smart contract to the new smart contract, so that the new smart contract is compatible with the original smart contract. Business data in the contract.
  • This specification provides a method for creating a data account, which is applied to blockchain nodes; the account types supported by the blockchain include data accounts; the data account is used to maintain smart contracts deployed on the blockchain for contract calculations Required business data; the methods include:
  • This specification also provides a data account creation device, which is applied to blockchain nodes; the account types supported by the blockchain include data accounts; the data account is used to maintain smart contracts deployed on the blockchain for contract execution Calculate the required business data; the device includes:
  • a receiving module that receives a data account creation transaction used to create the data account; wherein the data account creation transaction includes business data required for contract calculation by smart contracts deployed on the blockchain;
  • a creation module in response to the data account creation transaction, creates a data account on the blockchain; and adds the business data to the data account for maintenance.
  • This instruction manual also provides an electronic device, including:
  • Memory used to store instructions executable by the processor
  • the processor executes the steps of any of the above methods by running the executable instructions.
  • This specification also provides a computer-readable storage medium on which computer instructions are stored. When the instructions are executed by a processor, the steps of any of the above methods are implemented.
  • the blockchain node in the blockchain can respond to the received data account creation transaction, and perform the business required for contract calculation based on the smart contract deployed on the blockchain in the data account creation transaction.
  • Data create a data account on the blockchain, that is, add the business data to the created data account for maintenance.
  • the contract code of the smart contract can be separated from the business data required for contract calculation by the smart contract, so that the following purposes can be achieved: First, only the contract of the smart contract needs to be maintained in the contract account corresponding to the smart contract. code, so smart contracts with complex business logic can be split into multiple simpler sub-contracts, reducing the costs of smart contract development, testing, upgrades, etc.; Second, users registered in the blockchain User accounts, as well as contract accounts corresponding to smart contracts deployed on the blockchain, can directly access business data maintained in data accounts created on the blockchain. That is, data accounts can be used to implement user accounts and contract accounts.
  • Data sharing saves the execution overhead of smart contracts, enables parallel access to business data, and improves the transaction throughput of the blockchain; third, centralized maintenance of business data by data accounts can realize the assetization of business data and facilitate the acquisition of large amounts of data.
  • Business data is processed for data analysis, AI training, etc.
  • Figure 1 is a schematic diagram of the account structure of a user account.
  • Figure 2 is a schematic diagram of the account structure of a contract account.
  • Figure 3 is a flow chart of a method for creating a data account according to an exemplary embodiment of this specification.
  • Figure 4 is a schematic diagram of the account structure of a data account according to an exemplary embodiment of this specification.
  • Figure 5 is a flow chart of a data account access authorization method according to an exemplary embodiment of this specification.
  • FIG. 6 is a flow chart of another data account access authorization method according to an exemplary embodiment of this specification.
  • Figure 7 is a flow chart of another data account access authorization method according to an exemplary embodiment of this specification.
  • Figure 8 is a flow chart of a data account access method according to an exemplary embodiment of this specification.
  • Figure 9 is a flow chart of another data account access authorization method according to an exemplary embodiment of this specification.
  • FIG. 10 is a flow chart of another data account access authorization method according to an exemplary embodiment of this specification.
  • Figure 11 is a flow chart of another data account access method according to an exemplary embodiment of this specification.
  • Figure 12 is a flow chart of a data account updating method according to an exemplary embodiment of this specification.
  • Figure 13 is a schematic diagram of the hardware structure of a device according to an exemplary embodiment of this specification.
  • Figure 14 is a block diagram of a data account creation device illustrating an exemplary embodiment of this specification.
  • the steps of the corresponding method are not necessarily performed in the order shown and described in this specification.
  • methods may include more or fewer steps than described in this specification.
  • a single step described in this specification may be broken down into multiple steps for description in other embodiments; and multiple steps described in this specification may also be combined into a single step in other embodiments. describe.
  • Blockchains are generally divided into three types: Public Blockchain, Private Blockchain and Consortium Blockchain.
  • the public chain is the public chain. Participants who join the public chain (also called nodes in the blockchain) can read data records on the chain, participate in transactions, compete for the accounting rights of new blocks, etc. Moreover, each node can freely join or exit the network and perform related operations.
  • private chains have network write permissions controlled by an organization or institution, and data read permissions regulated by the organization. That is, a private chain can be viewed as a weakly centralized system with strict restrictions on nodes and a small number of nodes. This type of blockchain is more suitable for internal use within specific organizations.
  • the alliance chain is between the public chain and the private chain and can achieve "partial decentralization".
  • Each node in the alliance chain usually has a corresponding entity or organization; the nodes join the network through authorization and form an alliance of stakeholders to jointly maintain the operation of the blockchain.
  • nodes are logical communication entities; multiple nodes of different types can run on the same physical server or on different physical servers.
  • Transaction Transaction
  • blockchain network For data generated outside the blockchain, it can be constructed into a standard transaction (Transaction) format supported by the blockchain, and then published to the blockchain, and all nodes in the blockchain network will process the transaction. consensus. After reaching a consensus, the node in the blockchain network that serves as the accounting node can persist the transaction in the blockchain.
  • Transaction Transaction
  • the native transactions they support usually only include transfer transactions.
  • the user can pass the transaction postscript in the transfer transaction (i.e., the transfer postscript).
  • the transfer postscript i.e., the transfer postscript
  • the blockchain data that needs to be stored and maintained usually includes block data and account status data corresponding to the blockchain accounts in the blockchain; and the block data can be further Including block header data, block transaction data in the block, and transaction receipts corresponding to the block transaction data in the block, etc.
  • the above various blockchain data can usually be organized into a Merkle tree (i.e. Merkle tree) in the form of key-value pairs and stored in the database. .
  • Merkle tree i.e. Merkle tree
  • the data can be efficiently queried by using the keys of the various blockchain data as query indexes and traversing the above Merkle tree.
  • smart contracts for data storage can be deployed on the blockchain. Users can call the smart contract to use the data that needs to be stored as the contract account corresponding to the smart contract.
  • the account status is stored in the Merkle tree corresponding to the smart contract.
  • a special Merkle tree called an MPT tree is usually used to store and maintain blockchain data; account status data can be organized into an MPT status tree (commonly known as world status) and stored in the database;
  • the MPT status tree stores key-value pairs with the account address as the key and the account status data as the value.
  • the data content stored in the contract account corresponding to the smart contract will be further organized into a Storage tree (an MPT storage tree used to store data) and stored in the database; the Hash value of the root node of the Storage tree will be used as the Part of the account status data corresponding to the contract account is filled into the MPT status tree; and the hash of the root node of the MPT status tree will be used as the authentication root and further filled into the block header.
  • users need to deposit data, they can call the smart contract to store the data that needs to be deposited as the account status data of the contract account corresponding to the smart contract into the Storage tree corresponding to the smart contract.
  • accounts are usually divided into two categories: user accounts and contract accounts; user accounts are accounts directly controlled by users, also called external accounts; contract accounts are created by users through user accounts, including Account of the contract code (i.e. smart contract).
  • contract accounts are created by users through user accounts, including Account of the contract code (i.e. smart contract).
  • the account status of the account is usually maintained through a structure.
  • the status of the account associated with the transaction in the blockchain usually changes.
  • the account structure usually includes fields such as Balance, Nonce, Code and Storage. in:
  • the Nonce field is used to maintain the number of transactions of the account; it is a counter used to ensure that each transaction can and can only be processed once, effectively avoiding replay attacks;
  • the Code field is used to maintain the contract code of the account; in practical applications, the Code field usually only maintains the hash value of the contract code; therefore, the Code field is usually also called the CodeHash field.
  • the Storage field is used to maintain the storage content of the account (the default field value is empty); for contract accounts, an independent storage space is usually allocated to store the storage content of the contract account; this independent storage space is usually Call it the account storage of this contract account.
  • the storage content of the contract account is usually constructed into a data structure of an MPT (Merkle Patricia Trie) tree and stored in the above-mentioned independent storage space; among them, the MPT tree constructed based on the storage content of the contract account is usually also called a Storage tree .
  • the Storage field usually only maintains the root node of the Storage tree; therefore, the Storage field is usually also called the StorageRoot field.
  • the field values of the Code field and the Storage field shown above are both null.
  • Figure 1 is a schematic diagram of an account structure of a user account.
  • the account structure of the above user account may specifically include an Identity field and a Balance field.
  • the Identity field can be used to maintain the account identification of the user account.
  • Figure 2 is a schematic diagram of the account structure of a contract account.
  • the account structure of the above-mentioned contract account can specifically include the Identity field, the Balance field, the Code field, and the Storage field.
  • the Identity field can be used to maintain the account identification of the contract account.
  • the Code field usually only maintains the hash value of the contract code, which can also be called the CodeHash field.
  • the Storage field usually only maintains the root node of the Storage tree built based on the storage content of the contract account, which can also be called the StorageRoot field.
  • users can be provided with smart contract functions to support users in creating and calling some complex logic in the blockchain network.
  • the so-called smart contract is a program that can be triggered and executed by transactions on the blockchain.
  • each blockchain node can be equipped with a Turing-complete virtual machine as the execution environment for smart contracts, through which various complex logic can be implemented.
  • a Turing-complete virtual machine as the execution environment for smart contracts, through which various complex logic can be implemented.
  • the virtual machine directly runs the virtual machine code (virtual machine bytecode, hereinafter referred to as "bytecode"), so the smart contract deployed on the blockchain can be bytecode.
  • Bytecode consists of a series of bytes, each byte can identify an operation.
  • developers can choose a high-level language to write smart contract code instead of writing bytecode directly.
  • high-level languages can use Solidity, Serpent, LLL language, etc.
  • Smart contract codes written in high-level languages can be compiled by a compiler to generate bytecode that can be deployed on the blockchain.
  • Users can send a smart contract creation transaction containing contract code to the blockchain network, and each blockchain node can execute the transaction in the equipped virtual machine.
  • a contract account corresponding to the smart contract appears on the blockchain and has a specific address; the contract code (Code) and account storage (Storage) will be saved in the account storage of the contract account.
  • the behavior of a smart contract is controlled by the contract code, and the account storage of the smart contract saves the state of the contract.
  • each blockchain node After the user sends a smart contract call transaction to the Ethereum network, each blockchain node can execute the transaction in the equipped virtual machine.
  • the account status of the contract account may change. Subsequently, a client can view the account status of the contract account through the connected blockchain node.
  • Smart contracts can be executed independently on each node in the blockchain network in a prescribed manner. All execution records and data are saved on the blockchain. Therefore, after such a transaction is executed, there is no way to save it on the blockchain. Transaction vouchers that are tamper-resistant and cannot be lost.
  • This manual aims to propose a technical solution for creating data accounts.
  • By further expanding the account types supported by the blockchain it can expand the business of maintaining smart contracts deployed on the blockchain for contract calculations.
  • the data account of the data realizes the separation of the contract code of the smart contract and the business data required for the smart contract to perform contract calculations.
  • the blockchain node in the blockchain can respond to the received data account creation transaction, and perform the business required for contract calculation based on the smart contract deployed on the blockchain in the data account creation transaction.
  • Data create a data account on the blockchain, that is, add the business data to the created data account for maintenance.
  • the blockchain nodes in the above-mentioned blockchain can receive data account creation transactions.
  • the above-mentioned data account creation transaction can be used to create a data account corresponding to the above-mentioned smart contract, that is, the created data account is used to maintain the business data required for the smart contract to perform contract calculations.
  • the data account creation transaction may include the business data.
  • the above-mentioned blockchain node When the above-mentioned blockchain node receives the above-mentioned data account creation transaction, it can respond to the data account creation transaction and create a data account on the above-mentioned blockchain.
  • the above-mentioned blockchain node can add the business data in the above-mentioned data account creation transaction to the data account for maintenance. From this, a data account can be created for maintaining the business data required for contract calculations by the above smart contract.
  • the contract code of the smart contract can be separated from the business data required for contract calculation by the smart contract, so that the following purposes can be achieved: First, only the contract of the smart contract needs to be maintained in the contract account corresponding to the smart contract. code, so smart contracts with complex business logic can be split into multiple simpler sub-contracts, reducing the costs of smart contract development, testing, upgrades, etc.; Second, users registered in the blockchain User accounts, as well as contract accounts corresponding to smart contracts deployed on the blockchain, can directly access business data maintained in data accounts created on the blockchain. That is, data accounts can be used to implement user accounts and contract accounts.
  • Data sharing saves the execution overhead of smart contracts, enables parallel access to business data, and improves the transaction throughput of the blockchain; third, centralized maintenance of business data by data accounts can realize the assetization of business data and facilitate the acquisition of large amounts of data.
  • Business data is processed for data analysis, AI training, etc.
  • FIG. 3 is a flow chart of a method for creating a data account according to an exemplary embodiment of this specification.
  • the account types supported by the blockchain can be further expanded to expand a new account type that is independent of user accounts and contract accounts, called data accounts. That is, the account types supported by the blockchain can include user accounts, contract accounts and data accounts.
  • the business data required for contract calculations of smart contracts deployed on the above-mentioned blockchain can be maintained.
  • the contract code of the smart contract can be separated from the business data required for contract calculation by the smart contract.
  • the above data account creation method can be applied to blockchain nodes, including the following steps:
  • Step 302 Receive a data account creation transaction used to create the data account; wherein the data account creation transaction includes business data required for contract calculation by the smart contract deployed on the blockchain.
  • Step 304 In response to the data account creation transaction, create a data account on the blockchain.
  • Step 306 Add the business data to the data account for maintenance.
  • the manager corresponding to the data account to be created can initiate a data account creation transaction.
  • the above-mentioned management party can perform the operation of initiating the above-mentioned data account creation transaction through its corresponding client.
  • the client detects this operation, it can construct the data account creation transaction according to the standard transaction format supported by the above-mentioned blockchain, and publish the data account creation transaction to the blockchain.
  • the data account creation transaction can be received by the blockchain nodes in the blockchain.
  • the above-mentioned manager can be the owner of the above-mentioned smart contract (for example: the smart contract can implement the business logic of a certain enterprise, in which case the manager can be the enterprise), or can be the data to be created
  • the owner of the account for example: the data account can be used to maintain business data of a certain enterprise, in which case the manager can be the enterprise).
  • the above-mentioned data account creation transaction can be used to create a data account corresponding to the above-mentioned smart contract, that is, the created data account can be used to maintain the business data required for contract calculation by the smart contract.
  • the data account creation transaction may include business data required by the smart contract for contract calculations.
  • the above-mentioned blockchain node When the above-mentioned blockchain node receives the above-mentioned data account creation transaction, it can respond to the data account creation transaction and create a data account on the above-mentioned blockchain.
  • the above-mentioned blockchain node can add the business data in the above-mentioned data account creation transaction to the data account for maintenance. From this, a data account can be created for maintaining the business data required for contract calculations by the above smart contract.
  • the business data maintained in the data account can be organized into the form of a Merkle tree and stored in a local database carried by the blockchain node.
  • the account structure of the data account may include a data storage field used to maintain the Hash value of the root node of the Merkle tree, in which the business data required for contract calculation by the smart contract deployed on the blockchain is written.
  • the aforementioned adding the business data in the above-mentioned data account creation transaction to the above-mentioned data account for maintenance may specifically include writing the business data in the above-mentioned data account creation transaction into the local database carried by the above-mentioned blockchain node.
  • FIG. 4 is a schematic diagram of the account structure of a data account according to an exemplary embodiment of this specification.
  • the account structure of the above data account may specifically include a Storage field.
  • the Storage field can be used to maintain the Hash value of the root node of the Merkle tree, which is also called the StorageRoot field.
  • the business data required for smart contract calculations is written in the Merkle tree.
  • the storage content of the contract account may no longer include the business data required by the smart contract for contract calculations, but an independent data account maintains the business data required by the smart contract for contract calculations.
  • the contract code of the smart contract can be separated from the business data required for contract calculation by the smart contract.
  • the business data required for contract calculation by the smart contract deployed on the above-mentioned blockchain may include business data content and data access code corresponding to the business data content.
  • the aforementioned business data in the above-mentioned data account creation transaction is written into the Merkle tree stored in the local database carried by the above-mentioned blockchain node to update the Merkle tree, and the updated Merkle tree
  • the hash value of the root node is filled into the data storage field in the above-mentioned data account.
  • it may include writing the corresponding relationship between the business data content and the data access code in the data account creation transaction into the Merkle tree to conduct the Merkle tree Update, and fill the hash value of the updated root node of the Merkle tree into the data storage field in the data account.
  • the data storage field in the data account can be used to maintain the Hash value of the root node of the Merkle tree, which contains the business data content required for contract calculation by the smart contract deployed on the blockchain, and The corresponding relationship between the data access code corresponding to the business data content.
  • the Storage field in the account structure of the data account shown in Figure 4 can be used to maintain the Hash value of the root node of the Merkle tree, which can also be called the StorageRoot field.
  • the smart contract is written in the Merkle tree.
  • the Storage field can be regarded as including the Data field and the corresponding Data Access Code field.
  • the Data field can be regarded as the hash value of the root node of the Merkle tree used to maintain the business data content required for contract calculation in the smart contract
  • the Data Access Code field can be regarded as used to maintain the written content related to the business.
  • the corresponding data access code may include an interface code for reading/writing the business data content. That is, by calling the data access code, the content of the business data can be read/written.
  • the above-mentioned data account creation transaction may also include data description information corresponding to the business data required for the above-mentioned smart contract to perform contract calculations.
  • the account structure of the data account may also include a data description field used to maintain the Hash value of the data description information, which corresponds to the business data required for contract calculations by smart contracts deployed on the blockchain.
  • the above-mentioned blockchain node can also calculate the hash value of the data description information corresponding to the above-mentioned business data in the above-mentioned data account creation transaction, and fill the calculated hash value into The data description field in this data account.
  • the account structure of the data account shown in Figure 4 may specifically include a SchemaHash field and a Storage field.
  • the Storage field can be used to maintain the Hash value of the root node of the Merkle tree, which is also called the StorageRoot field.
  • the business data required for smart contract calculations is written in the Merkle tree.
  • the SchemaHash field can be used to maintain the Hash value of the data description information corresponding to the business data.
  • the account structure of the above-mentioned data account may also include any one or more fields shown below: an account identification field used to maintain the account identification of the data account; The balance field of the balance of the assets held by the data account; the management field used to maintain the public key of the administrator of the data account.
  • the account structure of the data account shown in Figure 4 may specifically include an Identity field, a Balance field, an AuthMap field, a SchemaHash field, and a Storage field.
  • the Identity field can be used to maintain the account identification of the data account.
  • the Balance field can be used to maintain the balance of assets held by the data account.
  • the AuthMap field can be used to maintain the public key of the administrator of the data account.
  • management field can be specifically used to maintain the corresponding relationship between the public key of at least one manager of the data account and the weight assigned to the public key of the at least one manager.
  • the aforementioned user accounts and contract accounts can access the data account to obtain the business data maintained in the data account, so that certain operations can be performed based on the business data. processing.
  • user accounts and contract accounts can be accessed for the data account. Permission control.
  • the account structure of the data account may include an authorization field for maintaining access authorization information corresponding to the data account.
  • Figure 5 is a flow chart of a data account access authorization method according to an exemplary embodiment of this specification.
  • the access authorization method for the above data account may include the following steps:
  • Step 502 Receive a data account authorization transaction for the data account initiated by the manager corresponding to the data account; wherein the data account authorization transaction includes the account identification of the target account, and the authorization for the target account. Access permission information of the data account.
  • Step 504 In response to the data account authorization transaction, determine whether the manager has management authority corresponding to the data account.
  • Step 506 If the manager has the management authority corresponding to the data account, fill in the corresponding relationship between the account ID of the target account and the access authority information as the access authorization information corresponding to the data account. to the authorization field in said data account.
  • the manager corresponding to the data account can initiate a data account authorization transaction for the data account.
  • the blockchain node in the blockchain can receive the data account authorization transaction.
  • the above-mentioned data account authorization transaction may include the account identification of the target account that can be authorized with access rights to the above-mentioned data account, and the access rights information for the data account authorized to the target account.
  • the above-mentioned blockchain node When the above-mentioned blockchain node receives the above-mentioned data account authorization transaction, it can respond to the data account authorization transaction and determine whether the above-mentioned manager who initiated the data account authorization transaction has the management authority corresponding to the above-mentioned data account.
  • the above-mentioned manager has the management authority corresponding to the above-mentioned data account, the corresponding relationship between the account ID of the above-mentioned target account and the above-mentioned access permission information can be filled in the data account as the access authorization information corresponding to the data account.
  • Authorization field If the above-mentioned manager has the management authority corresponding to the above-mentioned data account, the corresponding relationship between the account ID of the above-mentioned target account and the above-mentioned access permission information can be filled in the data account as the access authorization information corresponding to the data account. Authorization field.
  • the access authorization information corresponding to the data account may include a correspondence between the account identification of at least one target account and the access rights information for the data account authorized to the at least one target account, An access authorization list (also called an access control list, Access Control List, ACL). It should be noted that the account ID of the at least one target account and the access permission information for the data account authorized to the at least one target account are in one-to-one correspondence.
  • the corresponding relationship between the account identification of the target account and the access permission information for a certain data account authorized to the target account can be determined through the key-value key.
  • the key in the key-value pair can be the account ID of the target account
  • the value can be the access permission information authorized to the target account for the data account.
  • the above-mentioned access authorization list may be a Map list composed of key-value pairs corresponding to the above-mentioned at least one target account; the key in the key-value pair in the Map list is the account of the at least one target account.
  • Identification, value is the access permission information for the data account authorized to the at least one target account.
  • the above access permission information may specifically be an access certificate (Access Certificate, AC).
  • the specific contents stored in the above access authorization list may be the account ID of at least one target account, and the number authorized to the at least one target account. The corresponding relationship between the Hash values of the access permission information of the data account.
  • the account structure of the data account shown in Figure 4 may specifically include an Identity field, a Balance field, an AuthMap field, an ACL field, a SchemaHash field, and a Storage field.
  • the ACL field can be used to maintain access authorization information corresponding to the data account (for example: access authorization list).
  • the target account may include a user account registered in the blockchain; or a contract account corresponding to a smart contract deployed on the blockchain.
  • Figure 6 is a flow chart of another data account access authorization method according to an exemplary embodiment of this specification.
  • the access authorization method for the above data account may include the following steps:
  • Step 602 Receive a data account authorization transaction for the data account initiated by the manager corresponding to the data account; wherein the data account authorization transaction includes the account identification of the user account registered by the user in the blockchain , and the access permission information authorized to the user account for the data account.
  • Step 604 In response to the data account authorization transaction, determine whether the manager has management authority corresponding to the data account.
  • Step 606 If the manager has the management authority corresponding to the data account, fill in the corresponding relationship between the account ID of the user account and the access authority information as the access authorization information corresponding to the data account. to the authorization field in said data account.
  • steps 602 to 606 For the specific implementation of steps 602 to 606, reference can be made to steps 502 to 506, which will not be described again in this specification.
  • FIG. 7 is a flow chart of another data account access authorization method according to an exemplary embodiment of this specification.
  • the access authorization method for the above data account may include the following steps:
  • Step 702 Receive a data account authorization transaction for the data account initiated by the administrator corresponding to the user account registered in the blockchain; wherein the data account authorization transaction includes the account identification of the user account , and the access permission information authorized to the user account for the data account.
  • Step 704 In response to the data account authorization transaction, determine whether the manager has management authority corresponding to the data account.
  • Step 706 If the administrator has management rights corresponding to the data account, generate an approval event corresponding to the access rights authorized to the user account for the data account, so that the access rights corresponding to the data account are generated.
  • the manager approves the access rights authorized to the user account for the data account, and returns the approval result.
  • Step 708 In response to the received approval result, when the approval result indicates that the approval is passed, use the corresponding relationship between the account ID of the user account and the access permission information as the access authorization corresponding to the data account. information to populate the authorization fields in said data account.
  • the manager corresponding to any user account registered by the user in the blockchain can also initiate a data account authorization transaction for the data account.
  • the blockchain node in the blockchain can receive the data account authorization transaction.
  • the above-mentioned data account authorization transaction may include the account identification of the above-mentioned user account, and the access rights information authorized to the above-mentioned user account for the above-mentioned data account.
  • the above-mentioned blockchain node When the above-mentioned blockchain node receives the above-mentioned data account authorization transaction, it can respond to the data account authorization transaction and determine whether the above-mentioned manager who initiated the data account authorization transaction has the management authority corresponding to the above-mentioned user account.
  • the above-mentioned administrator can generate an approval event corresponding to the access rights authorized to the user account for the above-mentioned data account, and publish the approval event to the above-mentioned blockchain, thereby enabling
  • the manager corresponding to the data account can obtain the approval event from the blockchain, approve the access rights authorized to the user account for the data account accordingly, and return the approval result.
  • the above-mentioned blockchain node When the above-mentioned blockchain node receives the above-mentioned approval result, it may respond to the approval result, and when the approval result indicates that the approval is passed, the corresponding relationship between the account identification of the above-mentioned user account and the above-mentioned access permission information shall be used as the corresponding relationship with the above-mentioned
  • the access authorization information corresponding to the data account is filled in the authorization field in the data account.
  • the corresponding public and private key pair can be assigned to the user account. That is, the manager corresponding to the user account can hold the public-private key pair, the private key can be used to sign transactions initiated by the manager, and the public key can be used to verify the signature. Public keys can be broadcast in the blockchain.
  • the account structure of the above-mentioned data account also includes a management field for maintaining the public key of the manager of the data account, when determining whether the manager who initiated the above-mentioned data account authorization transaction
  • you have the management authority corresponding to the above data account you can specifically determine whether the public key of the manager matches the public key of the manager of the data account maintained in the management field. If so, you can determine that the manager has the same The management permissions corresponding to this data account.
  • the above-mentioned management field can be specifically used to maintain the corresponding relationship between the public key of at least one manager of the data account and the weight assigned to the public key of the at least one manager.
  • the public key of the manager who initiated the above-mentioned data account authorization transaction matches the public key of the manager of the data account maintained in the management field, it may be specifically based on the public key maintained in the management field.
  • Correspondence relationship determine whether the weight corresponding to the public key of the manager reaches a preset threshold, and if so, it can be determined that the public key of the manager matches the public key of the manager of the data account.
  • the data account authorization transaction can be signed based on the private key of the manager who initiated the above data account authorization transaction.
  • the public key of the manager can be determined first, and then the signature is verified based on the public key of the manager. If the verification is passed, a response can be made.
  • the account structure of the user account may also include a management field used to maintain the public key of the administrator of the user account.
  • the public key of the manager and the management of the user account maintained in the management field may also be determined. Whether the party's public key matches, if so, it can be determined that the manager has the management rights corresponding to the user account.
  • a method similar to the access authorization method of the data account shown in Figure 6 or 7 can also be used to perform all or all access authorization information corresponding to the data account maintained in the authorization field in the above data account. Partial update; or, revoke all or part of the authorization for the access authorization information corresponding to the data account maintained in the authorization field in the above-mentioned data account (for example: delete or mark the authorization as revoked).
  • Figure 8 is a flow chart of a data account access method according to an exemplary embodiment of this specification.
  • the above data account access method may include the following steps:
  • Step 802 Receive the data account access transaction from the user account for the data account; wherein the data account access transaction includes the data identification of the target data to be accessed, and the data account authorized to the user account for the data account. access rights information.
  • Step 804 In response to the data account access transaction, determine whether the access permission information in the data account access transaction matches the access authorization information corresponding to the data account maintained in the authorization field in the data account.
  • Step 806 If the access permission information matches the access authorization information corresponding to the data account, determine that the user account has the access permission of the data account, and search the business data maintained in the data account. The data identifies the corresponding target data.
  • the blockchain node in the above-mentioned blockchain can receive the data account access transaction of any user account for the data account.
  • the above-mentioned data account access transaction may include the data identification of the data to be accessed (which may be called target data), and the access permission information authorized to the above-mentioned user account for the data account.
  • the above-mentioned blockchain node When the above-mentioned blockchain node receives the above-mentioned data account access transaction, it can respond to the data account access transaction and determine whether the access permission information in the data account access transaction is consistent with the authorization field maintained in the data account. Whether the access authorization information corresponding to the data account matches.
  • the two match it can be determined that the above-mentioned user account has access rights to the above-mentioned data account, so that the above-mentioned target data corresponding to the data identifier in the above-mentioned data account access transaction can be found in the business data maintained in the data account.
  • the access authorization information corresponding to the data account may include the corresponding relationship between the account identification of at least one target account and the access permission information authorized to the at least one target account for the data account, the access authorization list is shown in In an implementation manner, the above-mentioned data account access transaction may also include the account identification of the above-mentioned user account.
  • the specific method may first be based on the information in the data account.
  • the access authorization list maintained in the authorization field looks for the access permission information corresponding to the account ID of the user account, and then determines whether the access permission information in the data account access transaction matches the found access permission information. If so, then It can be determined that the access permission information matches the access authorization information corresponding to the data account.
  • the data identifier of the target data may include the key of the target data.
  • the above Merkle stored in the local database carried by the above blockchain node can be used.
  • search for the value corresponding to the key of the target data and determine the found value as the target data.
  • the above-mentioned access permission information may also include a validity period, and a data identification set of data authorized to the above-mentioned user account access permission.
  • the access permission information when it is determined that the access permission information matches the access authorization information corresponding to the data account, it can also be determined based on the limited period in the access permission information whether the access permission information is valid. If so, then It may be further determined whether the above-mentioned data identification set in the access permission information includes the data identification of the above-mentioned target data, and if so, it may be determined that the above-mentioned user account has the access permission for the data account.
  • Figure 9 is a flow chart of another data account access authorization method according to an exemplary embodiment of this specification.
  • the access authorization method for the above data account may include the following steps:
  • Step 902 Receive a data account authorization transaction for the data account initiated by the manager corresponding to the data account; wherein, the data account authorization transaction includes a contract account corresponding to the smart contract deployed on the blockchain The account identification, and the access permission information authorized to the contract account for the data account.
  • Step 904 In response to the data account authorization transaction, determine whether the manager has management authority corresponding to the data account.
  • Step 906 If the manager has the management authority corresponding to the data account, fill in the corresponding relationship between the account ID of the contract account and the access authority information as the access authorization information corresponding to the data account. to the authorization field in said data account.
  • steps 902 to 906 For the specific implementation of steps 902 to 906, reference can be made to steps 502 to 506, which will not be described again in this specification.
  • FIG. 10 is a flow chart of another data account access authorization method according to an exemplary embodiment of this specification.
  • the access authorization method for the above data account may include the following steps:
  • Step 1002 Receive a data account authorization transaction for the data account initiated by the manager corresponding to the contract account corresponding to the smart contract deployed on the blockchain; wherein the data account authorization transaction includes the data account authorization transaction of the contract account. Account identification, and access permission information for the data account authorized to the contract account.
  • Step 1004 In response to the data account authorization transaction, determine whether the manager has management authority corresponding to the contract account.
  • Step 1006 If the management party has management rights corresponding to the contract account, generate an approval event corresponding to the access rights authorized to the contract account for the data account, so that the access rights corresponding to the data account are generated. When the management party obtains the approval event, it approves the access rights authorized to the contract account for the data account, and returns the approval result.
  • Step 1008 In response to the received approval result, when the approval result indicates that the approval is passed, use the corresponding relationship between the account identification of the contract account and the access permission information as the access authorization corresponding to the data account. information to populate the authorization fields in said data account.
  • the manager corresponding to any contract account corresponding to the smart contract deployed on the blockchain can also initiate a data account authorization transaction for the data account.
  • the blockchain node in the blockchain can receive the data account authorization transaction.
  • the above-mentioned data account authorization transaction may include the account identification of the above-mentioned contract account, and the access permission information authorized to the contract account for the above-mentioned data account.
  • the above-mentioned blockchain node When the above-mentioned blockchain node receives the above-mentioned data account authorization transaction, it can respond to the data account authorization transaction and determine whether the above-mentioned manager who initiated the data account authorization transaction has the management authority corresponding to the above-mentioned contract account.
  • the above-mentioned manager can generate an approval event corresponding to the access rights authorized to the contract account for the above-mentioned data account, and publish the approval event to the above-mentioned blockchain, thereby enabling The manager corresponding to the data account can obtain the approval event from the blockchain, approve the access rights authorized to the contract account for the data account accordingly, and return the approval results.
  • the above-mentioned blockchain node When the above-mentioned blockchain node receives the above-mentioned approval result, it may respond to the approval result and, when the approval result indicates that the approval is passed, use the corresponding relationship between the account identification of the above-mentioned contract account and the above-mentioned access permission information as the corresponding relationship with the above-mentioned
  • the access authorization information corresponding to the data account is filled in the authorization field in the data account.
  • the corresponding public and private key pair can be assigned to the contract account corresponding to the smart contract. That is, the manager corresponding to the contract account can hold the public-private key pair, the private key can be used to sign transactions initiated by the manager, and the public key can be used to verify the signature. Public keys can be broadcast in the blockchain.
  • the account structure of the above-mentioned data account also includes a management field for maintaining the public key of the manager of the data account, when determining whether the manager who initiated the above-mentioned data account authorization transaction
  • you have the management authority corresponding to the above data account you can specifically determine whether the public key of the manager matches the public key of the manager of the data account maintained in the management field. If so, you can determine that the manager has the same The management permissions corresponding to this data account.
  • the above-mentioned management field can be specifically used to maintain the corresponding relationship between the public key of at least one manager of the data account and the weight assigned to the public key of the at least one manager.
  • the public key of the manager who initiated the above-mentioned data account authorization transaction matches the public key of the manager of the data account maintained in the management field, it may be specifically based on the public key maintained in the management field.
  • Correspondence relationship determine whether the weight corresponding to the public key of the manager reaches a preset threshold, and if so, it can be determined that the public key of the manager matches the public key of the manager of the data account.
  • the data account authorization transaction can be signed based on the private key of the manager who initiated the above data account authorization transaction.
  • the public key of the manager can be determined first, and then the signature is verified based on the public key of the manager. If the verification is passed, a response can be made.
  • the account structure of the above-mentioned contract account may also include a management field used to maintain the public key of the manager of the contract account.
  • a management field used to maintain the public key of the manager of the contract account.
  • a method similar to the access authorization method of the data account shown in Figure 6 or 7 can also be used to perform all or all access authorization information corresponding to the data account maintained in the authorization field in the above data account. Partial update; or, revoke all or part of the authorization for the access authorization information corresponding to the data account maintained in the authorization field in the above-mentioned data account (for example: delete or mark the authorization as revoked).
  • Figure 11 is a flow chart of a data account access method according to an exemplary embodiment of this specification.
  • the above data account access method may include the following steps:
  • Step 1102 Receive the data account access transaction from the contract account for the data account; wherein the data account access transaction includes the data identification of the target data to be accessed, and the data account authorized to the contract account for the data account. access rights information.
  • Step 1104 In response to the data account access transaction, determine whether the access permission information in the data account access transaction matches the access authorization information corresponding to the data account maintained in the authorization field in the data account.
  • Step 1106 If the access permission information matches the access authorization information corresponding to the data account, determine that the contract account has the access permission of the data account, and search the business data maintained in the data account. The data identifies the corresponding target data.
  • the blockchain node in the above-mentioned blockchain can receive the data account access transaction of any contract account for the data account.
  • the above-mentioned data account access transaction may include the data identification of the data to be accessed (which may be called target data), and the access permission information authorized to the above-mentioned contract account for the data account.
  • the above-mentioned blockchain node When the above-mentioned blockchain node receives the above-mentioned data account access transaction, it can respond to the data account access transaction and determine whether the access permission information in the data account access transaction is consistent with the authorization field maintained in the data account. Whether the access authorization information corresponding to the data account matches.
  • the two match it can be determined that the above-mentioned contract account has access rights to the above-mentioned data account, so that the above-mentioned target data corresponding to the data identification in the above-mentioned data account access transaction can be found in the business data maintained in the data account.
  • the access authorization information corresponding to the data account may include the corresponding relationship between the account identification of at least one target account and the access permission information authorized to the at least one target account for the data account, the access authorization list is shown in In an implementation manner, the above-mentioned data account access transaction may also include the account identification of the above-mentioned contract account.
  • the specific method may first be based on the information in the data account. Use the access authorization list maintained in the authorization field to find the access permission information corresponding to the account ID of the contract account, and then determine whether the access permission information in the data account access transaction matches the found access permission information. If so, then It can be determined that the access permission information matches the access authorization information corresponding to the data account.
  • the data identifier of the target data may include the key of the target data.
  • the above Merkle stored in the local database carried by the above blockchain node can be used.
  • search for the value corresponding to the key of the target data and determine the found value as the target data.
  • the above-mentioned access permission information may also include a validity period, and a data identification set of data authorized to the above-mentioned contract account access permission.
  • the access permission information when it is determined that the access permission information matches the access authorization information corresponding to the data account, it can also be determined based on the limited period in the access permission information whether the access permission information is valid. If so, then It can be further determined whether the above-mentioned data identification set in the access permission information includes the data identification of the above-mentioned target data, and if so, it can be determined that the above-mentioned contract account has the access permission of the data account.
  • the business data required for contract calculations by smart contracts deployed on the blockchain usually changes based on changes in actual conditions.
  • Figure 12 is a flow chart of a data account update method shown in an exemplary embodiment of this specification. picture.
  • the above data account update method may include the following steps:
  • Step 1202 Receive a data account update transaction for the data account initiated by the manager corresponding to the data account; wherein the data account update transaction includes the updated business data.
  • Step 1204 In response to the data account update transaction, determine whether the manager has management authority corresponding to the data account.
  • Step 1206 If the management party has the management authority corresponding to the data account, write the updated business data into the Merkle tree stored in the local database to update the Merkle tree.
  • the business data that has been written is updated, and the Hash value of the root node of the updated Merkle tree is filled into the data storage field in the data account.
  • the manager corresponding to the data account can initiate a data account update transaction for the data account.
  • the data account update transaction can be received by the blockchain nodes in the blockchain.
  • the above data account update transaction can include the updated business data.
  • the above-mentioned blockchain node When the above-mentioned blockchain node receives the above-mentioned data account update transaction, it may respond to the data account update transaction and determine whether the above-mentioned manager who initiated the data account update transaction has the management authority corresponding to the above-mentioned data account.
  • the above-mentioned manager has the management authority corresponding to the above-mentioned data account, the above-mentioned business data maintained in the data account can be updated based on the above-mentioned updated business data.
  • the updated above-mentioned business data can be written into the Merkle tree. tree to update the business data that has been written on the Merkle tree, and fill the hash value of the root node of the updated Merkle tree into the data storage field in the data account. Therefore, the data maintained in the data storage field in the data account can be updated from the hash value of the root node of the Merkle tree in which the original business data is written to the Merkle tree in which the updated business data is written.
  • the Hash value of the root node can be updated from the hash value of the root node of the Merkle tree in which the original business data is written to the Merkle tree in which the updated business data is written.
  • the above-mentioned data account update transaction may also include data description information corresponding to the updated above-mentioned business data.
  • the data maintained in the data description field in the above-mentioned data account can also be replaced by the data description information corresponding to the original business data.
  • the Hash value is updated to the Hash value of the data description information corresponding to the updated business data.
  • the native transaction types supported by the blockchain can be expanded to extend native transactions with new functions in the blockchain. It should be noted that the expanded native transaction with new functions can specifically be a native transaction that is independent of transfer transactions or smart contract call transactions.
  • the native transaction types supported by the blockchain can be extended to extend a native transaction for creating a data account in the blockchain, which can be called a data account creation transaction. .
  • a data account creation transaction dedicated to creating a data account can be extended based on the transfer transactions it supports; while for a blockchain using the account model, In other words, based on the transfer transactions, smart contract creation transactions and smart contract call transactions it supports, a data account creation transaction dedicated to creating data accounts can be expanded.
  • the native transaction types supported by the blockchain can be expanded to extend a native transaction in the blockchain for updating the business data maintained in the data account, which can be called a data account. Update transaction.
  • the native transaction types supported by the blockchain can be expanded to include a native transaction for authorizing access to the data account in the blockchain, which can be called a data account authorization transaction.
  • the native transaction types supported by the blockchain can be expanded to extend a native transaction for accessing the data account in the blockchain, which can be called a data account access transaction.
  • the transaction formats of the above-mentioned data account creation transactions, the above-mentioned data account update transactions, the above-mentioned data account authorization transactions, and the above-mentioned data account access transactions are not specifically limited in this manual; in practical applications, compatible blockchain current transactions can be used. Some transaction formats can also be redefined into new transaction formats.
  • FIG. 13 is a schematic diagram of the hardware structure of a device according to an exemplary embodiment of this specification.
  • the above-mentioned equipment includes a processor 1302, an internal bus 1304, a network interface 1306, a memory 1308, and a non-volatile memory 1310.
  • a processor 1302 reads the corresponding computer program from the non-volatile memory 1310 into the memory 1308 and then runs it.
  • the processor 1302 reads the corresponding computer program from the non-volatile memory 1310 into the memory 1308 and then runs it.
  • one or more embodiments of this specification do not exclude other implementations, such as logic devices or a combination of software and hardware, etc. That is to say, the execution subject of the following processing flow is not limited to each Logic modules can also be hardware or logic devices.
  • FIG. 14 is a block diagram of a data account creation device according to an exemplary embodiment of this specification.
  • the above-mentioned data account creation device can be applied to the device shown in Figure 13 to implement the technical solution of this specification.
  • the device can be used as a blockchain node in the blockchain; the account types supported by the blockchain include data accounts; the data account is used to maintain the smart contracts deployed on the blockchain required for contract calculations.
  • Business data; the data account creation device may include:
  • the receiving module 1402 receives a data account creation transaction used to create the data account; wherein the data account creation transaction includes business data required for contract calculation by smart contracts deployed on the blockchain;
  • the creation module 1404 creates a data account on the blockchain in response to the data account creation transaction; and adds the business data to the data account for maintenance.
  • the business data maintained in the data account is organized into the form of a Merkle tree and stored in the local database carried by the blockchain node;
  • the account structure of the data account includes a method for maintaining the The data storage field of the Hash value of the root node of the Merkel tree;
  • the creation module 1404 is a first module 1404:
  • the service data includes service data content and a data access code corresponding to the service data content
  • the creation module 1404 is a first module 1404:
  • the data access code includes interface code for reading and writing business data content.
  • the data account creation transaction also includes data description information corresponding to the business data;
  • the account structure of the data account also includes a data description field used to maintain the Hash value of the data description information;
  • the device also includes:
  • the calculation module calculates the hash value of the data description information corresponding to the business data in the data account creation transaction, and fills the calculated hash value into the data description field in the data account.
  • the device also includes:
  • the second receiving module receives a data account update transaction for the data account initiated by the manager corresponding to the data account; wherein the data account update transaction includes the updated business data;
  • a second determination module in response to the data account update transaction, determines whether the manager has management authority corresponding to the data account
  • Update module if the management party has the management authority corresponding to the data account, writes the updated business data into the Merkle tree stored in the local database to update the Merkle tree
  • the business data that has been written is updated, and the Hash value of the root node of the updated Merkle tree is filled into the data storage field in the data account.
  • the account structure of the data account includes an authorization field used to maintain access authorization information corresponding to the data account;
  • the device also includes:
  • the third receiving module receives a data account authorization transaction for the data account initiated by the manager corresponding to the data account; wherein the data account authorization transaction includes the account identification of the target account, and authorization to the target account access permission information for the data account;
  • a third determination module in response to the data account authorization transaction, determines whether the manager has management authority corresponding to the data account;
  • the authorization module if the manager has the management authority corresponding to the data account, fills in the corresponding relationship between the account identification of the target account and the access authority information as the access authorization information corresponding to the data account. to the authorization field in said data account.
  • the access authorization information corresponding to the data account includes an access authorization consisting of the account identification of at least one target account and the corresponding relationship of the access permission information authorized to the at least one target account for the data account. list.
  • the corresponding relationship is a key-value pair
  • the access authorization list is a Map list composed of key-value pairs corresponding to the at least one target account
  • the key-value key The key of the value pair is the account identifier of the at least one target account
  • the value of the key-value pair is the access permission information for the data account authorized to the at least one target account.
  • the target account includes a user account registered by the user in the blockchain; or a contract account corresponding to a smart contract deployed on the blockchain.
  • the account structure of the data account also includes any one or more fields shown below:
  • an account identification field used to maintain the account identification of the data account
  • a management field used to maintain the public key of the administrator of the data account.
  • the data account creation transaction is a native transaction supported by the blockchain for creating a data account
  • the data account authorization transaction is a transaction supported by the blockchain for accessing the data account.
  • Authorized native transactions are a native transaction supported by the blockchain for creating a data account.
  • the device embodiment basically corresponds to the method embodiment, so for relevant details, please refer to the partial description of the method embodiment.
  • the device embodiments described above are only illustrative.
  • the modules described as separate components may or may not be physically separated.
  • the components shown as modules may or may not be physical modules, that is, they may be located in One place, or it can be distributed to multiple network modules. Some or all of the modules can be selected according to actual needs to achieve the purpose of the technical solution in this specification.
  • a typical implementation device is a computer, which may be in the form of a personal computer, a laptop, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email transceiver, or a game controller. desktop, tablet, wearable device, or a combination of any of these devices.
  • a computer includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
  • processors CPUs
  • input/output interfaces network interfaces
  • memory volatile and non-volatile memory
  • Memory may include non-permanent storage in computer-readable media, random access memory (RAM) and/or non-volatile memory in the form of read-only memory (ROM) or flash memory (flash RAM). Memory is an example of computer-readable media.
  • RAM random access memory
  • ROM read-only memory
  • flash RAM flash random access memory
  • Computer-readable media includes both persistent and non-volatile, removable and non-removable media that can be implemented by any method or technology for storage of information.
  • Information may be computer-readable instructions, data structures, modules of programs, or other data.
  • Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, Magnetic tape cartridges, magnetic disk storage, quantum memory, graphene-based storage media or other magnetic storage devices, or any other non-transmission medium, can be used to store information that can be accessed by computing devices.
  • computer-readable media does not include transient computer-readable media (transitory media), such as modulated data signals and carrier waves.
  • first, second, third, etc. may use the terms first, second, third, etc. to describe various information, the information should not be limited to these terms. These terms are only used to distinguish information of the same type from each other.
  • first information may also be called second information, and similarly, the second information may also be called first information.
  • word “if” as used herein may be interpreted as "when” or “when” or “in response to determining.”

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Databases & Information Systems (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Hardware Design (AREA)
  • Health & Medical Sciences (AREA)
  • Bioethics (AREA)
  • General Health & Medical Sciences (AREA)
  • Data Mining & Analysis (AREA)
  • Automation & Control Theory (AREA)
  • Computing Systems (AREA)
  • Financial Or Insurance-Related Operations Such As Payment And Settlement (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

Provided in one or more embodiments of the present specification are a data account creation method and apparatus, which are applied to a blockchain node, wherein an account type supported by a blockchain comprises a data account, and the data account is used for maintaining service data required for performing contract calculations by a smart contract deployed on the blockchain. The method comprises: receiving a data account creation transaction, which is used for creating a data account, wherein the data account creation transaction comprises service data required to perform contract calculations by a smart contract deployed on a blockchain; in response to the data account creation transaction, creating the data account on the blockchain; and adding the service data to the data account for maintenance.

Description

数据账户创建方法及装置Data account creation method and device
本申请要求于2022年07月29日提交中国专利局、申请号为202210911233.1、发明名称为“数据账户创建方法及装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims priority to the Chinese patent application filed with the China Patent Office on July 29, 2022, with the application number 202210911233.1 and the invention title "Data Account Creation Method and Device", the entire content of which is incorporated into this application by reference.
技术领域Technical field
本说明书一个或多个实施例涉及区块链领域,尤其涉及一种数据账户创建方法及装置。One or more embodiments of this specification relate to the field of blockchain, and in particular, to a method and device for creating a data account.
背景技术Background technique
智能合约的发明降低了区块链的应用门槛,联盟链的推出更是加快了企业对区块链的应用。然而,企业对区块链的应用面临着巨大的技术挑战,尤其在企业的业务逻辑日趋复杂,业务数据不断累积的情况下,由于现有的技术限制和性能瓶颈,通常需要由单个智能合约实现复杂的业务逻辑,该智能合约下也需要存储大量的业务数据。The invention of smart contracts has lowered the application threshold of blockchain, and the launch of alliance chain has accelerated the application of blockchain by enterprises. However, enterprises' application of blockchain faces huge technical challenges, especially when the enterprise's business logic becomes increasingly complex and business data continues to accumulate. Due to existing technical limitations and performance bottlenecks, it usually needs to be implemented by a single smart contract. Complex business logic requires a large amount of business data to be stored under this smart contract.
因此,通常会导致如下问题:第一,智能合约的代码量较大,甚至可能逼近用于执行智能合约的虚拟机的上限;第二,如果为了减小智能合约的代码量,将智能合约拆分为多个子合约,则需要在这多个子合约之间进行跨合约调用来执行业务,使业务的执行性能受到影响;第三,如果智能合约所实现的业务逻辑需要升级,则需要在区块链上部署新的智能合约,即需要将升级后的业务逻辑写入至新的智能合约,并将原先的智能合约中的业务数据拷贝至新的智能合约,使得新的智能合约兼容原先的智能合约中的业务数据。Therefore, the following problems usually result: First, the code amount of the smart contract is large, and may even approach the upper limit of the virtual machine used to execute the smart contract; second, if in order to reduce the code amount of the smart contract, the smart contract is split Divided into multiple sub-contracts, cross-contract calls need to be made between these multiple sub-contracts to execute the business, which will affect the execution performance of the business; thirdly, if the business logic implemented by the smart contract needs to be upgraded, it needs to be in the block To deploy a new smart contract on the chain, you need to write the upgraded business logic into the new smart contract, and copy the business data in the original smart contract to the new smart contract, so that the new smart contract is compatible with the original smart contract. Business data in the contract.
发明内容Contents of the invention
本说明书一个或多个实施例提供技术方案如下:One or more embodiments of this specification provide technical solutions as follows:
本说明书提供一种数据账户创建方法,应用于区块链节点;所述区块链支持的账户类型包括数据账户;所述数据账户用于维护所述区块链上部署的智能合约进行合约计算所需的业务数据;所述方法包括:This specification provides a method for creating a data account, which is applied to blockchain nodes; the account types supported by the blockchain include data accounts; the data account is used to maintain smart contracts deployed on the blockchain for contract calculations Required business data; the methods include:
接收用于创建所述数据账户的数据账户创建交易;其中,所述数据账户创建交易包括所述区块链上部署的智能合约进行合约计算所需的业务数据;Receive a data account creation transaction used to create the data account; wherein the data account creation transaction includes business data required for contract calculation by smart contracts deployed on the blockchain;
响应于所述数据账户创建交易,在所述区块链上创建数据账户;以及,creating a data account on the blockchain in response to the data account creation transaction; and,
将所述业务数据添加至所述数据账户进行维护。Add the business data to the data account for maintenance.
本说明书还提供一种数据账户创建装置,应用于区块链节点;所述区块链支持的账户类型包括数据账户;所述数据账户用于维护所述区块链上部署的智能合约进行合约计算所需的业务数据;所述装置包括:This specification also provides a data account creation device, which is applied to blockchain nodes; the account types supported by the blockchain include data accounts; the data account is used to maintain smart contracts deployed on the blockchain for contract execution Calculate the required business data; the device includes:
接收模块,接收用于创建所述数据账户的数据账户创建交易;其中,所述数据账户创建交易包括所述区块链上部署的智能合约进行合约计算所需的业务数据;A receiving module that receives a data account creation transaction used to create the data account; wherein the data account creation transaction includes business data required for contract calculation by smart contracts deployed on the blockchain;
创建模块,响应于所述数据账户创建交易,在所述区块链上创建数据账户;以及,将所述业务数据添加至所述数据账户进行维护。A creation module, in response to the data account creation transaction, creates a data account on the blockchain; and adds the business data to the data account for maintenance.
本说明书还提供一种电子设备,包括:This instruction manual also provides an electronic device, including:
处理器;processor;
用于存储处理器可执行指令的存储器;Memory used to store instructions executable by the processor;
其中,所述处理器通过运行所述可执行指令以实现如上述任一项所述方法的步骤。Wherein, the processor executes the steps of any of the above methods by running the executable instructions.
本说明书还提供一种计算机可读存储介质,其上存储有计算机指令,该指令被处理器执行时实现如上述任一项所述方法的步骤。This specification also provides a computer-readable storage medium on which computer instructions are stored. When the instructions are executed by a processor, the steps of any of the above methods are implemented.
在上述技术方案中,区块链中的区块链节点可以响应于接收到的数据账户创建交易,基于该数据账户创建交易中的该区块链上部署的智能合约进行合约计算所需的业务数据,在该区块链上创建数据账户, 即将该业务数据添加至所创建的该数据账户进行维护。In the above technical solution, the blockchain node in the blockchain can respond to the received data account creation transaction, and perform the business required for contract calculation based on the smart contract deployed on the blockchain in the data account creation transaction. Data, create a data account on the blockchain, that is, add the business data to the created data account for maintenance.
采用上述方式,可以将智能合约的合约代码与智能合约进行合约计算所需的业务数据分离开来,从而可以达到以下目的:第一,与智能合约对应的合约账户中仅需要维护智能合约的合约代码,因此可以将所实现的业务逻辑较为复杂的智能合约拆分成多个较为简单的子合约,降低智能合约的开发、测试、升级等的成本;第二,用户在区块链中注册的用户账户,以及与区块链上部署的智能合约对应的合约账户,均可以直接访问在区块链上创建的数据账户中维护的业务数据,即通过数据账户可以实现面向用户账户和合约账户的数据共享,节省智能合约的执行开销,实现对业务数据的并行访问,提高区块链的交易吞吐量;第三,由数据账户集中维护业务数据,可以实现业务数据的资产化,同时便于获取大量业务数据以进行数据分析、AI训练等处理。Using the above method, the contract code of the smart contract can be separated from the business data required for contract calculation by the smart contract, so that the following purposes can be achieved: First, only the contract of the smart contract needs to be maintained in the contract account corresponding to the smart contract. code, so smart contracts with complex business logic can be split into multiple simpler sub-contracts, reducing the costs of smart contract development, testing, upgrades, etc.; Second, users registered in the blockchain User accounts, as well as contract accounts corresponding to smart contracts deployed on the blockchain, can directly access business data maintained in data accounts created on the blockchain. That is, data accounts can be used to implement user accounts and contract accounts. Data sharing saves the execution overhead of smart contracts, enables parallel access to business data, and improves the transaction throughput of the blockchain; third, centralized maintenance of business data by data accounts can realize the assetization of business data and facilitate the acquisition of large amounts of data. Business data is processed for data analysis, AI training, etc.
附图说明Description of drawings
图1是一种用户账户的账户结构的示意图。Figure 1 is a schematic diagram of the account structure of a user account.
图2是一种合约账户的账户结构的示意图。Figure 2 is a schematic diagram of the account structure of a contract account.
图3是本说明书一示例性实施例示出的一种数据账户创建方法的流程图。Figure 3 is a flow chart of a method for creating a data account according to an exemplary embodiment of this specification.
图4是本说明书一示例性实施例示出的一种数据账户的账户结构的示意图。Figure 4 is a schematic diagram of the account structure of a data account according to an exemplary embodiment of this specification.
图5是本说明书一示例性实施例示出的一种数据账户的访问授权方法的流程图。Figure 5 is a flow chart of a data account access authorization method according to an exemplary embodiment of this specification.
图6是本说明书一示例性实施例示出的另一种数据账户的访问授权方法的流程图。FIG. 6 is a flow chart of another data account access authorization method according to an exemplary embodiment of this specification.
图7是本说明书一示例性实施例示出的另一种数据账户的访问授权方法的流程图。Figure 7 is a flow chart of another data account access authorization method according to an exemplary embodiment of this specification.
图8是本说明书一示例性实施例示出的一种数据账户访问方法的流程图。Figure 8 is a flow chart of a data account access method according to an exemplary embodiment of this specification.
图9是本说明书一示例性实施例示出的另一种数据账户的访问授权方法的流程图。Figure 9 is a flow chart of another data account access authorization method according to an exemplary embodiment of this specification.
图10是本说明书一示例性实施例示出的另一种数据账户的访问授权方法的流程图。FIG. 10 is a flow chart of another data account access authorization method according to an exemplary embodiment of this specification.
图11是本说明书一示例性实施例示出的另一种数据账户访问方法的流程图。Figure 11 is a flow chart of another data account access method according to an exemplary embodiment of this specification.
图12是本说明书一示例性实施例示出的一种数据账户更新方法的流程图。Figure 12 is a flow chart of a data account updating method according to an exemplary embodiment of this specification.
图13是本说明书一示例性实施例示出的一种设备的硬件结构的示意图。Figure 13 is a schematic diagram of the hardware structure of a device according to an exemplary embodiment of this specification.
图14是本说明书一示例性实施例示出的一种数据账户创建装置的框图。Figure 14 is a block diagram of a data account creation device illustrating an exemplary embodiment of this specification.
具体实施方式Detailed ways
这里将详细地对示例性实施例进行说明,其示例表示在附图中。下面的描述涉及附图时,除非另有表示,不同附图中的相同数字表示相同或相似的要素。以下示例性实施例中所描述的实施方式并不代表与本说明书一个或多个实施例相一致的所有实施方式。相反,它们仅是与如所附权利要求书中所详述的、本说明书一个或多个实施例的一些方面相一致的装置和方法的例子。Exemplary embodiments will be described in detail herein, examples of which are illustrated in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings refer to the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with one or more embodiments of this specification. Rather, they are merely examples of apparatus and methods consistent with some aspects of one or more embodiments of this specification as detailed in the appended claims.
需要说明的是:在其他实施例中并不一定按照本说明书示出和描述的顺序来执行相应方法的步骤。在一些其他实施例中,其方法所包括的步骤可以比本说明书所描述的更多或更少。此外,本说明书中所描述的单个步骤,在其他实施例中可能被分解为多个步骤进行描述;而本说明书中所描述的多个步骤,在其他实施例中也可能被合并为单个步骤进行描述。It should be noted that in other embodiments, the steps of the corresponding method are not necessarily performed in the order shown and described in this specification. In some other embodiments, methods may include more or fewer steps than described in this specification. In addition, a single step described in this specification may be broken down into multiple steps for description in other embodiments; and multiple steps described in this specification may also be combined into a single step in other embodiments. describe.
区块链一般被划分为三种类型:公有链(Public Blockchain)、私有链(Private Blockchain)和联盟链(Consortium Blockchain)。此外,还可以有上述多种类型的结合,比如私有链与联盟链的结合、联盟链与公有链的结合等。Blockchains are generally divided into three types: Public Blockchain, Private Blockchain and Consortium Blockchain. In addition, there can also be combinations of the above types, such as the combination of private chain and alliance chain, the combination of alliance chain and public chain, etc.
在上述三种类型的区块链中,去中心化程度最高的是公有链。加入公有链的参与方(也可以称为区块链中的节点)可以读取链上的数据记录、参与交易、竞争新区块的记账权等。而且,各节点可自由加入或退出网络,并进行相关操作。Among the above three types of blockchains, the most decentralized is the public chain. Participants who join the public chain (also called nodes in the blockchain) can read data records on the chain, participate in transactions, compete for the accounting rights of new blocks, etc. Moreover, each node can freely join or exit the network and perform related operations.
私有链则相反,网络的写入权限由某个组织或机构控制,数据读取权限受组织规定。也即,私有链可以视为一个弱中心化系统,其对节点具有严格限制且节点数量较少。这种类型的区块链更适合于特定 机构内部使用。On the contrary, private chains have network write permissions controlled by an organization or institution, and data read permissions regulated by the organization. That is, a private chain can be viewed as a weakly centralized system with strict restrictions on nodes and a small number of nodes. This type of blockchain is more suitable for internal use within specific organizations.
联盟链则介于公有链以及私有链之间,可以实现“部分去中心化”。联盟链中的各节点通常有与之对应的实体机构或组织;节点通过授权加入网络并组成利益相关联盟,共同维护区块链的运行。The alliance chain is between the public chain and the private chain and can achieve "partial decentralization". Each node in the alliance chain usually has a corresponding entity or organization; the nodes join the network through authorization and form an alliance of stakeholders to jointly maintain the operation of the blockchain.
在区块链网络中,节点是逻辑上的通信实体;不同类型的多个节点可以运行在同一个物理服务器上,也可以运行在不同的物理服务器上。In the blockchain network, nodes are logical communication entities; multiple nodes of different types can run on the same physical server or on different physical servers.
对于区块链外产生的数据而言,可以将其构建成区块链所支持的标准的交易(Transaction)格式,然后发布至区块链,由区块链网络中的所有节点对该交易进行共识。在达成共识后,可以由区块链网络中作为记账节点的节点,将这笔交易在区块链中进行持久化存证。For data generated outside the blockchain, it can be constructed into a standard transaction (Transaction) format supported by the blockchain, and then published to the blockchain, and all nodes in the blockchain network will process the transaction. consensus. After reaching a consensus, the node in the blockchain network that serves as the accounting node can persist the transaction in the blockchain.
目前的区块链系统通常包括两种主流的交易模型;其中,一种是UTXO(Unspent Transaction Output,未花费的交易输出)模型,而另外一种则是账户模型。Current blockchain systems usually include two mainstream transaction models; one is the UTXO (Unspent Transaction Output, unspent transaction output) model, and the other is the account model.
以上两类区块链如果想要实现数据存证,通常可以采用如下的存证方式:If the above two types of blockchains want to implement data storage, they can usually use the following storage methods:
对于采用UTXO模型的区块链而言,其支持的原生交易通常只包括转账交易,在基于转账交易进行转账的过程中,用户可以通过在转账交易中的交易附言(即转账附言)中来填充额外的数据,来将该额外的数据在区块链上进行存证。For blockchains that use the UTXO model, the native transactions they support usually only include transfer transactions. In the process of transferring money based on the transfer transaction, the user can pass the transaction postscript in the transfer transaction (i.e., the transfer postscript). To fill in additional data, to store the additional data on the blockchain.
对于采用账户模型的区块链而言,其需要存储和维护的区块链数据,通常包括区块数据、区块链中的区块链账户对应的账户状态数据;而区块数据又可以进一步包括区块头数据、区块中的区块交易数据、以及与区块中的区块交易数据对应的交易收据,等等。而在存储以上示出的各种区块链数据时,通常可以将上述各种区块链数据以key-value键值对的形式,组织成Merkle树(即默克尔树)在数据库中存储。当需要查询区块链节点存储的上述各种区块链数据时,可以通过将上述各种区块链数据的key作为查询索引,遍历上述Merkle树来高效的查询数据。For blockchains that use the account model, the blockchain data that needs to be stored and maintained usually includes block data and account status data corresponding to the blockchain accounts in the blockchain; and the block data can be further Including block header data, block transaction data in the block, and transaction receipts corresponding to the block transaction data in the block, etc. When storing the various blockchain data shown above, the above various blockchain data can usually be organized into a Merkle tree (i.e. Merkle tree) in the form of key-value pairs and stored in the database. . When it is necessary to query the various blockchain data stored in the blockchain node, the data can be efficiently queried by using the keys of the various blockchain data as query indexes and traversing the above Merkle tree.
在采用账户模型的区块链中,可以在区块链上部署用于进行数据存证的智能合约,用户可以通过调用智能合约的方式,将需要存证的数据作为该智能合约对应的合约账户的账户状态,存储到与该智能合约对应的Merkle树中。In a blockchain that adopts the account model, smart contracts for data storage can be deployed on the blockchain. Users can call the smart contract to use the data that needs to be stored as the contract account corresponding to the smart contract. The account status is stored in the Merkle tree corresponding to the smart contract.
例如,通常采用一种特殊的称之为MPT树的特殊的Merkle树来存储和维护区块链数据;其中,对于账户状态数据,可以组织成MPT状态树(俗称世界状态)在数据库中存储;MPT状态树上存储了以账户地址为key,以账户状态数据为value的key-value键值对。而智能合约对应的合约账户中存储的数据内容,也会被进一步组织成Storage树(一种用于存储数据的MPT存储树)在数据库中存储;Storage树的根节点的Hash值,会作为与该合约账户对应的账户状态数据的一部分,填充到MPT状态树中;而MPT状态树的根节点的Hash会被作为认证根,进一步填充到区块头中。当用户需要进行数据存证时,可以通过调用智能合约的方式,将需要存证的数据作为该智能合约对应的合约账户的账户状态数据,存储到与该智能合约对应的Storage树中。For example, a special Merkle tree called an MPT tree is usually used to store and maintain blockchain data; account status data can be organized into an MPT status tree (commonly known as world status) and stored in the database; The MPT status tree stores key-value pairs with the account address as the key and the account status data as the value. The data content stored in the contract account corresponding to the smart contract will be further organized into a Storage tree (an MPT storage tree used to store data) and stored in the database; the Hash value of the root node of the Storage tree will be used as the Part of the account status data corresponding to the contract account is filled into the MPT status tree; and the hash of the root node of the MPT status tree will be used as the authentication root and further filled into the block header. When users need to deposit data, they can call the smart contract to store the data that needs to be deposited as the account status data of the contract account corresponding to the smart contract into the Storage tree corresponding to the smart contract.
在区块链领域,通常将账户划分为用户账户和合约账户两类;用户账户就是由用户直接控制的账户,也称之为外部账户;而合约账户则是由用户通过用户账户创建的,包含合约代码的账户(即智能合约)。In the field of blockchain, accounts are usually divided into two categories: user accounts and contract accounts; user accounts are accounts directly controlled by users, also called external accounts; contract accounts are created by users through user accounts, including Account of the contract code (i.e. smart contract).
对于区块链中的账户而言,通常会通过一个结构体,来维护账户的账户状态。当区块中的交易被执行后,区块链中与该交易相关的账户的状态通常也会发生变化。For accounts in the blockchain, the account status of the account is usually maintained through a structure. When a transaction in a block is executed, the status of the account associated with the transaction in the blockchain usually changes.
在一个例子中,账户的结构体通常包括Balance,Nonce,Code和Storage等字段。其中:In an example, the account structure usually includes fields such as Balance, Nonce, Code and Storage. in:
Balance字段,用于维护账户目前的账户余额;Balance field, used to maintain the current account balance of the account;
Nonce字段,用于维护该账户的交易次数;它是用于保障每笔交易能且只能被处理一次的计数器,有效避免重放攻击;The Nonce field is used to maintain the number of transactions of the account; it is a counter used to ensure that each transaction can and can only be processed once, effectively avoiding replay attacks;
Code字段,用于维护该账户的合约代码;在实际应用中,Code字段中通常仅维护合约代码的Hash值;因而,Code字段通常也称之为CodeHash字段。The Code field is used to maintain the contract code of the account; in practical applications, the Code field usually only maintains the hash value of the contract code; therefore, the Code field is usually also called the CodeHash field.
Storage字段,用于维护该账户的存储内容(默认字段值为空);对于合约账户而言,通常会分配一 个独立的存储空间,用以存储该合约账户的存储内容;该独立的存储空间通常称之为该合约账户的账户存储。The Storage field is used to maintain the storage content of the account (the default field value is empty); for contract accounts, an independent storage space is usually allocated to store the storage content of the contract account; this independent storage space is usually Call it the account storage of this contract account.
合约账户的存储内容通常会构建成MPT(Merkle Patricia Trie)树的数据结构存储在上述独立的存储空间之中;其中,基于合约账户的存储内容构建成的MPT树,通常也称之为Storage树。而Storage字段通常仅维护该Storage树的根节点;因此,Storage字段通常也称之为StorageRoot字段。The storage content of the contract account is usually constructed into a data structure of an MPT (Merkle Patricia Trie) tree and stored in the above-mentioned independent storage space; among them, the MPT tree constructed based on the storage content of the contract account is usually also called a Storage tree . The Storage field usually only maintains the root node of the Storage tree; therefore, the Storage field is usually also called the StorageRoot field.
其中,对于用户账户而言,以上示出的Code字段和Storage字段的字段值均为空值。Among them, for the user account, the field values of the Code field and the Storage field shown above are both null.
请参考图1,图1是一种用户账户的账户结构的示意图。Please refer to Figure 1, which is a schematic diagram of an account structure of a user account.
如图1所示,上述用户账户的账户结构具体可以包括Identity字段、Balance字段。其中,Identity字段可以用于维护用户账户的账户标识。As shown in Figure 1, the account structure of the above user account may specifically include an Identity field and a Balance field. Among them, the Identity field can be used to maintain the account identification of the user account.
需要说明的是,由于用户账户中的Code字段和Storage字段的字段值通常为空值,图1中的用户账户的账户结构中省略了Code字段和Storage字段。It should be noted that since the field values of the Code field and the Storage field in the user account are usually null, the Code field and the Storage field are omitted from the account structure of the user account in Figure 1.
请参考图2,图2是一种合约账户的账户结构的示意图。Please refer to Figure 2, which is a schematic diagram of the account structure of a contract account.
如图2所示,上述合约账户的账户结构具体可以包括Identity字段、Balance字段、Code字段、Storage字段。其中,Identity字段可以用于维护合约账户的账户标识。As shown in Figure 2, the account structure of the above-mentioned contract account can specifically include the Identity field, the Balance field, the Code field, and the Storage field. Among them, the Identity field can be used to maintain the account identification of the contract account.
需要说明的是,Code字段中通常仅维护合约代码的Hash值,也可称为CodeHash字段。Storage字段中通常仅维护基于合约账户的存储内容构建成的Storage树的根节点,也可称为StorageRoot字段。It should be noted that the Code field usually only maintains the hash value of the contract code, which can also be called the CodeHash field. The Storage field usually only maintains the root node of the Storage tree built based on the storage content of the contract account, which can also be called the StorageRoot field.
在可编程的区块链中,可以通过面向用户提供智能合约(Smart Contract)的功能,支持用户在区块链网络中创建并调用一些复杂的逻辑。所谓智能合约是在区块链上可以被交易触发执行的程序。In a programmable blockchain, users can be provided with smart contract functions to support users in creating and calling some complex logic in the blockchain network. The so-called smart contract is a program that can be triggered and executed by transactions on the blockchain.
在可编程的区块链中,每一个区块链节点都可以搭载一个图灵完备的虚拟机作为智能合约的执行环境,通过它可以实现各种复杂的逻辑。用户在区块链中发布和调用智能合约就是在虚拟机上运行的。In a programmable blockchain, each blockchain node can be equipped with a Turing-complete virtual machine as the execution environment for smart contracts, through which various complex logic can be implemented. When users publish and call smart contracts in the blockchain, they run on the virtual machine.
实际上,虚拟机直接运行的是虚拟机代码(虚拟机字节码,下简称“字节码”),所以部署在区块链上的智能合约可以是字节码。字节码由一连串的字节组成,每一字节可以标识一个操作。基于开发效率、可读性等多方面考虑,开发者可以不直接书写字节码,而是选择一门高级语言编写智能合约代码。例如,高级语言可以采用诸如Solidity、Serpent、LLL语言等。对于采用高级语言编写的智能合约代码,可以经过编译器编译,生成可以部署到区块链上的字节码。In fact, the virtual machine directly runs the virtual machine code (virtual machine bytecode, hereinafter referred to as "bytecode"), so the smart contract deployed on the blockchain can be bytecode. Bytecode consists of a series of bytes, each byte can identify an operation. Based on various considerations such as development efficiency and readability, developers can choose a high-level language to write smart contract code instead of writing bytecode directly. For example, high-level languages can use Solidity, Serpent, LLL language, etc. Smart contract codes written in high-level languages can be compiled by a compiler to generate bytecode that can be deployed on the blockchain.
用户可以将一笔包含合约代码的智能合约创建交易发送到区块链网络后,各区块链节点均可以在搭载的虚拟机中执行这笔交易。Users can send a smart contract creation transaction containing contract code to the blockchain network, and each blockchain node can execute the transaction in the equipped virtual machine.
当区块链节点间通过共识机制达成一致后,这个智能合约成功创建,后续用户可以调用这个智能合约。When the blockchain nodes reach an agreement through the consensus mechanism, the smart contract is successfully created, and subsequent users can call the smart contract.
智能合约创建后,区块链上出现一个与该智能合约对应的合约账户,并拥有一个特定的地址;合约代码(Code)和账户存储(Storage)将保存在该合约账户的账户存储中。智能合约的行为由合约代码控制,而智能合约的账户存储则保存了合约的状态。After the smart contract is created, a contract account corresponding to the smart contract appears on the blockchain and has a specific address; the contract code (Code) and account storage (Storage) will be saved in the account storage of the contract account. The behavior of a smart contract is controlled by the contract code, and the account storage of the smart contract saves the state of the contract.
用户将一笔智能合约调用交易发送到以太坊网络后,各区块链节点均可以在搭载的虚拟机中执行这笔交易。After the user sends a smart contract call transaction to the Ethereum network, each blockchain node can execute the transaction in the equipped virtual machine.
调用智能合约后,合约账户的账户状态可能改变。后续,某个客户端可以通过接入的区块链节点查看合约账户的账户状态。After calling the smart contract, the account status of the contract account may change. Subsequently, a client can view the account status of the contract account through the connected blockchain node.
智能合约可以以规定的方式在区块链网络中每个节点独立的执行,所有执行记录和数据都保存在区块链上,所以当这样的交易执行完毕后,区块链上就保存了无法篡改、不会丢失的交易凭证。Smart contracts can be executed independently on each node in the blockchain network in a prescribed manner. All execution records and data are saved on the blockchain. Therefore, after such a transaction is executed, there is no way to save it on the blockchain. Transaction vouchers that are tamper-resistant and cannot be lost.
本说明书旨在提出一种用于创建数据账户的技术方案,通过对区块链支持的账户类型,进行进一步的扩展,扩展出用于维护该区块链上部署的智能合约进行合约计算的业务数据的数据账户,实现将智能合约的合约代码与智能合约进行合约计算所需的业务数据分离开来。This manual aims to propose a technical solution for creating data accounts. By further expanding the account types supported by the blockchain, it can expand the business of maintaining smart contracts deployed on the blockchain for contract calculations. The data account of the data realizes the separation of the contract code of the smart contract and the business data required for the smart contract to perform contract calculations.
在上述技术方案中,区块链中的区块链节点可以响应于接收到的数据账户创建交易,基于该数据账户创建交易中的该区块链上部署的智能合约进行合约计算所需的业务数据,在该区块链上创建数据账户,即将该业务数据添加至所创建的该数据账户进行维护。In the above technical solution, the blockchain node in the blockchain can respond to the received data account creation transaction, and perform the business required for contract calculation based on the smart contract deployed on the blockchain in the data account creation transaction. Data, create a data account on the blockchain, that is, add the business data to the created data account for maintenance.
在具体实现时,针对上述区块链上部署的智能合约,上述区块链中的区块链节点可以接收到数据账户创建交易。In specific implementation, for the smart contracts deployed on the above-mentioned blockchain, the blockchain nodes in the above-mentioned blockchain can receive data account creation transactions.
其中,上述数据账户创建交易可以用于创建与上述智能合约对应的数据账户,即所创建的该数据账户用于维护该智能合约进行合约计算所需的业务数据。相应的,该数据账户创建交易可以包括该业务数据。Among them, the above-mentioned data account creation transaction can be used to create a data account corresponding to the above-mentioned smart contract, that is, the created data account is used to maintain the business data required for the smart contract to perform contract calculations. Correspondingly, the data account creation transaction may include the business data.
上述区块链节点在接收到上述数据账户创建交易的情况下,可以响应于该数据账户创建交易,在上述区块链上创建数据账户。When the above-mentioned blockchain node receives the above-mentioned data account creation transaction, it can respond to the data account creation transaction and create a data account on the above-mentioned blockchain.
针对所创建的上述数据账户,上述区块链节点可以将上述数据账户创建交易中的业务数据添加至该数据账户进行维护。由此,即可创建用于维护上述智能合约进行合约计算所需的业务数据的数据账户。For the above-mentioned data account created, the above-mentioned blockchain node can add the business data in the above-mentioned data account creation transaction to the data account for maintenance. From this, a data account can be created for maintaining the business data required for contract calculations by the above smart contract.
采用上述方式,可以将智能合约的合约代码与智能合约进行合约计算所需的业务数据分离开来,从而可以达到以下目的:第一,与智能合约对应的合约账户中仅需要维护智能合约的合约代码,因此可以将所实现的业务逻辑较为复杂的智能合约拆分成多个较为简单的子合约,降低智能合约的开发、测试、升级等的成本;第二,用户在区块链中注册的用户账户,以及与区块链上部署的智能合约对应的合约账户,均可以直接访问在区块链上创建的数据账户中维护的业务数据,即通过数据账户可以实现面向用户账户和合约账户的数据共享,节省智能合约的执行开销,实现对业务数据的并行访问,提高区块链的交易吞吐量;第三,由数据账户集中维护业务数据,可以实现业务数据的资产化,同时便于获取大量业务数据以进行数据分析、AI训练等处理。Using the above method, the contract code of the smart contract can be separated from the business data required for contract calculation by the smart contract, so that the following purposes can be achieved: First, only the contract of the smart contract needs to be maintained in the contract account corresponding to the smart contract. code, so smart contracts with complex business logic can be split into multiple simpler sub-contracts, reducing the costs of smart contract development, testing, upgrades, etc.; Second, users registered in the blockchain User accounts, as well as contract accounts corresponding to smart contracts deployed on the blockchain, can directly access business data maintained in data accounts created on the blockchain. That is, data accounts can be used to implement user accounts and contract accounts. Data sharing saves the execution overhead of smart contracts, enables parallel access to business data, and improves the transaction throughput of the blockchain; third, centralized maintenance of business data by data accounts can realize the assetization of business data and facilitate the acquisition of large amounts of data. Business data is processed for data analysis, AI training, etc.
请参考图3,图3是本说明书一示例性实施例示出的一种数据账户创建方法的流程图。Please refer to FIG. 3 , which is a flow chart of a method for creating a data account according to an exemplary embodiment of this specification.
在本实施例中,可以对区块链支持的账户类型,进行进一步的扩展,以扩展出一种独立于用户账户和合约账户的新的账户类型,称为数据账户。也即,区块链支持的账户类型可以包括用户账户、合约账户和数据账户。In this embodiment, the account types supported by the blockchain can be further expanded to expand a new account type that is independent of user accounts and contract accounts, called data accounts. That is, the account types supported by the blockchain can include user accounts, contract accounts and data accounts.
对于上述数据账户而言,其中可以维护上述区块链上部署的智能合约进行合约计算所需的业务数据。由此,可以实现将智能合约的合约代码与智能合约进行合约计算所需的业务数据分离开来。For the above-mentioned data account, the business data required for contract calculations of smart contracts deployed on the above-mentioned blockchain can be maintained. As a result, the contract code of the smart contract can be separated from the business data required for contract calculation by the smart contract.
上述数据账户创建方法可以应用于区块链节点,包括以下步骤:The above data account creation method can be applied to blockchain nodes, including the following steps:
步骤302:接收用于创建所述数据账户的数据账户创建交易;其中,所述数据账户创建交易包括所述区块链上部署的智能合约进行合约计算所需的业务数据。Step 302: Receive a data account creation transaction used to create the data account; wherein the data account creation transaction includes business data required for contract calculation by the smart contract deployed on the blockchain.
步骤304:响应于所述数据账户创建交易,在所述区块链上创建数据账户。Step 304: In response to the data account creation transaction, create a data account on the blockchain.
步骤306:将所述业务数据添加至所述数据账户进行维护。Step 306: Add the business data to the data account for maintenance.
针对上述区块链上部署的智能合约,可以由与待创建的数据账户对应的管理方,发起数据账户创建交易。例如,上述管理方可以通过与其对应的客户端,执行发起上述数据账户创建交易的操作。该客户端在检测到该操作时,可以按照上述区块链支持的标准的交易格式,构建该数据账户创建交易,并将该数据账户创建交易发布至该区块链。在这种情况下,该区块链中的区块链节点可以接收到该数据账户创建交易。For the smart contracts deployed on the above-mentioned blockchain, the manager corresponding to the data account to be created can initiate a data account creation transaction. For example, the above-mentioned management party can perform the operation of initiating the above-mentioned data account creation transaction through its corresponding client. When the client detects this operation, it can construct the data account creation transaction according to the standard transaction format supported by the above-mentioned blockchain, and publish the data account creation transaction to the blockchain. In this case, the data account creation transaction can be received by the blockchain nodes in the blockchain.
在实际应用中,上述管理方具体可以是上述智能合约的所有者(例如:该智能合约可以实现某一企业的业务逻辑,此时该管理方可以是该企业),或者可以是待创建的数据账户的所有者(例如:该数据账户可以用于维护某一企业的业务数据,此时该管理方可以是该企业)。In practical applications, the above-mentioned manager can be the owner of the above-mentioned smart contract (for example: the smart contract can implement the business logic of a certain enterprise, in which case the manager can be the enterprise), or can be the data to be created The owner of the account (for example: the data account can be used to maintain business data of a certain enterprise, in which case the manager can be the enterprise).
需要说明的是,也可以由其他用户发起上述数据账户创建交易,或者可以由上述区块链节点在达到特定条件时,自行构建上述数据账户创建交易,本说明书对此不作限制。It should be noted that other users can also initiate the above-mentioned data account creation transaction, or the above-mentioned blockchain node can construct the above-mentioned data account creation transaction on its own when certain conditions are met. This instruction does not limit this.
其中,上述数据账户创建交易可以用于创建与上述智能合约对应的数据账户,即所创建的数据账户 可以用于维护该智能合约进行合约计算所需的业务数据。相应的,该数据账户创建交易可以包括该智能合约进行合约计算所需的业务数据。Among them, the above-mentioned data account creation transaction can be used to create a data account corresponding to the above-mentioned smart contract, that is, the created data account can be used to maintain the business data required for contract calculation by the smart contract. Correspondingly, the data account creation transaction may include business data required by the smart contract for contract calculations.
上述区块链节点在接收到上述数据账户创建交易的情况下,可以响应于该数据账户创建交易,在上述区块链上创建数据账户。When the above-mentioned blockchain node receives the above-mentioned data account creation transaction, it can respond to the data account creation transaction and create a data account on the above-mentioned blockchain.
针对所创建的上述数据账户,上述区块链节点可以将上述数据账户创建交易中的业务数据添加至该数据账户进行维护。由此,即可创建用于维护上述智能合约进行合约计算所需的业务数据的数据账户。For the above-mentioned data account created, the above-mentioned blockchain node can add the business data in the above-mentioned data account creation transaction to the data account for maintenance. From this, a data account can be created for maintaining the business data required for contract calculations by the above smart contract.
下面对数据账户的账户结构进行详细说明。The account structure of the data account is explained in detail below.
在示出的一种实施方式中,与前述的用户账户和合约账户类似,数据账户中维护的业务数据可以被组织成Merkle树的形式,在区块链节点搭载的本地数据库中存储。相应的,数据账户的账户结构可以包括用于维护Merkle树的根节点的Hash值的数据存储字段,该Merkle树中写入了区块链上部署的智能合约进行合约计算所需的业务数据。In one embodiment shown, similar to the aforementioned user accounts and contract accounts, the business data maintained in the data account can be organized into the form of a Merkle tree and stored in a local database carried by the blockchain node. Correspondingly, the account structure of the data account may include a data storage field used to maintain the Hash value of the root node of the Merkle tree, in which the business data required for contract calculation by the smart contract deployed on the blockchain is written.
在上述情况下,前述的将上述数据账户创建交易中的业务数据添加至上述数据账户进行维护,具体可以包括将该数据账户创建交易中的业务数据写入上述区块链节点搭载的本地数据库中存储的Merkle树,以对该Merkle树进行更新,并将更新后的Merkle树的根节点的Hash值填充至该数据账户中的数据存储字段。In the above case, the aforementioned adding the business data in the above-mentioned data account creation transaction to the above-mentioned data account for maintenance may specifically include writing the business data in the above-mentioned data account creation transaction into the local database carried by the above-mentioned blockchain node. Store the Merkle tree to update the Merkle tree, and fill the hash value of the root node of the updated Merkle tree into the data storage field in the data account.
请参考图4,图4是本说明书一示例性实施例示出的一种数据账户的账户结构的示意图。Please refer to FIG. 4 , which is a schematic diagram of the account structure of a data account according to an exemplary embodiment of this specification.
如图4所示,上述数据账户的账户结构具体可以包括Storage字段。其中,Storage字段可以用于维护Merkle树的根节点的Hash值,也可称为StorageRoot字段,该Merkle树中写入了智能合约进行合约计算所需的业务数据。As shown in Figure 4, the account structure of the above data account may specifically include a Storage field. Among them, the Storage field can be used to maintain the Hash value of the root node of the Merkle tree, which is also called the StorageRoot field. The business data required for smart contract calculations is written in the Merkle tree.
在上述情况下,合约账户的存储内容可以不再包括智能合约进行合约计算所需的业务数据,而是由独立的数据账户维护智能合约进行合约计算所需的业务数据。由此,即可实现将智能合约的合约代码与智能合约进行合约计算所需的业务数据分离开来。In the above situation, the storage content of the contract account may no longer include the business data required by the smart contract for contract calculations, but an independent data account maintains the business data required by the smart contract for contract calculations. In this way, the contract code of the smart contract can be separated from the business data required for contract calculation by the smart contract.
在示出的一种实施方式中,上述区块链上部署的智能合约进行合约计算所需的业务数据,可以包括业务数据内容和与该业务数据内容对应的数据访问代码。In an embodiment shown, the business data required for contract calculation by the smart contract deployed on the above-mentioned blockchain may include business data content and data access code corresponding to the business data content.
在上述情况下,前述的将上述数据账户创建交易中的业务数据写入上述区块链节点搭载的本地数据库中存储的Merkle树,以对该Merkle树进行更新,并将更新后的Merkle树的根节点的Hash值填充至上述数据账户中的数据存储字段,具体可以包括将该数据账户创建交易中的业务数据内容和数据访问代码的对应关系,写入该Merkle树,以对该Merkle树进行更新,并将更新后的Merkle树的根节点的Hash值填充至该数据账户中的数据存储字段。也即,数据账户中的数据存储字段可以用于维护Merkle树的根节点的Hash值,该Merkle树中写入了上述区块链上部署的智能合约进行合约计算所需的业务数据内容,以及与该业务数据内容对应的数据访问代码的对应关系。In the above case, the aforementioned business data in the above-mentioned data account creation transaction is written into the Merkle tree stored in the local database carried by the above-mentioned blockchain node to update the Merkle tree, and the updated Merkle tree The hash value of the root node is filled into the data storage field in the above-mentioned data account. Specifically, it may include writing the corresponding relationship between the business data content and the data access code in the data account creation transaction into the Merkle tree to conduct the Merkle tree Update, and fill the hash value of the updated root node of the Merkle tree into the data storage field in the data account. That is to say, the data storage field in the data account can be used to maintain the Hash value of the root node of the Merkle tree, which contains the business data content required for contract calculation by the smart contract deployed on the blockchain, and The corresponding relationship between the data access code corresponding to the business data content.
继续参考图4,如图4所示的数据账户的账户结构中的Storage字段,可以用于维护Merkle树的根节点的Hash值,也可称为StorageRoot字段,该Merkle树中写入了智能合约进行合约计算所需的业务数据内容,以及与该业务数据内容对应的数据访问代码的对应关系。在这种情况下,Storage字段可以视为包括Data字段和与之对应的Data Access Code字段。Continuing to refer to Figure 4, the Storage field in the account structure of the data account shown in Figure 4 can be used to maintain the Hash value of the root node of the Merkle tree, which can also be called the StorageRoot field. The smart contract is written in the Merkle tree. The business data content required for contract calculation and the corresponding relationship between the data access codes corresponding to the business data content. In this case, the Storage field can be regarded as including the Data field and the corresponding Data Access Code field.
其中,Data字段可以视为用于维护写入了智能合约进行合约计算所需的业务数据内容的Merkle树的根节点的Hash值,Data Access Code字段可以视为用于维护写入了与该业务数据内容对应的数据访问代码的Merkle树的根节点的Hash值。Among them, the Data field can be regarded as the hash value of the root node of the Merkle tree used to maintain the business data content required for contract calculation in the smart contract, and the Data Access Code field can be regarded as used to maintain the written content related to the business. The hash value of the root node of the Merkle tree of the data access code corresponding to the data content.
在示出的一种实施方式中,对于上述业务数据内容而言,与其对应的数据访问代码可以包括用于读/写该业务数据内容的接口代码。也即,通过调用该数据访问代码,可以实现对该业务数据内容的读/写。In one embodiment shown, for the above-mentioned business data content, the corresponding data access code may include an interface code for reading/writing the business data content. That is, by calling the data access code, the content of the business data can be read/written.
在示出的一种实施方式中,上述数据账户创建交易还可以包括与上述智能合约进行合约计算所需的业务数据对应的数据描述信息。相应的,数据账户的账户结构还可以包括用于维护数据描述信息的Hash 值的数据描述字段,该数据描述信息与区块链上部署的智能合约进行合约计算所需的业务数据相对应。In an embodiment shown, the above-mentioned data account creation transaction may also include data description information corresponding to the business data required for the above-mentioned smart contract to perform contract calculations. Correspondingly, the account structure of the data account may also include a data description field used to maintain the Hash value of the data description information, which corresponds to the business data required for contract calculations by smart contracts deployed on the blockchain.
在上述情况下,针对所创建的上述数据账户,上述区块链节点还可以计算上述数据账户创建交易中的与上述业务数据对应的数据描述信息的Hash值,并将计算出的Hash值填充至该数据账户中的数据描述字段。In the above case, for the above-mentioned data account created, the above-mentioned blockchain node can also calculate the hash value of the data description information corresponding to the above-mentioned business data in the above-mentioned data account creation transaction, and fill the calculated hash value into The data description field in this data account.
继续参考图4,如图4所示的数据账户的账户结构具体可以包括SchemaHash字段、Storage字段。其中,Storage字段可以用于维护Merkle树的根节点的Hash值,也可称为StorageRoot字段,该Merkle树中写入了智能合约进行合约计算所需的业务数据。在这种情况下,SchemaHash字段可以用于维护与该业务数据对应的数据描述信息的Hash值。Continuing to refer to Figure 4, the account structure of the data account shown in Figure 4 may specifically include a SchemaHash field and a Storage field. Among them, the Storage field can be used to maintain the Hash value of the root node of the Merkle tree, which is also called the StorageRoot field. The business data required for smart contract calculations is written in the Merkle tree. In this case, the SchemaHash field can be used to maintain the Hash value of the data description information corresponding to the business data.
在示出的一种实施方式中,上述数据账户的账户结构还可以包括以下示出的任一字段或者多个字段:用于维护所述数据账户的账户标识的账户标识字段;用于维护所述数据账户持有的资产的余额的余额字段;用于维护所述数据账户的管理方的公钥的管理字段。In an embodiment shown, the account structure of the above-mentioned data account may also include any one or more fields shown below: an account identification field used to maintain the account identification of the data account; The balance field of the balance of the assets held by the data account; the management field used to maintain the public key of the administrator of the data account.
继续参考图4,如图4所示的数据账户的账户结构具体可以包括Identity字段、Balance字段、AuthMap字段、SchemaHash字段、Storage字段。其中,Identity字段可以用于维护数据账户的账户标识。Balance字段可以用于维护数据账户持有的资产的余额。AuthMap字段可以用于维护数据账户的管理方的公钥。Continuing to refer to Figure 4, the account structure of the data account shown in Figure 4 may specifically include an Identity field, a Balance field, an AuthMap field, a SchemaHash field, and a Storage field. Among them, the Identity field can be used to maintain the account identification of the data account. The Balance field can be used to maintain the balance of assets held by the data account. The AuthMap field can be used to maintain the public key of the administrator of the data account.
需要说明的是,上述管理字段具体可以用于维护数据账户的至少一个管理方的公钥,以及为这至少一个管理方的公钥分配的权重的对应关系。It should be noted that the above-mentioned management field can be specifically used to maintain the corresponding relationship between the public key of at least one manager of the data account and the weight assigned to the public key of the at least one manager.
在实际应用中,对于区块链上创建的数据账户而言,前述的用户账户和合约账户都可以访问该数据账户,以获取该数据账户中维护的业务数据,从而可以基于该业务数据进行一定的处理。为了避免任一用户账户或者任一合约账户可以随意地访问区块链上创建的数据账户,提高数据账户中维护的业务数据的安全性,可以对用户账户和合约账户进行针对该数据账户的访问权限控制。In practical applications, for data accounts created on the blockchain, the aforementioned user accounts and contract accounts can access the data account to obtain the business data maintained in the data account, so that certain operations can be performed based on the business data. processing. In order to prevent any user account or any contract account from arbitrarily accessing the data account created on the blockchain and improve the security of the business data maintained in the data account, user accounts and contract accounts can be accessed for the data account. Permission control.
在示出的一种实施方式中,数据账户的账户结构可以包括用于维护与该数据账户对应的访问授权信息的授权字段。In one embodiment shown, the account structure of the data account may include an authorization field for maintaining access authorization information corresponding to the data account.
在如图3所示的数据账户创建方法的基础上,请参考图5,图5是本说明书一示例性实施例示出的一种数据账户的访问授权方法的流程图。Based on the data account creation method shown in Figure 3, please refer to Figure 5. Figure 5 is a flow chart of a data account access authorization method according to an exemplary embodiment of this specification.
上述数据账户的访问授权方法可以包括以下步骤:The access authorization method for the above data account may include the following steps:
步骤502:接收与所述数据账户对应的管理方发起的针对所述数据账户的数据账户授权交易;其中,所述数据账户授权交易包括目标账户的账户标识,以及授权给所述目标账户的针对所述数据账户的访问权限信息。Step 502: Receive a data account authorization transaction for the data account initiated by the manager corresponding to the data account; wherein the data account authorization transaction includes the account identification of the target account, and the authorization for the target account. Access permission information of the data account.
步骤504:响应于所述数据账户授权交易,确定所述管理方是否具有与所述数据账户对应的管理权限。Step 504: In response to the data account authorization transaction, determine whether the manager has management authority corresponding to the data account.
步骤506:如果所述管理方具有与所述数据账户对应的管理权限,则将所述目标账户的账户标识和所述访问权限信息的对应关系作为与所述数据账户对应的访问授权信息,填充至所述数据账户中的授权字段。Step 506: If the manager has the management authority corresponding to the data account, fill in the corresponding relationship between the account ID of the target account and the access authority information as the access authorization information corresponding to the data account. to the authorization field in said data account.
针对区块链上创建的任一数据账户,与该数据账户对应的管理方可以发起针对该数据账户的数据账户授权交易。在这种情况下,该区块链中的区块链节点可以接收到该数据账户授权交易。For any data account created on the blockchain, the manager corresponding to the data account can initiate a data account authorization transaction for the data account. In this case, the blockchain node in the blockchain can receive the data account authorization transaction.
其中,上述数据账户授权交易可以包括能被授权上述数据账户的访问权限的目标账户的账户标识,以及授权给该目标账户的针对该数据账户的访问权限信息。Wherein, the above-mentioned data account authorization transaction may include the account identification of the target account that can be authorized with access rights to the above-mentioned data account, and the access rights information for the data account authorized to the target account.
上述区块链节点在接收到上述数据账户授权交易的情况下,可以响应于该数据账户授权交易,确定发起该数据账户授权交易的上述管理方是否具有与上述数据账户对应的管理权限。When the above-mentioned blockchain node receives the above-mentioned data account authorization transaction, it can respond to the data account authorization transaction and determine whether the above-mentioned manager who initiated the data account authorization transaction has the management authority corresponding to the above-mentioned data account.
如果上述管理方具有与上述数据账户对应的管理权限,则可以将上述目标账户的账户标识和上述访问权限信息的对应关系,作为与该数据账户对应的访问授权信息,填充至该数据账户中的授权字段。If the above-mentioned manager has the management authority corresponding to the above-mentioned data account, the corresponding relationship between the account ID of the above-mentioned target account and the above-mentioned access permission information can be filled in the data account as the access authorization information corresponding to the data account. Authorization field.
在示出的一种实施方式中,与数据账户对应的访问授权信息可以包括由至少一个目标账户的账户标 识,以及授权给这至少一个目标账户的针对该数据账户的访问权限信息的对应关系,构成的访问授权列表(也可称为访问控制列表,Access Control List,ACL)。需要说明的是,这至少一个目标账户的账户标识,以及授权给这至少一个目标账户的针对该数据账户的访问权限信息,是一一对应的。In one embodiment shown, the access authorization information corresponding to the data account may include a correspondence between the account identification of at least one target account and the access rights information for the data account authorized to the at least one target account, An access authorization list (also called an access control list, Access Control List, ACL). It should be noted that the account ID of the at least one target account and the access permission information for the data account authorized to the at least one target account are in one-to-one correspondence.
在示出的一种实施方式中,对于任一目标账户而言,该目标账户的账户标识与授权给该目标账户的针对某一数据账户的访问权限信息的对应关系,可以通过key-value键值对的形式表示;该key-value键值对中的key可以是该目标账户的账户标识,value可以是授权给该目标账户的针对该数据账户的访问权限信息。相应的,上述访问授权列表可以是与上述至少一个目标账户对应的key-value键值对构成的Map列表;该Map列表中的key-value键值对中的key为这至少一个目标账户的账户标识,value为授权给这至少一个目标账户的针对该数据账户的访问权限信息。In an embodiment shown, for any target account, the corresponding relationship between the account identification of the target account and the access permission information for a certain data account authorized to the target account can be determined through the key-value key. Expressed in the form of a value pair; the key in the key-value pair can be the account ID of the target account, and the value can be the access permission information authorized to the target account for the data account. Correspondingly, the above-mentioned access authorization list may be a Map list composed of key-value pairs corresponding to the above-mentioned at least one target account; the key in the key-value pair in the Map list is the account of the at least one target account. Identification, value is the access permission information for the data account authorized to the at least one target account.
在实际应用中,上述访问权限信息具体可以是访问凭证(Access Certificate,AC)。为了保证访问权限信息的数据安全,提高访问权限信息的易用性,同时节省存储空间,上述访问授权列表中存储的具体可以是至少一个目标账户的账户标识,以及授权给这至少一个目标账户的针对该数据账户的访问权限信息的Hash值的对应关系。In actual applications, the above access permission information may specifically be an access certificate (Access Certificate, AC). In order to ensure the data security of the access permission information, improve the usability of the access permission information, and save storage space, the specific contents stored in the above access authorization list may be the account ID of at least one target account, and the number authorized to the at least one target account. The corresponding relationship between the Hash values of the access permission information of the data account.
继续参考图4,如图4所示的数据账户的账户结构具体可以包括Identity字段、Balance字段、AuthMap字段、ACL字段、SchemaHash字段、Storage字段。其中,ACL字段可以用于维护与数据账户对应的访问授权信息(例如:访问授权列表)。Continuing to refer to Figure 4, the account structure of the data account shown in Figure 4 may specifically include an Identity field, a Balance field, an AuthMap field, an ACL field, a SchemaHash field, and a Storage field. Among them, the ACL field can be used to maintain access authorization information corresponding to the data account (for example: access authorization list).
在示出的一种实施方式中,上述目标账户可以包括用户在上述区块链中注册的用户账户;或者,与上述区块链上部署的智能合约对应的合约账户。In one embodiment shown, the target account may include a user account registered in the blockchain; or a contract account corresponding to a smart contract deployed on the blockchain.
下面分别对用户账户和合约账户访问数据账户的过程进行详细说明。The process of accessing data accounts by user accounts and contract accounts is explained in detail below.
(1)用户账户访问数据账户(1)User account access data account
结合如图5所示的数据账户的访问授权方法,请参考图6,图6是本说明书一示例性实施例示出的另一种数据账户的访问授权方法的流程图。In conjunction with the data account access authorization method shown in Figure 5, please refer to Figure 6, which is a flow chart of another data account access authorization method according to an exemplary embodiment of this specification.
上述数据账户的访问授权方法可以包括以下步骤:The access authorization method for the above data account may include the following steps:
步骤602:接收与所述数据账户对应的管理方发起的针对所述数据账户的数据账户授权交易;其中,所述数据账户授权交易包括用户在所述区块链中注册的用户账户的账户标识,以及授权给所述用户账户的针对所述数据账户的访问权限信息。Step 602: Receive a data account authorization transaction for the data account initiated by the manager corresponding to the data account; wherein the data account authorization transaction includes the account identification of the user account registered by the user in the blockchain , and the access permission information authorized to the user account for the data account.
步骤604:响应于所述数据账户授权交易,确定所述管理方是否具有与所述数据账户对应的管理权限。Step 604: In response to the data account authorization transaction, determine whether the manager has management authority corresponding to the data account.
步骤606:如果所述管理方具有与所述数据账户对应的管理权限,则将所述用户账户的账户标识和所述访问权限信息的对应关系作为与所述数据账户对应的访问授权信息,填充至所述数据账户中的授权字段。Step 606: If the manager has the management authority corresponding to the data account, fill in the corresponding relationship between the account ID of the user account and the access authority information as the access authorization information corresponding to the data account. to the authorization field in said data account.
步骤602至606的具体实现可以参考步骤502至506,本说明书在此不再赘述。For the specific implementation of steps 602 to 606, reference can be made to steps 502 to 506, which will not be described again in this specification.
请参考图7,图7是本说明书一示例性实施例示出的另一种数据账户的访问授权方法的流程图。Please refer to FIG. 7 , which is a flow chart of another data account access authorization method according to an exemplary embodiment of this specification.
上述数据账户的访问授权方法可以包括以下步骤:The access authorization method for the above data account may include the following steps:
步骤702:接收与用户在所述区块链中注册的用户账户对应的管理方发起的针对所述数据账户的数据账户授权交易;其中,所述数据账户授权交易包括所述用户账户的账户标识,以及授权给所述用户账户的针对所述数据账户的访问权限信息。Step 702: Receive a data account authorization transaction for the data account initiated by the administrator corresponding to the user account registered in the blockchain; wherein the data account authorization transaction includes the account identification of the user account , and the access permission information authorized to the user account for the data account.
步骤704:响应于所述数据账户授权交易,确定所述管理方是否具有与所述数据账户对应的管理权限。Step 704: In response to the data account authorization transaction, determine whether the manager has management authority corresponding to the data account.
步骤706:如果所述管理方具有与所述数据账户对应的管理权限,则生成与授权给所述用户账户针对所述数据账户的访问权限对应的审批事件,以使与所述数据账户对应的管理方在获取到所述审批事件时,对授权给所述用户账户针对所述数据账户的访问权限进行审批,并返回审批结果。Step 706: If the administrator has management rights corresponding to the data account, generate an approval event corresponding to the access rights authorized to the user account for the data account, so that the access rights corresponding to the data account are generated. When obtaining the approval event, the manager approves the access rights authorized to the user account for the data account, and returns the approval result.
步骤708:响应于接收到的所述审批结果,在所述审批结果指示审批通过时,将所述用户账户的账户标识和所述访问权限信息的对应关系作为与所述数据账户对应的访问授权信息,填充至所述数据账户中的授权字段。Step 708: In response to the received approval result, when the approval result indicates that the approval is passed, use the corresponding relationship between the account ID of the user account and the access permission information as the access authorization corresponding to the data account. information to populate the authorization fields in said data account.
针对区块链上创建的任一数据账户,与用户在所述区块链中注册的任一用户账户对应的管理方也可以发起针对该数据账户的数据账户授权交易。在这种情况下,该区块链中的区块链节点可以接收到该数据账户授权交易。For any data account created on the blockchain, the manager corresponding to any user account registered by the user in the blockchain can also initiate a data account authorization transaction for the data account. In this case, the blockchain node in the blockchain can receive the data account authorization transaction.
其中,上述数据账户授权交易可以包括上述用户账户的账户标识,以及授权给该用户账户的针对上述数据账户的访问权限信息。Wherein, the above-mentioned data account authorization transaction may include the account identification of the above-mentioned user account, and the access rights information authorized to the above-mentioned user account for the above-mentioned data account.
上述区块链节点在接收到上述数据账户授权交易的情况下,可以响应于该数据账户授权交易,确定发起该数据账户授权交易的上述管理方是否具有与上述用户账户对应的管理权限。When the above-mentioned blockchain node receives the above-mentioned data account authorization transaction, it can respond to the data account authorization transaction and determine whether the above-mentioned manager who initiated the data account authorization transaction has the management authority corresponding to the above-mentioned user account.
如果上述管理方具有与上述用户账户对应的管理权限,则可以生成与授权给该用户账户针对上述数据账户的访问权限对应的审批事件,并将该审批事件发布至上述区块链,从而使与该数据账户对应的管理方可以从该区块链上获取到该审批事件,据此对授权给该用户账户针对该数据账户的访问权限进行审批,并返回审批结果。If the above-mentioned administrator has management rights corresponding to the above-mentioned user account, it can generate an approval event corresponding to the access rights authorized to the user account for the above-mentioned data account, and publish the approval event to the above-mentioned blockchain, thereby enabling The manager corresponding to the data account can obtain the approval event from the blockchain, approve the access rights authorized to the user account for the data account accordingly, and return the approval result.
上述区块链节点在接收到上述审批结果的情况下,可以响应于该审批结果,在该审批结果指示审批通过时,将上述用户账户的账户标识和上述访问权限信息的对应关系,作为与上述数据账户对应的访问授权信息,填充至该数据账户中的授权字段。When the above-mentioned blockchain node receives the above-mentioned approval result, it may respond to the approval result, and when the approval result indicates that the approval is passed, the corresponding relationship between the account identification of the above-mentioned user account and the above-mentioned access permission information shall be used as the corresponding relationship with the above-mentioned The access authorization information corresponding to the data account is filled in the authorization field in the data account.
需要说明的是,用户账户在区块链中完成注册后,可以为该用户账户分配对应的公私钥对。也即,与该用户账户对应的管理方可以持有该公私钥对,其中的私钥可以用于对该管理方发起的交易进行签名,公钥则可以用于对签名进行验证。公钥可以在区块链中进行广播。It should be noted that after the user account is registered in the blockchain, the corresponding public and private key pair can be assigned to the user account. That is, the manager corresponding to the user account can hold the public-private key pair, the private key can be used to sign transactions initiated by the manager, and the public key can be used to verify the signature. Public keys can be broadcast in the blockchain.
在示出的一种实施方式中,在上述数据账户的账户结构还包括用于维护该数据账户的管理方的公钥的管理字段的情况下,在确定发起上述数据账户授权交易的管理方是否具有与上述数据账户对应的管理权限时,具体可以确定该管理方的公钥与该管理字段中维护的该数据账户的管理方的公钥是否匹配,如果是,则可以确定该管理方具有与该数据账户对应的管理权限。In an embodiment shown, in the case where the account structure of the above-mentioned data account also includes a management field for maintaining the public key of the manager of the data account, when determining whether the manager who initiated the above-mentioned data account authorization transaction When you have the management authority corresponding to the above data account, you can specifically determine whether the public key of the manager matches the public key of the manager of the data account maintained in the management field. If so, you can determine that the manager has the same The management permissions corresponding to this data account.
在示出的一种实施方式中,上述管理字段具体可以用于维护数据账户的至少一个管理方的公钥,以及为这至少一个管理方的公钥分配的权重的对应关系。在这种情况下,在确定发起上述数据账户授权交易的管理方的公钥与该管理字段中维护的该数据账户的管理方的公钥是否匹配时,具体可以基于该管理字段中维护的该对应关系,确定与该管理方的公钥对应的权重是否达到预设的阈值,如果是,则可以确定该管理方的公钥与该数据账户的管理方的公钥匹配。In one embodiment shown, the above-mentioned management field can be specifically used to maintain the corresponding relationship between the public key of at least one manager of the data account and the weight assigned to the public key of the at least one manager. In this case, when determining whether the public key of the manager who initiated the above-mentioned data account authorization transaction matches the public key of the manager of the data account maintained in the management field, it may be specifically based on the public key maintained in the management field. Correspondence relationship, determine whether the weight corresponding to the public key of the manager reaches a preset threshold, and if so, it can be determined that the public key of the manager matches the public key of the manager of the data account.
在实际应用中,可以基于发起上述数据账户授权交易的管理方的私钥,对该数据账户授权交易进行签名。相应的,在对该数据账户授权交易进行响应之前,可以先确定该管理方的公钥,再基于该管理方的公钥对签名进行验证,如果验证通过再进行响应。In practical applications, the data account authorization transaction can be signed based on the private key of the manager who initiated the above data account authorization transaction. Correspondingly, before responding to the data account authorization transaction, the public key of the manager can be determined first, and then the signature is verified based on the public key of the manager. If the verification is passed, a response can be made.
类似的,上述用户账户的账户结构也可以包括用于维护该用户账户的管理方的公钥的管理字段。在这种情况下,在确定发起上述数据账户授权交易的管理方是否具有与该用户账户对应的管理权限时,也可以确定该管理方的公钥与该管理字段中维护的该用户账户的管理方的公钥是否匹配,如果是,则可以确定该管理方具有与该用户账户对应的管理权限。Similarly, the account structure of the user account may also include a management field used to maintain the public key of the administrator of the user account. In this case, when determining whether the manager who initiated the above-mentioned data account authorization transaction has the management authority corresponding to the user account, the public key of the manager and the management of the user account maintained in the management field may also be determined. Whether the party's public key matches, if so, it can be determined that the manager has the management rights corresponding to the user account.
需要说明的是,还可以采用与如图6或7所示的数据账户的访问授权方法类似的方式,对上述数据账户中的授权字段中维护的与该数据账户对应的访问授权信息进行全部或部分的更新;或者,对上述数据账户中的授权字段中维护的与该数据账户对应的访问授权信息进行全部或部分的授权撤销(例如:删除或者标记为授权已撤销)。It should be noted that a method similar to the access authorization method of the data account shown in Figure 6 or 7 can also be used to perform all or all access authorization information corresponding to the data account maintained in the authorization field in the above data account. Partial update; or, revoke all or part of the authorization for the access authorization information corresponding to the data account maintained in the authorization field in the above-mentioned data account (for example: delete or mark the authorization as revoked).
在如图6或7所示的数据账户的访问授权方法的基础上,请参考图8,图8是本说明书一示例性实施例示出的一种数据账户访问方法的流程图。Based on the data account access authorization method shown in Figure 6 or 7, please refer to Figure 8, which is a flow chart of a data account access method according to an exemplary embodiment of this specification.
上述数据账户访问方法可以包括以下步骤:The above data account access method may include the following steps:
步骤802:接收所述用户账户针对所述数据账户的数据账户访问交易;其中,所述数据账户访问交易包括待访问的目标数据的数据标识,以及授权给所述用户账户的针对所述数据账户的访问权限信息。Step 802: Receive the data account access transaction from the user account for the data account; wherein the data account access transaction includes the data identification of the target data to be accessed, and the data account authorized to the user account for the data account. access rights information.
步骤804:响应于所述数据账户访问交易,确定所述数据账户访问交易中的访问权限信息,与所述数据账户中的授权字段中维护的与所述数据账户对应的访问授权信息是否匹配。Step 804: In response to the data account access transaction, determine whether the access permission information in the data account access transaction matches the access authorization information corresponding to the data account maintained in the authorization field in the data account.
步骤806:如果所述访问权限信息与所述数据账户对应的访问授权信息匹配,则确定所述用户账户具有所述数据账户的访问权限,并在所述数据账户中维护的业务数据中查找与所述数据标识对应的所述目标数据。Step 806: If the access permission information matches the access authorization information corresponding to the data account, determine that the user account has the access permission of the data account, and search the business data maintained in the data account. The data identifies the corresponding target data.
针对区块链上创建的任一数据账户,上述区块链中的区块链节点可以接收到任一用户账户针对该数据账户的数据账户访问交易。For any data account created on the blockchain, the blockchain node in the above-mentioned blockchain can receive the data account access transaction of any user account for the data account.
其中,上述数据账户访问交易可以包括待访问的数据(可称为目标数据)的数据标识,以及授权给上述用户账户的针对该数据账户的访问权限信息。Wherein, the above-mentioned data account access transaction may include the data identification of the data to be accessed (which may be called target data), and the access permission information authorized to the above-mentioned user account for the data account.
上述区块链节点在接收到上述数据账户访问交易的情况下,可以响应于该数据账户访问交易,确定该数据账户访问交易中的访问权限信息,与该数据账户中的授权字段中维护的与该数据账户对应的访问授权信息是否匹配。When the above-mentioned blockchain node receives the above-mentioned data account access transaction, it can respond to the data account access transaction and determine whether the access permission information in the data account access transaction is consistent with the authorization field maintained in the data account. Whether the access authorization information corresponding to the data account matches.
如果两者匹配,则可以确定上述用户账户具有上述数据账户的访问权限,从而可以在该数据账户中维护的业务数据中查找与上述数据账户访问交易中的数据标识对应的上述目标数据。If the two match, it can be determined that the above-mentioned user account has access rights to the above-mentioned data account, so that the above-mentioned target data corresponding to the data identifier in the above-mentioned data account access transaction can be found in the business data maintained in the data account.
由于与数据账户对应的访问授权信息可以包括由至少一个目标账户的账户标识,以及授权给这至少一个目标账户的针对该数据账户的访问权限信息的对应关系,构成的访问授权列表,在示出的一种实施方式中,上述数据账户访问交易还可以包括上述用户账户的账户标识。Since the access authorization information corresponding to the data account may include the corresponding relationship between the account identification of at least one target account and the access permission information authorized to the at least one target account for the data account, the access authorization list is shown in In an implementation manner, the above-mentioned data account access transaction may also include the account identification of the above-mentioned user account.
在上述情况下,在确定上述数据账户访问交易中的访问权限信息,与上述数据账户中的授权字段中维护的与该数据账户对应的访问授权信息是否匹配时,具体可以先基于该数据账户中的授权字段中维护的访问授权列表,查找与该用户账户的账户标识对应的访问权限信息,再确定该数据账户访问交易中的访问权限信息与查找到的访问权限信息是否匹配,如果是,则可以确定该访问权限信息与该数据账户对应的访问授权信息匹配。In the above case, when determining whether the access permission information in the above-mentioned data account access transaction matches the access authorization information corresponding to the data account maintained in the authorization field in the above-mentioned data account, the specific method may first be based on the information in the data account. The access authorization list maintained in the authorization field, looks for the access permission information corresponding to the account ID of the user account, and then determines whether the access permission information in the data account access transaction matches the found access permission information. If so, then It can be determined that the access permission information matches the access authorization information corresponding to the data account.
由于数据账户中维护的业务数据可以被组织成Merkle树的形式,在区块链节点搭载的本地数据库中存储,而Merkle树上存储的是key-value键值对,在示出的一种实施方式中,上述目标数据的数据标识可以包括该目标数据的key。Since the business data maintained in the data account can be organized into the form of a Merkle tree and stored in the local database carried by the blockchain node, and the Merkle tree stores key-value pairs, in an implementation shown In this method, the data identifier of the target data may include the key of the target data.
在上述情况下,在上述数据账户中维护的业务数据中查找与上述数据账户访问交易中的数据标识对应的上述目标数据时,具体可以在上述区块链节点搭载的本地数据库中存储的上述Merkle树中,查找与该目标数据的key对应的value,并将查找到的该value确定为该目标数据。In the above case, when searching for the above target data corresponding to the data identifier in the above data account access transaction in the business data maintained in the above data account, the above Merkle stored in the local database carried by the above blockchain node can be used. In the tree, search for the value corresponding to the key of the target data, and determine the found value as the target data.
在示出的一种实施方式中,上述访问权限信息还可以包括有效期,以及授权给上述用户账户访问权限的数据的数据标识集合。In an embodiment shown, the above-mentioned access permission information may also include a validity period, and a data identification set of data authorized to the above-mentioned user account access permission.
在上述情况下,在确定了上述访问权限信息与上述数据账户对应的访问授权信息匹配时,还可以基于该访问权限信息中的所述有限期,确定该访问权限信息是否有效,如果是,则可以进一步确定该访问权限信息中的上述数据标识集合是否包括上述目标数据的数据标识,如果是,则可以确定上述用户账户具有该数据账户的访问权限。In the above case, when it is determined that the access permission information matches the access authorization information corresponding to the data account, it can also be determined based on the limited period in the access permission information whether the access permission information is valid. If so, then It may be further determined whether the above-mentioned data identification set in the access permission information includes the data identification of the above-mentioned target data, and if so, it may be determined that the above-mentioned user account has the access permission for the data account.
(2)合约账户访问数据账户(2) Contract account access data account
结合如图5所示的数据账户的访问授权方法,请参考图9,图9是本说明书一示例性实施例示出的另一种数据账户的访问授权方法的流程图。In conjunction with the data account access authorization method shown in Figure 5, please refer to Figure 9, which is a flow chart of another data account access authorization method according to an exemplary embodiment of this specification.
上述数据账户的访问授权方法可以包括以下步骤:The access authorization method for the above data account may include the following steps:
步骤902:接收与所述数据账户对应的管理方发起的针对所述数据账户的数据账户授权交易;其中, 所述数据账户授权交易包括与所述区块链上部署的智能合约对应的合约账户的账户标识,以及授权给所述合约账户的针对所述数据账户的访问权限信息。Step 902: Receive a data account authorization transaction for the data account initiated by the manager corresponding to the data account; wherein, the data account authorization transaction includes a contract account corresponding to the smart contract deployed on the blockchain The account identification, and the access permission information authorized to the contract account for the data account.
步骤904:响应于所述数据账户授权交易,确定所述管理方是否具有与所述数据账户对应的管理权限。Step 904: In response to the data account authorization transaction, determine whether the manager has management authority corresponding to the data account.
步骤906:如果所述管理方具有与所述数据账户对应的管理权限,则将所述合约账户的账户标识和所述访问权限信息的对应关系作为与所述数据账户对应的访问授权信息,填充至所述数据账户中的授权字段。Step 906: If the manager has the management authority corresponding to the data account, fill in the corresponding relationship between the account ID of the contract account and the access authority information as the access authorization information corresponding to the data account. to the authorization field in said data account.
步骤902至906的具体实现可以参考步骤502至506,本说明书在此不再赘述。For the specific implementation of steps 902 to 906, reference can be made to steps 502 to 506, which will not be described again in this specification.
请参考图10,图10是本说明书一示例性实施例示出的另一种数据账户的访问授权方法的流程图。Please refer to FIG. 10 , which is a flow chart of another data account access authorization method according to an exemplary embodiment of this specification.
上述数据账户的访问授权方法可以包括以下步骤:The access authorization method for the above data account may include the following steps:
步骤1002:接收与所述区块链上部署的智能合约对应的合约账户对应的管理方发起的针对所述数据账户的数据账户授权交易;其中,所述数据账户授权交易包括所述合约账户的账户标识,以及授权给所述合约账户的针对所述数据账户的访问权限信息。Step 1002: Receive a data account authorization transaction for the data account initiated by the manager corresponding to the contract account corresponding to the smart contract deployed on the blockchain; wherein the data account authorization transaction includes the data account authorization transaction of the contract account. Account identification, and access permission information for the data account authorized to the contract account.
步骤1004:响应于所述数据账户授权交易,确定所述管理方是否具有与所述合约账户对应的管理权限。Step 1004: In response to the data account authorization transaction, determine whether the manager has management authority corresponding to the contract account.
步骤1006:如果所述管理方具有与所述合约账户对应的管理权限,则生成与授权给所述合约账户针对所述数据账户的访问权限对应的审批事件,以使与所述数据账户对应的管理方在获取到所述审批事件时,对授权给所述合约账户针对所述数据账户的访问权限进行审批,并返回审批结果。Step 1006: If the management party has management rights corresponding to the contract account, generate an approval event corresponding to the access rights authorized to the contract account for the data account, so that the access rights corresponding to the data account are generated. When the management party obtains the approval event, it approves the access rights authorized to the contract account for the data account, and returns the approval result.
步骤1008:响应于接收到的所述审批结果,在所述审批结果指示审批通过时,将所述合约账户的账户标识和所述访问权限信息的对应关系作为与所述数据账户对应的访问授权信息,填充至所述数据账户中的授权字段。Step 1008: In response to the received approval result, when the approval result indicates that the approval is passed, use the corresponding relationship between the account identification of the contract account and the access permission information as the access authorization corresponding to the data account. information to populate the authorization fields in said data account.
针对区块链上创建的任一数据账户,与所述区块链上部署的智能合约对应的任一合约账户对应的管理方也可以发起针对该数据账户的数据账户授权交易。在这种情况下,该区块链中的区块链节点可以接收到该数据账户授权交易。For any data account created on the blockchain, the manager corresponding to any contract account corresponding to the smart contract deployed on the blockchain can also initiate a data account authorization transaction for the data account. In this case, the blockchain node in the blockchain can receive the data account authorization transaction.
其中,上述数据账户授权交易可以包括上述合约账户的账户标识,以及授权给该合约账户的针对上述数据账户的访问权限信息。Wherein, the above-mentioned data account authorization transaction may include the account identification of the above-mentioned contract account, and the access permission information authorized to the contract account for the above-mentioned data account.
上述区块链节点在接收到上述数据账户授权交易的情况下,可以响应于该数据账户授权交易,确定发起该数据账户授权交易的上述管理方是否具有与上述合约账户对应的管理权限。When the above-mentioned blockchain node receives the above-mentioned data account authorization transaction, it can respond to the data account authorization transaction and determine whether the above-mentioned manager who initiated the data account authorization transaction has the management authority corresponding to the above-mentioned contract account.
如果上述管理方具有与上述合约账户对应的管理权限,则可以生成与授权给该合约账户针对上述数据账户的访问权限对应的审批事件,并将该审批事件发布至上述区块链,从而使与该数据账户对应的管理方可以从该区块链上获取到该审批事件,据此对授权给该合约账户针对该数据账户的访问权限进行审批,并返回审批结果。If the above-mentioned manager has the management rights corresponding to the above-mentioned contract account, it can generate an approval event corresponding to the access rights authorized to the contract account for the above-mentioned data account, and publish the approval event to the above-mentioned blockchain, thereby enabling The manager corresponding to the data account can obtain the approval event from the blockchain, approve the access rights authorized to the contract account for the data account accordingly, and return the approval results.
上述区块链节点在接收到上述审批结果的情况下,可以响应于该审批结果,在该审批结果指示审批通过时,将上述合约账户的账户标识和上述访问权限信息的对应关系,作为与上述数据账户对应的访问授权信息,填充至该数据账户中的授权字段。When the above-mentioned blockchain node receives the above-mentioned approval result, it may respond to the approval result and, when the approval result indicates that the approval is passed, use the corresponding relationship between the account identification of the above-mentioned contract account and the above-mentioned access permission information as the corresponding relationship with the above-mentioned The access authorization information corresponding to the data account is filled in the authorization field in the data account.
需要说明的是,在完成将智能合约部署在区块链上后,可以为与该智能合约对应的合约账户分配对应的公私钥对。也即,与该合约账户对应的管理方可以持有该公私钥对,其中的私钥可以用于对该管理方发起的交易进行签名,公钥则可以用于对签名进行验证。公钥可以在区块链中进行广播。It should be noted that after the smart contract is deployed on the blockchain, the corresponding public and private key pair can be assigned to the contract account corresponding to the smart contract. That is, the manager corresponding to the contract account can hold the public-private key pair, the private key can be used to sign transactions initiated by the manager, and the public key can be used to verify the signature. Public keys can be broadcast in the blockchain.
在示出的一种实施方式中,在上述数据账户的账户结构还包括用于维护该数据账户的管理方的公钥的管理字段的情况下,在确定发起上述数据账户授权交易的管理方是否具有与上述数据账户对应的管理权限时,具体可以确定该管理方的公钥与该管理字段中维护的该数据账户的管理方的公钥是否匹配,如果是,则可以确定该管理方具有与该数据账户对应的管理权限。In an embodiment shown, in the case where the account structure of the above-mentioned data account also includes a management field for maintaining the public key of the manager of the data account, when determining whether the manager who initiated the above-mentioned data account authorization transaction When you have the management authority corresponding to the above data account, you can specifically determine whether the public key of the manager matches the public key of the manager of the data account maintained in the management field. If so, you can determine that the manager has the same The management permissions corresponding to this data account.
在示出的一种实施方式中,上述管理字段具体可以用于维护数据账户的至少一个管理方的公钥,以及为这至少一个管理方的公钥分配的权重的对应关系。在这种情况下,在确定发起上述数据账户授权交易的管理方的公钥与该管理字段中维护的该数据账户的管理方的公钥是否匹配时,具体可以基于该管理字段中维护的该对应关系,确定与该管理方的公钥对应的权重是否达到预设的阈值,如果是,则可以确定该管理方的公钥与该数据账户的管理方的公钥匹配。In one embodiment shown, the above-mentioned management field can be specifically used to maintain the corresponding relationship between the public key of at least one manager of the data account and the weight assigned to the public key of the at least one manager. In this case, when determining whether the public key of the manager who initiated the above-mentioned data account authorization transaction matches the public key of the manager of the data account maintained in the management field, it may be specifically based on the public key maintained in the management field. Correspondence relationship, determine whether the weight corresponding to the public key of the manager reaches a preset threshold, and if so, it can be determined that the public key of the manager matches the public key of the manager of the data account.
在实际应用中,可以基于发起上述数据账户授权交易的管理方的私钥,对该数据账户授权交易进行签名。相应的,在对该数据账户授权交易进行响应之前,可以先确定该管理方的公钥,再基于该管理方的公钥对签名进行验证,如果验证通过再进行响应。In practical applications, the data account authorization transaction can be signed based on the private key of the manager who initiated the above data account authorization transaction. Correspondingly, before responding to the data account authorization transaction, the public key of the manager can be determined first, and then the signature is verified based on the public key of the manager. If the verification is passed, a response can be made.
类似的,上述合约账户的账户结构也可以包括用于维护该合约账户的管理方的公钥的管理字段。在这种情况下,在确定发起上述数据账户授权交易的管理方是否具有与该合约账户对应的管理权限时,也可以确定该管理方的公钥与该管理字段中维护的该合约账户的管理方的公钥是否匹配,如果是,则可以确定该管理方具有与该合约账户对应的管理权限。Similarly, the account structure of the above-mentioned contract account may also include a management field used to maintain the public key of the manager of the contract account. In this case, when determining whether the manager who initiated the above-mentioned data account authorization transaction has the management authority corresponding to the contract account, it is also possible to determine whether the manager's public key and the management of the contract account maintained in the management field Whether the party's public key matches, if so, it can be determined that the manager has the management authority corresponding to the contract account.
需要说明的是,还可以采用与如图6或7所示的数据账户的访问授权方法类似的方式,对上述数据账户中的授权字段中维护的与该数据账户对应的访问授权信息进行全部或部分的更新;或者,对上述数据账户中的授权字段中维护的与该数据账户对应的访问授权信息进行全部或部分的授权撤销(例如:删除或者标记为授权已撤销)。It should be noted that a method similar to the access authorization method of the data account shown in Figure 6 or 7 can also be used to perform all or all access authorization information corresponding to the data account maintained in the authorization field in the above data account. Partial update; or, revoke all or part of the authorization for the access authorization information corresponding to the data account maintained in the authorization field in the above-mentioned data account (for example: delete or mark the authorization as revoked).
在如图9或10所示的数据账户的访问授权方法的基础上,请参考图11,图11是本说明书一示例性实施例示出的一种数据账户访问方法的流程图。Based on the data account access authorization method shown in Figure 9 or 10, please refer to Figure 11, which is a flow chart of a data account access method according to an exemplary embodiment of this specification.
上述数据账户访问方法可以包括以下步骤:The above data account access method may include the following steps:
步骤1102:接收所述合约账户针对所述数据账户的数据账户访问交易;其中,所述数据账户访问交易包括待访问的目标数据的数据标识,以及授权给所述合约账户的针对所述数据账户的访问权限信息。Step 1102: Receive the data account access transaction from the contract account for the data account; wherein the data account access transaction includes the data identification of the target data to be accessed, and the data account authorized to the contract account for the data account. access rights information.
步骤1104:响应于所述数据账户访问交易,确定所述数据账户访问交易中的访问权限信息,与所述数据账户中的授权字段中维护的与所述数据账户对应的访问授权信息是否匹配。Step 1104: In response to the data account access transaction, determine whether the access permission information in the data account access transaction matches the access authorization information corresponding to the data account maintained in the authorization field in the data account.
步骤1106:如果所述访问权限信息与所述数据账户对应的访问授权信息匹配,则确定所述合约账户具有所述数据账户的访问权限,并在所述数据账户中维护的业务数据中查找与所述数据标识对应的所述目标数据。Step 1106: If the access permission information matches the access authorization information corresponding to the data account, determine that the contract account has the access permission of the data account, and search the business data maintained in the data account. The data identifies the corresponding target data.
针对区块链上创建的任一数据账户,上述区块链中的区块链节点可以接收到任一合约账户针对该数据账户的数据账户访问交易。For any data account created on the blockchain, the blockchain node in the above-mentioned blockchain can receive the data account access transaction of any contract account for the data account.
其中,上述数据账户访问交易可以包括待访问的数据(可称为目标数据)的数据标识,以及授权给上述合约账户的针对该数据账户的访问权限信息。Wherein, the above-mentioned data account access transaction may include the data identification of the data to be accessed (which may be called target data), and the access permission information authorized to the above-mentioned contract account for the data account.
上述区块链节点在接收到上述数据账户访问交易的情况下,可以响应于该数据账户访问交易,确定该数据账户访问交易中的访问权限信息,与该数据账户中的授权字段中维护的与该数据账户对应的访问授权信息是否匹配。When the above-mentioned blockchain node receives the above-mentioned data account access transaction, it can respond to the data account access transaction and determine whether the access permission information in the data account access transaction is consistent with the authorization field maintained in the data account. Whether the access authorization information corresponding to the data account matches.
如果两者匹配,则可以确定上述合约账户具有上述数据账户的访问权限,从而可以在该数据账户中维护的业务数据中查找与上述数据账户访问交易中的数据标识对应的上述目标数据。If the two match, it can be determined that the above-mentioned contract account has access rights to the above-mentioned data account, so that the above-mentioned target data corresponding to the data identification in the above-mentioned data account access transaction can be found in the business data maintained in the data account.
由于与数据账户对应的访问授权信息可以包括由至少一个目标账户的账户标识,以及授权给这至少一个目标账户的针对该数据账户的访问权限信息的对应关系,构成的访问授权列表,在示出的一种实施方式中,上述数据账户访问交易还可以包括上述合约账户的账户标识。Since the access authorization information corresponding to the data account may include the corresponding relationship between the account identification of at least one target account and the access permission information authorized to the at least one target account for the data account, the access authorization list is shown in In an implementation manner, the above-mentioned data account access transaction may also include the account identification of the above-mentioned contract account.
在上述情况下,在确定上述数据账户访问交易中的访问权限信息,与上述数据账户中的授权字段中维护的与该数据账户对应的访问授权信息是否匹配时,具体可以先基于该数据账户中的授权字段中维护的访问授权列表,查找与该合约账户的账户标识对应的访问权限信息,再确定该数据账户访问交易中的访问权限信息与查找到的访问权限信息是否匹配,如果是,则可以确定该访问权限信息与该数据账户对 应的访问授权信息匹配。In the above case, when determining whether the access permission information in the above-mentioned data account access transaction matches the access authorization information corresponding to the data account maintained in the authorization field in the above-mentioned data account, the specific method may first be based on the information in the data account. Use the access authorization list maintained in the authorization field to find the access permission information corresponding to the account ID of the contract account, and then determine whether the access permission information in the data account access transaction matches the found access permission information. If so, then It can be determined that the access permission information matches the access authorization information corresponding to the data account.
由于数据账户中维护的业务数据可以被组织成Merkle树的形式,在区块链节点搭载的本地数据库中存储,而Merkle树上存储的是key-value键值对,在示出的一种实施方式中,上述目标数据的数据标识可以包括该目标数据的key。Since the business data maintained in the data account can be organized into the form of a Merkle tree and stored in the local database carried by the blockchain node, and the Merkle tree stores key-value pairs, in an implementation shown In this method, the data identifier of the target data may include the key of the target data.
在上述情况下,在上述数据账户中维护的业务数据中查找与上述数据账户访问交易中的数据标识对应的上述目标数据时,具体可以在上述区块链节点搭载的本地数据库中存储的上述Merkle树中,查找与该目标数据的key对应的value,并将查找到的该value确定为该目标数据。In the above case, when searching for the above target data corresponding to the data identifier in the above data account access transaction in the business data maintained in the above data account, the above Merkle stored in the local database carried by the above blockchain node can be used. In the tree, search for the value corresponding to the key of the target data, and determine the found value as the target data.
在示出的一种实施方式中,上述访问权限信息还可以包括有效期,以及授权给上述合约账户访问权限的数据的数据标识集合。In an embodiment shown, the above-mentioned access permission information may also include a validity period, and a data identification set of data authorized to the above-mentioned contract account access permission.
在上述情况下,在确定了上述访问权限信息与上述数据账户对应的访问授权信息匹配时,还可以基于该访问权限信息中的所述有限期,确定该访问权限信息是否有效,如果是,则可以进一步确定该访问权限信息中的上述数据标识集合是否包括上述目标数据的数据标识,如果是,则可以确定上述合约账户具有该数据账户的访问权限。In the above case, when it is determined that the access permission information matches the access authorization information corresponding to the data account, it can also be determined based on the limited period in the access permission information whether the access permission information is valid. If so, then It can be further determined whether the above-mentioned data identification set in the access permission information includes the data identification of the above-mentioned target data, and if so, it can be determined that the above-mentioned contract account has the access permission of the data account.
在实际应用中,对于区块链上部署的智能合约进行合约计算所需的业务数据而言,其通常会根据实际情况的变化而发生变化。为了保证区块链上创建的数据账户中维护的业务数据的正确性,避免智能合约基于该业务数据进行合约计算时出现差错,就需要对区块链上创建的数据账户中维护的业务数据进行更新。In practical applications, the business data required for contract calculations by smart contracts deployed on the blockchain usually changes based on changes in actual conditions. In order to ensure the correctness of the business data maintained in the data account created on the blockchain and avoid errors when the smart contract performs contract calculations based on the business data, it is necessary to perform business data maintenance on the data account created on the blockchain. renew.
在示出的一种实施方式中,在如图3所示的数据账户创建方法的基础上,请参考图12,图12是本说明书一示例性实施例示出的一种数据账户更新方法的流程图。In an embodiment shown, based on the data account creation method shown in Figure 3, please refer to Figure 12. Figure 12 is a flow chart of a data account update method shown in an exemplary embodiment of this specification. picture.
上述数据账户更新方法可以包括以下步骤:The above data account update method may include the following steps:
步骤1202:接收与所述数据账户对应的管理方发起的针对所述数据账户的数据账户更新交易;其中,所述数据账户更新交易包括更新后的所述业务数据。Step 1202: Receive a data account update transaction for the data account initiated by the manager corresponding to the data account; wherein the data account update transaction includes the updated business data.
步骤1204:响应于所述数据账户更新交易,确定所述管理方是否具有与所述数据账户对应的管理权限。Step 1204: In response to the data account update transaction, determine whether the manager has management authority corresponding to the data account.
步骤1206:如果所述管理方具有与所述数据账户对应的管理权限,则将更新后的所述业务数据写入所述本地数据库中存储的默克尔树,以对所述默克尔树上已写入的所述业务数据进行更新,并将更新后的默克尔树的根节点的Hash值填充至所述数据账户中的数据存储字段。Step 1206: If the management party has the management authority corresponding to the data account, write the updated business data into the Merkle tree stored in the local database to update the Merkle tree. The business data that has been written is updated, and the Hash value of the root node of the updated Merkle tree is filled into the data storage field in the data account.
针对区块链上创建的任一数据账户,与该数据账户对应的管理方可以发起针对该数据账户的数据账户更新交易。在这种情况下,该区块链中的区块链节点可以接收到该数据账户更新交易。For any data account created on the blockchain, the manager corresponding to the data account can initiate a data account update transaction for the data account. In this case, the data account update transaction can be received by the blockchain nodes in the blockchain.
由于上述数据账户可以用于维护上述区块链上部署的智能合约进行合约计算所需的业务数据,在这种情况下,上述数据账户更新交易可以包括更新后的该业务数据。Since the above data account can be used to maintain the business data required for contract calculation by smart contracts deployed on the above blockchain, in this case, the above data account update transaction can include the updated business data.
上述区块链节点在接收到上述数据账户更新交易的情况下,可以响应于该数据账户更新交易,确定发起该数据账户更新交易的上述管理方是否具有与上述数据账户对应的管理权限。When the above-mentioned blockchain node receives the above-mentioned data account update transaction, it may respond to the data account update transaction and determine whether the above-mentioned manager who initiated the data account update transaction has the management authority corresponding to the above-mentioned data account.
如果上述管理方具有与上述数据账户对应的管理权限,则可以基于更新后的上述业务数据对该数据账户中维护的上述业务数据进行更新。If the above-mentioned manager has the management authority corresponding to the above-mentioned data account, the above-mentioned business data maintained in the data account can be updated based on the above-mentioned updated business data.
由于上述数据账户中维护的上述业务数据可以被组织成Merkle树的形式,在上述区块链节点搭载的本地数据库中存储,在这种情况下,可以将更新后的上述业务数据写入该Merkle树,以对该Merkle树上已写入的该业务数据进行更新,并将更新后的Merkle树的根节点的Hash值填充至该数据账户中的数据存储字段。由此,该数据账户中的数据存储字段中维护的数据,即可由写入了原先的该业务数据的Merkle树的根节点的Hash值,更新为写入了更新后的该业务数据的Merkle树的根节点的Hash值。Since the above-mentioned business data maintained in the above-mentioned data account can be organized into the form of a Merkle tree and stored in the local database carried by the above-mentioned blockchain node, in this case, the updated above-mentioned business data can be written into the Merkle tree. tree to update the business data that has been written on the Merkle tree, and fill the hash value of the root node of the updated Merkle tree into the data storage field in the data account. Therefore, the data maintained in the data storage field in the data account can be updated from the hash value of the root node of the Merkle tree in which the original business data is written to the Merkle tree in which the updated business data is written. The Hash value of the root node.
需要说明的是,上述数据账户更新交易还可以包括与更新后的上述业务数据对应的数据描述信息。在这种情况下,在对上述数据账户中维护的上述业务数据进行更新的同时,还可以将该数据账户中的数 据描述字段中维护的数据,由与原先的该业务数据对应的数据描述信息的Hash值,更新为与更新后的该业务数据对应的数据描述信息的Hash值。It should be noted that the above-mentioned data account update transaction may also include data description information corresponding to the updated above-mentioned business data. In this case, while updating the above-mentioned business data maintained in the above-mentioned data account, the data maintained in the data description field in the above-mentioned data account can also be replaced by the data description information corresponding to the original business data. The Hash value is updated to the Hash value of the data description information corresponding to the updated business data.
在实际应用中,可以对区块链支持的原生交易类型进行扩展,以在该区块链中扩展出具有新的功能的原生交易。需要说明的是,扩展出的具有新的功能的原生交易,具体可以是独立于转账交易或智能合约调用交易的原生交易。In practical applications, the native transaction types supported by the blockchain can be expanded to extend native transactions with new functions in the blockchain. It should be noted that the expanded native transaction with new functions can specifically be a native transaction that is independent of transfer transactions or smart contract call transactions.
在示出的一种实施方式中,可以对区块链支持的原生交易类型进行扩展,以在该区块链中扩展出一种用于创建数据账户的原生交易,可称为数据账户创建交易。In an embodiment shown, the native transaction types supported by the blockchain can be extended to extend a native transaction for creating a data account in the blockchain, which can be called a data account creation transaction. .
例如,对于采用UTXO模型的区块链而言,可以在其支持的转账交易的基础上,再扩展出一种专用于创建数据账户的数据账户创建交易;而对于采用账户模型的区块链而言,则可以在其支持的转账交易、智能合约创建交易和智能合约调用交易的基础上,再扩展出一种专用于创建数据账户的数据账户创建交易。For example, for a blockchain using the UTXO model, a data account creation transaction dedicated to creating a data account can be extended based on the transfer transactions it supports; while for a blockchain using the account model, In other words, based on the transfer transactions, smart contract creation transactions and smart contract call transactions it supports, a data account creation transaction dedicated to creating data accounts can be expanded.
同理,可以对区块链支持的原生交易类型进行扩展,以在该区块链中扩展出一种用于对所述数据账户中维护的业务数据进行更新的原生交易,可称为数据账户更新交易。In the same way, the native transaction types supported by the blockchain can be expanded to extend a native transaction in the blockchain for updating the business data maintained in the data account, which can be called a data account. Update transaction.
可以对区块链支持的原生交易类型进行扩展,以在该区块链中扩展出一种用于对所述数据账户进行访问授权的原生交易,可称为数据账户授权交易。The native transaction types supported by the blockchain can be expanded to include a native transaction for authorizing access to the data account in the blockchain, which can be called a data account authorization transaction.
可以对区块链支持的原生交易类型进行扩展,以在该区块链中扩展出一种用于对所述数据账户进行访问的原生交易,可称为数据账户访问交易。The native transaction types supported by the blockchain can be expanded to extend a native transaction for accessing the data account in the blockchain, which can be called a data account access transaction.
其中,上述数据账户创建交易、上述数据账户更新交易、上述数据账户授权交易、上述数据账户访问交易的交易格式,在本说明书中不进行特别限定;在实际应用中,可以采用兼容区块链现有的交易格式,也可以重新定义新的交易格式。Among them, the transaction formats of the above-mentioned data account creation transactions, the above-mentioned data account update transactions, the above-mentioned data account authorization transactions, and the above-mentioned data account access transactions are not specifically limited in this manual; in practical applications, compatible blockchain current transactions can be used. Some transaction formats can also be redefined into new transaction formats.
请参考图13,图13是本说明书一示例性实施例示出的一种设备的硬件结构的示意图。Please refer to FIG. 13 , which is a schematic diagram of the hardware structure of a device according to an exemplary embodiment of this specification.
如图13所示,在硬件层面,上述设备包括处理器1302、内部总线1304、网络接口1306、内存1308以及非易失性存储器1310,当然还可能包括其他业务所需要的硬件。本说明书一个或多个实施例可以基于软件方式来实现,比如由处理器1302从非易失性存储器1310中读取对应的计算机程序到内存1308中然后运行。当然,除了软件实现方式之外,本说明书一个或多个实施例并不排除其他实现方式,比如逻辑器件抑或软硬件结合的方式等等,也就是说以下处理流程的执行主体并不限定于各个逻辑模块,也可以是硬件或逻辑器件。As shown in Figure 13, at the hardware level, the above-mentioned equipment includes a processor 1302, an internal bus 1304, a network interface 1306, a memory 1308, and a non-volatile memory 1310. Of course, it may also include other hardware required for services. One or more embodiments of this specification can be implemented based on software. For example, the processor 1302 reads the corresponding computer program from the non-volatile memory 1310 into the memory 1308 and then runs it. Of course, in addition to software implementation, one or more embodiments of this specification do not exclude other implementations, such as logic devices or a combination of software and hardware, etc. That is to say, the execution subject of the following processing flow is not limited to each Logic modules can also be hardware or logic devices.
请参考图14,图14是本说明书一示例性实施例示出的一种数据账户创建装置的框图。Please refer to FIG. 14 , which is a block diagram of a data account creation device according to an exemplary embodiment of this specification.
上述数据账户创建装置可以应用于如图13所示的设备,以实现本说明书的技术方案。该设备可以作为区块链中的区块链节点;所述区块链支持的账户类型包括数据账户;所述数据账户用于维护所述区块链上部署的智能合约进行合约计算所需的业务数据;该数据账户创建装置可以包括:The above-mentioned data account creation device can be applied to the device shown in Figure 13 to implement the technical solution of this specification. The device can be used as a blockchain node in the blockchain; the account types supported by the blockchain include data accounts; the data account is used to maintain the smart contracts deployed on the blockchain required for contract calculations. Business data; the data account creation device may include:
接收模块1402,接收用于创建所述数据账户的数据账户创建交易;其中,所述数据账户创建交易包括所述区块链上部署的智能合约进行合约计算所需的业务数据;The receiving module 1402 receives a data account creation transaction used to create the data account; wherein the data account creation transaction includes business data required for contract calculation by smart contracts deployed on the blockchain;
创建模块1404,响应于所述数据账户创建交易,在所述区块链上创建数据账户;以及,将所述业务数据添加至所述数据账户进行维护。The creation module 1404 creates a data account on the blockchain in response to the data account creation transaction; and adds the business data to the data account for maintenance.
可选的,所述数据账户中维护的业务数据被组织成默克尔树的形式,在所述区块链节点搭载的本地数据库中存储;所述数据账户的账户结构包括用于维护所述默克尔树的根节点的Hash值的数据存储字段;Optionally, the business data maintained in the data account is organized into the form of a Merkle tree and stored in the local database carried by the blockchain node; the account structure of the data account includes a method for maintaining the The data storage field of the Hash value of the root node of the Merkel tree;
所述创建模块1404:The creation module 1404:
将所述业务数据写入所述本地数据库中存储的默克尔树,以对所述默克尔树进行更新,并将更新后的默克尔树的根节点的Hash值填充至所述数据账户中的数据存储字段。Write the business data to the Merkle tree stored in the local database to update the Merkle tree, and fill the Hash value of the root node of the updated Merkle tree into the data Data storage fields in accounts.
可选的,所述业务数据包括业务数据内容和与所述业务数据内容对应的数据访问代码;Optionally, the service data includes service data content and a data access code corresponding to the service data content;
所述创建模块1404:The creation module 1404:
将所述业务数据内容和所述数据访问代码的对应关系,写入所述本地数据库中存储的默克尔树,以对所述默克尔树进行更新,并将更新后的默克尔树的根节点的Hash值填充至所述数据账户中的数据存储字段。Write the corresponding relationship between the business data content and the data access code into the Merkle tree stored in the local database to update the Merkle tree, and store the updated Merkle tree The hash value of the root node is filled into the data storage field in the data account.
可选的,所述数据访问代码包括用于读写业务数据内容的接口代码。Optionally, the data access code includes interface code for reading and writing business data content.
可选的,所述数据账户创建交易还包括与所述业务数据对应的数据描述信息;所述数据账户的账户结构还包括用于维护所述数据描述信息的Hash值的数据描述字段;Optionally, the data account creation transaction also includes data description information corresponding to the business data; the account structure of the data account also includes a data description field used to maintain the Hash value of the data description information;
所述装置还包括:The device also includes:
计算模块,计算所述数据账户创建交易中的与所述业务数据对应的数据描述信息的Hash值,并将计算出的所述Hash值填充至所述数据账户中的数据描述字段。The calculation module calculates the hash value of the data description information corresponding to the business data in the data account creation transaction, and fills the calculated hash value into the data description field in the data account.
可选的,所述装置还包括:Optionally, the device also includes:
第二接收模块,接收与所述数据账户对应的管理方发起的针对所述数据账户的数据账户更新交易;其中,所述数据账户更新交易包括更新后的所述业务数据;The second receiving module receives a data account update transaction for the data account initiated by the manager corresponding to the data account; wherein the data account update transaction includes the updated business data;
第二确定模块,响应于所述数据账户更新交易,确定所述管理方是否具有与所述数据账户对应的管理权限;A second determination module, in response to the data account update transaction, determines whether the manager has management authority corresponding to the data account;
更新模块,如果所述管理方具有与所述数据账户对应的管理权限,则将更新后的所述业务数据写入所述本地数据库中存储的默克尔树,以对所述默克尔树上已写入的所述业务数据进行更新,并将更新后的默克尔树的根节点的Hash值填充至所述数据账户中的数据存储字段。Update module, if the management party has the management authority corresponding to the data account, writes the updated business data into the Merkle tree stored in the local database to update the Merkle tree The business data that has been written is updated, and the Hash value of the root node of the updated Merkle tree is filled into the data storage field in the data account.
可选的,所述数据账户的账户结构包括用于维护与所述数据账户对应的访问授权信息的授权字段;Optionally, the account structure of the data account includes an authorization field used to maintain access authorization information corresponding to the data account;
所述装置还包括:The device also includes:
第三接收模块,接收与所述数据账户对应的管理方发起的针对所述数据账户的数据账户授权交易;其中,所述数据账户授权交易包括目标账户的账户标识,以及授权给所述目标账户的针对所述数据账户的访问权限信息;The third receiving module receives a data account authorization transaction for the data account initiated by the manager corresponding to the data account; wherein the data account authorization transaction includes the account identification of the target account, and authorization to the target account access permission information for the data account;
第三确定模块,响应于所述数据账户授权交易,确定所述管理方是否具有与所述数据账户对应的管理权限;A third determination module, in response to the data account authorization transaction, determines whether the manager has management authority corresponding to the data account;
授权模块,如果所述管理方具有与所述数据账户对应的管理权限,则将所述目标账户的账户标识和所述访问权限信息的对应关系作为与所述数据账户对应的访问授权信息,填充至所述数据账户中的授权字段。The authorization module, if the manager has the management authority corresponding to the data account, fills in the corresponding relationship between the account identification of the target account and the access authority information as the access authorization information corresponding to the data account. to the authorization field in said data account.
可选的,与所述数据账户对应的访问授权信息包括由至少一个目标账户的账户标识,以及授权给所述至少一个目标账户的针对所述数据账户的访问权限信息的对应关系构成的访问授权列表。Optionally, the access authorization information corresponding to the data account includes an access authorization consisting of the account identification of at least one target account and the corresponding relationship of the access permission information authorized to the at least one target account for the data account. list.
可选的,所述对应关系为key-value键值对;所述访问授权列表为与所述至少一个目标账户对应的key-value键值对构成的Map列表;其中,所述key-value键值对的key为所述至少一个目标账户的账户标识,所述key-value键值对的value为授权给所述至少一个目标账户的针对所述数据账户的访问权限信息。Optionally, the corresponding relationship is a key-value pair; the access authorization list is a Map list composed of key-value pairs corresponding to the at least one target account; wherein, the key-value key The key of the value pair is the account identifier of the at least one target account, and the value of the key-value pair is the access permission information for the data account authorized to the at least one target account.
可选的,所述目标账户包括用户在所述区块链中注册的用户账户;或者,与所述区块链上部署的智能合约对应的合约账户。Optionally, the target account includes a user account registered by the user in the blockchain; or a contract account corresponding to a smart contract deployed on the blockchain.
可选的,所述数据账户的账户结构还包括以下示出的任一字段或者多个字段:Optionally, the account structure of the data account also includes any one or more fields shown below:
用于维护所述数据账户的账户标识的账户标识字段;an account identification field used to maintain the account identification of the data account;
用于维护所述数据账户持有的资产的余额的余额字段;a balance field used to maintain the balance of assets held by said data account;
用于维护所述数据账户的管理方的公钥的管理字段。A management field used to maintain the public key of the administrator of the data account.
可选的,所述数据账户创建交易为所述区块链支持的用于创建数据账户的原生交易;所述数据账户 授权交易为所述区块链支持的用于对所述数据账户进行访问授权的原生交易。Optionally, the data account creation transaction is a native transaction supported by the blockchain for creating a data account; the data account authorization transaction is a transaction supported by the blockchain for accessing the data account. Authorized native transactions.
对于装置实施例而言,其基本对应于方法实施例,因此相关之处参见方法实施例的部分说明即可。As for the device embodiment, it basically corresponds to the method embodiment, so for relevant details, please refer to the partial description of the method embodiment.
以上所描述的装置实施例仅仅是示意性的,其中所述作为分离部件说明的模块可以是或者也可以不是物理上分开的,作为模块显示的部件可以是或者也可以不是物理模块,即可以位于一个地方,或者也可以分布到多个网络模块上。可以根据实际的需要选择其中的部分或者全部模块来实现本说明书的技术方案的目的。The device embodiments described above are only illustrative. The modules described as separate components may or may not be physically separated. The components shown as modules may or may not be physical modules, that is, they may be located in One place, or it can be distributed to multiple network modules. Some or all of the modules can be selected according to actual needs to achieve the purpose of the technical solution in this specification.
上述实施例阐明的系统、装置、模块或单元,具体可以由计算机芯片或实体实现,或者由具有某种功能的产品来实现。一种典型的实现设备为计算机,计算机的具体形式可以是个人计算机、膝上型计算机、蜂窝电话、相机电话、智能电话、个人数字助理、媒体播放器、导航设备、电子邮件收发设备、游戏控制台、平板计算机、可穿戴设备或者这些设备中的任意几种设备的组合。The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer, which may be in the form of a personal computer, a laptop, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email transceiver, or a game controller. desktop, tablet, wearable device, or a combination of any of these devices.
在一个典型的配置中,计算机包括一个或多个处理器(CPU)、输入/输出接口、网络接口和内存。In a typical configuration, a computer includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
内存可能包括计算机可读介质中的非永久性存储器,随机存取存储器(RAM)和/或非易失性内存等形式,如只读存储器(ROM)或闪存(flash RAM)。内存是计算机可读介质的示例。Memory may include non-permanent storage in computer-readable media, random access memory (RAM) and/or non-volatile memory in the form of read-only memory (ROM) or flash memory (flash RAM). Memory is an example of computer-readable media.
计算机可读介质包括永久性和非永久性、可移动和非可移动媒体可以由任何方法或技术来实现信息存储。信息可以是计算机可读指令、数据结构、程序的模块或其他数据。计算机的存储介质的例子包括,但不限于相变内存(PRAM)、静态随机存取存储器(SRAM)、动态随机存取存储器(DRAM)、其他类型的随机存取存储器(RAM)、只读存储器(ROM)、电可擦除可编程只读存储器(EEPROM)、快闪记忆体或其他内存技术、只读光盘只读存储器(CD-ROM)、数字多功能光盘(DVD)或其他光学存储、磁盒式磁带、磁盘存储、量子存储器、基于石墨烯的存储介质或其他磁性存储设备或任何其他非传输介质,可用于存储可以被计算设备访问的信息。按照本文中的界定,计算机可读介质不包括暂存电脑可读媒体(transitory media),如调制的数据信号和载波。Computer-readable media includes both persistent and non-volatile, removable and non-removable media that can be implemented by any method or technology for storage of information. Information may be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, Magnetic tape cartridges, magnetic disk storage, quantum memory, graphene-based storage media or other magnetic storage devices, or any other non-transmission medium, can be used to store information that can be accessed by computing devices. As defined in this article, computer-readable media does not include transient computer-readable media (transitory media), such as modulated data signals and carrier waves.
还需要说明的是,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、商品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、商品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、商品或者设备中还存在另外的相同要素。It should also be noted that the terms "comprises," "comprises," or any other variation thereof are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that includes a list of elements not only includes those elements, but also includes Other elements are not expressly listed or are inherent to the process, method, article or equipment. Without further limitation, an element defined by the statement "comprises a..." does not exclude the presence of additional identical elements in a process, method, article, or device that includes the stated element.
上述对本说明书特定实施例进行了描述。其他实施例在所附权利要求书的范围内。在一些情况下,在权利要求书中记载的动作或步骤可以按照不同于实施例中的顺序来执行并且仍然可以实现期望的结果。另外,在附图中描绘的过程不一定要求示出的特定顺序或者连续顺序才能实现期望的结果。在某些实施方式中,多任务处理和并行处理也是可以的或者可能是有利的。The foregoing describes specific embodiments of this specification. Other embodiments are within the scope of the following claims. In some cases, the actions or steps recited in the claims can be performed in a different order than in the embodiments and still achieve desired results. Additionally, the processes depicted in the figures do not necessarily require the specific order shown, or sequential order, to achieve desirable results. Multitasking and parallel processing are also possible or may be advantageous in certain implementations.
在本说明书一个或多个实施例使用的术语是仅仅出于描述特定实施例的目的,而非旨在限制本说明书一个或多个实施例。在本说明书一个或多个实施例和所附权利要求书中所使用的单数形式的“一种”、“所述”和“该”也旨在包括多数形式,除非上下文清楚地表示其他含义。还应当理解,本文中使用的术语“和/或”是指并包含一个或多个相关联的列出项目的任何或所有可能组合。The terminology used in one or more embodiments of this specification is for the purpose of describing particular embodiments only and is not intended to limit the one or more embodiments of this specification. As used in one or more embodiments of this specification and the appended claims, the singular forms "a," "the" and "the" are intended to include the plural forms as well, unless the context clearly dictates otherwise. It will also be understood that the term "and/or" as used herein refers to and includes any and all possible combinations of one or more of the associated listed items.
应当理解,尽管在本说明书一个或多个实施例可能采用术语第一、第二、第三等来描述各种信息,但这些信息不应限于这些术语。这些术语仅用来将同一类型的信息彼此区分开。例如,在不脱离本说明书一个或多个实施例范围的情况下,第一信息也可以被称为第二信息,类似地,第二信息也可以被称为第一信息。取决于语境,如在此所使用的词语“如果”可以被解释成为“在……时”或“当……时”或“响应于确定”。It should be understood that although one or more embodiments of this specification may use the terms first, second, third, etc. to describe various information, the information should not be limited to these terms. These terms are only used to distinguish information of the same type from each other. For example, without departing from the scope of one or more embodiments of this specification, the first information may also be called second information, and similarly, the second information may also be called first information. Depending on the context, the word "if" as used herein may be interpreted as "when" or "when" or "in response to determining."
以上所述仅为本说明书一个或多个实施例的较佳实施例而已,并不用以限制本说明书一个或多个实施例,凡在本说明书一个或多个实施例的精神和原则之内,所做的任何修改、等同替换、改进等,均应包含在本说明书一个或多个实施例保护的范围之内。The above are only preferred embodiments of one or more embodiments of this specification, and are not intended to limit one or more embodiments of this specification. Within the spirit and principles of one or more embodiments of this specification, Any modifications, equivalent substitutions, improvements, etc. shall be included in the scope of protection of one or more embodiments of this specification.

Claims (15)

  1. 一种数据账户创建方法,应用于区块链节点;所述区块链支持的账户类型包括数据账户;所述数据账户用于维护所述区块链上部署的智能合约进行合约计算所需的业务数据;所述方法包括:A data account creation method, applied to blockchain nodes; the account types supported by the blockchain include data accounts; the data account is used to maintain the smart contracts deployed on the blockchain required for contract calculations Business data; the methods include:
    接收用于创建所述数据账户的数据账户创建交易;其中,所述数据账户创建交易包括所述区块链上部署的智能合约进行合约计算所需的业务数据;Receive a data account creation transaction used to create the data account; wherein the data account creation transaction includes business data required for contract calculation by smart contracts deployed on the blockchain;
    响应于所述数据账户创建交易,在所述区块链上创建数据账户;以及,creating a data account on the blockchain in response to the data account creation transaction; and,
    将所述业务数据添加至所述数据账户进行维护。Add the business data to the data account for maintenance.
  2. 根据权利要求1所述的方法,所述数据账户中维护的业务数据被组织成默克尔树的形式,在所述区块链节点搭载的本地数据库中存储;所述数据账户的账户结构包括用于维护所述默克尔树的根节点的Hash值的数据存储字段;According to the method of claim 1, the business data maintained in the data account is organized into the form of a Merkel tree and stored in a local database carried by the blockchain node; the account structure of the data account includes A data storage field used to maintain the Hash value of the root node of the Merkel tree;
    所述将所述业务数据添加至所述数据账户进行维护,包括:Adding the business data to the data account for maintenance includes:
    将所述业务数据写入所述本地数据库中存储的默克尔树,以对所述默克尔树进行更新,并将更新后的默克尔树的根节点的Hash值填充至所述数据账户中的数据存储字段。Write the business data to the Merkle tree stored in the local database to update the Merkle tree, and fill the Hash value of the root node of the updated Merkle tree into the data Data storage fields in accounts.
  3. 根据权利要求2所述的方法,所述业务数据包括业务数据内容和与所述业务数据内容对应的数据访问代码;The method according to claim 2, wherein the business data includes business data content and a data access code corresponding to the business data content;
    所述将所述业务数据写入所述本地数据库中存储的默克尔树,以对所述默克尔树进行更新,并将更新后的默克尔树的根节点的Hash值填充至所述数据账户中的数据存储字段,包括:writing the business data into the Merkle tree stored in the local database to update the Merkle tree, and filling the Hash value of the root node of the updated Merkel tree into the The data storage fields in the data account include:
    将所述业务数据内容和所述数据访问代码的对应关系,写入所述本地数据库中存储的默克尔树,以对所述默克尔树进行更新,并将更新后的默克尔树的根节点的Hash值填充至所述数据账户中的数据存储字段。Write the corresponding relationship between the business data content and the data access code into the Merkle tree stored in the local database to update the Merkle tree, and store the updated Merkle tree The hash value of the root node is filled into the data storage field in the data account.
  4. 根据权利要求3所述的方法,所述数据访问代码包括用于读写业务数据内容的接口代码。According to the method of claim 3, the data access code includes an interface code for reading and writing business data content.
  5. 根据权利要求2所述的方法,所述数据账户创建交易还包括与所述业务数据对应的数据描述信息;所述数据账户的账户结构还包括用于维护所述数据描述信息的Hash值的数据描述字段;According to the method of claim 2, the data account creation transaction further includes data description information corresponding to the business data; the account structure of the data account further includes data used to maintain the Hash value of the data description information. description field;
    所述方法还包括:The method also includes:
    计算所述数据账户创建交易中的与所述业务数据对应的数据描述信息的Hash值,并将计算出的所述Hash值填充至所述数据账户中的数据描述字段。Calculate the hash value of the data description information corresponding to the business data in the data account creation transaction, and fill the calculated hash value into the data description field in the data account.
  6. 根据权利要求2所述的方法,所述方法还包括:The method of claim 2, further comprising:
    接收与所述数据账户对应的管理方发起的针对所述数据账户的数据账户更新交易;其中,所述数据账户更新交易包括更新后的所述业务数据;Receive a data account update transaction for the data account initiated by the manager corresponding to the data account; wherein the data account update transaction includes the updated business data;
    响应于所述数据账户更新交易,确定所述管理方是否具有与所述数据账户对应的管理权限;In response to the data account update transaction, determine whether the manager has management authority corresponding to the data account;
    如果所述管理方具有与所述数据账户对应的管理权限,则将更新后的所述业务数据写入所述本地数据库中存储的默克尔树,以对所述默克尔树上已写入的所述业务数据进行更新,并将更新后的默克尔树的根节点的Hash值填充至所述数据账户中的数据存储字段。If the management party has the management authority corresponding to the data account, then the updated business data is written into the Merkle tree stored in the local database to update the Merkle tree that has been written. The business data entered is updated, and the Hash value of the root node of the updated Merkel tree is filled into the data storage field in the data account.
  7. 根据权利要求1所述的方法,所述数据账户的账户结构包括用于维护与所述数据账户对应的访问授权信息的授权字段;The method according to claim 1, the account structure of the data account includes an authorization field for maintaining access authorization information corresponding to the data account;
    所述方法还包括:The method also includes:
    接收与所述数据账户对应的管理方发起的针对所述数据账户的数据账户授权交易;其中,所述数据账户授权交易包括目标账户的账户标识,以及授权给所述目标账户的针对所述数据账户的访问权限信息;Receive a data account authorization transaction for the data account initiated by the manager corresponding to the data account; wherein the data account authorization transaction includes the account identification of the target account, and the data authorized to the target account. Account access rights information;
    响应于所述数据账户授权交易,确定所述管理方是否具有与所述数据账户对应的管理权限;In response to the data account authorization transaction, determine whether the manager has management authority corresponding to the data account;
    如果所述管理方具有与所述数据账户对应的管理权限,则将所述目标账户的账户标识和所述访问权 限信息的对应关系作为与所述数据账户对应的访问授权信息,填充至所述数据账户中的授权字段。If the manager has the management authority corresponding to the data account, the corresponding relationship between the account identification of the target account and the access authority information is filled in the Authorization fields in data accounts.
  8. 根据权利要求7所述的方法,与所述数据账户对应的访问授权信息包括由至少一个目标账户的账户标识,以及授权给所述至少一个目标账户的针对所述数据账户的访问权限信息的对应关系构成的访问授权列表。The method of claim 7, wherein the access authorization information corresponding to the data account includes an account identification of at least one target account and a correspondence of access permission information authorized to the at least one target account for the data account. Access authorization list composed of relationships.
  9. 根据权利要求8所述的方法,所述对应关系为key-value键值对;所述访问授权列表为与所述至少一个目标账户对应的key-value键值对构成的Map列表;其中,所述key-value键值对的key为所述至少一个目标账户的账户标识,所述key-value键值对的value为授权给所述至少一个目标账户的针对所述数据账户的访问权限信息。The method according to claim 8, the corresponding relationship is a key-value pair; the access authorization list is a Map list composed of key-value pairs corresponding to the at least one target account; wherein, the The key of the key-value pair is the account identifier of the at least one target account, and the value of the key-value pair is the access permission information for the data account authorized to the at least one target account.
  10. 根据权利要求7所述的方法,所述目标账户包括用户在所述区块链中注册的用户账户;或者,与所述区块链上部署的智能合约对应的合约账户。According to the method of claim 7, the target account includes a user account registered by the user in the blockchain; or a contract account corresponding to a smart contract deployed on the blockchain.
  11. 根据权利要求7所述的方法,所述数据账户的账户结构还包括以下示出的任一字段或者多个字段:According to the method of claim 7, the account structure of the data account further includes any one or more fields shown below:
    用于维护所述数据账户的账户标识的账户标识字段;an account identification field used to maintain the account identification of the data account;
    用于维护所述数据账户持有的资产的余额的余额字段;a balance field used to maintain the balance of assets held by said data account;
    用于维护所述数据账户的管理方的公钥的管理字段。A management field used to maintain the public key of the administrator of the data account.
  12. 根据权利要求7所述的方法,所述数据账户创建交易为所述区块链支持的用于创建数据账户的原生交易;所述数据账户授权交易为所述区块链支持的用于对所述数据账户进行访问授权的原生交易。The method according to claim 7, the data account creation transaction is a native transaction supported by the blockchain for creating a data account; the data account authorization transaction is a transaction supported by the blockchain for all transactions. Use the above data account to perform native transactions for access authorization.
  13. 一种数据账户创建装置,应用于区块链节点;所述区块链支持的账户类型包括数据账户;所述数据账户用于维护所述区块链上部署的智能合约进行合约计算所需的业务数据;所述装置包括:A data account creation device, applied to blockchain nodes; the account types supported by the blockchain include data accounts; the data account is used to maintain the smart contracts deployed on the blockchain required for contract calculations Business data; the device includes:
    接收模块,接收用于创建所述数据账户的数据账户创建交易;其中,所述数据账户创建交易包括所述区块链上部署的智能合约进行合约计算所需的业务数据;A receiving module that receives a data account creation transaction used to create the data account; wherein the data account creation transaction includes business data required for contract calculation by smart contracts deployed on the blockchain;
    创建模块,响应于所述数据账户创建交易,在所述区块链上创建数据账户;以及,将所述业务数据添加至所述数据账户进行维护。A creation module, in response to the data account creation transaction, creates a data account on the blockchain; and adds the business data to the data account for maintenance.
  14. 一种电子设备,包括:An electronic device including:
    处理器;processor;
    用于存储处理器可执行指令的存储器;Memory used to store instructions executable by the processor;
    其中,所述处理器通过运行所述可执行指令以实现如权利要求1-12中任一项所述的方法。Wherein, the processor implements the method according to any one of claims 1-12 by running the executable instructions.
  15. 一种计算机可读存储介质,其上存储有计算机指令,该指令被处理器执行时实现如权利要求1-12中任一项所述的方法。A computer-readable storage medium having computer instructions stored thereon, which when executed by a processor implements the method according to any one of claims 1-12.
PCT/CN2022/135405 2022-07-29 2022-11-30 Data account creation method and apparatus WO2024021417A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202210911233.1A CN115203747A (en) 2022-07-29 2022-07-29 Data account creation method and device
CN202210911233.1 2022-07-29

Publications (1)

Publication Number Publication Date
WO2024021417A1 true WO2024021417A1 (en) 2024-02-01

Family

ID=83585357

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/135405 WO2024021417A1 (en) 2022-07-29 2022-11-30 Data account creation method and apparatus

Country Status (2)

Country Link
CN (1) CN115203747A (en)
WO (1) WO2024021417A1 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115203747A (en) * 2022-07-29 2022-10-18 蚂蚁区块链科技(上海)有限公司 Data account creation method and device

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110096857A (en) * 2019-05-07 2019-08-06 百度在线网络技术(北京)有限公司 Right management method, device, equipment and the medium of block catenary system
CN112400182A (en) * 2020-10-12 2021-02-23 北京和联共识科技有限公司 Method and device for executing intelligent contracts in block chain and electronic equipment
CN112559635A (en) * 2020-12-23 2021-03-26 网易(杭州)网络有限公司 Service processing method, device, equipment and medium for Ether house alliance link node
CN115203747A (en) * 2022-07-29 2022-10-18 蚂蚁区块链科技(上海)有限公司 Data account creation method and device
CN115203746A (en) * 2022-07-29 2022-10-18 蚂蚁区块链科技(上海)有限公司 Data account access authorization method and device
CN115221559A (en) * 2022-07-29 2022-10-21 蚂蚁区块链科技(上海)有限公司 Data account access authorization method and device

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110096857A (en) * 2019-05-07 2019-08-06 百度在线网络技术(北京)有限公司 Right management method, device, equipment and the medium of block catenary system
CN112400182A (en) * 2020-10-12 2021-02-23 北京和联共识科技有限公司 Method and device for executing intelligent contracts in block chain and electronic equipment
CN112559635A (en) * 2020-12-23 2021-03-26 网易(杭州)网络有限公司 Service processing method, device, equipment and medium for Ether house alliance link node
CN115203747A (en) * 2022-07-29 2022-10-18 蚂蚁区块链科技(上海)有限公司 Data account creation method and device
CN115203746A (en) * 2022-07-29 2022-10-18 蚂蚁区块链科技(上海)有限公司 Data account access authorization method and device
CN115221559A (en) * 2022-07-29 2022-10-21 蚂蚁区块链科技(上海)有限公司 Data account access authorization method and device

Also Published As

Publication number Publication date
CN115203747A (en) 2022-10-18

Similar Documents

Publication Publication Date Title
US11880494B2 (en) Secure decentralized system utilizing smart contracts, a blockchain, and/or a distributed file system
TWI737944B (en) Block chain-based transaction execution method and device, and electronic equipment
CN107368259B (en) Method and device for writing service data into block chain system
TWI706280B (en) Data reading and writing method and device, electronic equipment
US11232098B2 (en) Data structure reading methods and apparatuses, data structure update methods and apparatuses, and electronic devices
US10614454B1 (en) Remote population and redaction of high security data
US20150180872A1 (en) System and method for hierarchical resource permissions and role management in a multitenant environment
CN110032598B (en) Method and device for updating field and electronic equipment
US11294875B2 (en) Data storage on tree nodes
US11695559B2 (en) Nested tenancy that permits a hierarchy having a plurality of levels
JP7358396B2 (en) Secure dataset management
US11775507B2 (en) Methods and apparatuses for reading and updating data structures, and electronic devices
WO2022077186A1 (en) Execution method and apparatus for smart contract in blockchain, and electronic device
WO2024021417A1 (en) Data account creation method and apparatus
CN107438067A (en) A kind of multi-tenant construction method and system based on mesos container cloud platforms
CN115203746A (en) Data account access authorization method and device
CN115221559A (en) Data account access authorization method and device
WO2019052328A1 (en) Authentication method for anonymous account, and server
WO2020233423A1 (en) Receipt storage method and node based on transaction type
US20120216240A1 (en) Providing data security through declarative modeling of queries
Zhang et al. A blockchain based secure e-commerce transaction system
CN115098886A (en) Access authorization method and device of intelligent contract
US20240013294A1 (en) Secure Decentralized System
CN114503512B (en) Allowing nested tenants with a hierarchical structure of multiple levels
CN115964393A (en) Data processing method and device, electronic equipment and computer readable medium

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22952851

Country of ref document: EP

Kind code of ref document: A1