A method for blockchain interface encapsulation
The business center module encapsulates block link port calls and data processing, and solves the problems of complexity and data unreadability of block link port calls, improves security and analysis capabilities, and simplifies the blockchain operation process.
Patent Information
- Application Number
- CN202110991851.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-08-27
- Publication Date
- 2024-11-19
- Estimated Expiration
- 2041-08-27
AI Technical Summary
The block link port call process is complicated, the data format is not readable, there are security risks in TLS certificate management, the losses caused by certificate loss or corruption are immeasurable, and blockchain data cannot be statistically analyzed.
Develop business center module, encapsulate the block link port call process and return data, manage certificates through the certification center, establish client-certificate relationship, initialize channels, parse and re-encapsulate blockchain data, and support smart contract transactions, query and data analysis Interface, synchronize data to the local database for statistics regularly.
Simplify block link port calls, improve speed and security, reduce certificate management risks, enhance data readability, and support statistical analysis of blockchain information.
Smart Images

Figure CN113821548B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of blockchain technology, and in particular to a method for blockchain interface encapsulation. Background Art
[0002] As digital currency becomes more popular, the term blockchain has become well known, and the application of blockchain technology has also received widespread attention and recognition in the industry. Blockchain is a new application that combines many computer technologies. It uses technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, encryption algorithm, etc. However, as far as blockchain applications are concerned for business systems, the focus is only on blockchain interface calls.
[0003] At present, blockchain interface calls provide two modes. One is the native call. The general calling process is as follows: a TLS certificate is generated for the user. The user uses the TLS certificate to call the endorsement node in sequence, and then sends the call result to the sorting node for verification. If the result is consistent, a blockchain transaction is generated, which is then distributed to each node to generate a block. The other is the https call mode.
[0004] The above calling mode mainly has the following problems:
[0005] 1. The calling process is complicated, and improper handling of any step may cause the interface call to fail.
[0006] 2. The data format returned by the interface is not readable and needs to be processed and converted, which requires certain technical skills and the processing process is relatively complicated.
[0007] 3. The TLS certificate is directly handed over to the user, which poses certain security risks to the blockchain itself.
[0008] 4. If the certificate is lost or damaged, it will cause immeasurable losses to business applications.
[0009] 5. The data on the blockchain cannot be statistically analyzed. Summary of the invention
[0010] In view of the above-mentioned problems in the prior art, the purpose of the present invention is to provide a method for blockchain interface encapsulation, by developing a system module business center, encapsulating the blockchain interface calling process and the blockchain interface return data, thereby simplifying the blockchain interface calling process and increasing the readability of the blockchain interface return data.
[0011] The present invention is implemented through the following technical solutions: a method for encapsulating blockchain interface calls, comprising a business center, wherein the business center can encapsulate the calling process of different types of blockchain interfaces and the corresponding blockchain interface return data;
[0012] The encapsulation process is as follows: the business center responds to the blockchain interface call request initiated by the client and obtains the client parameters; obtains the token carried in the blockchain interface call request, and authenticates the validity and legality of the token through the authentication center; after the authentication is passed, obtains the blockchain user's certificate according to the token and hosts the certificate to the business center, and establishes the relationship between the client and the certificate; obtains the channel name passed in when the client calls the blockchain interface, and performs corresponding channel initialization; interacts with the blockchain according to the corresponding blockchain interface, and returns the generated blockchain data to the business center; the business center parses the blockchain data and re-packages the parsed data results.
[0013] Furthermore, the types of blockchain interfaces include smart contract transaction interfaces, smart contract query interfaces, and block information and transaction information query interfaces.
[0014] Furthermore, the channel initialization refers to establishing a direct grpc link between the business center and the blockchain node, and obtaining relevant information in the channel such as the blockchain peer node and the sorting node in the channel. Although the client user does not need to understand the relevant knowledge of the blockchain, it is necessary to know which smart contract is deployed on which channel, and which method in the smart contract implements which business, so that when calling the interface, you can know what interface parameters to pass, which is the prerequisite for the channel initialization business system to interact with the blockchain.
[0015] Furthermore, the process of interaction between the smart contract transaction interface and the blockchain is as follows: the blockchain peer node verifies the validity of the certificate and executes the smart contract after the verification; the smart contract transaction interface is endorsed and verified by randomly selecting a node combination that meets the endorsement strategy, which can maximize the interface performance. Finally, the verification results are sent to the sorting node. After the sorting node verifies that all execution results are consistent, the execution results are sent to each node, and finally blockchain data is formed. After the smart contract is executed, the blockchain data is returned to the business center.
[0016] Furthermore, the process of interaction between the smart contract query interface and the blockchain is as follows: calling the corresponding method in the smart contract, the blockchain peer node verifies the validity of the certificate, and after the verification, calling the corresponding method in the smart contract to obtain the blockchain data, and returning the blockchain data to the business center after execution.
[0017] Furthermore, the process of the block information and transaction information query interface interacting with the blockchain is as follows: calling the corresponding system chain code, the blockchain peer node verifies the validity of the certificate, and returns the query data to the business center after the verification is passed.
[0018] Furthermore, the business center can also encapsulate the calling process of the data analysis interface and the corresponding blockchain interface return data; the encapsulation process of the data analysis interface is as follows: set a scheduled task in the business center, synchronize the corresponding data from the blockchain to the local database at a regular time, and use traditional means to perform statistical analysis in the local database. The client only needs to pass parameters in a certain agreed format and use the traditional http calling mode to complete the relevant operations of the blockchain, which simplifies the blockchain interface calling process to the greatest extent, and can also perform statistical analysis on the information on the blockchain.
[0019] A blockchain interface calling method, characterized in that the client first goes to an authentication center to obtain a token, the authentication center verifies the identity based on the information submitted by the client, and generates a token for the client after successful verification; the client uses the token to call the blockchain interface of the business center, and the blockchain interface is encapsulated using the method described in claim 1.
[0020] The beneficial effects of the present invention are as follows: simplifying blockchain interface calls, making blockchain interface calls faster and more convenient; hosting blockchain interface call certificates in the system to reduce the risk of system use; encapsulating the data returned by the blockchain interface to increase the readability of the data returned by the interface; and conveniently performing statistical analysis on blockchain information. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] Figure 1 Encapsulate the flow chart for the smart contract transaction interface.
[0022] Figure 2 Encapsulate the flow chart for the smart contract query interface.
[0023] Figure 3 Encapsulates the flow chart for the block information and transaction information query interface.
[0024] Figure 4 Encapsulates flow chart for data analysis interface.
[0025] Figure 5 Flowchart for client calling interface. DETAILED DESCRIPTION
[0026] In order to clearly illustrate the technical features of this solution, this solution is described below through a specific implementation method.
[0027] See also Figure 1-Figure 5 ,Embodiment 1, the present invention is implemented by the following technical solutions: a method for blockchain interface encapsulation, comprising a business center, the business center can encapsulate the calling process of different types of blockchain interfaces and the corresponding blockchain interface return data;
[0028] The encapsulation process is as follows: the business center responds to the blockchain interface call request initiated by the client and obtains the client parameters; obtains the token carried in the blockchain interface call request, and authenticates the validity and legality of the token through the authentication center; after the authentication is passed, obtains the blockchain user's certificate according to the token and hosts the certificate to the business center, and establishes the relationship between the client and the certificate; obtains the channel name passed in when the client calls the blockchain interface, and performs corresponding channel initialization; interacts with the blockchain according to the corresponding blockchain interface, and returns the generated blockchain data to the business center; the business center parses the blockchain data and re-packages the parsed data results.
[0029] The types of blockchain interfaces include smart contract transaction interfaces, smart contract query interfaces, and block information and transaction information query interfaces.
[0030] The channel initialization refers to establishing a direct grpc link between the business center and the blockchain node, and obtaining relevant information in the channel such as the blockchain peer node and sorting node in the channel. Although the client user does not need to understand the relevant knowledge of the blockchain, it is necessary to know which smart contract is deployed on which channel, and which method in the smart contract implements which business, so that when calling the interface, you can know what interface parameters to pass, which is the prerequisite for the channel initialization business system to interact with the blockchain.
[0031] See also Figure 1 The process of interaction between the smart contract transaction interface and the blockchain is as follows: the blockchain peer node verifies the validity of the certificate and executes the smart contract after the verification; the smart contract transaction interface is endorsed and verified by randomly selecting a node combination that meets the endorsement strategy, which can maximize the interface performance. Finally, the verification results are sent to the sorting node. After the sorting node verifies that all execution results are consistent, the execution results are sent to each node, and finally the blockchain data is formed. After the smart contract is executed, the blockchain data is returned to the business center.
[0032] The following are some examples:
[0033] {"resultcode":200,
[0034] "msg":"Execution successful",
[0035] "data":"d42bc84269d4a7507e16ebdcc85b5d1520a69c5a046fd71795d7c192e3c9bda5"}, where resultcode is whether the interface is executed successfully, msg is the text prompt after the interface is executed, and data is the execution result. Depending on the actual situation, it can be a string, a json object or an array. Traditional database transaction operations generally return the number of affected rows, while blockchain transaction operations encapsulate the interface result return as the transaction ID of the transaction execution.
[0036] See also Figure 2 The process of interaction between the smart contract query interface and the blockchain is as follows: calling the corresponding method in the smart contract, the blockchain peer node verifies the validity of the certificate, and after the verification, calling the corresponding method in the smart contract to obtain the blockchain data, and returning the blockchain data to the business center after execution.
[0037] See also Figure 3 ,The process of the block information and transaction information query interface interacting with the ,blockchain is as follows: the corresponding system chain code is called, the blockchain peer node verifies the ,validity of the certificate, and returns the query data to the ,business center after the verification is passed.
[0038] Example 2, see Figure 4 On the basis of the first embodiment, the business center can also encapsulate the calling process of the data analysis interface and the corresponding blockchain interface return data; the encapsulation process of the data analysis interface is as follows: a scheduled task is set in the business center, and the corresponding data is synchronized from the blockchain to the local database at a regular time, and the local database can be statistically analyzed using traditional means. The client only needs to pass parameters in a certain agreed format and use the traditional http calling mode to complete the relevant operations of the blockchain, which simplifies the blockchain interface calling process to the greatest extent, and can also perform statistical analysis on the information on the blockchain.
[0039] See also Figure 5 Embodiment 3, based on embodiment 1 or 2, a blockchain interface calling method is provided, characterized in that the client first goes to the authentication center to obtain a token, the authentication center verifies the identity according to the information submitted by the client, and generates a token for the client after successful verification; the client uses the token to call the blockchain interface of the business center, and the blockchain interface is encapsulated using the method described in claim 1.
[0040] When a project requires the use of blockchain, the client only needs to go to the authentication center to obtain a token certificate. The authentication center verifies the identity based on the information submitted by the client. After successful verification, it generates token information for the client and returns it to the client. The client uses the token to call the chain code interface of the business center, and finally displays the data returned by the business center to the client. The complex chain code calling process can be completed in a few simple steps, so that even if the blockchain is used during the project development process, it does not need to spend too much energy, and more attention can be spent on the logical implementation of the business system.
[0041] In the description of the invention, the previous detailed description has been described various embodiments of the apparatus and / or process by using block diagrams, flow charts and / or examples. To the extent that such block diagrams, flow charts and / or examples contain one or more functions and / or operations, it will be understood by those skilled in the art that each function and / or operation within such block diagrams, flow charts or examples can be implemented individually and / or collectively by many various hardware, software, firmware or any combination thereof.
[0042] There is little difference between hardware and software implementations of various aspects of the system; the use of hardware or software is typically (but not always, as the choice between hardware and software may become important in certain scenarios) a design choice that represents a tradeoff between cost and efficiency. There are various means (e.g., hardware, software, and / or firmware) by which the processes and / or systems and / or other techniques described herein may be implemented, and the preferred means will vary depending on the scenario in which the processes and / or systems and / or other techniques are deployed. For example, if the implementer determines that speed and accuracy are extremely important, then the implementer may choose a primarily hardware and / or firmware means; if flexibility is extremely important, then the implementer may choose a primarily software implementation; or, but equally alternatively, the implementer may choose some combination of hardware, software, and / or firmware.
[0043] The terms "first", "second", etc. are used for descriptive purposes only and are not to be understood as indicating or implying relative importance or implicitly indicating the number of the technical features indicated. Thus, a feature defined as "first", "second", etc. may explicitly or implicitly include one or more of the features. In the description of the present invention, unless otherwise specified, "plurality" means two or more.
[0044] Technical features not described in the present invention can be achieved through or by adopting existing technologies and will not be described in detail here. Of course, the above description is not a limitation of the present invention, and the present invention is not limited to the above examples. Changes, modifications, additions or substitutions made by ordinary technicians in this technical field within the essential scope of the present invention should also fall within the scope of protection of the present invention.
[0045] In the description of the invention, it should be noted that, unless otherwise clearly specified and limited, the terms "install", "connect", "connect", and "set" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection, or it can be indirectly connected through an intermediate medium, or it can be the internal communication of two components. For ordinary technicians in this field, the specific meanings of the above terms in the invention can be understood according to specific circumstances.
Claims
1. A method for blockchain interface encapsulation, characterized in that: The calling process of the blockchain interface and the corresponding blockchain interface return data are packaged through the business center; The packaging process is as follows: The business center responds to the blockchain interface call request initiated by the client and obtains the client parameters; Obtain the token carried in the blockchain interface call request, and authenticate the validity and legality of the token through the authentication center; After the authentication is passed, the blockchain user's certificate is obtained according to the token and the certificate is hosted in the business center, and the relationship between the client and the certificate is established; Obtain the channel name passed in when the client calls the blockchain interface, and perform corresponding channel initialization; Interact with the blockchain according to the corresponding blockchain interface, and return the generated blockchain data to the business center; The business center parses the blockchain data and repackages the parsed data results; The types of blockchain interfaces include smart contract transaction interfaces, smart contract query interfaces, and block information and transaction information query interfaces; The process of interaction between the smart contract transaction interface and the blockchain is as follows: the blockchain peer node verifies the validity of the certificate and executes the smart contract after the verification; the smart contract transaction interface is endorsed and verified by randomly selecting a node combination that meets the endorsement strategy, and finally the verification results are sent to the sorting node. After the sorting node verifies that all execution results are consistent, the execution results are sent to each node, and finally the blockchain data is formed. After the smart contract is executed, the blockchain data is returned to the business center; The process of the smart contract query interface interacting with the blockchain is as follows: calling the corresponding method in the smart contract, the blockchain peer node verifies the validity of the certificate, and after the verification, calling the corresponding method in the smart contract to obtain the blockchain data, and returning the blockchain data to the business center after the execution is completed; The process of the block information and transaction information query interface interacting with the blockchain is as follows: calling the corresponding system chain code, the blockchain peer node verifies the validity of the certificate, and returns the query data to the business center after the verification is passed.
2. The method for blockchain interface encapsulation according to claim 1, characterized in that: The channel initialization refers to establishing a direct grpc link between the business center and the blockchain node, and obtaining relevant information in the channel such as the blockchain peer node and sorting node in the channel.
3. The method for blockchain interface encapsulation according to claim 1, characterized in that: The business center can also encapsulate the calling process of the data analysis interface and the corresponding data analysis interface return data; the encapsulation process of the data analysis interface is as follows: a scheduled task is set in the business center, and the corresponding data is synchronized from the blockchain to the local database at a regular interval, so that traditional means can be used to perform statistical analysis in the local database.
4. A blockchain interface calling method, characterized in that: The client first goes to the authentication center to obtain a token. The authentication center verifies the identity based on the information submitted by the client, and generates a token for the client after successful verification; The client uses the token to call the blockchain interface of the business center, and the blockchain interface is encapsulated using the method described in claim 1.
