WO2020125222A1 - 数据读写方法及装置、电子设备 - Google Patents
数据读写方法及装置、电子设备 Download PDFInfo
- Publication number
- WO2020125222A1 WO2020125222A1 PCT/CN2019/114580 CN2019114580W WO2020125222A1 WO 2020125222 A1 WO2020125222 A1 WO 2020125222A1 CN 2019114580 W CN2019114580 W CN 2019114580W WO 2020125222 A1 WO2020125222 A1 WO 2020125222A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- data
- smart contract
- blockchain
- read
- data read
- Prior art date
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F21/00—Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
- G06F21/60—Protecting data
- G06F21/62—Protecting access to data via a platform, e.g. using keys or access control rules
- G06F21/6218—Protecting 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/6227—Protecting 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
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/23—Updating
- G06F16/2379—Updates performed during online database operations; commit processing
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F21/00—Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
- G06F21/60—Protecting data
- G06F21/64—Protecting data integrity, e.g. using checksums, certificates or signatures
- G06F21/645—Protecting data integrity, e.g. using checksums, certificates or signatures using a third party
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F21/00—Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
- G06F21/60—Protecting data
- G06F21/604—Tools and structures for managing or administering access control systems
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F21/00—Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
- G06F21/60—Protecting data
- G06F21/62—Protecting access to data via a platform, e.g. using keys or access control rules
- G06F21/6218—Protecting 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
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F21/00—Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
- G06F21/60—Protecting data
- G06F21/64—Protecting data integrity, e.g. using checksums, certificates or signatures
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L63/00—Network architectures or network communication protocols for network security
- H04L63/12—Applying verification of the received information
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F2221/00—Indexing scheme relating to security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
- G06F2221/21—Indexing 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/2141—Access 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 technology, and in particular, to a data reading and writing method and device, and electronic equipment.
- Blockchain technology also known as distributed ledger technology
- distributed ledger technology is a decentralized distributed database technology, which has many characteristics such as decentralization, openness and transparency, non-tampering, and trust, and is applicable to many In application scenarios with high requirements for data reliability.
- one or more embodiments of this specification provide a data reading and writing method and device, and electronic equipment.
- a data reading and writing method including:
- Blockchain nodes in the blockchain network obtain data read and write requests for smart contracts, and the data read and write requests are used to read and write data to target objects in the data set contained in the smart contract;
- the blockchain node parses the metadata contained in the smart contract by running the code contained in the smart contract, and the analysis result is used to indicate the storage field corresponding to the target object in the data set to The storage field implements the data read and write operations.
- a data reading and writing device including:
- the acquiring unit enables the blockchain nodes in the blockchain network to acquire data read and write requests for smart contracts.
- the data read and write requests are used to read and write data to target objects in the data set contained in the smart contract ;
- the parsing unit enables the blockchain node to parse the metadata contained in the smart contract by running the code contained in the smart contract, and the parsing result is used to indicate the storage field in the data set corresponding to the target object To implement the data read-write operation on the storage field.
- an electronic device including:
- Memory for storing processor executable instructions
- the processor is configured to implement the data reading and writing method as described in any one of the above embodiments.
- FIG. 1 is a flowchart of a method for reading and writing data according to an exemplary embodiment.
- FIG. 2 is a schematic diagram of a data structure of a smart contract provided by an exemplary embodiment.
- FIG. 3 is a schematic diagram of querying the balance of a blockchain provided by an exemplary embodiment.
- FIG. 4 is a schematic diagram of a blockchain asset transfer provided by an exemplary embodiment.
- FIG. 5 is a schematic structural diagram of an apparatus provided by an exemplary embodiment.
- FIG. 6 is a block diagram of a data reading and writing device provided by an exemplary embodiment.
- the steps of the corresponding method are not necessarily performed in the order shown and described in this specification.
- the method may include more or fewer steps than described in this specification.
- the single step described in this specification may be decomposed into multiple steps for description in other embodiments; and the multiple steps described in this specification may also be combined into a single step in other embodiments. description.
- FIG. 1 is a flowchart of a method for reading and writing data according to an exemplary embodiment. As shown in FIG. 1, the method may include the following steps:
- Step 102 The blockchain node in the blockchain network obtains a data read and write request for a smart contract.
- the data read and write request is used to read and write data to a target object in a data set included in the smart contract.
- the data read and write request can be carried in a transaction created in the blockchain network, and by indicating the contract address and port information of the smart contract to be called in the transaction, the data is read and written The request is confirmed as "targeting" the above-mentioned smart contract, so as to read and write data of the data set contained in the smart contract.
- the transfer described in this specification refers to a piece of data created by a client corresponding to a blockchain node and required to be finally released to a distributed database of the blockchain network.
- a narrow transaction refers to a value transfer issued by the blockchain network; for example, in the traditional Bitcoin blockchain network, the transaction can be a transfer initiated in the blockchain network.
- the generalized transaction refers to a piece of business data published by the blockchain network with business intent; for example, the operator can build an alliance chain based on actual business needs, relying on the alliance chain to deploy some other types of irrelevant value transfer Online business (for example, rental business, vehicle scheduling business, insurance claim business, credit service, medical service, etc.), and in this type of alliance chain, the transaction can be a business message with business intent published in the alliance chain or Business request.
- the operator can build an alliance chain based on actual business needs, relying on the alliance chain to deploy some other types of irrelevant value transfer Online business (for example, rental business, vehicle scheduling business, insurance claim business, credit service, medical service, etc.), and in this type of alliance chain, the transaction can be a business message with business intent published in the alliance chain or Business request.
- the data read and write requests in this specification can be carried in the above-mentioned narrowly defined transaction, for example, the data set contained in the smart contract records the blockchain balance of each user, and the transaction is used to The blockchain balance is read and written.
- the data read and write requests in this specification can be carried in the above-mentioned broad transaction, for example, the data set contained in the smart contract records the credit data of each user, and the transaction is used to credit data of one or more users. Perform read and write operations.
- a smart contract may include several structures, such as a code structure for recording codes, a storage structure for recording data sets and metadata, and so on; in other embodiments, codes, data sets and metadata may be recorded For other structures in the smart contract, this manual does not limit this.
- the initiator of the data read-write request may include: a blockchain member in the blockchain network.
- the role of blockchain members can be assumed by individuals, corporate organizations, platforms, etc., and the corresponding operations can be implemented in the blockchain network based on the role of "blockchain members", such as initiating the above-mentioned data read and write requests. .
- the initiator of the data read-write request may include: another smart contract that is different from the smart contract.
- a contract operation based on the other smart contract needs to read relevant data from the data set of the smart contract during execution, or a contract operation based on the other smart contract needs to send the smart contract to the smart contract during execution
- the related data is written in the data set of, so that the contract operation based on the other smart contract can initiate the above-mentioned data read-write request to realize the corresponding data read or write operation.
- the other smart contract can be called by the members of the blockchain or by other smart contracts, and this specification does not limit this.
- Step 104 The blockchain node parses the metadata contained in the smart contract by running the code contained in the smart contract, and the analysis result is used to indicate a storage field in the data set corresponding to the target object, To implement the data read-write operation on the storage field.
- the code is not directly read and written to the data set when the code is executed, but the target object is determined in the data set by parsing the metadata Storage field, and then implement data read and write operations on the storage field.
- the blockchain node can read the input parameters included in the data call request, the input parameters include the target object; wherein, the data read-write operation is used to read the storage
- the value in the field is returned to the initiator of the data call request.
- the target object can be the blockchain balance of user A
- the metadata set in the data set corresponding to "user A's area” can be determined by analyzing metadata.
- the corresponding value of the blockchain balance can be read from the storage field; where, when the value is greater than the specified amount above, the transfer operation of the above-mentioned blockchain assets is allowed Otherwise, the transfer operation may be refused.
- the blockchain node can read the input parameters included in the data read-write request, the input parameters include the target object and the value of the target object; wherein, the data read The write operation is used to update the field value in the storage field according to the value of the target object.
- the target object may be the blockchain balance of the user B, and the metadata corresponding to "user B's area in the data set is determined by analyzing the metadata.
- the blockchain balance read in the storage field can be updated to the sum of the value of the blockchain balance and the above specified amount to complete the transfer operation of the blockchain assets.
- the target object when a specified amount of blockchain assets needs to be transferred from user A to user B, the target object may be the blockchain balance of the user B, and the value of the target object may be the value of the blockchain balance after the transfer is completed Value, and after analyzing the metadata to determine the storage field in the data set corresponding to "User B's Blockchain Balance", the field value in the storage field can be updated to the value of the target object.
- the blockchain node may respond to the data read-write request to return the target data when the data read-write request satisfies the calling condition of the smart contract.
- the calling condition may include: the initiator user corresponding to the data read-write request has the calling authority to the smart contract, so that on the one hand, data can be written into the data set included in the smart contract and published to the blockchain network, It is convenient for blockchain nodes to read and write related data. On the other hand, it can isolate the data set based on the calling authority to avoid unauthorized blockchain nodes from accessing or editing the data set, which solves the problem of data reading. The contradiction between writing convenience and data security.
- FIG. 2 is a schematic structural diagram of a smart contract provided by an exemplary embodiment.
- the smart contract may include a structure 201.
- the structure 201 may be referred to as a code structure, and is used to record a contract code (referred to simply as code) of the smart contract.
- the smart contract may include a structure 202.
- the structure 202 may be referred to as a storage structure, which is used to record contract data (referred to as data) in the smart contract, and metadata corresponding to the contract data.
- the metadata is used to describe the corresponding contract. data.
- the smart contract may also include other structures 203, such as a balance structure and a nonce structure in the related art, which are not limited in this specification. Among them, the smart contract can provide an API interface to the contract code in the structure 201 to the outside to implement the call to the contract code.
- FIG. 3 is a schematic diagram of querying the balance of a blockchain provided by an exemplary embodiment. As shown in Figure 3, the process of querying the balance of the blockchain can include the following steps:
- Step 301 create a transaction.
- the data of the blockchain balance of all users in the blockchain network is recorded in a smart contract S.
- the smart contract S adopts the data structure shown in FIG. 2, the block The data of the chain balance can be recorded in the storage structure of the smart contract S.
- the smart contract S is created and published to the blockchain network, a consensus is reached among the various blockchain nodes in the blockchain network and recorded on each blockchain node, such as the above-mentioned blockchain node G The smart contract S is also recorded on it.
- the above transaction may include the contract address and port information of the smart contract S, so that the blockchain node G can determine that the transaction needs to call the smart contract S based on the contract address, and include the smart contract S based on the port information.
- the contract code is called to implement operations such as querying the balance of the blockchain.
- Step 302 the blockchain node G verifies the user A's data access authority to the blockchain balance.
- the smart contract S may be set with data access permissions, similar to a whitelist or blacklist, to prevent data such as blockchain balances from being arbitrarily accessed and to prevent security risks.
- data access permissions similar to a whitelist or blacklist
- users with data access rights can be part of the pre-agreed users; for example, when the blockchain network belongs to an alliance chain, users with data access rights can be members of the alliance. Therefore, when the blockchain node G obtains the transaction issued by the user A and determines that the transaction requires data query for the smart contract S, it can first determine whether the user A has the corresponding data access authority, and when it has the data access authority Continue to implement the next steps, otherwise you can return the query failure information.
- Step 303 When user A has data access authority, blockchain node G invokes the above-mentioned smart contract to query the balance.
- user A may indicate relevant information of the blockchain balance to be queried in the transaction; for example, when user A wishes to query his own blockchain balance, the relevant information may include user A’s Account ID, asset type, etc.
- the blockchain node G invokes the contract code located in the code structure in the smart contract S, so that after the contract code is executed, it can be used to parse the metadata located in the storage structure in the smart contract S to determine the corresponding The storage field of the above-mentioned related information noted in the transaction.
- the data recorded in the smart contract S is shown in Table 1, including the personal information (such as account ID, age, address, etc.) of the user to which each account belongs, and the blockchain assets held by each account Balance, the total amount of all blockchain balances converted into RMB, etc.
- step 304 the blockchain node G returns the queried blockchain balance to the user A.
- FIG. 4 is a schematic diagram of a blockchain asset transfer provided by an exemplary embodiment. As shown in Figure 4, the process of transferring blockchain assets can include the following steps:
- Step 401 create a transaction.
- User A can create a block for transfer Chain asset transactions-equivalent to asset transfer requests, and publish this transaction to the blockchain network.
- the blockchain node G responds to the above transaction issued by the user A.
- the blockchain node G is usually the closest blockchain node to the user A. Of course, this specification does not limit this.
- the transfer function for blockchain assets is implemented by smart contract Q.
- the blockchain node G can call and execute the contract code recorded in the code structure of the smart contract Q to realize the transfer function for the blockchain assets.
- user A declares that the transfer of type B blockchain assets to user B and the number of transfers is 1000, then in the implementation of the asset transfer operation of smart contract Q, it is necessary to determine: The blockchain assets are not less than 1000, and user B has a real and effective account in the blockchain network.
- step 402 the blockchain node G calls the smart contract Q and indirectly calls the smart contract S to query related information.
- user A may indicate in the transaction the account ID of the asset transfer-out party (ie, user A's account ID), the asset transfer-in party's account ID (ie, user B's account ID), and the asset to be transferred.
- the type is "Type B” and the transfer quantity is "1000”.
- the blockchain node G responds to the above transaction issued by the smart contract Q. Similar to the embodiment shown in FIG. 3, the blockchain node G invokes the contract code located in the code structure in the smart contract S, so that after the contract code is executed, it can be used to locate the smart contract S in the storage structure
- the metadata of is analyzed to determine: 1) whether the blockchain balance of type B held by user A is not less than 1000, and 2) whether the account information of user B is true and valid.
- Step 403 the blockchain node calls the smart contract Q and indirectly calls the smart contract S to update the blockchain balance.
- the smart contract Q determines that the asset transfer operation requested by user A can be implemented according to the query result returned in step 403, and can create a transaction and publish it to the blockchain network, and indicate the smart contract in the transaction S's contract address, port information, etc., so as to update the blockchain balance of the relevant account after the asset transfer is completed by calling the smart contract S.
- the originally recorded data in the smart contract S is shown in Table 1, in which the account balance corresponding to user A is "0003" and the held asset type is "type B”.
- the blockchain balance is 2100 2.
- the total amount of assets held is equivalent to RMB 24,200 (assuming that the conversion ratio of blockchain assets of type A and RMB is 1:1, and the conversion ratio of blockchain assets of type B and RMB is 1:2), user B
- the corresponding account ID is "0001”
- the held asset type is "Type B”
- the blockchain balance is 1500
- the total assets held are equivalent to RMB 5,000.
- the balance of the blockchain with account ID “0003” and asset type “type B” will be updated to 1100
- the total assets held will be updated to RMB 22200
- the account balance will be updated to 2500
- the asset type will be updated to 2500
- the total assets held will be updated to RMB 7000.
- the relevant data is as follows 2 shows.
- Step 404 the blockchain node G returns the result to the user A.
- the user A invokes the contract code contained in the smart contract S by publishing the transaction to the blockchain network, and based on the analysis result of the contract code to the metadata contained in the smart contract S, the The data contained in the smart contract S is read (queried).
- operations such as reading the balance of the blockchain can also be implemented in a manner similar to that shown in FIG. 4, that is, based on indirect calls between multiple smart contracts.
- the user A directly invokes the smart contract Q by publishing a transaction to the blockchain network, and the smart contract Q invokes the smart contract S included in the process of implementing related logic.
- the contract code based on the analysis result of the metadata of the smart contract S based on the contract code, reads (queries) and writes (updates) the data included in the smart contract S.
- operations such as reading and updating the blockchain balance can also be implemented in a manner similar to that shown in FIG. 3, that is, based on the user's direct call to the smart contract.
- FIG. 5 is a schematic structural diagram of a device provided by an exemplary embodiment. Please refer to FIG. 5.
- the device includes a processor 502, an internal bus 504, a network interface 506, a memory 508, and a non-volatile memory 510.
- the processor 502 reads the corresponding computer program from the non-volatile memory 510 into the memory 508 and then runs it to form a data reading and writing device at a logical level.
- one or more embodiments of this specification do not exclude other implementations, such as logic devices or a combination of hardware and software, etc., that is to say, the execution body of the following processing flow is not limited to each
- the logic unit may also be a hardware or logic device.
- the data reading and writing device may include:
- the acquiring unit 61 enables a blockchain node in the blockchain network to acquire a data read and write request for a smart contract.
- the data read and write request is used to read and write data to a target object in a data set included in the smart contract operating;
- the parsing unit 62 enables the blockchain node to parse the metadata contained in the smart contract by running the code contained in the smart contract, and the analysis result is used to indicate the storage corresponding to the target object in the data set Field to implement the data read-write operation on the storage field.
- Optional also includes:
- the first reading unit 63 causes the blockchain node to read the input parameters included in the data call request, the input parameters including the target object;
- the data read-write operation is used to read the field value in the storage field to return to the initiator of the data call request.
- Optional also includes:
- the second reading unit 64 causes the blockchain node to read the input parameters included in the data read-write request, and the input parameters include the target object and the value of the target object;
- the data read-write operation is used to update the field value in the storage field according to the value of the target object.
- the initiator of the data read-write request includes: a blockchain member in the blockchain network, or another smart contract different from the smart contract.
- Optional also includes:
- the response unit 65 enables the blockchain node to respond to the data read-write request when the data read-write request satisfies the calling condition of the smart contract to return the target data.
- the calling condition includes:
- the initiator user corresponding to the data read-write request has the calling authority to the smart contract.
- the system, device, module or unit explained in the above embodiments may be specifically implemented by a computer chip or entity, or implemented by a product having a certain function.
- a typical implementation device is a computer, and the specific form of the computer may be a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email sending and receiving device, and a game control Desk, tablet computer, wearable device, or any combination of these devices.
- the 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
- the memory may include non-permanent memory, random access memory (RAM) and/or non-volatile memory in a computer-readable medium, such as 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 memory
- Computer readable media including permanent and non-permanent, removable and non-removable media, can store information by any method or technology.
- the 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 technologies, read-only compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, Magnetic tape cassettes, magnetic disk storage, quantum memory, graphene-based storage media or other magnetic storage devices or any other non-transmission media can be used to store information that can be accessed by computing devices.
- computer-readable media does not include temporary 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 the same type of information from each other.
- first information may also be referred to as second information, and similarly, the second information may also be referred to as first information.
- word "if” as used herein may be interpreted as "when” or “when” or “in response to a determination”.
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Computer Security & Cryptography (AREA)
- General Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Computer Hardware Design (AREA)
- Health & Medical Sciences (AREA)
- Bioethics (AREA)
- General Health & Medical Sciences (AREA)
- Software Systems (AREA)
- Databases & Information Systems (AREA)
- Automation & Control Theory (AREA)
- Data Mining & Analysis (AREA)
- Computer Networks & Wireless Communication (AREA)
- Computing Systems (AREA)
- Signal Processing (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
- Management, Administration, Business Operations System, And Electronic Commerce (AREA)
Abstract
一种数据读写方法及装置、电子设备,该方法包括:区块链网络中的区块链节点获取针对智能合约的数据读写请求,所述数据读写请求用于对所述智能合约包含的数据集合中的目标对象进行数据读写操作(102);所述区块链节点通过运行所述智能合约包含的代码对所述智能合约包含的元数据进行解析,解析结果用于指示所述数据集合中对应于所述目标对象的存储字段,以对所述存储字段实施所述数据读写操作(104)。
Description
本说明书一个或多个实施例涉及区块链技术领域,尤其涉及一种数据读写方法及装置、电子设备。
区块链技术(也被称之为,分布式账本技术)是一种去中性化的分布式数据库技术,具有去中心化、公开透明、不可篡改、可信任等多种特点,适用于诸多对数据可靠性具有高需求的应用场景中。
发明内容
有鉴于此,本说明书一个或多个实施例提供一种数据读写方法及装置、电子设备。
为实现上述目的,本说明书一个或多个实施例提供技术方案如下:
根据本说明书一个或多个实施例的第一方面,提出了一种数据读写方法,包括:
区块链网络中的区块链节点获取针对智能合约的数据读写请求,所述数据读写请求用于对所述智能合约包含的数据集合中的目标对象进行数据读写操作;
所述区块链节点通过运行所述智能合约包含的代码对所述智能合约包含的元数据进行解析,解析结果用于指示所述数据集合中对应于所述目标对象的存储字段,以对所述存储字段实施所述数据读写操作。
根据本说明书一个或多个实施例的第二方面,提出了一种数据读写装置,包括:
获取单元,使区块链网络中的区块链节点获取针对智能合约的数据读写请求,所述数据读写请求用于对所述智能合约包含的数据集合中的目标对象进行数据读写操作;
解析单元,使所述区块链节点通过运行所述智能合约包含的代码对所述智能合约包含的元数据进行解析,解析结果用于指示所述数据集合中对应于所述目标对象的存储字段,以对所述存储字段实施所述数据读写操作。
根据本说明书一个或多个实施例的第三方面,提出了一种电子设备,包括:
处理器;
用于存储处理器可执行指令的存储器;
其中,所述处理器被配置为实现如上述实施例中任一所述的数据读写方法。
图1是一示例性实施例提供的一种数据读写方法的流程图。
图2是一示例性实施例提供的一种智能合约的数据结构的示意图。
图3是一示例性实施例提供的一种查询区块链余额的示意图。
图4是一示例性实施例提供的一种转移区块链资产的示意图。
图5是一示例性实施例提供的一种设备的结构示意图。
图6是一示例性实施例提供的一种数据读写装置的框图。
这里将详细地对示例性实施例进行说明,其示例表示在附图中。下面的描述涉及附图时,除非另有表示,不同附图中的相同数字表示相同或相似的要素。以下示例性实施例中所描述的实施方式并不代表与本说明书一个或多个实施例相一致的所有实施方式。相反,它们仅是与如所附权利要求书中所详述的、本说明书一个或多个实施例的一些方面相一致的装置和方法的例子。
需要说明的是:在其他实施例中并不一定按照本说明书示出和描述的顺序来执行相应方法的步骤。在一些其他实施例中,其方法所包括的步骤可以比本说明书所描述的更多或更少。此外,本说明书中所描述的单个步骤,在其他实施例中可能被分解为多个步骤进行描述;而本说明书中所描述的多个步骤,在其他实施例中也可能被合并为单个步骤进行描述。
图1是一示例性实施例提供的一种数据读写方法的流程图。如图1所示,该方法可以包括以下步骤:
步骤102,区块链网络中的区块链节点获取针对智能合约的数据读写请求,所述数据读写请求用于对所述智能合约包含的数据集合中的目标对象进行数据读写操作。
在一实施例中,数据读写请求可以承载于区块链网络中创建的一笔交易,并通过在该交易中指明所需调用的智能合约的合约地址、端口信息等,使得该数据读写请求被确认为“针对”上述的智能合约,从而对该智能合约包含的数据集合进行数据读写。
在一实施例中,本说明书中所描述的交易(transfer),是指通过区块链节点对应的客户端创建,并需要最终发布至区块链网络的分布式数据库中的一笔数据。其中,区块链网络中的交易,存在狭义的交易以及广义的交易之分。狭义的交易是指向区块链网络发布的一笔价值转移;例如,在传统的比特币区块链网络中,交易可以是在区块链网络中发起的一笔转账。而广义的交易是指向区块链网络发布的一笔具有业务意图的业务数据;例如,运营方可以基于实际的业务需求搭建一个联盟链,依托于联盟链部署一些与价值转移无关的其它类型的在线业务(比如,租房业务、车辆调度业务、保险理赔业务、信用服务、医疗服务等),而在这类联盟链中,交易可以是在联盟链中发布的一笔具有业务意图的业务消息或者业务请求。
在一实施例中,本说明书中的数据读写请求可以承载于上述狭义的交易,比如智能合约包含的数据集合记录有各个用户的区块链余额,该交易用于对一个或多个用户的区块链余额进行读写操作。
在一实施例中,本说明书中的数据读写请求可以承载于上述广义的交易,比如智能合约包含的数据集合记录有各个用户的信用数据,该交易用于对一个或多个用户的信用数据进行读写操作。
在一实施例中,智能合约可以包括若干结构,比如用于记录代码的code结构、用于记录数据集合和元数据的storage结构等;在其他实施例中,代码、数据集合和元数据可以记录于智能合约中的其他结构,本说明书并不对此进行限制。
在一实施例中,所述数据读写请求的发起方可以包括:所述区块链网络中的区块链成员。区块链成员的角色可以由个人、企业机构或平台等来承担,并且可以基于该“区块链成员”的角色在区块链网络中实施相应的操作,比如发起上述的数据读写请求等。
在一实施例中,所述数据读写请求的发起方可以包括:区别于所述智能合约的另一智能合约。例如,基于该另一智能合约的合约操作在执行过程中需要从所述智能合约的数据集合中读取相关数据,或者基于该另一智能合约的合约操作在执行过程中需要向所述智能合约的数据集合中写入相关数据,使得基于该另一智能合约的合约操作可以发起上述的数据读写请求,以实现相应的数据读取或写入操作。其中,该另一智能合约可以由区块链成员所调用,或者由其他智能合约所调用,本说明书并不对此进行限制。
步骤104,所述区块链节点通过运行所述智能合约包含的代码对所述智能合约包含的元数据进行解析,解析结果用于指示所述数据集合中对应于所述目标对象的存储字段,以对所述存储字段实施所述数据读写操作。
在一实施例中,通过在智能合约中添加针对数据集合的元数据,使得数据集合中的数据需要实现字段更新时,无需对数据集合进行直接更新,而可以仅针对元数据进行更新,即可使得代码被执行以解析该元数据后,对数据集合实现上述的字段更新。
在一实施例中,通过在智能合约中添加针对数据集合的元数据,使得代码被执行时并不直接对数据集合进行数据读写操作,而是通过解析元数据确定出目标对象在数据集合中的存储字段,然后针对该存储字段实施数据读写操作。
在一实施例中,所述区块链节点可以读取所述数据调用请求包含的输入参数,所述输入参数包括所述目标对象;其中,所述数据读写操作用于读取所述存储字段内的字段取值,以返回至所述数据调用请求的发起方。例如,当需要由用户A向用户B转移指定数额的区块链资产时,目标对象可以为该用户A的区块链余额,而通过对元数据解析确定数据集合中对应于“用户A的区块链余额”的存储字段后,可以从该存储字段中读取相应的区块链余额的取值;其中,当该取值大于上述的指定数额时,允许实施上述区块链资产的转移操作,否则可以拒绝实施该转移操作。
在一实施例中,所述区块链节点可以读取所述数据读写请求包含的输入参数,所述输入参数包括所述目标对象和所述目标对象的取值;其中,所述数据读写操作用于根据所述目标对象的取值对所述存储字段内的字段取值进行更新。例如,当需要由用户A向用户B转移指定数额的区块链资产时,目标对象可以为该用户B的区块链余额,而通过对元数据解析确定数据集合中对应于“用户B的区块链余额”的存储字段后,可以将该存储字段中读取的区块链余额更新为该区块链余额的数值与上述的指定数额之和,以完成对区块链资产的转移操作。再例如,当需要由用户A向用户B转移指定数额的区块链资产时,目标对象可以为该用户B的区块链余额,目标对象的取值可以为转移完成后的区块链余额的数值,而通过对元数据解析确定数据集合中对应于“用户B的区块链余额”的存储字段后,可以将该存储字段内的字段取值更新为上述目标对象的取值。
在一实施例中,所述区块链节点可以在所述数据读写请求满足对所述智能合约的调用条件时,对所述数据读写请求进行响应,以返回所述目标数据。例如,该调用条件可以包括:所述数据读写请求对应的发起方用户对所述智能合约具有调用权限,从而一方面可以将数据写入智能合约包含的数据集合并发布至区块链网络,便于区块链节点对相关数据进行读写操作,另一方面可以基于该调用权限对该数据集合进行权限隔离、避免无权限的区块链节点对该数据集合进行访问或编辑,解决了数据读写便捷性与数据安全性之间的矛盾问题。
图2是一示例性实施例提供的一种智能合约的结构示意图。如图2所示,在本说明书的 实施例中,针对区块链网络中的智能合约实施了结构改进,以实现基于本说明书的数据读写方案。其中,智能合约可以包括结构201,比如该结构201可以称为code结构,用于记录该智能合约的合约代码(简称为代码)。智能合约可以包括结构202,比如该结构202可以称为storage结构,用于记录该智能合约中的合约数据(简称为数据)、该合约数据对应的元数据,该元数据用于描述相应的合约数据。智能合约还可以包括其他的结构203,比如相关技术中的balance结构、nonce结构等,本说明书并不对此进行限制。其中,智能合约可以向外部提供针对结构201中合约代码的API接口,以实现针对该合约代码的调用。
基于如图2所示的数据结构的智能合约,可以实现本说明书的数据读写方案。下面以针对区块链余额的查询操作为例,对基于本说明书的数据读取方案进行详细描述。图3是一示例性实施例提供的一种查询区块链余额的示意图。如图3所示,查询区块链余额的过程可以包括以下步骤:
步骤301,创建交易。
在一实施例中,假定用户A需要查询自身在区块链网络中持有的区块链资产,即该用户A的区块链余额,该用户A可以创建用于查询余额的交易——相当于余额查询请求,并向区块链网络发布这条交易。假定由区块链节点G对用户A发布的上述交易进行响应,该区块链节点G通常为距离用户A最近的区块链节点,当然本说明书并不对此进行限制。
在一实施例中,区块链网络中的所有用户的区块链余额的数据均记录于某一智能合约S中,比如该智能合约S采用如图2所示的数据结构时,该区块链余额的数据可以记录于该智能合约S的storage结构中。智能合约S被创建并发布至区块链网络后,在该区块链网络中的各个区块链节点之间达成共识,并记录于各个区块链节点上,比如上述的区块链节点G上同样记录有该智能合约S。
在一实施例中,区块链网络中可以存在很多的智能合约,以分别用于实现相应的事件或目的。因此,上述交易中可以包含智能合约S的合约地址、端口信息等,以使得区块链节点G可以基于该合约地址确定该交易需要调用该智能合约S,并基于端口信息对该智能合约S包含的合约代码进行调用,以实现对区块链余额的查询等操作。
步骤302,区块链节点G验证用户A对区块链余额的数据访问权限。
在一实施例中,智能合约S可以设定有数据访问权限,类似于白名单或黑名单的形式,以避免区块链余额等数据被任意访问,防止发生安全性风险。例如,当区块链网络属于公有链时,具有数据访问权限的用户可以为预先约定的部分用户;又例如,当区块链网络属于联 盟链时,具有数据访问权限的用户可以为联盟成员。因此,当区块链节点G获取用户A发布的交易,并确定该交易需要对智能合约S进行数据查询时,可以首先确定该用户A是否具有相应的数据访问权限,并在具有数据访问权限时继续实施后续步骤,否则可以返回查询失败的信息。
需要指出的是:基于区块链网络的分布式数据存储的特点,使得发布至区块链网络的数据需要被记录于所有区块链节点上,使得这些数据不可篡改、可溯源。但是,对于诸如上述的区块链余额等可能具有一定私密性的数据而言,如果发布至区块链网络则可能造成私密性无法保障,而如果不发布至区块链网络则可能存在数据内容不可靠的问题,并且不利于各个区块链节点对于相关数据的快捷读取和调用等。因此,本说明书中通过将上述具有私密性需求的数据记录于智能合约中,并通过对数据访问权限的管理而限制无权限用户对相关数据的随意访问,使得这些数据既能够公布至区块链网络、以享有区块链网络所带来的可靠性与便利性,又能够确保数据具有足够的私密性和安全性。
步骤303,在用户A具有数据访问权限时,区块链节点G调用上述的智能合约来查询余额。
在一实施例中,用户A可以在交易中注明所需查询的区块链余额的相关信息;比如,当用户A希望查询自身的区块链余额时,该相关信息可以包括该用户A的账户ID、资产类型等。区块链节点G通过调用智能合约S中位于code结构中的合约代码,使得该合约代码被执行后,可以用于对智能合约S中位于storage结构中的元数据进行解析,以确定出对应于交易中注明的上述相关信息的存储字段。
表1
在一实施例中,假定智能合约S中记录的数据如表1所示,包括各个账户所属用户的个人信息(如账户ID、年龄、地址等),以及各个账户所持有的区块链资产的余额、所有区块链余额兑换为人民币后的总额等。
例如,当用户A在区块链网络中的账户ID为“0003”、交易中注明的资产类型为“类型B”,那么区块链节点G可以通过调用智能合约S包含的合约代码,使得该合约代码被执行 并对智能合约S包含的元数据进行解析后,可以确定出“账户ID=0003”、“资产类型=类型B”的存储字段,从而读取该存储字段的取值为“2100”,即用户A所持有的类型B的区块链余额为2100。
步骤304,区块链节点G向用户A返回查询到的区块链余额。
下面以针对区块链资产的资产转移操作为例,对基于本说明书的数据读取方案进行详细描述。图4是一示例性实施例提供的一种转移区块链资产的示意图。如图4所示,转移区块链资产的过程可以包括以下步骤:
步骤401,创建交易。
在一实施例中,假定用户A在区块链网络中持有一定的区块链资产,该用户A希望将至少一部分区块链资产转移至用户B,该用户A可以创建用于转移区块链资产的交易——相当于资产转移请求,并向区块链网络发布这条交易。假定由区块链节点G对用户A发布的上述交易进行响应,该区块链节点G通常为距离用户A最近的区块链节点,当然本说明书并不对此进行限制。
在一实施例中,假定针对区块链资产的转移功能由智能合约Q来实现。区块链节点G可以调用并执行该智能合约Q在code结构中记录的合约代码,以实现针对区块链资产的转移功能。例如,用户A在上述交易中声明向用户B转移类型B的区块链资产、转移数量为1000,那么智能合约Q在实施资产转移的操作中,需要确定:用户A持有的类型B的区块链资产不小于1000、用户B在区块链网络中具有真实有效的账户等。
步骤402,区块链节点G调用智能合约Q,间接调用智能合约S,查询相关信息。
在一实施例中,用户A可以在交易中注明资产转出方的账户ID(即用户A的账户ID)、资产转入方的账户ID(即用户B的账户ID)、待转移资产的类型为“类型B”、转移数量为“1000”。那么,智能合约Q包含的合约代码在被执行时,可以基于上述对于区块链余额、账户真实性等方面的验证需求,创建另一条交易并发布至区块链网络,并在该交易中注明智能合约S的合约地址、端口信息等,从而通过调用该智能合约S满足上述需求。
在一实施例中,假定由区块链节点G对智能合约Q发布的上述交易进行响应。类似于图3所示的实施例,该区块链节点G通过调用智能合约S中位于code结构中的合约代码,使得该合约代码被执行后,可以用于对智能合约S中位于storage结构中的元数据进行解析,以确定出:1)用户A持有的类型B的区块链余额是否不小于1000,2)用户B的账户信息是否真实有效。
仍以上述表1所示的数据为例。假定用户A在区块链网络中的账户ID为“0003”、交易中注明的资产类型为“类型B”,那么区块链节点G可以通过调用智能合约S包含的合约代码,使得该合约代码被执行并对智能合约S包含的元数据进行解析后,可以确定出“账户ID=0003”、“资产类型=类型B”的存储字段,从而读取该存储字段的取值为“2100”,即用户A所持有的类型B的区块链余额为2100,满足“不小于1000”。
在一实施例中,假定用户A在交易中注明的资产转入方的账户ID为“0001”,那么区块链节点G可以通过调用智能合约S包含的合约代码,使得该合约代码被执行并对智能合约S包含的元数据进行解析后,可以确定出存在“账户ID=0001”的相关字段,因而可以判定用户B的账户信息真实有效。
步骤403,区块链节点调用智能合约Q,间接调用智能合约S,更新区块链余额。
在一实施例中,智能合约Q根据步骤403传回的查询结果,确定能够实施用户A请求的资产转移操作,可以创建一条交易并发布至区块链网络,并在该交易中注明智能合约S的合约地址、端口信息等,从而通过调用该智能合约S对相关账户在资产转移完成后的区块链余额进行更新。
在一实施例中,假定智能合约S中原本记录的数据如表1所示,其中用户A对应的账户ID为“0003”、持有的资产类型为“类型B”的区块链余额为2100、持有的资产总额相当于人民币24200元(假定类型A的区块链资产与人民币的兑换比例为1:1、类型B的区块链资产与人民币的兑换比例为1:2),用户B对应的账户ID为“0001”、持有的资产类型为“类型B”的区块链余额为1500、持有的资产总额相当于人民币5000元。
其中,如果将用户A持有的类型B、数量为1000的区块链资产转移至用户B,那么账户ID为“0003”、资产类型为“类型B”的区块链余额将更新为1100、持有的资产总额更新为人民币22200元,账户ID为“0001”、资产类型为“类型B”的区块链余额将更新为2500、持有的资产总额更新为人民币7000元,相关数据如下表2所示。
表2
在一种情况下,智能合约Q可以在步骤403发布的交易中注明:针对账户ID为0003的账户,将资产类型为类型B的区块链余额减少1000,针对账户ID为0001的账户,将资产类型为类型B的区块链余额增加1000,而由智能合约S包含的合约代码被执行后,自动确定出对应的存储字段包括:“账户ID=0003”、“资产类型=类型B”的存储字段,“账户ID=0003”、“总额”的存储字段,“账户ID=0001”、“资产类型=类型B”的存储字段,“账户ID=0001”、“总额”的存储字段,并进一步将“账户ID=0003”、“资产类型=类型B”的存储字段的取值由2100更新为减少后的1100,将“账户ID=0003”、“总额”的存储字段的取值由24200元更新减少后的为22200元,将“账户ID=0001”、“资产类型=类型B”的存储字段的取值由1500更新为增加后的2500,以及将“账户ID=0001”、“总额”的存储字段的取值由5000元更新为增加后的7000元。
在另一种情况下,智能合约Q可以在步骤403发布的交易中注明:针对账户ID为0003的账户,将资产类型为类型B的区块链余额更新为1100、总额更新为22200元,针对账户ID为0001的账户,将资产类型为类型B的区块链余额更新为2500、总额更新为7000元,而由智能合约S包含的合约代码被执行后,自动确定出对应的存储字段包括:“账户ID=0003”、“资产类型=类型B”的存储字段,“账户ID=0003”、“总额”的存储字段,“账户ID=0001”、“资产类型=类型B”的存储字段,“账户ID=0001”、“总额”的存储字段,并进一步将“账户ID=0003”、“资产类型=类型B”的存储字段的取值更新为1100,将“账户ID=0003”、“总额”的存储字段的取值更新为22200元,将“账户ID=0001”、“资产类型=类型B”的存储字段的取值更新为2500,以及将“账户ID=0001”、“总额”的存储字段的取值更新为7000元。
步骤404,区块链节点G向用户A返回结果。
在图3所示的实施例中,由用户A通过向区块链网络中发布交易,调用智能合约S包含的合约代码,基于该合约代码对智能合约S包含的元数据的解析结果,对该智能合约S包含的数据进行读取(查询)。而在其他实施例中,针对区块链余额的读取等操作,也可以采用类似于图4所示的方式,即基于多个智能合约之间的间接调用而实现。
在图4所示的实施例中,由用户A通过向区块链网络中发布交易,对智能合约Q进行直接调用,而该智能合约Q在实现相关逻辑的过程中,调用智能合约S包含的合约代码,基于该合约代码对智能合约S包含的元数据的解析结果,对该智能合约S包含的数据进行读取(查询)和写入(更新)。而在其他实施例中,针对区块链余额的读取、更新等操作,也可以采用类似于图3所示的方式,即基于用户对智能合约的直接调用而实现。
图5是一示例性实施例提供的一种设备的示意结构图。请参考图5,在硬件层面,该设备 包括处理器502、内部总线504、网络接口506、内存508以及非易失性存储器510,当然还可能包括其他业务所需要的硬件。处理器502从非易失性存储器510中读取对应的计算机程序到内存508中然后运行,在逻辑层面上形成数据读写装置。当然,除了软件实现方式之外,本说明书一个或多个实施例并不排除其他实现方式,比如逻辑器件抑或软硬件结合的方式等等,也就是说以下处理流程的执行主体并不限定于各个逻辑单元,也可以是硬件或逻辑器件。
请参考图6,在软件实施方式中,该数据读写装置可以包括:
获取单元61,使区块链网络中的区块链节点获取针对智能合约的数据读写请求,所述数据读写请求用于对所述智能合约包含的数据集合中的目标对象进行数据读写操作;
解析单元62,使所述区块链节点通过运行所述智能合约包含的代码对所述智能合约包含的元数据进行解析,解析结果用于指示所述数据集合中对应于所述目标对象的存储字段,以对所述存储字段实施所述数据读写操作。
可选的,还包括:
第一读取单元63,使所述区块链节点读取所述数据调用请求包含的输入参数,所述输入参数包括所述目标对象;
其中,所述数据读写操作用于读取所述存储字段内的字段取值,以返回至所述数据调用请求的发起方。
可选的,还包括:
第二读取单元64,使所述区块链节点读取所述数据读写请求包含的输入参数,所述输入参数包括所述目标对象和所述目标对象的取值;
其中,所述数据读写操作用于根据所述目标对象的取值对所述存储字段内的字段取值进行更新。
可选的,所述数据读写请求的发起方包括:所述区块链网络中的区块链成员,或者区别于所述智能合约的另一智能合约。
可选的,还包括:
响应单元65,使所述区块链节点在所述数据读写请求满足对所述智能合约的调用条件时,对所述数据读写请求进行响应,以返回所述目标数据。
可选的,所述调用条件包括:
所述数据读写请求对应的发起方用户对所述智能合约具有调用权限。
上述实施例阐明的系统、装置、模块或单元,具体可以由计算机芯片或实体实现,或者由具有某种功能的产品来实现。一种典型的实现设备为计算机,计算机的具体形式可以是个人计算机、膝上型计算机、蜂窝电话、相机电话、智能电话、个人数字助理、媒体播放器、导航设备、电子邮件收发设备、游戏控制台、平板计算机、可穿戴设备或者这些设备中的任意几种设备的组合。
在一个典型的配置中,计算机包括一个或多个处理器(CPU)、输入/输出接口、网络接口和内存。
内存可能包括计算机可读介质中的非永久性存储器,随机存取存储器(RAM)和/或非易失性内存等形式,如只读存储器(ROM)或闪存(flash RAM)。内存是计算机可读介质的示例。
计算机可读介质包括永久性和非永久性、可移动和非可移动媒体可以由任何方法或技术来实现信息存储。信息可以是计算机可读指令、数据结构、程序的模块或其他数据。计算机的存储介质的例子包括,但不限于相变内存(PRAM)、静态随机存取存储器(SRAM)、动态随机存取存储器(DRAM)、其他类型的随机存取存储器(RAM)、只读存储器(ROM)、电可擦除可编程只读存储器(EEPROM)、快闪记忆体或其他内存技术、只读光盘只读存储器(CD-ROM)、数字多功能光盘(DVD)或其他光学存储、磁盒式磁带、磁盘存储、量子存储器、基于石墨烯的存储介质或其他磁性存储设备或任何其他非传输介质,可用于存储可以被计算设备访问的信息。按照本文中的界定,计算机可读介质不包括暂存电脑可读媒体(transitory media),如调制的数据信号和载波。
还需要说明的是,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、商品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、商品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、商品或者设备中还存在另外的相同要素。
上述对本说明书特定实施例进行了描述。其它实施例在所附权利要求书的范围内。在一些情况下,在权利要求书中记载的动作或步骤可以按照不同于实施例中的顺序来执行并且仍然可以实现期望的结果。另外,在附图中描绘的过程不一定要求示出的特定顺序或者连续顺序才能实现期望的结果。在某些实施方式中,多任务处理和并行处理也是可以的或者可能是有利的。
在本说明书一个或多个实施例使用的术语是仅仅出于描述特定实施例的目的,而非旨在限制本说明书一个或多个实施例。在本说明书一个或多个实施例和所附权利要求书中所使用的单数形式的“一种”、“所述”和“该”也旨在包括多数形式,除非上下文清楚地表示其他含义。还应当理解,本文中使用的术语“和/或”是指并包含一个或多个相关联的列出项目的任何或所有可能组合。
应当理解,尽管在本说明书一个或多个实施例可能采用术语第一、第二、第三等来描述各种信息,但这些信息不应限于这些术语。这些术语仅用来将同一类型的信息彼此区分开。例如,在不脱离本说明书一个或多个实施例范围的情况下,第一信息也可以被称为第二信息,类似地,第二信息也可以被称为第一信息。取决于语境,如在此所使用的词语“如果”可以被解释成为“在……时”或“当……时”或“响应于确定”。
以上所述仅为本说明书一个或多个实施例的较佳实施例而已,并不用以限制本说明书一个或多个实施例,凡在本说明书一个或多个实施例的精神和原则之内,所做的任何修改、等同替换、改进等,均应包含在本说明书一个或多个实施例保护的范围之内。
Claims (13)
- 一种数据读写方法,包括:区块链网络中的区块链节点获取针对智能合约的数据读写请求,所述数据读写请求用于对所述智能合约包含的数据集合中的目标对象进行数据读写操作;所述区块链节点通过运行所述智能合约包含的代码对所述智能合约包含的元数据进行解析,解析结果用于指示所述数据集合中对应于所述目标对象的存储字段,以对所述存储字段实施所述数据读写操作。
- 根据权利要求1所述的方法,还包括:所述区块链节点读取所述数据调用请求包含的输入参数,所述输入参数包括所述目标对象;其中,所述数据读写操作用于读取所述存储字段内的字段取值,以返回至所述数据调用请求的发起方。
- 根据权利要求1所述的方法,还包括:所述区块链节点读取所述数据读写请求包含的输入参数,所述输入参数包括所述目标对象和所述目标对象的取值;其中,所述数据读写操作用于根据所述目标对象的取值对所述存储字段内的字段取值进行更新。
- 根据权利要求1所述的方法,所述数据读写请求的发起方包括:所述区块链网络中的区块链成员,或者区别于所述智能合约的另一智能合约。
- 根据权利要求1所述的方法,还包括:所述区块链节点在所述数据读写请求满足对所述智能合约的调用条件时,对所述数据读写请求进行响应,以返回所述目标数据。
- 根据权利要求5所述的方法,所述调用条件包括:所述数据读写请求对应的发起方用户对所述智能合约具有调用权限。
- 一种数据读写装置,包括:获取单元,使区块链网络中的区块链节点获取针对智能合约的数据读写请求,所述数据读写请求用于对所述智能合约包含的数据集合中的目标对象进行数据读写操作;解析单元,使所述区块链节点通过运行所述智能合约包含的代码对所述智能合约包含的元数据进行解析,解析结果用于指示所述数据集合中对应于所述目标对象的存储字段,以对所述存储字段实施所述数据读写操作。
- 根据权利要求7所述的装置,还包括:第一读取单元,使所述区块链节点读取所述数据调用请求包含的输入参数,所述输入参数包括所述目标对象;其中,所述数据读写操作用于读取所述存储字段内的字段取值,以返回至所述数据调用请求的发起方。
- 根据权利要求7所述的装置,还包括:第二读取单元,使所述区块链节点读取所述数据读写请求包含的输入参数,所述输入参数包括所述目标对象和所述目标对象的取值;其中,所述数据读写操作用于根据所述目标对象的取值对所述存储字段内的字段取值进行更新。
- 根据权利要求7所述的装置,所述数据读写请求的发起方包括:所述区块链网络中的区块链成员,或者区别于所述智能合约的另一智能合约。
- 根据权利要求7所述的装置,还包括:响应单元,使所述区块链节点在所述数据读写请求满足对所述智能合约的调用条件时,对所述数据读写请求进行响应,以返回所述目标数据。
- 根据权利要求11所述的装置,所述调用条件包括:所述数据读写请求对应的发起方用户对所述智能合约具有调用权限。
- 一种电子设备,包括:处理器;用于存储处理器可执行指令的存储器;其中,所述处理器被配置为实现如权利要求1-6中任一项所述的数据读写方法。
Priority Applications (3)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
SG11202100802QA SG11202100802QA (en) | 2018-12-20 | 2019-10-31 | Data read and write method and apparatus, and electronic device |
EP19897928.8A EP3812943A4 (en) | 2018-12-20 | 2019-10-31 | METHOD AND DEVICE FOR READING AND WRITING DATA AND ELECTRONIC DEVICE |
US17/161,640 US11200226B2 (en) | 2018-12-20 | 2021-01-28 | Data read and write method and apparatus, and electronic device |
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811564466.9A CN110020542B (zh) | 2018-12-20 | 2018-12-20 | 数据读写方法及装置、电子设备 |
CN201811564466.9 | 2018-12-20 |
Related Child Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
US17/161,640 Continuation US11200226B2 (en) | 2018-12-20 | 2021-01-28 | Data read and write method and apparatus, and electronic device |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2020125222A1 true WO2020125222A1 (zh) | 2020-06-25 |
Family
ID=67188652
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2019/114580 WO2020125222A1 (zh) | 2018-12-20 | 2019-10-31 | 数据读写方法及装置、电子设备 |
Country Status (6)
Country | Link |
---|---|
US (1) | US11200226B2 (zh) |
EP (1) | EP3812943A4 (zh) |
CN (2) | CN110020542B (zh) |
SG (1) | SG11202100802QA (zh) |
TW (1) | TWI706280B (zh) |
WO (1) | WO2020125222A1 (zh) |
Families Citing this family (11)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110020542B (zh) | 2018-12-20 | 2020-05-19 | 阿里巴巴集团控股有限公司 | 数据读写方法及装置、电子设备 |
US11657391B1 (en) | 2019-05-24 | 2023-05-23 | Hiro Systems Pbc | System and method for invoking smart contracts |
US11513815B1 (en) * | 2019-05-24 | 2022-11-29 | Hiro Systems Pbc | Defining data storage within smart contracts |
US10699269B1 (en) | 2019-05-24 | 2020-06-30 | Blockstack Pbc | System and method for smart contract publishing |
CN111475827A (zh) * | 2019-11-08 | 2020-07-31 | 支付宝(杭州)信息技术有限公司 | 基于链下授权的隐私数据查询方法及装置 |
CN111400291A (zh) * | 2020-02-25 | 2020-07-10 | 南京可信区块链与算法经济研究院有限公司 | 联盟链中可信资产数据的生成方法、系统、设备及介质 |
CN111738861A (zh) * | 2020-07-31 | 2020-10-02 | 支付宝(杭州)信息技术有限公司 | 通过区块链进行权益累加的方法及装置 |
CN114077639B (zh) * | 2020-08-20 | 2024-08-23 | 北京字节跳动网络技术有限公司 | 数据写入方法、装置、电子设备和存储介质 |
EP3979166A1 (en) * | 2020-10-02 | 2022-04-06 | Siemens Aktiengesellschaft | Method and system for automatically distributing asset pool shares among actors in a blockchain network |
CN112199186B (zh) * | 2020-12-07 | 2021-03-02 | 腾讯科技(深圳)有限公司 | 基于智能合约的数据处理方法、装置、设备及存储介质 |
CN112527460A (zh) * | 2020-12-17 | 2021-03-19 | 山大地纬软件股份有限公司 | 一种控制区块链底层资产数据状态一致性的方法及系统 |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20170236143A1 (en) * | 2016-02-15 | 2017-08-17 | Shannon Code | System and process for electronic tokenization of product brand loyalty and incentives |
CN108694589A (zh) * | 2018-05-08 | 2018-10-23 | 杭州佑他科技有限公司 | 一种基于区块链的资产监控方法 |
CN108769173A (zh) * | 2018-05-21 | 2018-11-06 | 阿里体育有限公司 | 运行智能合约的区块链实现方法及设备 |
CN110020542A (zh) * | 2018-12-20 | 2019-07-16 | 阿里巴巴集团控股有限公司 | 数据读写方法及装置、电子设备 |
CN110032598A (zh) * | 2018-12-20 | 2019-07-19 | 阿里巴巴集团控股有限公司 | 字段更新方法及装置、电子设备 |
Family Cites Families (32)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CA2991211C (en) * | 2015-07-02 | 2024-02-20 | Nasdaq, Inc. | Systems and methods of secure provenance for distributed transaction databases |
US20170048235A1 (en) * | 2015-07-14 | 2017-02-16 | Fmr Llc | Crypto Captcha and Social Aggregating, Fractionally Efficient Transfer Guidance, Conditional Triggered Transaction, Datastructures, Apparatuses, Methods and Systems |
US20170085545A1 (en) * | 2015-07-14 | 2017-03-23 | Fmr Llc | Smart Rules and Social Aggregating, Fractionally Efficient Transfer Guidance, Conditional Triggered Transaction, Datastructures, Apparatuses, Methods and Systems |
US20170140408A1 (en) * | 2015-11-16 | 2017-05-18 | Bank Of America Corporation | Transparent self-managing rewards program using blockchain and smart contracts |
CN107122364B (zh) * | 2016-02-25 | 2021-05-18 | 华为技术有限公司 | 数据操作方法和数据管理服务器 |
GB201613176D0 (en) * | 2016-07-29 | 2016-09-14 | Eitc Holdings Ltd | Computer-implemented method and system |
US10417217B2 (en) * | 2016-08-05 | 2019-09-17 | Chicago Mercantile Exchange Inc. | Systems and methods for blockchain rule synchronization |
US10250694B2 (en) * | 2016-08-19 | 2019-04-02 | Ca, Inc. | Maintaining distributed state among stateless service clients |
US10614239B2 (en) * | 2016-09-30 | 2020-04-07 | Amazon Technologies, Inc. | Immutable cryptographically secured ledger-backed databases |
CN107016548B (zh) * | 2016-12-09 | 2022-01-28 | 创新先进技术有限公司 | 客户系统、信息处理方法和读写方法及装置 |
US10698675B2 (en) * | 2016-12-19 | 2020-06-30 | International Business Machines Corporation | Decentralized automated software updates via blockchain |
WO2018112805A1 (zh) * | 2016-12-21 | 2018-06-28 | 深圳前海达闼云端智能科技有限公司 | 区块链存储方法、装置及节点设备 |
US10871948B1 (en) * | 2017-03-30 | 2020-12-22 | Wells Fargo Bank, N.A. | Smart contract blockchain abstraction API |
CN107103054B (zh) * | 2017-04-12 | 2019-03-26 | 北京航空航天大学 | 一种私有区块链的智能合约异步执行存储系统与实现方法 |
US10713963B2 (en) * | 2017-05-25 | 2020-07-14 | International Business Machines Corporation | Managing lifelong learner events on a blockchain |
US20190108576A1 (en) * | 2017-10-11 | 2019-04-11 | Capital One Services, Llc | Blockchain systems and methods for procurement |
CN107807991B (zh) * | 2017-11-07 | 2020-05-12 | 泰康保险集团股份有限公司 | 用于处理区块链数据的方法及装置 |
CN108052620B (zh) * | 2017-12-15 | 2021-02-12 | 泰康保险集团股份有限公司 | 数据状态的存储系统、区块链的节点数据处理系统和方法 |
CN108055274B (zh) * | 2017-12-22 | 2020-09-11 | 广东工业大学 | 一种基于联盟链存储数据的加密与共享方法及系统 |
CN108052321B (zh) * | 2017-12-28 | 2020-12-25 | 杭州趣链科技有限公司 | 一种基于配置信息自动生成区块链智能合约的方法 |
CN108492180B (zh) * | 2018-02-14 | 2020-11-24 | 创新先进技术有限公司 | 资产管理方法及装置、电子设备 |
US10901974B2 (en) * | 2018-03-29 | 2021-01-26 | Salesforce.Com, Inc. | Hybrid cloud chain management of centralized and decentralized data |
CN108566420A (zh) * | 2018-03-29 | 2018-09-21 | 上海点融信息科技有限责任公司 | 用于区块链的数据处理方法、设备及计算机可读存储介质 |
CN111861433B (zh) * | 2018-03-30 | 2024-04-02 | 创新先进技术有限公司 | 基于区块链的业务执行方法及装置、电子设备 |
US10897499B2 (en) * | 2018-04-24 | 2021-01-19 | International Business Machines Corporation | Resolving status and synchronization discrepancies in a distributed computing environment using blockchains |
US10095888B1 (en) * | 2018-06-04 | 2018-10-09 | Capital One Services, Llc | Secure decentralized system utilizing smart contracts, a blockchain, and/or a distributed file system |
CN108776890A (zh) * | 2018-06-04 | 2018-11-09 | 青岛大学 | 一种基于区块链的可信智能工资发放方法和系统 |
CN108830720B (zh) * | 2018-06-21 | 2021-04-30 | 北京京东尚科信息技术有限公司 | 智能合约运行方法、装置、系统和计算机可读存储介质 |
CN108965399B (zh) * | 2018-06-25 | 2022-02-25 | 百度在线网络技术(北京)有限公司 | 智能合约的执行方法、装置、设备及存储介质 |
US10671372B2 (en) * | 2018-11-01 | 2020-06-02 | Dell Products L.P. | Blockchain-based secure customized catalog system |
US20200143337A1 (en) * | 2018-11-02 | 2020-05-07 | Figure Technologies, Inc. | Secure computer network-based platform |
US11349653B2 (en) * | 2018-12-18 | 2022-05-31 | Hewlett Packard Enterprise Development Lp | Multiple-site private network secured by IPsec using blockchain network for key exchange |
-
2018
- 2018-12-20 CN CN201811564466.9A patent/CN110020542B/zh active Active
- 2018-12-20 CN CN202010645627.8A patent/CN111898139B/zh active Active
-
2019
- 2019-10-04 TW TW108136002A patent/TWI706280B/zh active
- 2019-10-31 EP EP19897928.8A patent/EP3812943A4/en active Pending
- 2019-10-31 WO PCT/CN2019/114580 patent/WO2020125222A1/zh unknown
- 2019-10-31 SG SG11202100802QA patent/SG11202100802QA/en unknown
-
2021
- 2021-01-28 US US17/161,640 patent/US11200226B2/en active Active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20170236143A1 (en) * | 2016-02-15 | 2017-08-17 | Shannon Code | System and process for electronic tokenization of product brand loyalty and incentives |
CN108694589A (zh) * | 2018-05-08 | 2018-10-23 | 杭州佑他科技有限公司 | 一种基于区块链的资产监控方法 |
CN108769173A (zh) * | 2018-05-21 | 2018-11-06 | 阿里体育有限公司 | 运行智能合约的区块链实现方法及设备 |
CN110020542A (zh) * | 2018-12-20 | 2019-07-16 | 阿里巴巴集团控股有限公司 | 数据读写方法及装置、电子设备 |
CN110032598A (zh) * | 2018-12-20 | 2019-07-19 | 阿里巴巴集团控股有限公司 | 字段更新方法及装置、电子设备 |
Non-Patent Citations (1)
Title |
---|
See also references of EP3812943A4 * |
Also Published As
Publication number | Publication date |
---|---|
US20210157798A1 (en) | 2021-05-27 |
TWI706280B (zh) | 2020-10-01 |
US11200226B2 (en) | 2021-12-14 |
CN111898139A (zh) | 2020-11-06 |
EP3812943A4 (en) | 2022-01-05 |
CN110020542A (zh) | 2019-07-16 |
EP3812943A1 (en) | 2021-04-28 |
SG11202100802QA (en) | 2021-02-25 |
TW202024984A (zh) | 2020-07-01 |
CN111898139B (zh) | 2024-04-16 |
CN110020542B (zh) | 2020-05-19 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2020125222A1 (zh) | 数据读写方法及装置、电子设备 | |
WO2020125233A1 (zh) | 字段更新方法及装置、电子设备 | |
TWI722592B (zh) | 資料結構的讀取及更新方法、裝置、電子設備 | |
US20210248605A1 (en) | Cross-chain right usage systems, methods, apparatuses, electronic devices, and storage media | |
US20210049602A1 (en) | Transaction method and system based on centralized settlement and blockchain deposit certificates | |
WO2018214898A1 (zh) | 一种向区块链系统中写入业务数据的方法和装置 | |
US20190147106A1 (en) | Providing accountability of blockchain queries | |
WO2020134699A1 (zh) | 基于区块链的发票报销方法、装置及电子设备 | |
TW202022857A (zh) | 基於區塊鏈的發票創建方法及裝置、電子設備 | |
TW202008196A (zh) | 基於中心化結算與區塊鏈存證的交易方法及系統 | |
TWI724570B (zh) | 資料結構的讀取及更新方法、裝置、電子設備及儲存媒體 | |
TW202008235A (zh) | 基於中心化結算與區塊鏈存證的交易方法及系統 | |
TW202022754A (zh) | 基於區塊鏈的發票創建方法及裝置、電子設備 | |
WO2020082875A1 (zh) | 基于区块链的跨链数据访问方法和装置 | |
TW201600985A (zh) | 資料的查詢方法及查詢裝置 | |
WO2022077186A1 (zh) | 区块链中智能合约的执行方法及装置和电子设备 | |
TW202025020A (zh) | 基於區塊鏈的內容管理系統及方法、裝置、電子設備 | |
WO2021228242A1 (zh) | 调用智能合约的方法及装置 | |
WO2024021417A1 (zh) | 数据账户创建方法及装置 | |
WO2023045575A1 (zh) | 区块链中的权限管控 | |
CN115221559A (zh) | 数据账户的访问授权方法及装置 | |
WO2020108055A1 (zh) | 一种基于多个区块链网络的数据读取方法及系统 | |
Scargall et al. | Enabling Persistence Using a Real-World Application | |
CN115098886A (zh) | 智能合约的访问授权方法及装置 |
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: 19897928 Country of ref document: EP Kind code of ref document: A1 |
|
ENP | Entry into the national phase |
Ref document number: 2019897928 Country of ref document: EP Effective date: 20210120 |
|
NENP | Non-entry into the national phase |
Ref country code: DE |