WO2020125219A1 - 数据结构的读取及更新方法、装置、电子设备 - Google Patents

数据结构的读取及更新方法、装置、电子设备 Download PDF

Info

Publication number
WO2020125219A1
WO2020125219A1 PCT/CN2019/114435 CN2019114435W WO2020125219A1 WO 2020125219 A1 WO2020125219 A1 WO 2020125219A1 CN 2019114435 W CN2019114435 W CN 2019114435W WO 2020125219 A1 WO2020125219 A1 WO 2020125219A1
Authority
WO
WIPO (PCT)
Prior art keywords
smart contract
data structure
contract
metadata
update
Prior art date
Application number
PCT/CN2019/114435
Other languages
English (en)
French (fr)
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 阿里巴巴集团控股有限公司
Priority to SG11202100673WA priority Critical patent/SG11202100673WA/en
Priority to EP19898395.9A priority patent/EP3812921A4/en
Publication of WO2020125219A1 publication Critical patent/WO2020125219A1/zh
Priority to US17/159,090 priority patent/US11232098B2/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/23Updating
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/23Updating
    • G06F16/2379Updates performed during online database operations; commit processing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/901Indexing; Data structures therefor; Storage structures
    • G06F16/9024Graphs; Linked lists
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • G06F16/2228Indexing structures
    • G06F16/2272Management thereof
    • 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/25Integrating or interfacing systems involving database management systems
    • G06F16/258Data format conversion from or to a database
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/02Payment architectures, schemes or protocols involving a neutral party, e.g. certification authority, notary or trusted third party [TTP]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/38Payment protocols; Details thereof
    • G06Q20/381Currency conversion
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/38Payment protocols; Details thereof
    • G06Q20/389Keeping log of transactions for guaranteeing non-repudiation of a transaction
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q2220/00Business processing using cryptography
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/50Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols using hash chains, e.g. blockchains or hash trees

Definitions

  • One or more embodiments of this specification relate to the field of blockchain technology, and in particular, to a method, device, and electronic device for reading and updating data structures.
  • 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 method, device, and electronic device for reading and updating a data structure.
  • a method for reading a data structure including:
  • the blockchain nodes in the blockchain network obtain the call request for the first smart contract
  • the blockchain node runs the contract code contained in the first smart contract to parse the data structure described by the metadata contained in the second smart contract, and then analyzes the data structure through the computer programming language. Characterize the data structure;
  • the blockchain node returns the data structure represented by the computer programming language to the initiator of the call request.
  • a method for updating a data structure including:
  • the blockchain nodes in the blockchain network obtain the call request for the first smart contract
  • the blockchain node obtains the updated data structure based on the computer programming language
  • the blockchain node runs the first contract code included in the first smart contract, the first contract code is used to parse the updated data structure, and is characterized as based on the definition
  • the metadata after the update in the description language is used to update the metadata before the update included in the second smart contract.
  • a data structure reading device including:
  • the obtaining unit enables the block chain nodes in the block chain network to obtain the calling request for the first smart contract
  • the response unit in response to the call request, causes the blockchain node to run the contract code contained in the first smart contract to parse the data structure described by the metadata contained in the second smart contract and pass the computer
  • the programming language characterizes the data structure
  • a return unit causes the blockchain node to return the data structure represented by the computer programming language to the initiator of the call request.
  • a data structure updating device including:
  • a request acquisition unit to enable a blockchain node in the blockchain network to acquire a call request for the first smart contract
  • a structure acquisition unit to enable the blockchain node to obtain an updated data structure based on a computer programming language
  • a request response unit in response to the call request, causes the blockchain node to run a first contract code included in the first smart contract, the first contract code is used to parse the updated data structure, And it is characterized as the updated metadata based on the definition description language to update the pre-update metadata included in the second smart contract.
  • an electronic device including:
  • Memory for storing processor executable instructions
  • the processor is configured to implement the data structure reading method as described in any of the above embodiments.
  • an electronic device including:
  • Memory for storing processor executable instructions
  • the processor is configured to implement the data structure updating method as described in any one of the above embodiments.
  • FIG. 1 is a flowchart of a data structure reading method provided by an exemplary embodiment.
  • FIG. 2 is a flowchart of a data structure updating method provided by an exemplary embodiment.
  • FIG. 3 is a schematic structural diagram of a smart contract provided by an exemplary embodiment.
  • FIG. 4 is a schematic diagram of a read data structure provided by an exemplary embodiment.
  • FIG. 5 is a schematic diagram of an update data structure provided by an exemplary embodiment.
  • FIG. 6 is a schematic structural diagram of an apparatus provided by an exemplary embodiment.
  • FIG. 7 is a block diagram of a data structure reading apparatus provided by an exemplary embodiment.
  • FIG. 8 is a schematic structural diagram of another device provided by an exemplary embodiment.
  • FIG. 9 is a block diagram of an apparatus for updating a data structure 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 data structure reading method provided by 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 call request for the first smart contract.
  • the call request may be carried in a transaction created in the blockchain network, and by indicating the contract address, port information, etc. of the first smart contract to be called in the transaction, the call request is made It is confirmed to be “targeted” to the above-mentioned first smart contract, so that the contract code contained in the first smart contract is executed.
  • 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 initiator of the call request may include: a certain role in the blockchain network.
  • the role may include a developer or an ordinary user of the blockchain network. The role can quickly read the data structure of the data contained in the second smart contract based on the call to the first smart contract.
  • the first smart contract can be agreed among various blockchain nodes in the blockchain network and recorded in the blockchain network, which can be called by the blockchain nodes.
  • the first smart contract may be a system contract provided by the system function of the blockchain network.
  • the first smart contract can be written into the source code of the blockchain network, so that the first smart contract can be used as a default "tool" for the blockchain node to call the first smart contract, such as
  • the first smart contract can be used as a default "tool" for the blockchain node to call the first smart contract, such as
  • ordinary users or general developers cannot modify the first smart contract to ensure its reliability.
  • Step 104 In response to the call request, the blockchain node runs the contract code contained in the first smart contract to parse the data structure described by the metadata contained in the second smart contract and program it through a computer The language characterizes the data structure.
  • a role such as a developer can read and edit data structures based on computer programming languages, while metadata is characterized using a definition description language and cannot be directly read and edited. Therefore, the contract code contained in the first smart contract can be used to implement the conversion function module between the computer programming language and the definition description language, and the metadata represented by the definition description language can be parsed and further converted into the computer programming language. Characterization, so that the above-mentioned role can easily read the data structure of the data contained in the second smart contract.
  • the first smart contract may include a code structure, and the code structure includes the above-mentioned contract code.
  • the second smart contract may include a storage structure, which is used to record data sets and metadata.
  • the first smart contract may also include a storage structure or other structures for recording corresponding data or other content, which is not limited in this specification.
  • the second smart contract may also include a code structure, which is used to record the contract code. For example, after the contract code is executed, the metadata contained in the second smart contract may be parsed to read the data contained in the second smart contract Write operations, update operations, etc., this manual does not limit this.
  • the data structure may include: contained data fields, hierarchical relationships between the various data fields, value relationships between the various data fields, etc. This specification does not limit this.
  • Step 106 The blockchain node returns the data structure represented by the computer programming language to the initiator of the call request.
  • the computer programming language may include: a preset type of language. For example, it can be preset to use Solidity language, JavaScript language, Python language or even mixed language, etc., and this manual does not limit this.
  • Cross-contract calling can also be used to call between contracts written in different languages; moreover, when contracts are upgraded, existing contracts can be rewritten in the same or different languages without affecting other contracts. Using cross-contract calling can also enable contracts written in different languages to access the same data.
  • the computer programming language may include: the type of language indicated in the call request.
  • the initiator of the call request can specify the type of computer programming language it wishes to use. This designation can be for any type, or it can be selected from a variety of pre-configured types, which is not limited in this specification.
  • FIG. 2 is a flowchart of a data structure updating method provided by an exemplary embodiment. As shown in Figure 2, the method may include the following steps:
  • Step 202A The blockchain node in the blockchain network obtains a call request for the first smart contract.
  • the call request may be carried in a transaction created in the blockchain network, and by indicating the contract address, port information, etc. of the first smart contract to be called in the transaction, the call request is made It is confirmed to be “targeted” to the above-mentioned first smart contract, so that the first contract code contained in the first smart contract is executed.
  • 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 initiator of the call request may include: a certain role in the blockchain network.
  • the role may include developers, maintainers, ordinary users, or authorized users of the blockchain network.
  • the role can be based on a call to the first smart contract, thereby conveniently implementing data on the data contained in the second smart contract
  • the structure is updated, or the data contained in the second smart contract can be accessed or updated conveniently.
  • the first smart contract can be agreed among various blockchain nodes in the blockchain network and recorded in the blockchain network, which can be called by the blockchain nodes.
  • the first smart contract may be a system contract provided by the system function of the blockchain network.
  • the first smart contract can be written into the source code of the blockchain network, so that the first smart contract can be used as a default "tool" for the blockchain node to call the first smart contract, such as
  • the first smart contract can be used as a default "tool" for the blockchain node to call the first smart contract, such as
  • ordinary users or general developers cannot modify the first smart contract to ensure its reliability.
  • Step 202B The blockchain node obtains the updated data structure based on the computer programming language.
  • the developer may read the data structure of the data contained in the second smart contract through implementation such as shown in FIG. 1 and update the data structure based on the computer programming language to obtain the updated data structure.
  • the computer programming language may include: a preset type of language.
  • a preset type of language For example, it can be preset to use Solidity language, JavaScript language, Python language, etc., and this manual does not limit this.
  • the data structure may include: contained data fields, hierarchical relationships between the various data fields, value relationships between the various data fields, etc. This specification does not limit this.
  • step 202A there is no necessary sequence between step 202A and step 202B, as long as it occurs before step 204, this specification does not limit this.
  • Step 204 In response to the call request, the blockchain node runs a first contract code included in the first smart contract, and the first contract code is used to parse and characterize the updated data structure It is the updated metadata based on the definition description language to update the pre-update metadata included in the second smart contract.
  • a role such as a developer can read and edit data structures based on computer programming languages, while metadata is characterized using a definition description language and cannot be directly read and edited. Therefore, the first contract code contained in the first smart contract can be used to implement the conversion function module between the computer programming language and the definition description language, and the metadata represented by the definition description language can be parsed and further converted into computer programming.
  • the language is characterized so that the above-mentioned roles can update the data structure of the data through the computer programming language, and the updated data structure is conveniently updated to the metadata contained in the second smart contract through the first smart contract, so as to pass the updated
  • the metadata updates the data structure of the data contained in the second smart contract.
  • developers and other roles to quickly read and modify the data structure of the data contained in the second smart contract.
  • the first smart contract may include a code structure that contains the above-mentioned first contract code; the first smart contract may also include a storage structure or other structures for recording corresponding data or other content, This manual does not limit this.
  • the second smart contract may include a code structure that contains the above-mentioned second contract code, and the second smart contract may also include a storage structure, which is used to record data sets and metadata. Wherein, if the pre-update metadata included in the second smart contract is updated to post-update metadata, the above-mentioned second contract code may be executed to parse the updated metadata included in the second smart contract, thereby Determine the updated data structure, and update the data structure of the data contained in the second smart contract accordingly.
  • the first contract code is also used to: compare the pre-update data structure corresponding to the pre-update metadata with the post-update data structure to verify that the post-update data structure is reasonable Wherein, when the rationality of the updated data structure passes the verification, the updated metadata is used to update the metadata before the update.
  • the data in the second smart contract contains fields such as account ID, age, and phone number, and uses "01” for “account ID”, “02” for “age”, and “03” for “record” Phone number”, etc.
  • "02” is modified to represent “phone number” in the updated data structure, and "03” still represents “phone number”, it will lead to confusion in the field of "phone number”, resulting in the update
  • the data structure is unreasonable, it should avoid directly updating the metadata before the update, but should call the first smart contract caller (such as a developer) to alert it to make changes.
  • FIG. 3 is a schematic structural diagram of a smart contract provided by an exemplary embodiment. As shown in FIG. 3, this specification relates to smart contract 1 and smart contract 2.
  • the smart contract 1 may include a structure 301.
  • the structure 301 may be referred to as a code structure for recording the contract code of the smart contract 1 (referred to as code 1 for short); the smart contract 1 may also include other structures 302, such as related technologies.
  • the storage structure, balance structure, nonce structure, etc., this manual does not limit this.
  • the smart contract 2 may include a structure 303.
  • the structure 303 may be referred to as a code structure for recording the contract code of the smart contract 2 (referred to as code 2 for short);
  • the smart contract 2 may include a structure 304, for example, the structure 304 may be referred to as
  • the storage structure is used to record the contract data (referred to as data) in the smart contract 2 and the metadata corresponding to the contract data.
  • the metadata is used to describe the corresponding contract data; the smart contract 2 may also include other structures 305,
  • the balance structure and nonce structure in the related art are not limited in this specification.
  • the smart contract 1 can provide an API interface to the code 1 in the structure 301 to the outside to implement the call to the code 1.
  • the smart contract 2 can provide an API interface to the code 2 in the structure 303 to the outside to implement the call to the code 2.
  • the worker can call the code 1 contained in the smart contract 1 through the API interface provided by the smart contract 1, and the code 1 can be executed through the API interface provided by the smart contract 2 after being executed.
  • This code 2 is called to parse or update the metadata contained in the smart contract 2, so as to read or update the data structure adopted by the data contained in the smart contract 2.
  • smart contract 2 for example, user A is a developer. Since the metadata in smart contract 2 is described in a definition description language, the staff is good at adopting Computer programming language for development or maintenance, and the above-mentioned smart contract 1 can be switched between the definition description language and the computer programming language, which helps staff to easily develop or maintain smart contract 2 by calling the smart contract 1 To further read or update the data structure of the data contained in the smart contract 2.
  • FIG. 4 is a schematic diagram of a read data structure provided by an exemplary embodiment. As shown in Figure 4, the process of reading the data structure may include the following steps:
  • Step 401 create a transaction.
  • the user A needs to read the data structure of the data contained in the smart contract 2 to modify the data structure. Therefore, the user A can create a transaction for reading the data structure-equivalent to a structure read request, and publish this transaction to the blockchain network. It is assumed that 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 metadata contained in the smart contract 2 records the data structure of the relevant data
  • the smart contract 1 described above can be familiar with user A's definition description language and user A.
  • the computer programming languages are converted between each other, so user A can call smart contract 1 through the above transaction, so that smart contract 1 can process the metadata contained in smart contract 2, so as to know the data of the data contained in smart contract 2. structure.
  • the above transaction may include the contract address and port information of smart contract 1, so that the blockchain node G can determine that the transaction needs to call the smart contract 1 based on the contract address, and include the smart contract 1 based on the port information.
  • the code 1 is called.
  • the smart contract 1 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
  • the smart contract 1 is also recorded on the blockchain node G of.
  • the smart contract 2 is created and published to the blockchain network, it can also be established in the blockchain node G based on consensus.
  • the smart contract 1 can be configured as a basic function provided by the blockchain network.
  • the smart contract 1 can be written into the source code of the blockchain network, rather than based on the individual blockchain nodes. The generation of consensus makes the smart contract 1 more secure and reliable.
  • step 402 the blockchain node G verifies the user A's permission to call the smart contract 1.
  • the smart contract 1 may be set with a calling authority, similar to a whitelist or blacklist, to avoid the smart contract 1 being arbitrarily used to read or change the metadata of other smart contracts to prevent Security risks.
  • a user with calling authority may be a predetermined part of the user; for example, when the blockchain network belongs to an alliance chain, the user with calling authority may be a member of the alliance. Therefore, when the blockchain node G obtains the transaction issued by the user A and determines that the transaction needs to call the smart contract 1, it can first determine whether the user A has the corresponding calling authority, and continue to implement the follow-up when it has the calling authority Step, otherwise it can return failure information.
  • step 403 the blockchain node G calls the smart contract 1, and executes the code 1 contained in the smart contract 1.
  • the user A may add an input parameter for the smart contract 1 in the above transaction, for example, the input parameter may include the contract address and port information of the smart contract 2, so that the code 1 contained in the smart contract 1 is executed , You can call Smart Contract 2 accordingly.
  • the input parameter may include the contract address and port information of the smart contract 2, so that the code 1 contained in the smart contract 1 is executed , You can call Smart Contract 2 accordingly.
  • the input parameter added by user A in the above transaction may also include an operation type, for example, the operation type may include "read metadata", so that when code 1 contained in smart contract 1 is executed, it may be based on the The call of the smart contract 2 reads the metadata contained in the smart contract 2, parses the metadata based on the definition description language, and characterizes the parsed data structure as a computer programming language to provide to user A for viewing.
  • the operation type may include "read metadata", so that when code 1 contained in smart contract 1 is executed, it may be based on the The call of the smart contract 2 reads the metadata contained in the smart contract 2, parses the metadata based on the definition description language, and characterizes the parsed data structure as a computer programming language to provide to user A for viewing.
  • step 404 the blockchain node G calls smart contract 2, executes code 2, and reads the metadata.
  • the blockchain node G can call the smart contract 2. For example, by calling and executing the above-mentioned code 2 included in the smart contract 2, the metadata included in the smart contract 2 may be read, and the metadata may be returned to the smart contract 1.
  • the smart contract 2 may be set with a calling authority, similar to the form of a white list or black list, to avoid the smart contract 2 from being called at will, and to prevent the metadata or data it contains from being read or changed at will, Prevent security risks.
  • a calling authority may be a predetermined part of the user; for example, when the blockchain network belongs to an alliance chain, the user with calling authority may be a member of the alliance. Therefore, when smart contract 1 is called by user A to initiate a call to smart contract 2, it can be determined whether user A has the calling authority for this smart contract 2, and continue to implement the subsequent steps if it has the calling authority, otherwise it can return Failure information.
  • the characteristics of distributed data storage based on the blockchain network make the data published to the blockchain network need to be recorded on all blockchain nodes, so that the data cannot be tampered with and traceable.
  • some data may have certain privacy. If it is published to the blockchain network, privacy may not be guaranteed, and if it is not published to the blockchain network, there may be a problem of unreliable data content, and it is not conducive to each block
  • the chain node reads and calls the data structure of related data quickly. Therefore, in this specification, by recording the above-mentioned data with privacy requirements and its metadata in a smart contract (such as smart contract 2), and through the management of the calling authority, the unauthorized user is restricted from the relevant data and its metadata. Random access, so that these data and its metadata can be published to the blockchain network to enjoy the reliability and convenience brought by the blockchain network, and can ensure that the data and its metadata have sufficient privacy and security Sex.
  • a smart contract such as smart contract 2
  • Step 405 the blockchain node G parses the metadata and performs language conversion on the metadata.
  • the executed code 1 can also parse the metadata based on the definition description language, and characterize the parsed data structure as a computer programming language to provide Go to user A to view.
  • user A may add an input parameter for smart contract 1 in the above transaction, for example, the input parameter may include a type of computer programming language, that is, user A may specify a certain type of computer programming language accordingly, so that After the code 1 contained in the smart contract 1 is executed, the parsed data structure can be characterized using this type of computer programming language, so that user A can view or edit it.
  • the input parameter may include a type of computer programming language, that is, user A may specify a certain type of computer programming language accordingly, so that After the code 1 contained in the smart contract 1 is executed, the parsed data structure can be characterized using this type of computer programming language, so that user A can view or edit it.
  • the data structure in this specification may include: the data fields involved in the data, the hierarchical relationship between each data field, the value relationship between each data field, etc., which can be used to describe the smart contract 2
  • the information of the contained data can be provided to user A as the data structure here.
  • the input parameter added by user A in the above transaction may include the type of data structure, such as several types of data structures that user A concerns, so that after code 1 contained in smart contract 1 is executed, it can be filtered out
  • types of data structures are provided to user A, while other types of data structures may not be provided to user A, making the data structure viewed by user A more targeted and more in line with the actual needs of user A, and eliminating the need for The process of parsing and characterizing other types of data structures helps to improve the efficiency of reading data structures.
  • step 406 the blockchain node G returns the processing result to the user A.
  • User A can update the data structure of the data contained in the smart contract 2. For example, after reading the pre-update data structure of the data contained in the smart contract 2 through the embodiment shown in FIG. 4, user A may modify the pre-update data structure to obtain the updated data structure, and based on the update The post-data structure updates the metadata contained in the smart contract 2, and then updates the data structure of the corresponding data according to the updated metadata.
  • the user A can also obtain the pre-update data structure of the data contained in the smart contract 2 through other methods, which is not limited in this specification.
  • FIG. 5 is a schematic diagram of an updated data structure provided by an exemplary embodiment.
  • the process of updating the data structure may include the following steps:
  • Step 501 create a transaction.
  • the user A can create a transaction for updating the data structure-equivalent to a structure update request, and issue it to the blockchain network This transaction. It is assumed that 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.
  • user A may change the pre-update data structure used by the data contained in smart contract 2 to obtain an updated data structure; wherein, the post-update data structure uses the user A well-known computer programming language is characterized, and the above-mentioned smart contract 1 can convert the updated data structure represented by the computer programming language and the definition description language adopted by the metadata to obtain updated metadata, and according to this The data structure of the data contained in the smart contract 2 is updated.
  • the above transaction may include the contract address and port information of smart contract 1, so that the blockchain node G can determine that the transaction needs to call the smart contract 1 based on the contract address, and based on the port information.
  • the code 1 contained in the smart contract 1 is called.
  • the smart contract 1 in this embodiment may refer to the related description in the embodiment shown in FIG. 4 and will not be repeated here.
  • step 502 the blockchain node G verifies the user A's permission to call the smart contract 1.
  • step 502 reference may be made to step 402 shown in FIG. 4, which will not be repeated here.
  • step 503 the blockchain node G invokes smart contract 1, performs language conversion on the updated data structure, and generates updated metadata.
  • the input parameters added by user A in the above transaction may include an updated data structure, so that when the code 1 contained in the smart contract 1 is executed, the updated data structure characterized based on the computer programming language can be performed After conversion, get the updated metadata characterized by the definition description language.
  • the data structure in this specification may include: the data fields involved in the data, the hierarchical relationship between each data field, the value relationship between each data field, etc., which can be used to describe the smart contract 2
  • the information of the contained data can be provided to user A as the data structure here.
  • the update of the data structure by user A may involve any of the above data structures, such as adding, deleting, or modifying data fields, and then adding, deleting, or modifying the hierarchical relationship between data fields. Another example is to add, delete, or modify value relationships between data fields.
  • the data structure before the update of the data contained in smart contract 2 can be characterized as shown in Table 1 below, including the personal information (such as account ID, age, address, etc.) of the user to which each account belongs, and each account for each type of blockchain Asset holdings.
  • the updated data structure may also be checked to determine whether the update implemented by user A is reasonable.
  • the management of data fields in smart contract 2 is implemented by means of "identification”; for example, the use of the identifier "01” indicates the above-mentioned field “account ID”, and the use of the identification "02” means the above-mentioned field "age” 3.
  • the identifier "03" is used to indicate the above-mentioned field "telephone”.
  • Smart Contract 2 can also adopt other methods, which are not limited in this specification.
  • Smart Contract 2 can also use the "offset” method, such as the "account ID” field as the starting field, the offset corresponding to the "account ID” is 0, the “age” field is the right of the “account ID” field
  • the first field on the side, the offset of the "age” field relative to the “account ID” is 1, similarly, the offset of the "telephone” field relative to the “account ID” is 2, etc.
  • the data fields and their positional relationship are managed, and the rationality of the updated data structure is determined accordingly, which will not be repeated here.
  • step 504 the blockchain node G calls the smart contract 2 to update the pre-update metadata contained in the smart contract 2.
  • the user A may add an input parameter for the smart contract 1 in the above transaction, for example, the input parameter may include the contract address and port information of the smart contract 2, so that the code 1 contained in the smart contract 1 is executed , You can call Smart Contract 2 accordingly.
  • the input parameter may include the contract address and port information of the smart contract 2, so that the code 1 contained in the smart contract 1 is executed , You can call Smart Contract 2 accordingly.
  • the smart contract 2 may be set with a calling authority, similar to the form of a white list or black list, to avoid the smart contract 2 being called at will, to prevent the metadata contained in it from being read or changed at will, and to prevent generation Security risks.
  • a calling authority may be a predetermined part of the user; for example, when the blockchain network belongs to an alliance chain, the user with calling authority may be a member of the alliance. Therefore, when smart contract 1 is called by user A to initiate a call to smart contract 2, it can be determined whether user A has the calling authority for this smart contract 2, and continue to implement the subsequent steps if it has the calling authority, otherwise it can return Failure information.
  • the characteristics of distributed data storage based on the blockchain network make the data published to the blockchain network need to be recorded on all blockchain nodes, so that the data cannot be tampered with and traceable.
  • some data may have certain privacy. If it is published to the blockchain network, privacy may not be guaranteed, and if it is not published to the blockchain network, there may be a problem of unreliable data content, and it is not conducive to each block
  • the chain node reads and calls the data structure of related data quickly. Therefore, in this specification, by recording the above-mentioned data with privacy requirements and its metadata in a smart contract (such as smart contract 2), and through the management of the calling authority, the unauthorized user is restricted from the relevant data and its metadata. Random access, so that these data and its metadata can be published to the blockchain network to enjoy the reliability and convenience brought by the blockchain network, and can ensure that the data and its metadata have sufficient privacy and security Sex.
  • a smart contract such as smart contract 2
  • the generated updated metadata can be used as an input parameter when calling the smart contract 2, so that when the code 2 contained in the smart contract 2 is executed, the smart The metadata before the update originally included in the contract 2 is replaced with the metadata after the update, thereby updating the metadata included in the smart contract 2.
  • step 505 the blockchain node G returns the processing result to the user A.
  • the updated metadata included in the smart contract 2 adopts the updated data structure of the user A
  • the code 2 included in the smart contract 2 is executed, the updated metadata can be parsed, and Based on the analysis result, the data contained in the smart contract 2 is updated, thereby finally realizing the update operation of the data structure of the data contained in the smart contract 2.
  • the updated metadata can be parsed by executing the code 2 included in the smart contract 2, and all data included in the smart contract 2 can be updated based on the analysis result .
  • the updated data can be as shown in Table 3. Show.
  • the data structure of all data included in the smart contract 2 may not be updated, and the data structure of these data is updated only when related data is involved. For example, after the metadata contained in smart contract 2 is updated, the data contained in smart contract 2 may still temporarily adopt the data structure shown in Table 1.
  • FIG. 6 is a schematic structural diagram of a device provided by an exemplary embodiment. Please refer to FIG. 6.
  • the device includes a processor 602, an internal bus 604, a network interface 606, a memory 608, and a non-volatile memory 610. Of course, it may include hardware required for other services.
  • the processor 602 reads the corresponding computer program from the non-volatile memory 610 into the memory 608 and then runs it, forming a reading device of a data structure on 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 structure reading device may include:
  • the obtaining unit 71 enables the blockchain node in the blockchain network to obtain a call request for the first smart contract
  • the response unit 72 in response to the call request, causes the blockchain node to run the contract code contained in the first smart contract to parse the data structure described by the metadata contained in the second smart contract, and passes The computer programming language characterizes the data structure;
  • the return unit 73 causes the blockchain node to return the data structure represented by the computer programming language to the initiator of the call request.
  • the metadata is used to describe the data contained in the second smart contract.
  • the computer programming language includes: a language of a preset type or a language of the type indicated in the call request.
  • the first smart contract is a system contract provided by the system function of the blockchain network.
  • FIG. 8 is a schematic structural diagram of a device provided by an exemplary embodiment. Please refer to FIG. 8.
  • the device includes a processor 802, an internal bus 804, a network interface 806, a memory 808, and a non-volatile memory 810. Of course, it may include hardware required for other services.
  • the processor 802 reads the corresponding computer program from the non-volatile memory 810 into the memory 808 and then runs it to form a data structure update 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 structure updating device may include:
  • the request obtaining unit 91 enables the blockchain node in the blockchain network to obtain a call request for the first smart contract
  • the structure obtaining unit 92 enables the blockchain node to obtain the updated data structure based on the computer programming language
  • a request response unit 93 in response to the call request, causes the blockchain node to run a first contract code included in the first smart contract, the first contract code is used to parse the updated data structure , And characterized as updated metadata based on the definition description language, to update the pre-update metadata included in the second smart contract.
  • the metadata included in the second smart contract is used to describe the data included in the second smart contract.
  • the second smart contract includes a second contract code
  • the second contract code is used to parse the updated metadata to update the data structure of the data included in the second smart contract .
  • the first smart contract is a system contract provided by the system function of the blockchain network.
  • the first contract code is also used to: compare the pre-update data structure corresponding to the pre-update metadata with the post-update data structure to verify the rationality of the post-update data structure; Wherein, when the rationality of the updated data structure passes the verification, the updated metadata is used to update the pre-update metadata.
  • 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”.

Abstract

一种数据结构的读取及更新方法、装置、电子设备,该数据结构的读取方法可以包括:区块链网络中的区块链节点获取针对第一智能合约的调用请求(102);响应于所述调用请求,所述区块链节点运行所述第一智能合约包含的合约代码,以对第二智能合约包含的元数据所描述的数据结构进行解析,并通过计算机编程语言对所述数据结构进行表征(104);所述区块链节点将所述计算机编程语言表征的数据结构返回至所述调用请求的发起方(106)。

Description

数据结构的读取及更新方法、装置、电子设备 技术领域
本说明书一个或多个实施例涉及区块链技术领域,尤其涉及一种数据结构的读取及更新方法、装置、电子设备。
背景技术
区块链技术(也被称之为,分布式账本技术)是一种去中性化的分布式数据库技术,具有去中心化、公开透明、不可篡改、可信任等多种特点,适用于诸多对数据可靠性具有高需求的应用场景中。
发明内容
有鉴于此,本说明书一个或多个实施例提供一种数据结构的读取及更新方法、装置、电子设备。
为实现上述目的,本说明书一个或多个实施例提供技术方案如下:
根据本说明书一个或多个实施例的第一方面,提出了一种数据结构的读取方法,包括:
区块链网络中的区块链节点获取针对第一智能合约的调用请求;
响应于所述调用请求,所述区块链节点运行所述第一智能合约包含的合约代码,以对第二智能合约包含的元数据所描述的数据结构进行解析,并通过计算机编程语言对所述数据结构进行表征;
所述区块链节点将所述计算机编程语言表征的数据结构返回至所述调用请求的发起方。
根据本说明书一个或多个实施例的第二方面,提出了一种数据结构的更新方法,包括:
区块链网络中的区块链节点获取针对第一智能合约的调用请求;
所述区块链节点获取基于计算机编程语言的更新后数据结构;
响应于所述调用请求,所述区块链节点运行所述第一智能合约包含的第一合约代码, 所述第一合约代码用于对所述更新后数据结构进行解析,并表征为基于定义描述语言的更新后元数据,以对第二智能合约包含的更新前元数据进行更新。
根据本说明书一个或多个实施例的第三方面,提出了一种数据结构的读取装置,包括:
获取单元,使区块链网络中的区块链节点获取针对第一智能合约的调用请求;
响应单元,响应于所述调用请求,使所述区块链节点运行所述第一智能合约包含的合约代码,以对第二智能合约包含的元数据所描述的数据结构进行解析,并通过计算机编程语言对所述数据结构进行表征;
返回单元,使所述区块链节点将所述计算机编程语言表征的数据结构返回至所述调用请求的发起方。
根据本说明书一个或多个实施例的第四方面,提出了一种数据结构的更新装置,包括:
请求获取单元,使区块链网络中的区块链节点获取针对第一智能合约的调用请求;
结构获取单元,使所述区块链节点获取基于计算机编程语言的更新后数据结构;
请求响应单元,响应于所述调用请求,使所述区块链节点运行所述第一智能合约包含的第一合约代码,所述第一合约代码用于对所述更新后数据结构进行解析,并表征为基于定义描述语言的更新后元数据,以对第二智能合约包含的更新前元数据进行更新。
根据本说明书一个或多个实施例的第五方面,提出了一种电子设备,包括:
处理器;
用于存储处理器可执行指令的存储器;
其中,所述处理器被配置为实现如上述实施例中任一所述的数据结构的读取方法。
根据本说明书一个或多个实施例的第六方面,提出了一种电子设备,包括:
处理器;
用于存储处理器可执行指令的存储器;
其中,所述处理器被配置为实现如上述实施例中任一所述的数据结构的更新方法。
附图说明
图1是一示例性实施例提供的一种数据结构的读取方法的流程图。
图2是一示例性实施例提供的一种数据结构的更新方法的流程图。
图3是一示例性实施例提供的一种智能合约的结构示意图。
图4是一示例性实施例提供的一种读取数据结构的示意图。
图5是一示例性实施例提供的一种更新数据结构的示意图。
图6是一示例性实施例提供的一种设备的结构示意图。
图7是一示例性实施例提供的一种数据结构的读取装置的框图。
图8是一示例性实施例提供的另一种设备的结构示意图。
图9是一示例性实施例提供的一种数据结构的更新装置的框图。
具体实施方式
这里将详细地对示例性实施例进行说明,其示例表示在附图中。下面的描述涉及附图时,除非另有表示,不同附图中的相同数字表示相同或相似的要素。以下示例性实施例中所描述的实施方式并不代表与本说明书一个或多个实施例相一致的所有实施方式。相反,它们仅是与如所附权利要求书中所详述的、本说明书一个或多个实施例的一些方面相一致的装置和方法的例子。
需要说明的是:在其他实施例中并不一定按照本说明书示出和描述的顺序来执行相应方法的步骤。在一些其他实施例中,其方法所包括的步骤可以比本说明书所描述的更多或更少。此外,本说明书中所描述的单个步骤,在其他实施例中可能被分解为多个步骤进行描述;而本说明书中所描述的多个步骤,在其他实施例中也可能被合并为单个步骤进行描述。
图1是一示例性实施例提供的一种数据结构的读取方法的流程图。如图1所示,该方法可以包括以下步骤:
步骤102,区块链网络中的区块链节点获取针对第一智能合约的调用请求。
在一实施例中,调用请求可以承载于区块链网络中创建的一笔交易,并通过在该交易中指明所需调用的该第一智能合约的合约地址、端口信息等,使得该调用请求被确认 为“针对”上述的第一智能合约,从而执行该第一智能合约包含的合约代码。
在一实施例中,本说明书中所描述的交易(transfer),是指通过区块链节点对应的客户端创建,并需要最终发布至区块链网络的分布式数据库中的一笔数据。其中,区块链网络中的交易,存在狭义的交易以及广义的交易之分。狭义的交易是指向区块链网络发布的一笔价值转移;例如,在传统的比特币区块链网络中,交易可以是在区块链网络中发起的一笔转账。而广义的交易是指向区块链网络发布的一笔具有业务意图的业务数据;例如,运营方可以基于实际的业务需求搭建一个联盟链,依托于联盟链部署一些与价值转移无关的其它类型的在线业务(比如,租房业务、车辆调度业务、保险理赔业务、信用服务、医疗服务等),而在这类联盟链中,交易可以是在联盟链中发布的一笔具有业务意图的业务消息或者业务请求。
在一实施例中,所述调用请求的发起方可以包括:所述区块链网络中的某一角色。例如,该角色可以包括区块链网络的开发人员或普通用户,该角色能够基于对该第一智能合约的调用,对第二智能合约包含的数据的数据结构进行快速读取。
在一实施例中,第一智能合约可以经过区块链网络中的各个区块链节点之间共识,并记录于区块链网络中,可供区块链节点进行调用。
在一实施例中,所述第一智能合约可以为所述区块链网络的系统功能提供的系统合约。譬如,该第一智能合约可以被写入区块链网络的源代码中,使得该第一智能合约可以作为预设“工具”,供区块链节点对该第一智能合约进行调用,譬如用于对第二智能合约包含的数据的数据结构进行读取,但普通用户或一般开发人员无法对该第一智能合约进行修改,以确保其可靠性。
步骤104,响应于所述调用请求,所述区块链节点运行所述第一智能合约包含的合约代码,以对第二智能合约包含的元数据所描述的数据结构进行解析,并通过计算机编程语言对所述数据结构进行表征。
在一实施例中,开发人员等角色可以读取和编辑基于计算机编程语言的数据结构,而元数据采用定义描述语言进行表征、无法被直接读取和编辑。因此,第一智能合约包含的合约代码可以用于实现在计算机编程语言与定义描述语言之间的转换功能模块,可以对定义描述语言表征的元数据进行解析,并进一步转换为采用计算机编程语言进行表征,以使得上述角色能够便捷地读取第二智能合约包含的数据的数据结构。
在一实施例中,第一智能合约可以包括code结构,该code结构中包含上述的合约 代码。第二智能合约可以包括storage结构,该storage结构用于记录数据集合和元数据。第一智能合约也可以包括storage结构或其他结构,以用于记录相应数据或其他内容,本说明书并不对此进行限制。第二智能合约也可以包括code结构,该code结构用于记录合约代码,比如该合约代码被执行后可以对第二智能合约包含的元数据进行解析,以针对第二智能合约包含的数据进行读写操作、更新操作等,本说明书并不对此进行限制。
在一实施例中,数据结构可以包括:包含的数据字段、各个数据字段之间的层级关系、各个数据字段之间的取值关系等,本说明书并不对此进行限制。
步骤106,所述区块链节点将所述计算机编程语言表征的数据结构返回至所述调用请求的发起方。
在一实施例中,所述计算机编程语言可以包括:预设类型的语言。例如,可以预先设定为均采用Solidity语言、JavaScript语言、Python语言甚至混合语言等,本说明书并不对此进行限制。采用跨合约的调用,还可以实现不同语言编写的合约之间的调用;而且,在合约升级时,可以采用相同或者不同语言重新编写已有合约,而不影响其它合约。采用跨合约的调用,还可以实现不同语言编写的合约访问相同的数据。
在一实施例中,所述计算机编程语言可以包括:所述调用请求中指示类型的语言。换言之,调用请求的发起方可以指定希望采用的计算机编程语言的类型,这种指定可以针对任意类型,也可以在预先配置的多种类型中进行选择,本说明书并不对此进行限制。
图2是一示例性实施例提供的一种数据结构的更新方法的流程图。如图2所示,该方法可以包括以下步骤:
步骤202A,区块链网络中的区块链节点获取针对第一智能合约的调用请求。
在一实施例中,调用请求可以承载于区块链网络中创建的一笔交易,并通过在该交易中指明所需调用的该第一智能合约的合约地址、端口信息等,使得该调用请求被确认为“针对”上述的第一智能合约,从而执行该第一智能合约包含的第一合约代码。
在一实施例中,本说明书中所描述的交易(transfer),是指通过区块链节点对应的客户端创建,并需要最终发布至区块链网络的分布式数据库中的一笔数据。其中,区块链网络中的交易,存在狭义的交易以及广义的交易之分。狭义的交易是指向区块链网络发布的一笔价值转移;例如,在传统的比特币区块链网络中,交易可以是在区块链网络中发起的一笔转账。而广义的交易是指向区块链网络发布的一笔具有业务意图的业务数据;例如,运营方可以基于实际的业务需求搭建一个联盟链,依托于联盟链部署一些与 价值转移无关的其它类型的在线业务(比如,租房业务、车辆调度业务、保险理赔业务、信用服务、医疗服务等),而在这类联盟链中,交易可以是在联盟链中发布的一笔具有业务意图的业务消息或者业务请求。
在一实施例中,所述调用请求的发起方可以包括:所述区块链网络中的某一角色。例如,该角色可以包括区块链网络的开发人员、维护人员、普通用户或者授权用户,该角色能够基于对该第一智能合约的调用,从而便捷地实现对第二智能合约包含的数据的数据结构的更新,或者便捷的实现对第二智能合约包含的数据进行访问或者更新。
在一实施例中,第一智能合约可以经过区块链网络中的各个区块链节点之间共识,并记录于区块链网络中,可供区块链节点进行调用。
在一实施例中,所述第一智能合约可以为所述区块链网络的系统功能提供的系统合约。譬如,该第一智能合约可以被写入区块链网络的源代码中,使得该第一智能合约可以作为预设“工具”,供区块链节点对该第一智能合约进行调用,譬如用于对第二智能合约包含的元数据进行更新、以进一步修改第二智能合约包含的数据的数据结构,但普通用户或一般开发人员无法对该第一智能合约进行修改,以确保其可靠性。
步骤202B,所述区块链节点获取基于计算机编程语言的更新后数据结构。
在一实施例中,开发人员可以通过诸如图1所示的实施读取第二智能合约包含的数据的数据结构,并基于计算机编程语言对该数据结构实施更新,从而得到更新后数据结构。
在一实施例中,所述计算机编程语言可以包括:预设类型的语言。例如,可以预先设定为均采用Solidity语言、JavaScript语言、Python语言等,本说明书并不对此进行限制。
在一实施例中,数据结构可以包括:包含的数据字段、各个数据字段之间的层级关系、各个数据字段之间的取值关系等,本说明书并不对此进行限制。
在一实施例中,步骤202A与步骤202B之间并不存在必然的先后顺序,只要发生于步骤204之前即可,本说明书并不对此进行限制。
步骤204,响应于所述调用请求,所述区块链节点运行所述第一智能合约包含的第一合约代码,所述第一合约代码用于对所述更新后数据结构进行解析,并表征为基于定义描述语言的更新后元数据,以对第二智能合约包含的更新前元数据进行更新。
在一实施例中,开发人员等角色可以读取和编辑基于计算机编程语言的数据结构,而元数据采用定义描述语言进行表征、无法被直接读取和编辑。因此,第一智能合约包含的第一合约代码可以用于实现在计算机编程语言与定义描述语言之间的转换功能模块,可以对定义描述语言表征的元数据进行解析,并进一步转换为采用计算机编程语言进行表征,以使得上述角色能够通过计算机编程语言对数据的数据结构进行更新,并通过第一智能合约将更新后数据结构便捷地更新为第二智能合约包含的元数据,以通过更新后的元数据对第二智能合约包含的数据的数据结构进行更新。那么,尤其是在开发阶段或维护阶段,使得开发人员等角色能够快捷地读取、修改第二智能合约包含的数据的数据结构。
在一实施例中,第一智能合约可以包括code结构,该code结构中包含上述的第一合约代码;第一智能合约也可以包括storage结构或其他结构,以用于记录相应数据或其他内容,本说明书并不对此进行限制。第二智能合约可以包括code结构,该code结构中包含上述的第二合约代码,第二智能合约还可以包括storage结构,该storage结构用于记录数据集合和元数据。其中,若第二智能合约包含的更新前元数据被更新为更新后元数据,上述的第二合约代码可以被执行,以用于对该第二智能合约包含的更新后元数据进行解析,从而确定更新后数据结构,并据此对该第二智能合约包含的数据的数据结构进行更新。
在一实施例中,所述第一合约代码还用于:将所述更新前元数据对应的更新前数据结构与所述更新后数据结构进行比较,以校验所述更新后数据结构的合理性;其中,在所述更新后数据结构的合理性通过校验的情况下,所述更新后元数据被用于对所述更新前元数据进行更新。例如,假定第二智能合约中的数据包含账户ID、年龄、电话号码等字段,并且在记录时采用“01”代表“账户ID”、采用“02”代表“年龄”、采用“03”代表“电话号码”等,那么在更新后数据结构中如果将“02”修改为代表“电话号码”,而“03”仍然代表“电话号码”,就会导致“电话号码”字段出现混乱,造成更新后数据结构不合理,应当避免直接对更新前元数据进行更新,而应当对第一智能合约的调用方(如开发人员)发出告警,提示其作出修改。
图3是一示例性实施例提供的一种智能合约的结构示意图。如图3所示,本说明书中涉及智能合约1和智能合约2。智能合约1可以包括结构301,比如该结构301可以称为code结构,用于记录该智能合约1的合约代码(简称为代码1);智能合约1还可以包括其他的结构302,比如相关技术中的storage结构、balance结构、nonce结构等, 本说明书并不对此进行限制。智能合约2可以包括结构303,比如该结构303可以称为code结构,用于记录该智能合约2的合约代码(简称为代码2);智能合约2可以包括结构304,比如该结构304可以称为storage结构,用于记录该智能合约2中的合约数据(简称为数据)、该合约数据对应的元数据,该元数据用于描述相应的合约数据;智能合约2还可以包括其他的结构305,比如相关技术中的balance结构、nonce结构等,本说明书并不对此进行限制。
其中,智能合约1可以向外部提供针对结构301中的代码1的API接口,以实现针对该代码1的调用。以及,智能合约2可以向外部提供针对结构303中的代码2的API接口,以实现针对该代码2的调用。而在本说明书的实施例中,工作人员可以通过智能合约1提供的API接口,对该智能合约1包含的代码1进行调用,而该代码1被执行后可以通过智能合约2提供的API接口而对该代码2进行调用,以针对该智能合约2包含的元数据进行解析或更新,从而读取或更新智能合约2包含的数据采用的数据结构。
在本说明书的技术方案中,假定由用户A对智能合约2进行开发或维护(譬如用户A为开发人员),由于智能合约2中的元数据采用定义描述语言进行描述,而工作人员擅长于通过计算机编程语言进行开发或维护,而上述的智能合约1可以在定义描述语言与计算机编程语言之间实现切换,从而有助于工作人员通过调用该智能合约1而便捷地开发或维护智能合约2包含的元数据,以进一步读取或更新智能合约2包含的数据的数据结构。
图4是一示例性实施例提供的一种读取数据结构的示意图。如图4所示,读取数据结构的过程可以包括以下步骤:
步骤401,创建交易。
在一实施例中,假定用户A需要读取上述的智能合约2包含的数据的数据结构,以针对该数据结构进行更改。因此,该用户A可以创建用于读取数据结构的交易——相当于结构读取请求,并向区块链网络发布这条交易。假定由区块链节点G对用户A发布的上述交易进行响应,该区块链节点G通常为距离用户A最近的区块链节点,当然本说明书并不对此进行限制。
在一实施例中,基于如图3所示的实施例,智能合约2包含的元数据记录了相关数据的数据结构,而上述的智能合约1可以对元数据采用的定义描述语言与用户A熟知的计算机编程语言进行相互转换,因而用户A可以通过上述交易对智能合约1进行调用, 以使得该智能合约1可以对智能合约2包含的元数据进行处理,从而获知智能合约2包含的数据的数据结构。
在一实施例中,区块链网络中可以存在很多的智能合约,以分别用于实现相应的事件或目的。因此,上述交易中可以包含智能合约1的合约地址、端口信息等,以使得区块链节点G可以基于该合约地址确定该交易需要调用该智能合约1,并基于端口信息对该智能合约1包含的代码1进行调用。
在一实施例中,智能合约1被创建并发布至区块链网络后,在该区块链网络中的各个区块链节点之间达成共识,并记录于各个区块链节点上,比如上述的区块链节点G上同样记录有该智能合约1。类似地,智能合约2被创建并发布至区块链网络后,也可以基于共识而被建立于区块链节点G中。
在一实施例中,智能合约1可以被配置为区块链网络所提供的基础功能,比如该智能合约1可以被写入区块链网络的源代码中,而并非基于各个区块链节点的共识而产生,使得该智能合约1更加安全、可靠。
步骤402,区块链节点G验证用户A对智能合约1的调用权限。
在一实施例中,智能合约1可以设定有调用权限,类似于白名单或黑名单的形式,以避免智能合约1被随意用于对其他智能合约的元数据进行读取或更改,防止造成安全性风险。例如,当区块链网络属于公有链时,具有调用权限的用户可以为预先约定的部分用户;又例如,当区块链网络属于联盟链时,具有调用权限的用户可以为联盟成员。因此,当区块链节点G获取用户A发布的交易,并确定该交易需要对智能合约1进行调用时,可以首先确定该用户A是否具有相应的调用权限,并在具有调用权限时继续实施后续步骤,否则可以返回失败信息。
步骤403,区块链节点G调用智能合约1,执行智能合约1包含的代码1。
在一实施例中,用户A可以在上述交易中添加针对智能合约1的入参,比如该入参可以包括智能合约2的合约地址、端口信息等,以使得智能合约1包含的代码1被执行时,可以据此对智能合约2实现调用。
在一实施例中,用户A在上述交易中添加的入参还可以包括操作类型,比如该操作类型可以包括“读取元数据”,使得智能合约1包含的代码1被执行时,可以基于对智能合约2的调用,读取该智能合约2包含的元数据、对基于定义描述语言的该元数据进行解析,并将解析出的数据结构表征为计算机编程语言,以提供至用户A进行查看。
步骤404,区块链节点G调用智能合约2,执行代码2,读取元数据。
在一实施例中,基于被执行的上述代码1,区块链节点G可以对智能合约2进行调用。例如,可以通过调用并执行该智能合约2包含的上述代码2,读取该智能合约2包含的元数据,并将该元数据返回至智能合约1。
在一实施例中,智能合约2可以设定有调用权限,类似于白名单或黑名单的形式,以避免智能合约2被随意调用,防止其包含的元数据或数据被随意读取或更改,防止产生安全性风险。例如,当区块链网络属于公有链时,具有调用权限的用户可以为预先约定的部分用户;又例如,当区块链网络属于联盟链时,具有调用权限的用户可以为联盟成员。因此,当智能合约1被用户A所调用,以针对智能合约2发起调用时,可以确定该用户A是否针对该智能合约2具有调用权限,并在具有调用权限时继续实施后续步骤,否则可以返回失败信息。
需要说明的是:基于区块链网络的分布式数据存储的特点,使得发布至区块链网络的数据需要被记录于所有区块链节点上,使得这些数据不可篡改、可溯源。但是,一些数据可能具有一定私密性,如果发布至区块链网络则可能造成私密性无法保障,而如果不发布至区块链网络则可能存在数据内容不可靠的问题,并且不利于各个区块链节点对于相关数据的数据结构进行快捷读取和调用等。因此,本说明书中通过将上述具有私密性需求的数据及其元数据记录于智能合约(如智能合约2)中,并通过对调用权限的管理而限制无权限用户对相关数据及其元数据的随意访问,使得这些数据及其元数据既能够公布至区块链网络、以享有区块链网络所带来的可靠性与便利性,又能够确保数据及其元数据具有足够的私密性和安全性。
步骤405,区块链节点G解析元数据,对元数据进行语言转换。
在一实施例中,针对智能合约2返回的元数据,被执行的上述代码1还可以对基于定义描述语言的该元数据进行解析,并将解析出的数据结构表征为计算机编程语言,以提供至用户A进行查看。
在一实施例中,用户A可以在上述交易中添加针对智能合约1的入参,比如该入参可以包括计算机编程语言的类型,即用户A可以据此指定某一类型的计算机编程语言,使得智能合约1包含的代码1被执行后,可以将解析出的数据结构采用该类型的计算机编程语言进行表征,以便用户A进行查看或编辑。
在一实施例中,本说明书中的数据结构可以包括:数据所涉及的数据字段、各个数 据字段之间的层级关系、各个数据字段之间的取值关系等,凡是能够用于描述智能合约2所包含的数据的信息,均可以作为此处的数据结构而提供至用户A。
在一实施例中,用户A在上述交易中添加的入参可以包括数据结构的类型,比如该用户A关注的若干类型的数据结构,使得智能合约1包含的代码1被执行后,可以筛选出这些类型的数据结构并提供至用户A,而其他类型的数据结构可以不提供至用户A,使得用户A查看到的数据结构更加具有针对性、更加符合用户A的实际需求,而且免去了对其他类型的数据结构进行解析和表征的过程,有助于提升对数据结构的读取效率。
步骤406,区块链节点G向用户A返回处理结果。
用户A可以对智能合约2包含的数据实施数据结构的更新。例如,在通过如图4所示的实施例读取该智能合约2包含的数据的更新前数据结构后,用户A可以针对该更新前数据结构进行修改,得到更新后数据结构,并基于该更新后数据结构对智能合约2包含的元数据进行更新,然后根据更新后元数据对相应数据的数据结构进行更新。当然,用户A还可以通过其他方式获得智能合约2包含的数据的更新前数据结构,本说明书并不对此进行限制。
相应地,图5是一示例性实施例提供的一种更新数据结构的示意图。如图5所示,更新数据结构的过程可以包括以下步骤:
步骤501,创建交易。
在一实施例中,假定用户A需要更新上述的智能合约2包含的数据的数据结构,该用户A可以创建用于更新数据结构的交易——相当于结构更新请求,并向区块链网络发布这条交易。假定由区块链节点G对用户A发布的上述交易进行响应,该区块链节点G通常为距离用户A最近的区块链节点,当然本说明书并不对此进行限制。
在一实施例中,基于如图3所示的实施例,用户A可以对智能合约2包含的数据采用的更新前数据结构进行更改,得到更新后数据结构;其中,该更新后数据结构采用用户A熟知的计算机编程语言进行表征,而上述的智能合约1可以对该计算机编程语言表征的更新后数据结构与元数据采用的定义描述语言进行相互转换,从而得到更新后元数据,并据此对智能合约2包含的数据的数据结构进行更新。
在一实施例中,上述交易中可以包含智能合约1的合约地址、端口信息等,以使得区块链节点G可以基于该合约地址确定该交易需要调用该智能合约1,并基于端口信息对该智能合约1包含的代码1进行调用。
在一实施例中,本实施例中的智能合约1可以参考图4所示实施例中的相关描述,此处不再赘述。
步骤502,区块链节点G验证用户A对智能合约1的调用权限。
在一实施例中,步骤502可以参考图4所示的步骤402,此处不再赘述。
步骤503,区块链节点G调用智能合约1,对更新后数据结构进行语言转换,并生成为更新后元数据。
在一实施例中,用户A在上述交易中添加的入参可以包括更新后数据结构,使得智能合约1包含的代码1被执行时,可以对基于计算机编程语言进行表征的该更新后数据结构进行转换,得到基于定义描述语言进行表征的更新后元数据。
在一实施例中,本说明书中的数据结构可以包括:数据所涉及的数据字段、各个数据字段之间的层级关系、各个数据字段之间的取值关系等,凡是能够用于描述智能合约2所包含的数据的信息,均可以作为此处的数据结构而提供至用户A。
在一实施例中,用户A对于数据结构的更新可以涉及上述任意方面的数据结构,比如对数据字段进行添加、删除或修改,再比如对数据字段之间的层级关系进行增加、删除或修改,又比如对数据字段之间的取值关系进行增加、删除或修改等。
下面以针对数据字段的增加、删除或修改为例,对更新前后的数据结构进行详细说明:
假定智能合约2包含的数据的更新前数据结构可以表征为如下表1所示,包括各个账户所属用户的个人信息(如账户ID、年龄、地址等),以及各个账户对于各个类型的区块链资产的持有情况。
Figure PCTCN2019114435-appb-000001
表1
在一种情况下,假定用户A对于数据结构的更新方式为:添加数据字段。譬如,在上述表1的基础上添加新的数据字段“Balance-Type X(余额-类型X)”,相应的更新 后数据结构如下表2所示。
Figure PCTCN2019114435-appb-000002
表2
在另一种情况下,假定用户A对于数据结构的更新方式为:删除数据字段。譬如,在上述表2的基础上删除了原有的数据字段“Balance-Type X(余额-类型X)”,相应的更新后数据结构如下表1所示。
在又一种情况下,假定用户A对于数据结构的更新方式为:修改数据字段。譬如,在上述表1的基础上将原有的数据字段“Total-RMB(总额-人民币)”更改为“Total-Dollar(总额-美元)”,即原本采用人民币对各个账户持有的区块链资产总额进行统计,更改为采用美元对各个账户持有的区块链资产总额进行统计,相应的更新后数据结构如下表3所示。
Figure PCTCN2019114435-appb-000003
表3
在一实施例中,智能合约1包含的代码1被执行时,还可以针对更新后数据结构进行校验,以确定用户A实施的更新是否合理。例如,假定智能合约2中对于数据字段的管理,采用“标识”的方式来实现;譬如,采用标识“01”表示上述的字段“账户ID”、采用标识“02”表示上述的字段“年龄”、采用标识“03”表示上述的字段“电话”等。那么,如果在更新后数据结构中在表1的基础上添加了表2所示的“Balance-Type X(余额-类型X)”字段,并且采用标识“02”表示该“Balance-Type X(余额-类型X)”字段,那么标识“02”同时对应于两个不同字段,表明用户A实施的更新不合理,可以向用户A返回提示信息,并暂停或终止对数据结构的更新操作。
当然,除了基于“标识”的管理方式之外,智能合约2还可以采用其他方式,本说明书并不对此进行限制。譬如,智能合约2还可以采用“偏移量”方式,比如“账户ID”字段作为起始字段,该“账户ID”对应的偏移量为0,“年龄”字段为“账户ID”字段右侧的第一个字段,该“年龄”字段相对于“账户ID”的偏移量为1,类似地,“电话”字段相对于“账户ID”的偏移量为2等,以此对各个数据字段及其位置关系进行管理,并据此确定更新后数据结构的合理性,此处不再赘述。
步骤504,区块链节点G调用智能合约2,对智能合约2包含的更新前元数据进行更新。
在一实施例中,用户A可以在上述交易中添加针对智能合约1的入参,比如该入参可以包括智能合约2的合约地址、端口信息等,以使得智能合约1包含的代码1被执行时,可以据此对智能合约2实现调用。
在一实施例中,智能合约2可以设定有调用权限,类似于白名单或黑名单的形式,以避免智能合约2被随意调用,防止其包含的元数据被随意读取或更改,防止产生安全性风险。例如,当区块链网络属于公有链时,具有调用权限的用户可以为预先约定的部分用户;又例如,当区块链网络属于联盟链时,具有调用权限的用户可以为联盟成员。因此,当智能合约1被用户A所调用,以针对智能合约2发起调用时,可以确定该用户A是否针对该智能合约2具有调用权限,并在具有调用权限时继续实施后续步骤,否则可以返回失败信息。
需要说明的是:基于区块链网络的分布式数据存储的特点,使得发布至区块链网络的数据需要被记录于所有区块链节点上,使得这些数据不可篡改、可溯源。但是,一些数据可能具有一定私密性,如果发布至区块链网络则可能造成私密性无法保障,而如果不发布至区块链网络则可能存在数据内容不可靠的问题,并且不利于各个区块链节点对于相关数据的数据结构进行快捷读取和调用等。因此,本说明书中通过将上述具有私密性需求的数据及其元数据记录于智能合约(如智能合约2)中,并通过对调用权限的管理而限制无权限用户对相关数据及其元数据的随意访问,使得这些数据及其元数据既能够公布至区块链网络、以享有区块链网络所带来的可靠性与便利性,又能够确保数据及其元数据具有足够的私密性和安全性。
在一实施例中,智能合约1包含的代码1被执行后,生成的更新后元数据可以被作为调用智能合约2时的入参,使得智能合约2包含的代码2被执行时,可以将智能合约2原本包含的更新前元数据更换为该更新后元数据,从而对智能合约2包含的元数 据进行更新。
步骤505,区块链节点G向用户A返回处理结果。
在一实施例中,由于智能合约2包含的更新后元数据采用了用户A更新后的数据结构,因而当智能合约2包含的代码2被执行时,可以对该更新后元数据进行解析,并基于解析结果对智能合约2包含的数据进行更新,从而最终实现了对智能合约2包含的数据的数据结构的更新操作。
在一实施例中,智能合约2包含的元数据被更新后,可以通过执行智能合约2包含的代码2对该更新后元数据进行解析,并基于解析结果对智能合约2包含的所有数据进行更新。例如,当数据结构的更新方式为将表1所示的“Total-RMB(总额-人民币)”字段更改为“Total-Dollar(总额-美元)”字段时,更新后的数据可以如表3所示。
在一实施例中,智能合约2包含的元数据被更新后,可以不对智能合约2包含的所有数据进行数据结构更新,而仅当涉及到相关数据时,才针对这些数据的数据结构进行更新。例如,智能合约2包含的元数据被更新后,智能合约2包含的数据可以仍然暂时采用表1所示的数据结构。
Figure PCTCN2019114435-appb-000004
表4
而假定智能合约2被调用,以针对账户ID为002的区块链资产总额进行查询,那么智能合约2包含的代码2被执行,以针对智能合约2包含的更新后元数据进行解析,由于更新后数据结构采用“Total-Dollar(总额-美元)”字段,因而如上表4所示,可以为该“账户ID=0002”的用户信息添加“Total-Dollar(总额-美元)”字段,将原本对应于“Total-RMB(总额-人民币)”字段的数据“13000”删除,而更改为“Total-Dollar(总额-美元)”字段下的“1999.1696”,表明用户B所持有的区块链资产的总额相当于1999.1696美元。由于仅涉及到“账户ID=0002”的数据,因而对于该账户而言,相当于将“Total-RMB(总额-人民币)”字段更改为“Total-Dollar(总额-美元)”字段,但其他账户仍然采用“Total-RMB(总额-人民币)”字段,直至相关数据被涉及到,这样尤其是当被 涉及到的账户数量较少时,可以极大地减少工作量。
图6是一示例性实施例提供的一种设备的示意结构图。请参考图6,在硬件层面,该设备包括处理器602、内部总线604、网络接口606、内存608以及非易失性存储器610,当然还可能包括其他业务所需要的硬件。处理器602从非易失性存储器610中读取对应的计算机程序到内存608中然后运行,在逻辑层面上形成数据结构的读取装置。当然,除了软件实现方式之外,本说明书一个或多个实施例并不排除其他实现方式,比如逻辑器件抑或软硬件结合的方式等等,也就是说以下处理流程的执行主体并不限定于各个逻辑单元,也可以是硬件或逻辑器件。
请参考图7,在软件实施方式中,该数据结构的读取装置可以包括:
获取单元71,使区块链网络中的区块链节点获取针对第一智能合约的调用请求;
响应单元72,响应于所述调用请求,使所述区块链节点运行所述第一智能合约包含的合约代码,以对第二智能合约包含的元数据所描述的数据结构进行解析,并通过计算机编程语言对所述数据结构进行表征;
返回单元73,使所述区块链节点将所述计算机编程语言表征的数据结构返回至所述调用请求的发起方。
可选的,所述元数据用于描述所述第二智能合约包含的数据。
可选的,所述计算机编程语言包括:预设类型的语言或所述调用请求中指示类型的语言。
可选的,所述第一智能合约为所述区块链网络的系统功能提供的系统合约。
图8是一示例性实施例提供的一种设备的示意结构图。请参考图8,在硬件层面,该设备包括处理器802、内部总线804、网络接口806、内存808以及非易失性存储器810,当然还可能包括其他业务所需要的硬件。处理器802从非易失性存储器810中读取对应的计算机程序到内存808中然后运行,在逻辑层面上形成数据结构的更新装置。当然,除了软件实现方式之外,本说明书一个或多个实施例并不排除其他实现方式,比如逻辑器件抑或软硬件结合的方式等等,也就是说以下处理流程的执行主体并不限定于各个逻辑单元,也可以是硬件或逻辑器件。
请参考图9,在软件实施方式中,该数据结构的更新装置可以包括:
请求获取单元91,使区块链网络中的区块链节点获取针对第一智能合约的调用 请求;
结构获取单元92,使所述区块链节点获取基于计算机编程语言的更新后数据结构;
请求响应单元93,响应于所述调用请求,使所述区块链节点运行所述第一智能合约包含的第一合约代码,所述第一合约代码用于对所述更新后数据结构进行解析,并表征为基于定义描述语言的更新后元数据,以对第二智能合约包含的更新前元数据进行更新。
可选的,所述第二智能合约包含的元数据用于描述所述第二智能合约包含的数据。
可选的,所述第二智能合约包含第二合约代码,所述第二合约代码用于对所述更新后元数据进行解析,以对所述第二智能合约包含的数据的数据结构进行更新。
可选的,所述第一智能合约为所述区块链网络的系统功能提供的系统合约。
可选的,所述第一合约代码还用于:将所述更新前元数据对应的更新前数据结构与所述更新后数据结构进行比较,以校验所述更新后数据结构的合理性;其中,在所述更新后数据结构的合理性通过校验的情况下,所述更新后元数据被用于对所述更新前元数据进行更新。
上述实施例阐明的系统、装置、模块或单元,具体可以由计算机芯片或实体实现,或者由具有某种功能的产品来实现。一种典型的实现设备为计算机,计算机的具体形式可以是个人计算机、膝上型计算机、蜂窝电话、相机电话、智能电话、个人数字助理、媒体播放器、导航设备、电子邮件收发设备、游戏控制台、平板计算机、可穿戴设备或者这些设备中的任意几种设备的组合。
在一个典型的配置中,计算机包括一个或多个处理器(CPU)、输入/输出接口、网络接口和内存。
内存可能包括计算机可读介质中的非永久性存储器,随机存取存储器(RAM)和/或非易失性内存等形式,如只读存储器(ROM)或闪存(flash RAM)。内存是计算机可读介质的示例。
计算机可读介质包括永久性和非永久性、可移动和非可移动媒体可以由任何方法或技术来实现信息存储。信息可以是计算机可读指令、数据结构、程序的模块或其他 数据。计算机的存储介质的例子包括,但不限于相变内存(PRAM)、静态随机存取存储器(SRAM)、动态随机存取存储器(DRAM)、其他类型的随机存取存储器(RAM)、只读存储器(ROM)、电可擦除可编程只读存储器(EEPROM)、快闪记忆体或其他内存技术、只读光盘只读存储器(CD-ROM)、数字多功能光盘(DVD)或其他光学存储、磁盒式磁带、磁盘存储、量子存储器、基于石墨烯的存储介质或其他磁性存储设备或任何其他非传输介质,可用于存储可以被计算设备访问的信息。按照本文中的界定,计算机可读介质不包括暂存电脑可读媒体(transitory media),如调制的数据信号和载波。
还需要说明的是,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、商品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、商品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、商品或者设备中还存在另外的相同要素。
上述对本说明书特定实施例进行了描述。其它实施例在所附权利要求书的范围内。在一些情况下,在权利要求书中记载的动作或步骤可以按照不同于实施例中的顺序来执行并且仍然可以实现期望的结果。另外,在附图中描绘的过程不一定要求示出的特定顺序或者连续顺序才能实现期望的结果。在某些实施方式中,多任务处理和并行处理也是可以的或者可能是有利的。
在本说明书一个或多个实施例使用的术语是仅仅出于描述特定实施例的目的,而非旨在限制本说明书一个或多个实施例。在本说明书一个或多个实施例和所附权利要求书中所使用的单数形式的“一种”、“所述”和“该”也旨在包括多数形式,除非上下文清楚地表示其他含义。还应当理解,本文中使用的术语“和/或”是指并包含一个或多个相关联的列出项目的任何或所有可能组合。
应当理解,尽管在本说明书一个或多个实施例可能采用术语第一、第二、第三等来描述各种信息,但这些信息不应限于这些术语。这些术语仅用来将同一类型的信息彼此区分开。例如,在不脱离本说明书一个或多个实施例范围的情况下,第一信息也可以被称为第二信息,类似地,第二信息也可以被称为第一信息。取决于语境,如在此所使用的词语“如果”可以被解释成为“在……时”或“当……时”或“响应于确定”。
以上所述仅为本说明书一个或多个实施例的较佳实施例而已,并不用以限制本说明书一个或多个实施例,凡在本说明书一个或多个实施例的精神和原则之内,所做的任何修改、等同替换、改进等,均应包含在本说明书一个或多个实施例保护的范围之内。

Claims (20)

  1. 一种数据结构的读取方法,包括:
    区块链网络中的区块链节点获取针对第一智能合约的调用请求;
    响应于所述调用请求,所述区块链节点运行所述第一智能合约包含的合约代码,以对第二智能合约包含的元数据所描述的数据结构进行解析,并通过计算机编程语言对所述数据结构进行表征;
    所述区块链节点将所述计算机编程语言表征的数据结构返回至所述调用请求的发起方。
  2. 根据权利要求1所述的方法,所述元数据用于描述所述第二智能合约包含的数据。
  3. 根据权利要求1所述的方法,所述计算机编程语言包括:预设类型的语言或所述调用请求中指示类型的语言。
  4. 根据权利要求1所述的方法,所述第一智能合约为所述区块链网络的系统功能提供的系统合约。
  5. 一种数据结构的更新方法,包括:
    区块链网络中的区块链节点获取针对第一智能合约的调用请求;
    所述区块链节点获取基于计算机编程语言的更新后数据结构;
    响应于所述调用请求,所述区块链节点运行所述第一智能合约包含的第一合约代码,所述第一合约代码用于对所述更新后数据结构进行解析,并表征为基于定义描述语言的更新后元数据,以对第二智能合约包含的更新前元数据进行更新。
  6. 根据权利要求5所述的方法,所述第二智能合约包含的元数据用于描述所述第二智能合约包含的数据。
  7. 根据权利要求5所述的方法,所述第二智能合约包含第二合约代码,所述第二合约代码用于对所述更新后元数据进行解析,以对所述第二智能合约包含的数据的数据结构进行更新。
  8. 根据权利要求5所述的方法,所述第一智能合约为所述区块链网络的系统功能提供的系统合约。
  9. 根据权利要求5所述的方法,所述第一合约代码还用于:将所述更新前元数据对应的更新前数据结构与所述更新后数据结构进行比较,以校验所述更新后数据结构的合理性;其中,在所述更新后数据结构的合理性通过校验的情况下,所述更新后元数据被用于对所述更新前元数据进行更新。
  10. 一种数据结构的读取装置,包括:
    获取单元,使区块链网络中的区块链节点获取针对第一智能合约的调用请求;
    响应单元,响应于所述调用请求,使所述区块链节点运行所述第一智能合约包含的合约代码,以对第二智能合约包含的元数据所描述的数据结构进行解析,并通过计算机编程语言对所述数据结构进行表征;
    返回单元,使所述区块链节点将所述计算机编程语言表征的数据结构返回至所述调用请求的发起方。
  11. 根据权利要求10所述的装置,所述元数据用于描述所述第二智能合约包含的数据。
  12. 根据权利要求10所述的装置,所述计算机编程语言包括:预设类型的语言或所述调用请求中指示类型的语言。
  13. 根据权利要求10所述的装置,所述第一智能合约为所述区块链网络的系统功能提供的系统合约。
  14. 一种数据结构的更新装置,包括:
    请求获取单元,使区块链网络中的区块链节点获取针对第一智能合约的调用请求;
    结构获取单元,使所述区块链节点获取基于计算机编程语言的更新后数据结构;
    请求响应单元,响应于所述调用请求,使所述区块链节点运行所述第一智能合约包含的第一合约代码,所述第一合约代码用于对所述更新后数据结构进行解析,并表征为基于定义描述语言的更新后元数据,以对第二智能合约包含的更新前元数据进行更新。
  15. 根据权利要求14所述的装置,所述第二智能合约包含的元数据用于描述所述第二智能合约包含的数据。
  16. 根据权利要求14所述的装置,所述第二智能合约包含第二合约代码,所述第二合约代码用于对所述更新后元数据进行解析,以对所述第二智能合约包含的数据的数据结构进行更新。
  17. 根据权利要求14所述的装置,所述第一智能合约为所述区块链网络的系统功能提供的系统合约。
  18. 根据权利要求14所述的装置,所述第一合约代码还用于:将所述更新前元数据对应的更新前数据结构与所述更新后数据结构进行比较,以校验所述更新后数据结构的合理性;其中,在所述更新后数据结构的合理性通过校验的情况下,所述更新后元数据被用于对所述更新前元数据进行更新。
  19. 一种电子设备,包括:
    处理器;
    用于存储处理器可执行指令的存储器;
    其中,所述处理器被配置为实现如权利要求1-4中任一项所述的数据结构的读取方法。
  20. 一种电子设备,包括:
    处理器;
    用于存储处理器可执行指令的存储器;
    其中,所述处理器被配置为实现如权利要求5-9中任一项所述的数据结构的更新方法。
PCT/CN2019/114435 2018-12-20 2019-10-30 数据结构的读取及更新方法、装置、电子设备 WO2020125219A1 (zh)

Priority Applications (3)

Application Number Priority Date Filing Date Title
SG11202100673WA SG11202100673WA (en) 2018-12-20 2019-10-30 Data structure reading methods and apparatuses, data structure update methods and apparatuses, and electronic devices
EP19898395.9A EP3812921A4 (en) 2018-12-20 2019-10-30 METHOD AND DEVICE FOR READING DATA STRUCTURES, METHOD AND DEVICE FOR UPDATING DATA STRUCTURES, AND ELECTRONIC DEVICE
US17/159,090 US11232098B2 (en) 2018-12-20 2021-01-26 Data structure reading methods and apparatuses, data structure update methods and apparatuses, and electronic devices

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201811564698.4A CN110032599B (zh) 2018-12-20 2018-12-20 数据结构的读取及更新方法、装置、电子设备
CN201811564698.4 2018-12-20

Related Child Applications (1)

Application Number Title Priority Date Filing Date
US17/159,090 Continuation US11232098B2 (en) 2018-12-20 2021-01-26 Data structure reading methods and apparatuses, data structure update methods and apparatuses, and electronic devices

Publications (1)

Publication Number Publication Date
WO2020125219A1 true WO2020125219A1 (zh) 2020-06-25

Family

ID=67235374

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/114435 WO2020125219A1 (zh) 2018-12-20 2019-10-30 数据结构的读取及更新方法、装置、电子设备

Country Status (6)

Country Link
US (1) US11232098B2 (zh)
EP (1) EP3812921A4 (zh)
CN (2) CN110032599B (zh)
SG (1) SG11202100673WA (zh)
TW (1) TWI722592B (zh)
WO (1) WO2020125219A1 (zh)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112070608A (zh) * 2020-08-20 2020-12-11 财付通支付科技有限公司 信息处理方法、装置、介质及电子设备
CN112685016A (zh) * 2020-12-31 2021-04-20 北京存金所贵金属有限公司 区块链应用的开发方法、装置和设备

Families Citing this family (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2019078879A1 (en) 2017-10-20 2019-04-25 Hewlett Packard Enterprise Development Lp PERMISSIONS FROM ENTITIES AND ACCESSING INFORMATION
WO2019078878A1 (en) * 2017-10-20 2019-04-25 Hewlett Packard Enterprise Development Lp ACCESS TO INFORMATION BASED ON PRIVILEGES
CN110032568B (zh) 2018-12-20 2020-05-12 阿里巴巴集团控股有限公司 数据结构的读取及更新方法、装置、电子设备
CN110032599B (zh) * 2018-12-20 2020-05-05 阿里巴巴集团控股有限公司 数据结构的读取及更新方法、装置、电子设备
US20210092127A1 (en) * 2019-09-19 2021-03-25 Microsoft Technology Licensing, Llc Writing role-backed access control to chain
CN110602133B (zh) * 2019-09-20 2021-04-09 腾讯科技(深圳)有限公司 智能合约处理方法、区块链管理设备及存储介质
CN113220701B (zh) * 2021-05-25 2023-05-02 成都佰纳瑞信息技术有限公司 基于区块链的数据结构自适应变动升级方法、装置、设备和产品
CN115037610B (zh) * 2022-04-24 2023-09-22 浙江清捷智能科技有限公司 一种自动配置系统及自动配置方法
CN115657901B (zh) * 2022-10-20 2023-07-11 吉林银行股份有限公司 一种基于统一参数的业务变更方法及装置

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106778329A (zh) * 2016-11-28 2017-05-31 中国银行股份有限公司 一种区块链智能合约模板动态更新方法、装置及系统
CN107807991A (zh) * 2017-11-07 2018-03-16 泰康保险集团股份有限公司 用于处理区块链数据的方法及装置
WO2018149504A1 (en) * 2017-02-17 2018-08-23 Nokia Technologies Oy Changing smart contracts recorded in block chains
CN108876619A (zh) * 2018-06-26 2018-11-23 北京溯安链科技有限公司 基于区块链智能合约的处理方法、装置、设备和介质
CN110032599A (zh) * 2018-12-20 2019-07-19 阿里巴巴集团控股有限公司 数据结构的读取及更新方法、装置、电子设备

Family Cites Families (40)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102571657B (zh) 2010-12-10 2015-10-21 中兴通讯股份有限公司 一种变换采样率的数字预失真处理系统和方法
US8537041B2 (en) 2011-05-12 2013-09-17 Andrew Llc Interpolation-based digital pre-distortion architecture
CN102361476B (zh) 2011-07-29 2013-01-30 上海交通大学 宽带多频段功放数字预失真装置及其方法
US20150379510A1 (en) * 2012-07-10 2015-12-31 Stanley Benjamin Smith Method and system to use a block chain infrastructure and Smart Contracts to monetize data transactions involving changes to data included into a data supply chain.
US9628119B2 (en) 2014-06-27 2017-04-18 Nxp Usa, Inc. Adaptive high-order nonlinear function approximation using time-domain volterra series to provide flexible high performance digital pre-distortion
US20160092988A1 (en) * 2014-09-30 2016-03-31 Raistone, Inc. Systems and methods for transferring digital assests using a de-centralized exchange
CN104580044B (zh) 2014-12-29 2018-12-18 大唐移动通信设备有限公司 一种预失真处理方法和系统
US20160203496A1 (en) * 2015-01-12 2016-07-14 Optima Compass Group, LLC Multivariate Dynamic Rules Engine Framework and System
WO2016164496A1 (en) * 2015-04-06 2016-10-13 Bitmark, Inc. System and method for decentralized title recordation and authentication
US20160321676A1 (en) * 2015-05-01 2016-11-03 Monegraph, Inc. Sharing content within social network services
WO2016179334A1 (en) * 2015-05-05 2016-11-10 ShoCard, Inc. Identity management service using a block chain
US10255336B2 (en) * 2015-05-07 2019-04-09 Datometry, Inc. Method and system for transparent interoperability between applications and data management systems
US20170011460A1 (en) * 2015-07-09 2017-01-12 Ouisa, LLC Systems and methods for trading, clearing and settling securities transactions using blockchain technology
WO2017090041A1 (en) * 2015-11-24 2017-06-01 Ben-Ari Adi A system and method for blockchain smart contract data privacy
US10423993B2 (en) * 2015-12-28 2019-09-24 Raise Marketplace, Llc Authenticating an exchange item in an exchange item marketplace network
EP3420669B1 (en) * 2016-02-23 2021-03-24 Nchain Holdings Limited Cryptographic method and system for secure extraction of data from a blockchain
MX2018010054A (es) * 2016-02-23 2019-01-21 Nchain Holdings Ltd Metodo y sistema de tokenizacion para la implementacion de cambios de moneda en una cadena de bloques.
US10346406B2 (en) * 2016-03-28 2019-07-09 International Business Machines Corporation Decentralized autonomous edge compute coordinated by smart contract on a blockchain
US10720232B2 (en) * 2016-04-13 2020-07-21 Accenture Global Solutions Limited Distributed healthcare records management
SG11201809963XA (en) * 2016-05-11 2018-12-28 Nasdaq Inc Application framework using blockchain-based asset ownership
US20170345011A1 (en) * 2016-05-26 2017-11-30 Hitfin, Inc. System and method executed on a blockchain network
WO2018006072A1 (en) * 2016-06-30 2018-01-04 Clause, Inc. Systems and method for forming, storing, managing,and executing contracts
US20180089761A1 (en) * 2016-09-26 2018-03-29 Shapeshift Ag System and method of providing a leader-follower multi-asset portfolio
US11176519B2 (en) * 2016-11-11 2021-11-16 International Business Machines Corporation Smart contract admission check and fault tolerance in a blockchain
US20180218455A1 (en) * 2017-01-30 2018-08-02 Dais Technology, Inc. System for creating and utilizing smart policies on a blockchain
WO2018140913A1 (en) * 2017-01-30 2018-08-02 SALT Lending Holdings, Inc. System and method of creating an asset based automated secure agreement
GB201701589D0 (en) * 2017-01-31 2017-03-15 Nchain Holdings Ltd Computer-implemented system and method
US10158479B2 (en) * 2017-02-06 2018-12-18 Northern Trust Corporation Systems and methods for generating, uploading and executing code blocks within distributed network nodes
AU2018230763A1 (en) * 2017-03-08 2019-10-31 Ip Oversight Corporation System and method for creating commodity asset-secured tokens from reserves
CN107248074A (zh) * 2017-03-29 2017-10-13 阿里巴巴集团控股有限公司 一种基于区块链的业务处理方法及设备
CA3065319A1 (en) * 2017-06-01 2018-12-06 Schvey, Inc. d/b/a/ Axoni Distributed privately subspaced blockchain data structures with secure access restriction management
CN107943469B (zh) * 2017-11-17 2022-01-11 深圳圣马歌科技有限公司 一种智能合约的发布方法及装置
AU2018100150A4 (en) * 2018-02-03 2018-03-08 Talbot, Phillip David MR Proof of delivery on the blockchain
CN108510389B (zh) * 2018-03-30 2020-12-18 深圳前海微众银行股份有限公司 基于区块链的智能合约调用方法、设备及可读存储介质
CN108848119B (zh) * 2018-04-03 2020-04-28 阿里巴巴集团控股有限公司 跨区块链的交互方法及装置、系统、电子设备
CN108694589A (zh) * 2018-05-08 2018-10-23 杭州佑他科技有限公司 一种基于区块链的资产监控方法
CN108769173B (zh) * 2018-05-21 2021-11-09 阿里体育有限公司 运行智能合约的区块链实现方法及设备
CN108718341B (zh) * 2018-05-30 2021-06-01 北京阿尔山区块链联盟科技有限公司 数据的共享和搜索的方法
CN108898390B (zh) * 2018-06-27 2021-01-12 创新先进技术有限公司 基于区块链的智能合约调用方法及装置、电子设备
CN108921558A (zh) * 2018-07-11 2018-11-30 物数(上海)信息科技有限公司 基于区块链的资产清结算方法、系统、设备及存储介质

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106778329A (zh) * 2016-11-28 2017-05-31 中国银行股份有限公司 一种区块链智能合约模板动态更新方法、装置及系统
WO2018149504A1 (en) * 2017-02-17 2018-08-23 Nokia Technologies Oy Changing smart contracts recorded in block chains
CN107807991A (zh) * 2017-11-07 2018-03-16 泰康保险集团股份有限公司 用于处理区块链数据的方法及装置
CN108876619A (zh) * 2018-06-26 2018-11-23 北京溯安链科技有限公司 基于区块链智能合约的处理方法、装置、设备和介质
CN110032599A (zh) * 2018-12-20 2019-07-19 阿里巴巴集团控股有限公司 数据结构的读取及更新方法、装置、电子设备

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
See also references of EP3812921A4 *

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112070608A (zh) * 2020-08-20 2020-12-11 财付通支付科技有限公司 信息处理方法、装置、介质及电子设备
CN112070608B (zh) * 2020-08-20 2024-03-19 财付通支付科技有限公司 信息处理方法、装置、介质及电子设备
CN112685016A (zh) * 2020-12-31 2021-04-20 北京存金所贵金属有限公司 区块链应用的开发方法、装置和设备

Also Published As

Publication number Publication date
SG11202100673WA (en) 2021-02-25
US11232098B2 (en) 2022-01-25
CN110032599B (zh) 2020-05-05
EP3812921A1 (en) 2021-04-28
US20210149883A1 (en) 2021-05-20
TWI722592B (zh) 2021-03-21
TW202024953A (zh) 2020-07-01
EP3812921A4 (en) 2021-10-27
CN110032599A (zh) 2019-07-19
CN111782668A (zh) 2020-10-16

Similar Documents

Publication Publication Date Title
WO2020125219A1 (zh) 数据结构的读取及更新方法、装置、电子设备
CN110020542B (zh) 数据读写方法及装置、电子设备
CN110032598B (zh) 字段更新方法及装置、电子设备
WO2020119287A1 (zh) 基于区块链的发票创建方法及装置、电子设备
WO2020125224A1 (zh) 数据结构的读取及更新方法、装置、电子设备
US11847135B2 (en) Blockchain node and transaction method
WO2018201895A1 (zh) 接口代码生成方法、装置、终端设备及介质
TW202008196A (zh) 基於中心化結算與區塊鏈存證的交易方法及系統
US11615078B2 (en) Blockchain-based transaction methods
US11720545B2 (en) Optimization of chaincode statements
TW201600985A (zh) 資料的查詢方法及查詢裝置
WO2022077186A1 (zh) 区块链中智能合约的执行方法及装置和电子设备
CN111033489B (zh) 用于数据遍历的方法和设备
WO2024021417A1 (zh) 数据账户创建方法及装置
WO2022206209A1 (zh) 基于区块链的资产管理
CN115221559A (zh) 数据账户的访问授权方法及装置
WO2022077181A1 (zh) 保护区块链上数据安全的方法及装置和电子设备
US20120216240A1 (en) Providing data security through declarative modeling of queries
US11768819B2 (en) Data unblocking in application platforms

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: 19898395

Country of ref document: EP

Kind code of ref document: A1

ENP Entry into the national phase

Ref document number: 2019898395

Country of ref document: EP

Effective date: 20210122

NENP Non-entry into the national phase

Ref country code: DE