A data communication method and device for a blockchain client

By including node flags, identity flags and data signatures in the Http request of the blockchain client, and authenticating and forwarding them by the Http proxy server, the problem of Http request identity checking and user usage difficulty in blockchain business is solved. A secure and simplified Http communication between blockchain clients and nodes is realized.

CN114338036BActive Publication Date: 2024-11-29HANGZHOU QULIAN TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202111589922.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-23
Publication Date
2024-11-29
Estimated Expiration
2041-12-23

AI Technical Summary

Technical Problem

The existing technology cannot directly support the identity verification function of Http requests in blockchain services, and in blockchain scenarios, users do not care about the IP address of the node, and forwarding using the IP address will increase the difficulty of users.

Method used

By including node flags, identity flags and data signatures in the Http request of the blockchain client, and receiving and verifying these signatures by the Http proxy server, if the authentication is passed, the Http request will be forwarded to the target blockchain node.

Benefits of technology

It realizes Http communication between blockchain clients and blockchain nodes, reduces the difficulty of users and enhances the security of data communication.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114338036B_ABST
    Figure CN114338036B_ABST
Patent Text Reader

Abstract

The embodiment of the present application is applicable to the field of blockchain technology, and provides a data communication method and device for a blockchain client, the method comprising: receiving an Http request from a blockchain client, the Http request comprising a request header; obtaining a node flag, an identity flag and a data signature of the Http request from the request header; authenticating the Http request according to the data signature and the identity flag; if the Http request passes the authentication, forwarding the Http request to the corresponding target blockchain node according to the node flag. Through the above method, the Http proxy in the blockchain business can be realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of blockchain technology, and in particular, relates to a data communication method and device for a blockchain client. Background Art

[0002] Http (Hyper Text Transfer Protocol) is a simple request-response protocol. For blockchains that support Http (such as the Hyperchain blockchain), the blockchain client can send Http requests to interact with the blockchain.

[0003] However, on the one hand, the existing technology only supports the forwarding of regular Http requests, and cannot directly support the identity verification function for Http requests on blockchain services; on the other hand, the existing technology generally implements forwarding by configuring IP addresses, but in blockchain scenarios, users generally do not care about the IP of the node. If the IP is still used, it will increase the difficulty of use for users. Summary of the invention

[0004] In view of this, an embodiment of the present application provides a data communication method and device for a blockchain client, which is used to implement identity authentication of an Http proxy in a blockchain business.

[0005] A first aspect of an embodiment of the present application provides a data communication method of a blockchain client, which is applied to an Http proxy server, and the method includes:

[0006] Receive an HTTP request from a blockchain client, where the HTTP request includes a request header and a request body;

[0007] Obtaining the node mark, identity mark and data signature of the Http request from the request header, wherein the data signature is obtained by the blockchain client encrypting the request body according to the identity mark;

[0008] Authenticate the HTTP request based on the data signature and the identity mark;

[0009] If the Http request passes the identity authentication, the Http request is forwarded to the corresponding target blockchain node according to the node flag.

[0010] A second aspect of an embodiment of the present application provides a data communication method of a blockchain client, which is applied to a blockchain client, and the method includes:

[0011] Determine the node flag and identity flag of the HTTP request, where the node flag is used to represent the target blockchain node of the HTTP request;

[0012] Writing the node flag and the identity flag into the request header of the Http request;

[0013] The Http request is sent to an Http proxy server, and the Http proxy server is used to forward the Http request to the target blockchain node.

[0014] A third aspect of the embodiments of the present application provides a data communication device of a blockchain client, which is applied to an Http proxy server, and the device includes:

[0015] A receiving module, used to receive an Http request from a blockchain client, wherein the Http request includes a request header and a request body;

[0016] An acquisition module, used to obtain the node mark, identity mark and data signature of the Http request from the request header, wherein the data signature is obtained by the blockchain client encrypting the request body according to the identity mark;

[0017] A verification module, used for authenticating the HTTP request according to the data signature and the identity mark;

[0018] The forwarding module is used to forward the Http request to the corresponding target blockchain node according to the node flag if the Http request passes the identity authentication.

[0019] A fourth aspect of the embodiments of the present application provides a data communication device of a blockchain client, which is applied to a blockchain client, and the device includes:

[0020] A determination module, used to determine the node flag and identity flag of the HTTP request, wherein the node flag is used to characterize the target blockchain node of the HTTP request;

[0021] A writing module, used for writing the node mark and the identity mark into the request header of the Http request;

[0022] The sending module is used to send the Http request to the Http proxy server, and the Http proxy server is used to forward the Http request to the target blockchain node.

[0023] A fifth aspect of an embodiment of the present application provides a server, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method described in the first aspect when executing the computer program.

[0024] A sixth aspect of an embodiment of the present application provides a terminal device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method described in the second aspect above when executing the computer program.

[0025] A seventh aspect of an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method described in the first aspect above is implemented.

[0026] An eighth aspect of an embodiment of the present application provides another computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method described in the second aspect above is implemented.

[0027] A ninth aspect of the embodiments of the present application provides a computer program product. When the computer program product runs on a server, the server executes the method described in the first aspect.

[0028] A tenth aspect of the embodiments of the present application provides another computer program product. When the computer program product runs on a server, the server executes the method described in the second aspect.

[0029] Compared with the prior art, the embodiments of the present application have the following advantages:

[0030] In the embodiment of the present application, the blockchain client can realize Http communication with the blockchain node through the Http proxy server. The Http proxy server receives the Http request from the blockchain client, then extracts the node mark, identity mark and data signature from the request header, and then uses the identity mark and data signature to authenticate the Http request; if the Http request passes the authentication, the Http proxy server can forward the Http request to the corresponding target blockchain node according to the node mark. In the embodiment of the present application, when the user accesses the blockchain through the blockchain client, he does not need to care about the IP of the blockchain, but only needs to know the node mark of the blockchain, which reduces the difficulty of use for the user. BRIEF DESCRIPTION OF THE DRAWINGS

[0031] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the embodiments or prior art descriptions. Obviously, the drawings described below are only some embodiments of the present application, and for ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0032] Figure 1This is a schematic diagram of the steps of a data communication method for a blockchain client provided by an embodiment of the present application;

[0033] Figure 2 This is a schematic diagram of the steps of another data communication method of a blockchain client provided by an embodiment of the present application;

[0034] Figure 3 This is a flowchart of a data communication method of a blockchain client provided by an embodiment of the present application;

[0035] Figure 4 This is a schematic diagram of a data communication device of a blockchain client provided by an embodiment of the present application;

[0036] Figure 5 It is a schematic diagram of another data communication device of a blockchain client provided by an embodiment of the present application;

[0037] Figure 6 This is a schematic diagram of a server provided by an embodiment of the present application. DETAILED DESCRIPTION

[0038] In the following description, specific details such as specific system structures, technologies, etc. are proposed for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application can also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from hindering the description of the present application.

[0039] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, wholes, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or combinations thereof.

[0040] It should also be understood that the term “and / or” used in the specification and appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.

[0041] As used in the specification and appended claims of this application, the term "if" can be interpreted as "when" or "uponce" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrase "if it is determined" or "if [described condition or event] is detected" can be interpreted as meaning "uponce it is determined" or "in response to determining" or "uponce [described condition or event] is detected" or "in response to detecting [described condition or event]", depending on the context.

[0042] In addition, in the description of the present application specification and the appended claims, the terms "first", "second", "third", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.

[0043] References to "one embodiment" or "some embodiments" etc. described in the specification of this application mean that one or more embodiments of the present application include specific features, structures or characteristics described in conjunction with the embodiment. Therefore, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.

[0044] The technical solution of the present application is described below through specific embodiments.

[0045] Reference Figure 1 , shows a schematic flow chart of a data communication method for a blockchain client provided by an embodiment of the present application, which may specifically include the following steps:

[0046] S101, receiving an HTTP request from a blockchain client, wherein the HTTP request includes a request header and a request body.

[0047] The execution subject of this embodiment is a proxy server, and in this application, the proxy server can specifically be an Http proxy server. The method in this embodiment can be applied to blockchain business. Blockchain is a decentralized distributed shared account book composed of multiple blockchain nodes. Users can interact with blockchain by sending Http requests to blockchain nodes through a blockchain client that integrates the corresponding blockchain software development kit (Software Development Kit, SDK). Data communication in this embodiment can refer to data interaction between blockchain clients and blockchain nodes.

[0048] Http proxy is a bridge between the client and the server. It can receive the Http request from the client and forward it to the server. For blockchain business, the client of Http proxy is the blockchain client, and the server is the blockchain node. By using Http proxy, on the one hand, blockchain nodes can be protected more flexibly and the possibility of blockchain nodes being attacked can be reduced; on the other hand, resources can be allocated more effectively and the response speed of Http requests can be improved.

[0049] The blockchain client can generate an Http request according to user needs, and then send the Http request to the corresponding blockchain node through the proxy server. In this process, the proxy server can receive the Http request sent by the blockchain client, process the Http request, and then send it to the corresponding blockchain node.

[0050] S102, obtaining the node mark, identity mark and data signature of the Http request from the request header, wherein the data signature is obtained by the blockchain client encrypting the request body according to the identity mark.

[0051] Specifically, the Http request includes a request header and a request body. The request header may include a node flag, an identity flag, and a data signature. In an embodiment of the present application, the blockchain client software development kit may be modified in advance so that the request header of the Http request generated by the blockchain client may include a node flag, an identity flag, and a data signature. The above-mentioned node flag is the unique identification information of the target blockchain node; the identity flag refers to the identity information of the user; and the data signature can be obtained by encrypting the request body according to the identity flag.

[0052] The data in the request header can exist in the form of key-value, that is, the request header can include a node flag field, an identity flag field and a data signature field. The proxy server can obtain the node flag, identity flag and data signature by obtaining the values ​​of each field.

[0053] S103, authenticating the HTTP request according to the data signature and the identity mark.

[0054] Specifically, the Http proxy server and the blockchain client can agree on an encryption algorithm in advance, such as the MD5 algorithm. After the Http proxy server obtains the data signature, it can use the pre-agreed encryption algorithm to encrypt the identity mark and the request body to obtain the signature to be verified; then compare the signature to be verified with the data signature extracted from the request header. If the two are the same, it is determined that the Http request has passed the identity authentication.

[0055] This step, on the one hand, authenticates the HTTP request, and on the other hand, ensures that the data in the request body is not tampered with, thereby ensuring data security during the data communication process.

[0056] S104: If the Http request passes the identity authentication, the Http request is forwarded to the corresponding target blockchain node according to the node flag.

[0057] Specifically, the unique corresponding target blockchain node can be determined according to the node flag, and then the proxy server forwards the Http request to the target blockchain node.

[0058] In one possible implementation, the http proxy server may pre-store the identifiers and corresponding IP addresses of multiple blockchain nodes. Through the node identifier, the blockchain node may determine the IP address of the target blockchain, establish a connection with the target blockchain node, and then send the http request to the corresponding target blockchain node through the connection.

[0059] In addition, after receiving the Http request, the target blockchain node needs to send the return result of the Http request to the blockchain client; at this time, the target blockchain node can send the return result to the proxy server, and then the proxy server forwards the return result to the corresponding blockchain client.

[0060] In a possible implementation, the target blockchain node needs to use a certificate when performing data communication. After receiving the Http request, the proxy server can obtain the certificate information of the target blockchain node; then load the corresponding certificate according to the certificate information, and send the certificate to the target blockchain node along with the Http request.

[0061] In this embodiment, when the blockchain client communicates data with the blockchain node through the Http proxy, the blockchain client does not need to know the IP address of the blockchain, nor does it need to know whether the blockchain node requires a certificate. It only needs to add an identity flag and a node flag to the request header to send the Http request to the target blockchain node, thereby achieving lightweight blockchain client.

[0062] Reference Figure 2 , shows a schematic flow chart of another data communication method of a blockchain client provided by an embodiment of the present application, which may specifically include the following steps:

[0063] S201, determining a node flag and an identity flag of an HTTP request, wherein the node flag is used to characterize a target blockchain node of the HTTP request.

[0064] The execution subject of this embodiment is the blockchain client. The blockchain client includes a client software development kit. In this embodiment, the client software development kit can be modified. Specifically, in the entry method of the client software development kit to send the Http request, the node flag and identity flag that the Http proxy can recognize can be passed and put into the request header. In the logic of sending the request body, the original request body data is encrypted in combination with the identity flag to obtain a data signature, and the signature is put into the request header.

[0065] Specifically, the blockchain client can be installed on a terminal device, and the user can log in to the blockchain client through the terminal device and then send an HTTP request to the blockchain. The node flag can be the unique identification information of the target blockchain node of the HTTP request; the identity flag can be the identification information of the user. For example, the node flag can be node1; the identity flag can be user1.

[0066] S202, writing the node flag and the identity flag into the request header of the Http request.

[0067] Specifically, the request header may include a node flag field and an identity flag field; the node flag is written into the request header as the value of the node flag field; and the identity flag is written into the request header as the value of the identity flag field. Exemplarily, the request header includes a node flag field Node-ID=node1 and an identity flag field User-ID=user1.

[0068] The request header may also include a data signature, which can be used to detect whether the HTTP request has been tampered with. Specifically, the request body may be encrypted in combination with the identity mark to obtain a data signature, and then the data signature may be written into the corresponding position of the request header.

[0069] In the embodiment of the present application, both the blockchain client and the proxy server can use an irreversible algorithm to encrypt the request body to obtain a data signature. The irreversible algorithm can specifically include the MD5 algorithm, the SHS algorithm, etc.

[0070] For example, the blockchain client can perform MD5 encryption on the identity mark and the request body to obtain a data signature; the proxy server can perform MD5 encryption on the same identity mark and the request body to obtain a signature to be verified. In this way, the data signature and the signature to be verified are the same. If the proxy service uses a different identity mark or a different request body when obtaining the signature to be verified, the obtained signature to be verified will be different from the data signature.

[0071] S203, sending the Http request to an Http proxy server, and the Http proxy server is used to forward the Http request to the target blockchain node.

[0072] Specifically, after the blockchain client generates an Http request, it can send the Http request to the Http proxy server. After receiving the Http request, the Http proxy server can authenticate the Http request based on the identity flag; and forward the Http request to the corresponding blockchain node based on the node flag.

[0073] In this embodiment, by adding an identity flag and a node flag in the request header, the proxy server can determine the target blockchain node according to the node flag; the identity flag can also be used to implement identity authentication of the Http proxy in the blockchain business, thereby ensuring the security of data communication.

[0074] It should be noted that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.

[0075] Reference Figure 3 , shows a flow chart of another data communication method of a blockchain client provided by an embodiment of the present application. Figure 3 As shown, the blockchain client includes the client SDK, and the blockchain client can send an Http request to the Http proxy; the Http proxy can receive the Http request from the blockchain client and forward the Http request to the corresponding blockchain. The blockchain can return the result to the Http proxy for the Http request, and the Http proxy can receive the return result from the blockchain and send the return result to the corresponding blockchain client.

[0076] The method in this embodiment is described below with a specific example. Assume that the blockchain client is a client Lite-SDK using the Java language, the user's identity mark is user1, and the blockchain node whose node mark is node1 needs to be accessed.

[0077] First, the client SDK needs to be modified as follows:

[0078] In the entry method HttpProvider.Builder of Lite-SDK to send Http request, the node flag node1 and identity flag user1 that can be recognized by the Http proxy are passed and put into the request header, that is, the request header contains Node-ID = node1, User-ID = user1.

[0079] In the logic of sending the request body, an irreversible encryption algorithm, such as the MD5 algorithm, is used in combination with the identity token user1 to encrypt the original request body data {"method":"getState"} to obtain a data signature A9861C2938E335538BF5FB5234CC567C, and the data signature is placed in the request header, that is, the request header contains Sign=A9861C2938E335538BF5FB5234CC567C.

[0080] After the above transformation, the method in this application can be used to implement user user1 sending a request to blockchain node node1 through the blockchain client. The specific process can be as follows:

[0081] The blockchain client can send http requests to the http proxy server. The specific processing process of the http proxy server is as follows:

[0082] First, obtain the node mark node1 and the identity mark user1 from the request header Node-ID=node1, User-ID=user1, so as to identify the target node node1 of the Http request;

[0083] Then, obtain the data signature from the request header Sign = A9861C2938E335538BF5FB5234CC567C, and verify the request body data {"method":"getState"} according to the identity mark user1;

[0084] Then determine whether the target node node1 needs a certificate. If the Http request requires a certificate, load the corresponding certificate. Assuming that the blockchain node node1 uses the server certificate service.cert, load the certificate in the Http proxy.

[0085] Finally, the Http request is forwarded to the target node node1, and the result is returned to the blockchain client.

[0086] Reference Figure 4 , shows a schematic diagram of a data communication device of a blockchain client provided by an embodiment of the present application, which may specifically include a receiving module 41, an acquisition module 42, a verification module 43, and a forwarding module 44, wherein:

[0087] The receiving module 41 is used to receive an HTTP request from a blockchain client, wherein the HTTP request includes a request header and a request body;

[0088] An acquisition module 42 is used to obtain the node mark, identity mark and data signature of the HTTP request from the request header, and the data signature is obtained by the blockchain client encrypting the request body according to the identity mark;

[0089] A verification module 43, used for authenticating the HTTP request according to the data signature and the identity mark;

[0090] The forwarding module 44 is used to forward the Http request to the corresponding target blockchain node according to the node flag if the Http request passes the identity authentication.

[0091] In a possible implementation, the Http request further includes a request body, and the verification module 42 includes:

[0092] The encryption submodule is used to encrypt the request body according to the identity mark and generate a signature to be verified for the Http request;

[0093] The verification submodule is used to determine that the Http request passes the identity authentication if the signature to be verified is the same as the data signature.

[0094] In a possible implementation, the above device further includes:

[0095] A return result receiving module, used to receive the return result of the target blockchain node for the Http request;

[0096] The returned result forwarding module is used to forward the returned result to the blockchain client.

[0097] In a possible implementation, the above device further includes:

[0098] A certificate information acquisition module, used to obtain the certificate information of the target blockchain node;

[0099] The certificate loading module is used to load the corresponding certificate according to the certificate information, and the certificate is used for authentication of the target blockchain node.

[0100] Reference Figure 5 , shows a schematic diagram of another data communication device of a blockchain client provided by an embodiment of the present application, which may specifically include: a determination module 51, a writing module 52 and a sending module 53, wherein:

[0101] A determination module 51 is used to determine a node flag and an identity flag of an HTTP request, wherein the node flag is used to represent a target blockchain node of the HTTP request;

[0102] A writing module 52, used for writing the node mark and the identity mark into the request header of the Http request;

[0103] The sending module 53 is used to send the Http request to the Http proxy server, and the Http proxy server is used to forward the Http request to the target blockchain node.

[0104] In a possible implementation, the above device further includes:

[0105] An encryption module, used to encrypt the request body of the Http request according to the identity mark to obtain a data signature of the request body;

[0106] The data signature writing module is used to write the data signature into the request header, and the data signature is used to authenticate the HTTP request.

[0107] In a possible implementation, the writing module 52 includes:

[0108] Creating a submodule, used to create a node flag field and an identity flag field in the request header;

[0109] A node flag writing submodule, used for writing the node flag into the request header as the value of the node flag field;

[0110] The identity mark writing submodule is used to write the identity mark into the request header as the value of the identity mark field.

[0111] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the description of the method embodiment part.

[0112] Figure 6 A schematic diagram of the structure of a server provided in one embodiment of the present application. Figure 6 As shown, the server 6 of this embodiment includes: at least one processor 60 ( Figure 6 Only one is shown in the figure) a processor, a memory 61, and a computer program 62 stored in the memory 61 and executable on the at least one processor 60, and when the processor 60 executes the computer program 62, the steps in any of the above-mentioned method embodiments are implemented.

[0113] The server 6 may be a computing device such as a cloud server. The server may include, but is not limited to, a processor 60 and a memory 61. Those skilled in the art will appreciate that Figure 6 It is only an example of the server 6 and does not constitute a limitation on the server 6. The server 6 may include more or fewer components than shown in the figure, or a combination of certain components, or different components, for example, it may also include input and output devices, network access devices, etc.

[0114] The processor 60 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.

[0115] In some embodiments, the memory 61 may be an internal storage unit of the server 6, such as a hard disk or memory of the server 6. In other embodiments, the memory 61 may also be an external storage device of the server 6, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the server 6. Further, the memory 61 may also include both an internal storage unit of the server 6 and an external storage device. The memory 61 is used to store an operating system, an application program, a boot loader (BootLoader), data, and other programs, such as the program code of the computer program. The memory 61 may also be used to temporarily store data that has been output or is to be output.

[0116] An embodiment of the present application also provides a terminal device, which includes: at least one processor, a memory, and a computer program stored in the memory and executable on the at least one processor, wherein when the processor executes the computer program, the steps of a data communication method of a blockchain client applied to a blockchain client in the above method embodiment are implemented.

[0117] An embodiment of the present application also provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, it can implement the steps of a data communication method of a blockchain client applied to a proxy server in the above-mentioned various method embodiments.

[0118] An embodiment of the present application also provides another computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, it can implement the steps of a data communication method for a blockchain client applied to a blockchain client in the above-mentioned various method embodiments.

[0119] An embodiment of the present application provides a computer program product. When the computer program product is run on a terminal device, the terminal device implements the steps of a data communication method of a proxy server applied to a blockchain client in each of the above method embodiments.

[0120] An embodiment of the present application provides another computer program product. When the computer program product is run on a terminal device, the terminal device implements the steps of a data communication method for a blockchain client applied to a blockchain client in the above-mentioned various method embodiments when executing the computer program product.

[0121] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, which can be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium can at least include: any entity or device that can carry the computer program code to the camera / terminal device, recording medium, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, RandomAccess Memory), electric carrier signal, telecommunication signal and software distribution medium. For example, a USB flash drive, a mobile hard disk, a magnetic disk or an optical disk. In some jurisdictions, according to legislation and patent practice, computer-readable media cannot be electric carrier signals and telecommunication signals.

[0122] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0123] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0124] In the embodiments provided in the present application, it should be understood that the disclosed devices / terminal equipment and methods can be implemented in other ways. For example, the device / terminal equipment embodiments described above are only schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0125] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0126] The above-described embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application is described in detail with reference to the above-mentioned embodiments, a person skilled in the art should understand that the technical solutions described in the above-mentioned embodiments can still be modified, or some of the technical features can be replaced by equivalents; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application, and should be included in the protection scope of the present application.

Claims

1. A data communication method for a blockchain client, characterized in that: Applied to an Http proxy server, the method comprises: Receive an HTTP request from a blockchain client, where the HTTP request includes a request header and a request body; Obtaining the node mark, identity mark and data signature of the Http request from the request header, wherein the data signature is obtained by the blockchain client encrypting the request body according to the identity mark, and the node mark is the unique identification information of the target blockchain node; Authenticate the HTTP request based on the data signature and the identity mark; If the Http request passes the identity authentication, the Http request is forwarded to the corresponding target blockchain node according to the node flag. The Http proxy server stores the node flags and corresponding IP addresses of multiple blockchain nodes. The node flag is used to determine the IP address of the target blockchain node. The IP address is used to establish a connection with the target blockchain node. The Http proxy server is used to forward the Http request to the target blockchain node through the established connection.

2. The method according to claim 1, characterized in that The Http request also includes a request body, and the identity authentication of the Http request according to the data signature and the identity mark includes: According to the identity mark, the request body is encrypted to generate a signature to be verified for the Http request; If the signature to be verified is the same as the data signature, it is determined that the Http request passes the identity authentication.

3. The method according to claim 1 or 2, characterized in that The method further comprises: Receive the return result of the target blockchain node for the Http request; The returned result is forwarded to the blockchain client.

4. The method according to claim 3, characterized in that The method further comprises: Obtaining certificate information of the target blockchain node; According to the certificate information, the corresponding certificate is loaded, and the certificate is used for authentication of the target blockchain node.

5. A data communication method for a blockchain client, characterized in that: Applied to a blockchain client, the method includes: Determine the node flag and identity flag of the HTTP request, the node flag is used to represent the target blockchain node of the HTTP request, and the node flag is the unique identification information of the target blockchain node; Writing the node mark and the identity mark into the request header of the Http request, wherein the request header also includes a data signature, and the data signature and the identity mark are used to authenticate the identity of the Http request; The Http request is sent to an Http proxy server, which is used to forward the Http request to the target blockchain node. The Http proxy server stores node flags and corresponding IP addresses of multiple blockchain nodes. The node flag is used to determine the IP address of the target blockchain node. The IP address is used to establish a connection with the target blockchain node. The Http proxy server is used to forward the Http request to the target blockchain node through the established connection.

6. The method according to claim 5, characterized in that The method further comprises: According to the identity mark, encrypt the request body of the Http request to obtain a data signature of the request body; The data signature is written into the request header, and the data signature is used to authenticate the HTTP request.

7. The method according to claim 5, characterized in that The step of writing the node flag and the identity flag into the request header of the Http request comprises: Creating a node flag field and an identity flag field in the request header; Writing the node flag into the request header as the value of the node flag field; The identity flag is written into the request header as the value of the identity flag field.

8. A data communication device for a blockchain client, characterized in that: Applied to Http proxy server, the device comprises: A receiving module, used to receive an Http request from a blockchain client, wherein the Http request includes a request header and a request body; An acquisition module is used to obtain the node mark, identity mark and data signature of the Http request from the request header, wherein the data signature is obtained by the blockchain client encrypting the request body according to the identity mark, and the node mark is the unique identification information of the target blockchain node; A verification module, used for authenticating the HTTP request according to the data signature and the identity mark; The forwarding module is used for forwarding the Http request to the corresponding target blockchain node according to the node flag if the Http request passes the identity authentication. The Http proxy server stores the node flags and corresponding IP addresses of multiple blockchain nodes. The node flag is used to determine the IP address of the target blockchain node. The IP address is used to establish a connection with the target blockchain node. The Http proxy server is used to forward the Http request to the target blockchain node through the established connection.

9. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the method according to any one of claims 1 to 4 or claims 5 to 7 is implemented.

10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 4 or claims 5 to 7 is implemented.

Citation Information

Patent Citations

  • Webpage request processing method and device

    CN109617977A

  • Blockchain network identity authentication system, data processing method and gateway equipment

    CN111010372A