CN114528353A - Method and apparatus for providing blockchain service - Google Patents

Method and apparatus for providing blockchain service Download PDF

Info

Publication number
CN114528353A
CN114528353A CN202210170751.2A CN202210170751A CN114528353A CN 114528353 A CN114528353 A CN 114528353A CN 202210170751 A CN202210170751 A CN 202210170751A CN 114528353 A CN114528353 A CN 114528353A
Authority
CN
China
Prior art keywords
data
field
data structure
index
identifier
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210170751.2A
Other languages
Chinese (zh)
Inventor
付剑
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ant Blockchain Technology Shanghai Co Ltd
Original Assignee
Ant Blockchain Technology Shanghai Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ant Blockchain Technology Shanghai Co Ltd filed Critical Ant Blockchain Technology Shanghai Co Ltd
Priority to CN202210170751.2A priority Critical patent/CN114528353A/en
Publication of CN114528353A publication Critical patent/CN114528353A/en
Pending legal-status Critical Current

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/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • 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/2282Tablespace storage structures; Management 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/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/24Querying
    • G06F16/242Query formulation
    • G06F16/2433Query languages
    • 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/24Querying
    • G06F16/245Query processing
    • G06F16/2453Query optimisation
    • G06F16/24534Query rewriting; Transformation
    • 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/24Querying
    • G06F16/245Query processing
    • G06F16/2458Special types of queries, e.g. statistical queries, fuzzy queries or distributed queries
    • G06F16/2471Distributed queries
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/25Integrating or interfacing systems involving database management systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/62Protecting access to data via a platform, e.g. using keys or access control rules
    • G06F21/6218Protecting access to data via a platform, e.g. using keys or access control rules to a system of files or objects, e.g. local or distributed file system or database
    • 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/04Payment circuits
    • G06Q20/06Private payment circuits, e.g. involving electronic currency used among participants of a common payment scheme
    • G06Q20/065Private payment circuits, e.g. involving electronic currency used among participants of a common payment scheme using e-cash
    • 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/08Payment architectures
    • G06Q20/10Payment architectures specially adapted for electronic funds transfer [EFT] systems; specially adapted for home banking systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/38Payment protocols; Details thereof
    • G06Q20/382Payment protocols; Details thereof insuring higher security of transaction
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q40/00Finance; Insurance; Tax strategies; Processing of corporate or income taxes
    • G06Q40/04Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange

Abstract

The embodiment of the specification provides a method and a device for providing a block chain service, which are applied to a device under a chain. One embodiment of the method comprises: obtaining a data structure of data on a chain from a block link point, wherein the data structure defines a plurality of fields in the data on the chain; analyzing the acquired data structure, and generating and storing a field table of each field, wherein the field table comprises field identifications of corresponding fields and attribute information of the fields; and providing data interaction service for the block chain according to the field table.

Description

Method and apparatus for providing blockchain service
Technical Field
The embodiment of the present specification belongs to the technical field of block chaining, and in particular, relates to a method and an apparatus for providing a block chaining service.
Background
The Blockchain (Blockchain) is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, a consensus mechanism, an encryption algorithm and the like. In the block chain system, data blocks are combined into a chain data structure in a sequential connection mode according to a time sequence, and a distributed account book which is not falsifiable and counterfeitable is ensured in a cryptographic mode. Because the blockchain has the characteristics of decentralization, information non-tampering, autonomy and the like, the blockchain is also paid more and more attention and is applied by people.
With the rapid development of the blockchain, more and more blockchains are developed, the development of the blockchain brings bottleneck of the computing power of the blockchain, and the supplement of the edge computing power provides a new computing power growth space for the blockchain. Based on the method, how to quickly build the service node for providing the edge calculation power has important practical significance and value.
Disclosure of Invention
The embodiment of the specification describes a method and a device for providing a block chain service, which are applied to a device under a chain, and are used for acquiring a data structure of data on the chain from a block chain link point, analyzing the data structure, generating and storing a field table of each field, and providing a data interaction service for the block chain according to the field table. Thus, by automatically mapping the data structure to the field table of the device under the chain, the device under the chain can be made to provide edge computing power for the blockchain.
According to a first aspect, there is provided a method for providing blockchain services, which is applied to an apparatus under a chain, and includes: obtaining a data structure of data on a chain from a block link point, wherein the data structure defines a plurality of fields in the data on the chain; analyzing the acquired data structure, and generating and storing a field table of each field, wherein the field table comprises field identifications of corresponding fields and attribute information of the fields; and providing data interaction service for the block chain according to the field table.
In one embodiment, the attribute information of the field includes an index identifier of field data of the field, and the method further includes: receiving first data from a block chain node, wherein the first data comprises field identifications of all fields and field data which are associated with the field identifications of all the fields; acquiring a field table of each field according to the field identification of each field; storing the first data, and establishing an index relation between each field identification of the first data and each field data through the index identification of each field data in each field table; the providing of the data interaction service for the block chain according to the field table includes: and querying the first data based on the index relation.
In one embodiment, the first data further includes a data identifier, and the method further includes: generating and storing a data structure table of the data structure, wherein the data structure table comprises the name of the data structure, the index identification of the data structure and a data structure code; wherein, the field table also includes the index identification of the data structure; the storing the first data and establishing the index relationship between each field identifier of the first data and each field data through the index identifier includes: determining the data structure table corresponding to the first data, and determining the index identifier of the data structure from the data structure table; determining the index identification of each field data from the field table according to the field identification of each field and the index identification of the data structure; a data table for generating and storing the first data, the data table including: the data identifier, the index identifier of the data structure, each field data and the index identifier of each field data.
In one embodiment, said querying said first data based on said index relationship comprises: receiving a data query request from a user terminal, wherein the data query request includes a data identifier of the first data and a field identifier of a target field; acquiring a data table of the first data according to the data identifier of the first data; acquiring a field table of a target field according to an index identifier of a data structure in a data table of first data and a field identifier of the target field; determining the index identification corresponding to the target field according to the field table of the target field; according to the determined index identification, searching field data corresponding to the target field from the data table of the first data; and returning the field data to the user terminal.
In one embodiment, the method further comprises: generating a data query log according to the provided on-chain data query service; and performing uplink on the data query log.
In an embodiment, the providing the data interaction service for the blockchain according to the field table includes: receiving an uplink request from a user terminal, wherein the uplink request comprises field data of each field of data to be uplink-transmitted; determining a field identifier corresponding to each field data from the field table of each field according to the field table of each field of the data to be uplink; and performing data uplink according to the field data and the field identification corresponding to the field data.
In an embodiment, the above data structure for acquiring data on a chain from a block link point includes: sending a transaction invoking a contract to a block link point, the contract for defining a data structure of data on the chain; the data structure is received from a block link point.
In an embodiment, the parsing the acquired data structure to generate and store a field table of each field includes: checking the acquired data structure; in response to determining that the data structure has verified, determining a programming language used by the data structure; and analyzing the data structure according to a programming language to generate a field table of each field.
According to a second aspect, there is provided an apparatus for providing blockchain services, provided in an apparatus under a chain, comprising: an obtaining unit configured to obtain a data structure of data on a chain from a block link point, the data structure defining a plurality of fields in the data on the chain; the analysis unit is configured to analyze the acquired data structure, generate and store a field table of each field, wherein the field table comprises field identifications of corresponding fields and attribute information of the fields; and the service unit is configured to provide data interaction service for the block chain according to the field table.
According to a third aspect, there is provided a computer-readable storage medium having stored thereon a computer program which, when executed in a computer, causes the computer to perform the method as described in any one of the implementations of the first aspect.
According to a fourth aspect, a computing device is provided, which includes a memory and a processor, and is characterized in that the memory stores executable codes, and the processor executes the executable codes to implement the method as described in any implementation manner of the first aspect.
According to the method and the device for providing the block chain service provided by the embodiment of the specification, the method and the device are applied to an under-chain device, a data structure of data on a chain is firstly obtained from a block chain link point, wherein the data structure defines a plurality of fields in the data on the chain. And then, analyzing the acquired data structure, and generating and storing a field table of each field, wherein the field table comprises the field identification of the corresponding field and the attribute information of the field. And finally, providing data interaction service for the block chain according to the field table. Therefore, the data structure of the block chain is automatically mapped to the field table of the equipment under the chain, the equipment under the chain can provide the edge calculation power for the block chain, and the quick construction of the service node for providing the edge calculation power for the block chain is realized.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the drawings needed to be used in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments described in the present disclosure, and it is obvious for a person skilled in the art to obtain other drawings based on these drawings without inventive labor.
FIG. 1 illustrates a block chain architecture diagram in one embodiment;
FIG. 2 shows a schematic diagram of one application scenario in which embodiments of the present specification may be applied;
fig. 3 shows a flow diagram of a method of providing blockchain services according to one embodiment;
FIG. 4 is a diagram illustrating a data structure in one embodiment;
FIG. 5 is a diagram illustrating a table stored in an equipment under a chain in one embodiment of the present description;
FIG. 6 illustrates an example schematic of the tables of FIG. 5;
fig. 7 shows a schematic block diagram of an apparatus for providing blockchain services according to one embodiment.
Detailed Description
In order to make those skilled in the art better understand the technical solutions in the present specification, the technical solutions in the embodiments of the present specification will be clearly and completely described below with reference to the drawings in the embodiments of the present specification, and it is obvious that the described embodiments are only a part of the embodiments of the present specification, and not all of the embodiments. All other embodiments obtained by a person skilled in the art based on the embodiments in the present specification without any inventive step should fall within the scope of protection of the present specification.
FIG. 1 illustrates a block chain architecture diagram in one embodiment. As shown in fig. 1, the block chain 100 includes, for example, 6 nodes. The lines between the nodes schematically represent P2P (Peer-to-Peer) connections. The nodes may have a full ledger stored on them, i.e. the status of all blocks and all accounts. Wherein each node in the blockchain can generate the same state in the blockchain by performing the same transaction, and each node in the blockchain can store the same state database. It is to be understood that although fig. 1 illustrates 6 nodes included in the blockchain, embodiments of the present specification are not limited thereto and may include other numbers of nodes. Specifically, the nodes included in the block chain can meet the Byzantine Fault Tolerance (BFT) requirement. The byzantine fault tolerance requirement can be understood as that byzantine nodes can exist in a block chain, and the block chain does not show the byzantine behavior to the outside. Generally, some Byzantine Fault-tolerant algorithms require the number of nodes to be greater than 3f +1, where f is the number of Byzantine nodes, such as the practical Byzantine Fault-tolerant algorithm pbft (practical Byzantine Fault tolerance).
A transaction in the blockchain domain may refer to a unit of task that is performed in the blockchain and recorded in the blockchain. The transaction typically includes a send field (From), a receive field (To), and a Data field (Data). Where the transaction is a transfer transaction, the From field indicates the address of the account From which the transaction was initiated (i.e., From which a transfer task To another account was initiated), the To field indicates the address of the account From which the transaction was received (i.e., From which a transfer was received), and the Data field includes the transfer amount. In the case of a transaction calling an intelligent contract in a blockchain, a From field represents an account address for initiating the transaction, a To field represents an account address of the contract called by the transaction, and a Data field includes Data such as a function name in the calling contract and incoming parameters To the function, so as To obtain code of the function From the blockchain and execute the code of the function when the transaction is executed.
The block chain may provide the functionality of an intelligent contract. An intelligent contract on a blockchain is a contract that can be executed on a blockchain system triggered by a transaction. An intelligent contract may be defined in the form of code. The intelligent contract is called in the Ethernet workshop, and a transaction pointing to the intelligent contract address is initiated, so that each node in the Ethernet workshop network runs the intelligent contract code in a distributed mode. It should be noted that, in addition to the creation of the smart contracts by the users, the smart contracts may also be set by the system in the creation block. Such contracts are generally referred to as foundational contracts. In general, the data structure, parameters, attributes and methods of some blockchains may be set in the startup contract. Further, an account with system administrator privileges may create a contract at the system level, or modify a contract at the system level (simply referred to as a system contract). Wherein the system contract is usable to add data structures for different services in a blockchain.
In the scenario of contract deployment, for example, Bob sends a transaction containing information to create an intelligent contract (i.e., a deployment contract) into the blockchain as shown in fig. 1, the data field of the transaction includes the code (e.g., bytecode or machine code) of the contract to be created, and the to field of the transaction is null to indicate that the transaction is for contract deployment. After the agreement is achieved among the nodes through a consensus mechanism, a contract address '0 x6f8ae93 …' of the contract is determined, each node adds a contract account corresponding to the contract address of the intelligent contract in a state database, allocates a state storage corresponding to the contract account, and stores a contract code in the state storage of the contract, so that the contract creation is successful.
In the scenario of invoking a contract, for example, Bob sends a transaction for invoking a smart contract into the blockchain as shown in fig. 1, where the from field of the transaction is the address of the account of the transaction initiator (i.e., Bob), and "0 x6f8ae93 …" in the to field represents the address of the invoked smart contract, and the data field of the transaction includes the method and parameters for invoking the smart contract. After the transaction is identified in the blockchain, each node in the blockchain can execute the transaction respectively, so that the contract is executed respectively, and the state database is updated based on the execution of the contract.
As mentioned above, the development of the blockchain brings bottlenecks in the computation power of the blockchain, and the supplement of the edge computation power provides a new computation power growth space for the blockchain. Edge computing means that an open platform integrating network, computing, storage and application core capabilities is adopted on one side close to an object or a data source to provide nearest-end services nearby. The method is initiated at the edge side, generates faster network service response, and meets the basic requirements of the industry in the aspects of real-time business, application intelligence, safety, privacy protection and the like. The edge computation is between the physical entity and the industrial connection, or on top of the physical entity. At this stage, some blockchain nodes on the blockchain depend on an edge computing power server, and the service capabilities most frequently needed in the edge computing power include: an on-link data query service, an uplink service, etc. In some conventional approaches, to exploit the edge power of blockchains, multiple encodings are required for different blockchains. For example, a block chain contract needs to be developed, which includes defining a data structure and a contract code on a chain, and obtaining a server computing (Serverless) chain interactive interface. Meanwhile, a data structure on the edge computing power server needs to be defined, a service interface for processing power needs to be defined, and the whole process is time-consuming and labor-consuming.
To this end, embodiments of the present specification provide a scheme for providing a blockchain service, which may be applied to an apparatus under a chain and may provide blockchain services for blockchains in different industries. Taking a plurality of block chains 201 such as a logistics financial chain, an ETC (ethernet Classic) chain, a legal chain, and a digital commodity chain as an example, fig. 2 shows a schematic diagram of an application scenario in which the embodiments of the present description can be applied, and in the application scenario shown in fig. 2, the lower-chain device 202 is an edge computing power server. As shown in fig. 2, for each blockchain 201 in the plurality of blockchains, the downlink device 202 may obtain a data structure of the uplink data from any blockchain link point of the blockchain, where the data structure is used to define a plurality of fields in the uplink data. Thereafter, the obtained data structure may be parsed, and a field table of each field may be generated and stored, where the field table may include field identifications (e.g., field names) of the corresponding fields, attribute information of the fields, and the like. The under-chain device may then provide data interaction services to the blockchain according to the field table. In practice, the field tables corresponding to the block chains may be stored in the same table, so that data interaction services for the block chains may be provided according to the table.
With continued reference to fig. 3, fig. 3 illustrates a flow diagram of a method of providing blockchain services according to one embodiment. It is to be appreciated that the method can be applied to the down-link device 202 in fig. 2, and the down-link device 202 can be any apparatus, device, platform, device cluster, etc. having computing, processing capabilities. As shown in fig. 3, the method for providing the block chain service may include the following steps:
step 301, obtain the data structure of the data on the chain from the block link point.
In this embodiment, the apparatus under the chain may pull the data model on the chain from any one of the blockchain link points of the blockchain, thereby obtaining the data structure of the data on the chain. The data structure is used to define a plurality of fields in the data on the chain. The data stored in the blockchain includes, for example, a transaction body, a transaction receipt, block data, account status data, and the like, and different types of data may have different data structures. Alternatively, a plurality of service scenarios, such as a financing service scenario, a commission service scenario, a transaction service scenario, etc., may be set in the blockchain, and different service scenarios may set different data structures, which will be described as an example below.
FIG. 4 is a diagram of a data structure in an embodiment. The data structure is for example a data structure of a transaction receipt for a commission transaction in a commission scenario. As shown in fig. 4, a plurality of fields with field identifications (or field names) of categoryID, commensalisroleacountid, senderID, receiverID, etc. are defined in the data structure, and other attributes of each field, such as field types (e.g., String, uint32, uint64, etc.), field codes (codes), and some attributes not shown in fig. 4, such as whether unique keys are present, whether indexes are present, whether non-null, whether complex types are present, index identifications of associated data structures, etc., are also defined in the data structure.
As described above, the data structure of the data in the blockchain may be set in the blockchain by a contract creation or a system contract, the code of these contracts includes the data structure of the data, and a function (or a query interface) for acquiring the data structure is provided. For example, in a Commission payment business scenario, a Commission data structure (e.g., a Commission contract) as shown in fig. 4 is set up in the block chain by deploying a Commission contract (e.g., a Commission contract) that includes the Commission data structure and provides a query interface for the Commission data structure. The commission data structure is used, for example, to define various fields in a commission business scenario. Additionally, the commission contract can provide other functions (e.g., payment functions) for conducting a commission payment service, e.g., a user terminal can pay a commission to other users or blockchain platforms by sending a transaction that invokes the payment function of the commission contract into a blockchain, which after execution of the transaction, a blockchain node generates and stores into the blockchain a transaction receipt for the transaction that includes field data for a plurality of fields defined in the commission data structure.
The data structure may be received from a blockchain node by the down-link device 202 by sending a call to the query interface to any blockchain node. Specifically, for the commission data structure, the under-chain device 202 may send an inquiry request (or transaction) to any block link node, where the inquiry request invokes an inquiry interface provided by the commission contract, and the block link node executes the inquiry interface after receiving the inquiry request, acquires the commission data structure included in the code of the commission contract, and returns the commission data structure to the under-chain device 202.
Step 302, analyzing the obtained data structure, and generating and storing a field table of each field.
In this embodiment, the data structure obtained in step 301 may be analyzed, and a field table of each field may be generated and stored. Fig. 5 is a schematic diagram of a table stored in the apparatus under the link in an embodiment of the present specification, where the table includes a field table 501. As shown in FIG. 5, field table 501 may be used to define information for individual fields in a data structure. In this example, the field table 501 may include field identifications (e.g., field names) of corresponding fields and attribute information of the fields. The attribute information of a field may include various information related to the attribute of the field, including but not limited to creation time, update time, index identification of the data structure to which the field belongs, index identification of field data corresponding to the field, field code, field type, whether it is a unique key, whether it is an index, whether it is not null, whether it is a complex type, index identification of the associated data structure, and so on. Wherein the index identification of the field data is a name or number of the field data generated by the downlinker device 202 that uniquely identifies the target field among the plurality of fields of the data structure. By generating the index identifier of the field data, the downlinker device 202 can store the index identifier of each field data in association with the corresponding field data when storing the data having the data structure, so that the target field data in the stored data can be read by the index identifier.
Fig. 6 is a schematic diagram of an example of each table in fig. 5. Taking the commission data structure in fig. 4 as an example, by analyzing the data structure, the field table 601 shown in fig. 6 can be obtained. For example, a field table corresponding to the field "categoryID" is shown in the 2 nd row in the field table 601, where field data such as "field identification categoryID", "field code categoryID", "field type string" and the like can be obtained by parsing the data structure in fig. 4, "index identification V0 of field data" is an index identification generated by the apparatus 202 under the chain and corresponding to the field "categoryID", and "index identification 01" of the data structure is an index identification generated by the apparatus 202 under the chain and corresponding to the communion data structure.
In some optional implementations, the step 302 may further be specifically performed as follows:
first, the acquired data structure is checked. For example, it may be checked whether the syntax between data within the data structure complies with syntax rules or whether syntax errors exist.
Then, after the data structure is determined to be verified, the programming language used by the data structure is determined. By way of illustration, programming languages that may be used with the data structures may include, but are not limited to: the Solidity programming language, the Golang programming language, the C + + programming language, and so forth.
And finally, analyzing the data structure according to the programming language to generate a field table of each field. For example, for different programming languages, corresponding parsing manners may be preset, so that parsing of the data structure according to the programming language may be implemented. By the implementation mode, the analysis of the data structures of different programming languages can be realized.
Step 303, providing data interaction service for the blockchain according to the field table.
In this embodiment, a data interaction service for the blockchain may be provided according to the generated field table. Here, the data interactive service for the blockchain may include service capabilities frequently required in edge computing such as an on-chain data query service, an uplink service, and the like. As an example, an SQL (Structured Query Language) conversion engine, a result conversion engine, a rights management engine, a log management engine, and the like may be included in the device. The SQL conversion engine may convert the query parameters in the query interface into query SQL for the table, the result conversion engine may analyze the query result obtained based on the table into a result required by the query interface, the permission management and control engine may provide interface authentication control, and the log management and control engine may record query logs, uplink logs, and the like.
In some optional implementations, the method for providing a blockchain service may further include:
step 1), receiving first data from a block chain node in real time, wherein the first data may include, but is not limited to, a data identifier, a field identifier of each field, and field data of each field associated with the field identifier, the field identifier included in the first data indicates a data structure corresponding to the first data, or the first data may also include a name of the corresponding data structure. Wherein the first data is, for example, a transaction receipt for a commission transaction. The transaction receipt has, for example, the form as follows:
{Receipt1
CategoryID:02
……
SenderID:A
ReceiverID:B}
wherein, "Receptip 1" is the data identifier, and the transaction Receipt Receptip 1 includes the field names (or field identifiers) and field values of a plurality of fields such as Category ID, Sender ID, Receptive ID, etc.
And 2) acquiring a field table of each field according to the field identification of each field.
And 3) storing the first data, and establishing the index relation between each field identification of the first data and each field data through the index identification of each field data in each field table. Specifically, a mapping relationship table between the index identifier of each field data and the storage location (or storage address) of the corresponding field data may be established, so that the index identifier of the field data corresponding to the field identifier may be determined according to the field table of the field, and the storage location of the field data may be determined according to the mapping relationship table, so as to read the field data.
After storing the first data as described above, the step 303 may specifically proceed as follows: and querying the first data based on the index relation.
Optionally, the method for providing blockchain service may further include the following steps: a data structure table of data structures is generated and stored.
As an example, the table diagram stored in the apparatus under the chain shown in fig. 5 further includes a data structure table 502. The data structure table 502 may include information such as a primary key ID (identification), a name of a data structure, an index identification of the data structure, a data structure code, a data structure version, and a blockchain ID (identification) and a blockchain name of a belonging blockchain. Wherein the index identification of the data structure is a name or number of a data structure generated by the downlinker device 202 that uniquely identifies the target data structure among the plurality of data structures. By generating the index identifiers of the data structures, when storing data having the data structures, the downlinker device 202 can store the index identifiers of the respective data structures in association with the index identifiers of the field data of the plurality of fields of the corresponding data structures, so that reading of the field data of the plurality of fields of the target data structure in the stored data can be performed through the index identifiers.
For example, the data structure may be analyzed according to a preset analysis mode to obtain a data structure table of the data structure. Fig. 6 is a diagram illustrating an example of each table in fig. 5. Taking the commission data structure in fig. 4 as an example, by parsing the data structure, the data structure table 602 shown in fig. 6 can be obtained.
In this embodiment, the step 3) stores the first data, and establishes an index relationship between each field identifier of the first data and each field data by using the index identifier of each field data in each field table, which may be implemented as follows:
and S1, determining a data structure table corresponding to the first data, and determining the index identifier of the data structure from the data structure table.
Specifically, from the foregoing fields of the category id, SenderID, receiverdid, and the like included in the transaction Receipt1, it is determined that the fields included in the transaction Receipt1 coincide with the fields defined in the data structure shown in fig. 4, and thus it is determined that the transaction Receipt1 corresponds to the data structure table 602 shown in fig. 6. Alternatively, where the name of the data structure (Commission) or the corresponding contract name is included in the transaction Receipt Recript 1, the data structure table may be determined from the name of the data structure. The chained device 202 may then read the index identification "01" of the data structure the transaction Receipt Recript 1 has from the data structure table 602.
And S2, determining the index identifier of each field data from the field table according to the field identifier of each field and the index identifier of the data structure.
Specifically, as shown in fig. 6, taking the transaction receipt of the commission transaction as an example, first, a field table 601 of each field is determined according to the index identifier 01 of the data structure and the field identifier of each field, and then the index identifier of the field data of each field can be determined from the field table 601. For example, from the field identification CategoryID, it can be determined from the field table 601 that the index identification of the field data of the field CategoryID is V0.
S3, generating and storing a data table of the first data, wherein the data table may include a data identifier, an index identifier of the data structure, each field data, and an index identifier of each field data. As an example, the table diagram stored in the apparatus under link shown in fig. 5 further includes a data table 503. And FIG. 6 is a schematic diagram of an example of each table in FIG. 5. Taking the commission data structure in fig. 4 as an example, the data table 603 shown in fig. 6 can be obtained by pulling the on-chain data in real time. The VO data, the V1 data, and the like are field data associated with an index identifier of the field data, and the field data of a plurality of fields of the data structure is stored in different fields, which is advantageous for reading data in different fields. The index identifier of the data may be a name or a number generated by the device 202 under the chain to identify the data, and the device 202 under the chain may store the index identifier of the data in association with the storage address information of the data, so that the data may be read by the index identifier of the data.
In some optional implementations, the data interaction service may be an on-chain data query service, and the querying for the first data based on the index relationship may be performed as follows:
1) an on-chain data query request is received from a user terminal. The data query request may include, among other things, a data identification of the first data, a field identification of the target field, and so on.
For example, the data query request is for querying the field data of the CategoryID field in the transaction Receipt Reception 1, which may include the data identification "Reception 1" of the target data and the field identification "CategoryID" of the target data.
When the on-chain data query is carried out, the on-chain data query request can be analyzed and spliced into SQL according to the field sequence, and the data in the data table can be found according to the spliced SQL.
2) And acquiring a data table of the first data according to the data identification of the first data.
Specifically, the chained device 202 may obtain the data table 603 of the first data according to the data identifier "reduce 1".
3) And acquiring a field table of the target field according to the index identification of the data structure in the data table of the first data and the field identification of the target field.
Specifically, the chained device 202 may determine the field table 601 according to the index identifier 01 of the data structure in the data table of the first data, and determine the field table of the CategoryID field in the field table 601 according to the field identifier CategoryID.
4) And determining the index identification corresponding to the target field according to the field table of the target field.
Specifically, the chained device 202 may determine the index identifier ("V0") corresponding to the category id field according to the field table of the category id field.
5) And searching field data corresponding to the target field from a data table of the first data according to the determined index identifier.
Specifically, the device 202 under the chain may search field data corresponding to the category id field from the data table of the first data according to the index identifier V0, and feedback the field data after further processing.
6) And returning the searched field data to the user terminal.
It is to be understood that the data query service provided by the embodiment of the present specification is described above by way of an example only, and the data query service provided by the embodiment of the present specification is not limited thereto. For example, in another example, the field identification and field data (e.g., SenderID: Alice) included in the data to be queried may be included in a query request, such as for querying all transactions sent by Alice. After receiving the query request, the downlinker device 202 may locate a field table corresponding to the SenderID field in the Commission data structure according to the SenderID, obtain an index identifier (e.g., V5) of the SenderID field from the field table, retrieve all the data tables of V5 ═ Alice according to the index identifier, and obtain the transaction sent by Alice from the retrieved data tables, and the downlinker device 202 may also similarly retrieve the transactions sent by Alice of other data structures.
By the implementation mode, the on-chain data query service based on the edge computing power is realized.
In some optional implementations, the method for providing a blockchain service may further include: generating a data query log according to the provided on-chain data query service; and uploading the data query log.
In addition, services that can be provided by the down-link device, which is an edge computing power providing device, can be packaged in the form of an interface. The device under the chain can also have authority control capability for authenticating the user calling the interface.
In some optional implementations, the data interaction service may also be an uplink service, and the step 303 may specifically be performed as follows:
first, an uplink request is received from a user equipment. Here, the uplink request may include field data of each field of the data to be uplink. The uplink request is used, for example, to uplink a transaction that will invoke a Commission contract (Commission contract), and likewise, the transaction conforms to the Commission data structure. The uplink request includes field Data of a SenderID field (corresponding To a From field of a transaction), a recieveerid field (corresponding To a To field of a transaction) and a Data field, for example, the Data of the SenderID field is "Alice", the recieveerid field Data is a contract address of a Commission contract, and the Data of the Data field includes a payment function name in the Commission contract To indicate that the transaction is initiated by an account Alice and a payment function in the Commission contract is called.
And then, according to the field table of each field of the data to be uplink, determining the field identifier corresponding to each field data from the field table of each field.
Specifically, the data structure table of the data to be uplink linked may be determined according to the field data of each field, and the index identifier of the data structure of the data to be uplink linked may be determined from the data structure table. For example, the chained device 202 may determine the data structure table of the data To be chained as the data structure table 602 shown in fig. 6 according To the contract address of the Commission contract in the field data of the To field in the chained data, so that the index identifier 01 of the data structure may be read from the data structure table 602. Then, the field table 601 of each field is obtained according to the index identifier 01 of the data structure, and the field identifier corresponding to each field data is determined from the field table of each field.
And finally, performing data uplink according to each field data and the field identification corresponding to each field data.
Specifically, the uplink transaction can be generated according To the field identifier corresponding To each field data and each field data, for example, the field data of the SenderID field is placed at the From field of the transaction, the field data of the receiverID field is placed at the To field of the transaction, and the like, so as To generate the uplink transaction conforming To the preset transaction form, and the uplink transaction is sent To the node of the block chain, so as To store the transaction in the block chain. By the implementation mode, the uplink service based on the edge calculation can be realized.
Reviewing the above process, in an embodiment of the present specification, a data structure of on-chain data of a blockchain is automatically mapped to a table of off-chain devices, and the off-chain devices may provide edge computing power based on the mapped table. Thus, a service node that can provide edge computing power can be quickly built for the blockchain.
According to an embodiment of another aspect, an apparatus for providing a blockchain service is provided. The device for providing the blockchain service is arranged in an equipment under the chain, and the equipment under the chain can be any equipment, platform or equipment cluster with computing and processing capabilities.
Fig. 7 shows a schematic block diagram of an apparatus for providing blockchain services according to one embodiment. As shown in fig. 7, the apparatus 700 for providing block chain service includes: an obtaining unit 701 configured to obtain a data structure of data on a chain from a block link point, where the data structure defines a plurality of fields in the data on the chain; an analyzing unit 702 configured to analyze the obtained data structure, generate and store a field table of each field, where the field table includes a field identifier of a corresponding field and attribute information of the field; the service unit 703 is configured to provide a data interaction service for the block chain according to the field table.
In some optional implementations of this embodiment, the attribute information of the field includes an index identifier of field data of the field, and the apparatus 700 further includes: a receiving unit (not shown in the figure) configured to receive first data from the block link point, the first data including field identifications of the respective fields and field data associated with the field identifications of the respective fields; a field table obtaining unit (not shown in the figure) configured to obtain a field table of each field according to the field identifier of each field; a storage unit (not shown in the figure) configured to store the first data, and establish an index relationship between each field identifier of the first data and each field data through an index identifier of each field data in each field table; the service unit 703 includes an inquiry module (not shown), which is configured to: and querying the first data based on the index relation.
In some optional implementation manners of this embodiment, the first data further includes a data identifier, and the apparatus 700 further includes: a generating unit (not shown in the figure) configured to generate and store a data structure table of the data structure, where the data structure table includes a name of the data structure, an index identifier of the data structure, and a data structure code; wherein, the field table also includes the index identification of the data structure; the memory cell is further configured to: determining the data structure table corresponding to the first data, and determining the index identifier of the data structure from the data structure table; determining the index identification of each field data from the field table according to the field identification of each field and the index identification of the data structure; a data table for generating and storing the first data, wherein the data table comprises: the data identifier, the index identifier of the data structure, each field data and the index identifier of each field data.
In some optional implementations of this embodiment, the query module is further configured to: receiving a data query request from a user terminal, wherein the data query request includes a data identifier of the first data and a field identifier of a target field; acquiring a data table of the first data according to the data identifier of the first data; acquiring a field table of a target field according to an index identifier of a data structure in a data table of first data and a field identifier of the target field; determining the index identification corresponding to the target field according to the field table of the target field; according to the determined index identification, searching field data corresponding to the target field from the data table of the first data; and returning the field data to the user terminal.
In some optional implementations of this embodiment, the apparatus 700 further includes: a log generating unit (not shown in the figure) configured to generate a data query log according to the provided on-chain data query service; a uplink unit (not shown) configured to uplink the data query logs.
In some optional implementations of this embodiment, the service unit 703 is further configured to: receiving an uplink request from a user terminal, wherein the uplink request comprises field data of each field of data to be uplink-transmitted; determining a field identifier corresponding to each field data from the field table of each field according to the field table of each field of the data to be uplink; and carrying out data uplink according to the field data and the field identification corresponding to the field data.
In some optional implementation manners of this embodiment, the obtaining unit 701 is further configured to: sending a transaction invoking a contract to a block link point, the contract for defining a data structure of data on the chain; the data structure is received from a block link point.
In some optional implementations of this embodiment, the parsing unit 702 is further configured to: checking the acquired data structure; in response to determining that the data structure has verified, determining a programming language used by the data structure; and analyzing the data structure according to a programming language to generate a field table of each field.
According to an embodiment of another aspect, there is also provided a computer-readable storage medium having stored thereon a computer program, which, when executed in a computer, causes the computer to perform the method described in fig. 3.
According to an embodiment of still another aspect, there is also provided a computing device including a memory and a processor, wherein the memory stores executable code, and the processor executes the executable code to implement the method described in fig. 3.
In the 90 s of the 20 th century, improvements in a technology could clearly distinguish between improvements in hardware (e.g., improvements in circuit structures such as diodes, transistors, switches, etc.) and improvements in software (improvements in process flow). However, as technology advances, many of today's process flow improvements have been seen as direct improvements in hardware circuit architecture. Designers almost always obtain the corresponding hardware circuit structure by programming an improved method flow into the hardware circuit. Thus, it cannot be said that an improvement in the process flow cannot be realized by hardware physical modules. For example, a Programmable Logic Device (PLD), such as a Field Programmable Gate Array (FPGA), is an integrated circuit whose Logic functions are determined by programming the Device by a user. A digital system is "integrated" on a PLD by the designer's own programming without requiring the chip manufacturer to design and fabricate application-specific integrated circuit chips. Furthermore, nowadays, instead of manually making an Integrated Circuit chip, such Programming is often implemented by "logic compiler" software, which is similar to a software compiler used in program development and writing, but the original code before compiling is also written by a specific Programming Language, which is called Hardware Description Language (HDL), and HDL is not only one but many, such as abel (advanced Boolean Expression Language), ahdl (alternate Hardware Description Language), traffic, pl (core universal Programming Language), HDCal (jhdware Description Language), lang, Lola, HDL, laspam, hardward Description Language (vhr Description Language), vhal (Hardware Description Language), and vhigh-Language, which are currently used in most common. It will also be apparent to those skilled in the art that hardware circuitry that implements the logical method flows can be readily obtained by merely slightly programming the method flows into an integrated circuit using the hardware description languages described above.
The controller may be implemented in any suitable manner, for example, the controller may take the form of, for example, a microprocessor or processor and a computer-readable medium storing computer-readable program code (e.g., software or firmware) executable by the (micro) processor, logic gates, switches, an Application Specific Integrated Circuit (ASIC), a programmable logic controller, and an embedded microcontroller, examples of which include, but are not limited to, the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320, the memory controller may also be implemented as part of the control logic of the memory. Those skilled in the art will also appreciate that, in addition to implementing the controller as pure computer readable program code, the same functionality can be implemented by logically programming method steps such that the controller is in the form of logic gates, switches, application specific integrated circuits, programmable logic controllers, embedded microcontrollers and the like. Such a controller may thus be regarded as a hardware component and the means for performing the various functions included therein may also be regarded as structures within the hardware component. Or even means for performing the functions may be regarded as being both a software module for performing the method and a structure within a hardware component.
The systems, devices, modules or units illustrated in the above embodiments may be implemented by a computer chip or an entity, or by a product with certain functions. One typical implementation device is a server system. Of course, this application does not exclude that with future developments in computer technology, the computer implementing the functionality of the above described embodiments may be, for example, a personal computer, a laptop computer, a vehicle-mounted human-computer interaction device, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device or a combination of any of these devices.
Although one or more embodiments of the present description provide method operational steps as described in the embodiments or flowcharts, more or fewer operational steps may be included based on conventional or non-inventive approaches. The order of steps recited in the embodiments is merely one manner of performing the steps in a multitude of orders and does not represent the only order of execution. When an actual apparatus or end product executes, it may execute sequentially or in parallel (e.g., parallel processors or multi-threaded environments, or even distributed data processing environments) according to the method shown in the embodiment or the figures. The terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, the presence of additional identical or equivalent elements in processes, methods, articles, or apparatus that include the recited elements is not excluded. For example, the use of the terms first, second, etc. are used to denote names, but not to denote any particular order.
For convenience of description, the above devices are described as being divided into various modules by functions, and are described separately. Of course, when implementing one or more of the present description, the functions of each module may be implemented in one or more software and/or hardware, or a module implementing the same function may be implemented by a combination of multiple sub-modules or sub-units, etc. The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units is only one logical division, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In a typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include forms of volatile memory in a computer readable medium, Random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). Memory is an example of a computer-readable medium.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage, graphene storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
As will be appreciated by one skilled in the art, one or more embodiments of the present description may be provided as a method, system, or computer program product. Accordingly, one or more embodiments of the present description may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, one or more embodiments of the present description may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
One or more embodiments of the present description may be described in the general context of computer-executable instructions, such as program modules, being executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform particular tasks or implement particular abstract data types. One or more embodiments of the present specification can also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed computing environment, program modules may be located in both local and remote computer storage media including memory storage devices.
The embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the system embodiment, since it is substantially similar to the method embodiment, the description is simple, and for the relevant points, reference may be made to the partial description of the method embodiment. In the description of the specification, reference to the description of the term "one embodiment," "some embodiments," "an example," "a specific example," or "some examples," etc., means that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the specification. In this specification, the schematic representations of the terms used above are not necessarily intended to refer to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples. Furthermore, various embodiments or examples and features of different embodiments or examples described in this specification can be combined and combined by one skilled in the art without contradiction.
The above description is merely exemplary of one or more embodiments of the present disclosure and is not intended to limit the scope of one or more embodiments of the present disclosure. Various modifications and alterations to one or more embodiments described herein will be apparent to those skilled in the art. Any modification, equivalent replacement, improvement or the like made within the spirit and principle of the present specification should be included in the scope of the claims.

Claims (18)

1. A method for providing block chain service is applied to equipment under a chain, and comprises the following steps:
obtaining a data structure of data on a chain from a block link point, the data structure defining a plurality of fields in the data on the chain;
analyzing the acquired data structure, and generating and storing a field table of each field, wherein the field table comprises field identifications of corresponding fields and attribute information of the fields;
and providing data interaction service for the block chain according to the field table.
2. The method of claim 1, wherein the attribute information of the field includes an index identifier of field data of the field, the method further comprising:
receiving first data from the block chain node, wherein the first data comprises field identifications of all fields and field data of all fields, which are associated with the field identifications;
acquiring a field table of each field according to the field identification of each field;
storing the first data, and establishing an index relation between each field identification of the first data and each field data through the index identification of each field data in each field table;
the providing the data interaction service for the blockchain according to the field table comprises:
and querying the first data based on the index relation.
3. The method of claim 2, wherein the first data further comprises a data identifier, the method further comprising:
generating and storing a data structure table of the data structure, wherein the data structure table comprises the name of the data structure, the index identification of the data structure and a data structure code; wherein, the field table further comprises an index identifier of the data structure;
the storing the first data, and the establishing of the index relationship between each field identifier of the first data and each field data by the index identifier includes:
determining the data structure table corresponding to the first data, and determining the index identification of the data structure from the data structure table;
determining the index identification of each field data from the field table according to the field identification of each field and the index identification of the data structure;
generating and storing a data table of the first data, wherein the data table comprises: the data identification, the index identification of the data structure, each field data and the index identification of each field data.
4. The method of claim 3, wherein the querying the first data based on the index relationship comprises:
receiving a data query request on a chain from a user terminal, wherein the data query request comprises a data identifier of the first data and a field identifier of a target field;
acquiring a data table of the first data according to the data identifier of the first data;
acquiring a field table of a target field according to an index identifier of a data structure in a data table of first data and a field identifier of the target field;
determining an index identifier corresponding to the target field according to the field table of the target field;
according to the determined index identification, searching field data corresponding to the target field from a data table of the first data;
and returning the field data to the user terminal.
5. The method of claim 1, wherein the method further comprises:
generating a data query log according to the provided on-chain data query service;
and performing uplink on the data query log.
6. The method of claim 1, wherein the providing data interaction services for the blockchain according to the field table comprises:
receiving an uplink request from a user terminal, wherein the uplink request comprises field data of each field of data to be uplink;
determining a field identifier corresponding to each field data from the field table of each field according to the field table of each field of the data to be uplink;
and carrying out data chaining according to the field data and the field identification corresponding to the field data.
7. The method of claim 1, wherein the obtaining a data structure of on-chain data from a block link point comprises:
sending a transaction to a block link point invoking a contract, the contract to define a data structure for data on a chain;
the data structure is received from a block link point.
8. The method of claim 1, wherein the parsing the obtained data structure to generate and store a field table for each field comprises:
checking the acquired data structure;
in response to determining that the data structure verifies, determining a programming language used by the data structure;
and analyzing the data structure according to a programming language to generate a field table of each field.
9. An apparatus for providing a blockchain service, provided in an apparatus under a chain, comprising:
an obtaining unit configured to obtain a data structure of data on a chain from a block link point, the data structure defining a plurality of fields in the data on the chain;
the analysis unit is configured to analyze the acquired data structure, generate and store a field table of each field, wherein the field table comprises field identifications of corresponding fields and attribute information of the fields;
and the service unit is configured to provide data interaction service for the block chain according to the field table.
10. The apparatus of claim 9, wherein the attribute information of a field includes an index identifier of field data of the field, the apparatus further comprising:
a receiving unit configured to receive first data from the block link point, the first data including field identifications of the respective fields and field data associated with the field identifications of the respective fields;
a field table obtaining unit configured to obtain a field table of each field according to the field identifier of each field;
the storage unit is configured to store the first data, and establish an index relationship between each field identifier of the first data and each field data through the index identifier of each field data in each field table;
the service unit includes a query module configured to:
and querying the first data based on the index relation.
11. The apparatus of claim 10, wherein the first data further comprises a data identifier, the apparatus further comprising:
the generating unit is configured to generate and store a data structure table of the data structure, wherein the data structure table comprises the name of the data structure, the index identification of the data structure and a data structure code; wherein, the field table further comprises an index identifier of the data structure;
the storage unit is further configured to:
determining the data structure table corresponding to the first data, and determining the index identification of the data structure from the data structure table;
determining the index identification of each field data from the field table according to the field identification of each field and the index identification of the data structure;
generating and storing a data table of the first data, wherein the data table comprises: the data identification, the index identification of the data structure, each field data and the index identification of each field data.
12. The apparatus of claim 11, wherein the query module is further configured to:
receiving a data query request on a chain from a user terminal, wherein the data query request comprises a data identifier of the first data and a field identifier of a target field;
acquiring a data table of the first data according to the data identifier of the first data;
acquiring a field table of a target field according to an index identifier of a data structure in a data table of first data and a field identifier of the target field;
determining an index identifier corresponding to the target field according to the field table of the target field;
according to the determined index identification, searching field data corresponding to the target field from a data table of the first data;
and returning the field data to the user terminal.
13. The apparatus of claim 9, wherein the apparatus further comprises:
a log generating unit configured to generate a data query log according to the provided on-chain data query service;
and the uplink unit is configured to uplink the data query log.
14. The apparatus of claim 9, wherein the service unit is further configured to:
receiving an uplink request from a user terminal, wherein the uplink request comprises field data of each field of data to be uplink-transmitted;
according to the field table of each field of the data to be uplink-linked, determining a field identifier corresponding to each field data from the field table of each field;
and carrying out data chaining according to the field data and the field identification corresponding to the field data.
15. The apparatus of claim 9, wherein the obtaining unit is further configured to:
sending a transaction to a block link point invoking a contract, the contract to define a data structure for data on a chain;
receiving the data structure from a block link point.
16. The apparatus of claim 9, wherein the parsing unit is further configured to:
checking the acquired data structure;
in response to determining that the data structure verifies, determining a programming language used by the data structure;
and analyzing the data structure according to a programming language to generate a field table of each field.
17. A computer-readable storage medium, on which a computer program is stored which, when executed in a computer, causes the computer to carry out the method of any one of claims 1-8.
18. A computing device comprising a memory and a processor, wherein the memory has stored therein executable code that, when executed by the processor, performs the method of any of claims 1-8.
CN202210170751.2A 2022-02-23 2022-02-23 Method and apparatus for providing blockchain service Pending CN114528353A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210170751.2A CN114528353A (en) 2022-02-23 2022-02-23 Method and apparatus for providing blockchain service

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210170751.2A CN114528353A (en) 2022-02-23 2022-02-23 Method and apparatus for providing blockchain service

Publications (1)

Publication Number Publication Date
CN114528353A true CN114528353A (en) 2022-05-24

Family

ID=81623870

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210170751.2A Pending CN114528353A (en) 2022-02-23 2022-02-23 Method and apparatus for providing blockchain service

Country Status (1)

Country Link
CN (1) CN114528353A (en)

Similar Documents

Publication Publication Date Title
US20220075793A1 (en) Interface Analysis
CN109614823B (en) Data processing method, device and equipment
CN110032599B (en) Data structure reading and updating method and device, and electronic equipment
CN111859470B (en) Business data chaining method and device
CN111340631B (en) Asset transfer method, device, equipment and system
US20240095538A1 (en) Privacy-preserving graphical model training methods, apparatuses, and devices
CN111046237B (en) User behavior data processing method and device, electronic equipment and readable medium
CN108599973B (en) Log association method, device and equipment
CN107016047A (en) Document query, document storing method and device
US20160299771A1 (en) Collaborative generation of configuration technical data for a product to be manufactured
CN110032568B (en) Data structure reading and updating method and device, and electronic equipment
CN103177329A (en) Rule-based determination and validation in business object processing
CN112241506A (en) User behavior backtracking method, device, equipment and system
CN115269683A (en) Data query method and device based on multi-party cooperation
US20120159515A1 (en) Sharing object representations
CN110992039B (en) Transaction processing method, device and equipment
CN113987337A (en) Search method, system, equipment and storage medium based on componentized dynamic arrangement
CN114327374A (en) Business process generation method and device and computer equipment
Byun et al. Efficient and privacy-enhanced object traceability based on unified and linked EPCIS events
CN106294530A (en) The method and system of rule match
CN104050264A (en) Method and device for generating SQL statement
CN111324645B (en) Block chain data processing method and device
WO2022206209A1 (en) Blockchain-based asset management
CN114528353A (en) Method and apparatus for providing blockchain service
US11074508B2 (en) Constraint tracking and inference generation

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination