Service calling method, device, system and equipment and storage medium
The server determines the height threshold based on the user identification, and calls the full node that meets the height threshold from the blockchain node collection to provide services to the client, solving the problem that the consensus algorithm affects the efficiency of data acquisition and achieving efficient and accurate data acquisition.
Patent Information
- Application Number
- CN202311509721.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-13
- Publication Date
- 2025-05-13
AI Technical Summary
In the prior art, the consensus algorithm is relied on to return data to the client, resulting in inefficient data acquisition.
The server receives the client's service call request, determines a set of blockchain nodes matching the user ID, and calls a full node whose block height is greater than or equal to the height threshold from the set to provide services to the client. The height threshold is determined based on the user identification.
It improves the efficiency of data acquisition, avoids the full-node coordination required by consensus algorithms, and ensures data consistency and accuracy.
Smart Images

Figure CN119987904A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a service calling method, apparatus, system, device and storage medium. Background Art
[0002] Currently, a blockchain can contain multiple full nodes, and each full node stores the full data of the blockchain. Since the full nodes in the blockchain are based on distributed deployment, the time required for the same message to be transmitted to different full nodes in the blockchain is different. This causes the client to obtain different results when requesting data from different full nodes.
[0003] In related technologies, a consensus algorithm can be used to ensure that the blockchain can return consistent data to the client.
[0004] However, the consensus algorithm requires the participation of all nodes in the blockchain, and data will not be returned to the client until all nodes reach a consensus, which affects the efficiency of data acquisition. Summary of the invention
[0005] The present application provides a service calling method, apparatus, system, device and storage medium, which solves the technical problem in the related art that the efficiency of data acquisition is affected by relying on a consensus algorithm to return data to the client.
[0006] In a first aspect, a service calling method is provided, which is executed by a server, and the method comprises: first, receiving a service calling request from a client, the service calling request including a user identifier; then determining a blockchain node set matching the user identifier according to the service calling request, and calling a full node from the blockchain node set to provide services to the client, the blockchain node set comprising: one or more full nodes whose block height is greater than or equal to a height threshold, the height threshold being determined according to the user identifier.
[0007] It can be understood that the method described in the first aspect can be executed by a computing device, which can be a terminal, an apparatus including a terminal, or a chip in a terminal, or the computing device can also be a network device, an apparatus including a network device, or a chip in a network device. For ease of understanding, the following description will be given by taking the execution of a computing device as an example.
[0008] In the present application, after receiving the service call request from the client, the server can determine the height threshold based on the user's identifier included in the service call request, and determine the full nodes with a block height greater than or equal to the height threshold from all full nodes included in the network, and obtain a blockchain node set that matches the user's identifier. Finally, the server can call a full node from the blockchain node set to provide services to the client. In the present application, the server can determine the height threshold corresponding to each user based on the identifier of each user, and because the blockchain node set includes one or more full nodes with a block height greater than or equal to the height threshold, the server can call any full node with a block height greater than or equal to the height threshold to provide services to the client, which can effectively implement the service call process and improve the efficiency of data acquisition.
[0009] Optionally, the service calling method further includes: determining a target calling strategy based on the identifier of the user, the target calling strategy being used to indicate the full node to be called corresponding to the client; and determining the height threshold based on the target calling strategy.
[0010] In the present application, the server can determine the unique strategy (ie, target call strategy) corresponding to the user and used to determine the height threshold based on the user's identification. In this way, the server can accurately and effectively determine the height threshold based on the unique strategy.
[0011] Optionally, the server stores the original call policy corresponding to the user. Before receiving the service call request sent by the client, the service call method also includes: receiving a policy update indication sent by the client, the policy update indication including the target call policy; based on the policy update indication, updating the original call policy to the target call policy.
[0012] In this application, after receiving the policy update instruction sent by the client, the server can update the original call policy corresponding to the stored user to the target call policy, and can indicate the corresponding node range and the calculation method of the height threshold in a customized way. In addition, the server can provide different levels of service according to different definitions of users, thereby providing differentiated customized services.
[0013] Optionally, the target calling strategy includes a calculation function and node information of the full node to be called, and the determining of the height threshold based on the calling strategy specifically includes: obtaining the block height of the full node to be called based on the node information; and determining the block height of the full node to be called that satisfies the calculation function as the height threshold.
[0014] In this application, the node information of the full node to be called included in the target call strategy can represent the node range of the full node that the client can call, and the calculation function included in the target call strategy can represent the calculation method of the height threshold. Through the node range and the calculation method, the server can accurately determine the height threshold corresponding to the user, and locally execute the target call strategy without the need for an additional consensus process, which improves the efficiency of service calls and ensures that accurate data is obtained.
[0015] Optionally, the above-mentioned obtaining the block height of the full node to be called based on the node information specifically includes: when the node information is stored in the local cache, obtaining the block height of the full node to be called from the local cache based on the node information.
[0016] In this application, when the local cache stores the node information of the full node to be called, it means that the local cache also stores the block height of the full node to be called. In this way, the server can obtain the block height of the node to be called from the local cache based on the node information. This can improve the efficiency of obtaining the block height, thereby improving the efficiency of service calls.
[0017] Optionally, the above-mentioned obtaining the block height of the full node to be called based on the node information specifically includes: when the node information is not stored in the local cache, obtaining the block height of the full node to be called from the database based on the node information.
[0018] In this application, when the local cache does not store the node information of the full node to be called, it means that the local cache does not store the block height of the full node to be called. At this time, the server can obtain the block height of the full node to be called from the database based on the node information. In this way, it can be guaranteed that the server can obtain the block height of the full node to be called, ensuring the reliability of the service call.
[0019] Optionally, the above-mentioned node information includes a combination of one or more of the following information: the type of the full node to be called and the identifier of the full node to be called.
[0020] In the present application, the server can accurately and effectively determine the node information of the full node to be called based on the type of the full node to be called and / or the identifier of the full node to be called, thereby accurately and effectively obtaining the block height of the full node to be called.
[0021] Optionally, the height threshold is greater than or equal to a first block height, where the first block height is the block height of the full node that last provided services to the client.
[0022] In this application, since the blockchain is a chain structure, the data in the blockchain needs to be continuously superimposed and cannot be rolled back. The block height (or ledger height) of the full node that can currently provide services to the client must be greater than or equal to the block height (i.e., the first block height) of the full node that last provided services to the client. In this way, it can be guaranteed that consistent and correct data is returned to the client.
[0023] Optionally, the service calling method further includes: issuing an alarm message when the height threshold is less than a first block height, where the first block height is the block height of the full node that last provided services to the client.
[0024] In this application, when the height threshold is less than the first block height, that is, the height threshold is less than the block height of the full node that provided services to the client last time. This indicates that there is an abnormality in the full node in the blockchain, such as book rollback, soft fork or hard fork, and there may be no data that meets the requirements. At this time, the server sends an alarm message to prevent the client from obtaining inconsistent data.
[0025] Optionally, when the height threshold is greater than or equal to the second block height, the block height of each full node included in the blockchain node set is less than or equal to the maximum block height, the second block height is the difference between the maximum block height and the stable block number, the maximum block height is the maximum value of the block heights in the full node to be called corresponding to the client, the stable block number is the number of blocks in a stable state in the target blockchain, and the target blockchain is the blockchain to which the full node to be called belongs.
[0026] In the present application, the second block height can characterize the number of blocks in the target blockchain that are in an unstable state. When the height threshold is greater than or equal to the second block height, it means that the full nodes with a block height greater than the maximum block height are unstable (or do not meet the requirements), and the data stored in these full nodes may change at any time. At this time, the server can determine the full nodes with a block height less than or equal to the maximum block height as stable and compliant full nodes, that is, determine that the block height of each full node included in the blockchain node set is less than or equal to the maximum block height. It can ensure that stable and consistent data is returned to the client.
[0027] Optionally, when the height threshold is less than the second block height, the block height of each full node included in the blockchain node set is less than or equal to the second block height, the second block height is the difference between the maximum block height and the stable block number, the maximum block height is the maximum value of the block heights in the full node to be called corresponding to the client, the stable block number is the number of blocks in a stable state in the target blockchain, and the target blockchain is the blockchain to which the full node to be called belongs.
[0028] In this application, when the height threshold is less than the second block height, it means that the full nodes with a block height greater than the second block height are unstable, and the data stored in these full nodes may change at any time. At this time, the server can determine the full nodes with a block height less than or equal to the second block height as stable and qualified full nodes, that is, determine that the block height of each full node included in the blockchain node set is less than or equal to the second block height. It can ensure that stable and consistent data is returned to the client.
[0029] Optionally, the full node called by the above-mentioned server from the blockchain node set to provide services to the client is the full node with the smallest load in the blockchain node set.
[0030] In the present application, since the full node called by the server from the blockchain node set to provide services to the client is the full node with the smallest load in the blockchain node set, the server can call the full node with the smallest load to provide services to the client, which can ensure the effective implementation of the service.
[0031] Optionally, the load of a full node is determined based on a load evaluation index of the full node, and the load evaluation index of the full node includes a combination of one or more of the following indicators: the size of resources consumed by the full node, the resource utilization of the full node, the bandwidth occupancy of the full node, and the number of service indications received by the full node in a historical time period.
[0032] In the present application, the server can accurately and effectively determine the load of each full node based on the load evaluation index of each full node, and then accurately and effectively determine the full node that can ensure the effective service, thereby calling the full node to provide services to the client.
[0033] Optionally, the service calling method also includes: obtaining a load evaluation index of each full node included in the blockchain node set, wherein the load evaluation index of a full node includes a combination of one or more of the following indicators: the size of resources consumed by the full node, the resource utilization rate of the full node, the bandwidth occupancy rate of the full node, and the number of service indications received by the full node in a historical time period; based on the load evaluation index of each full node, determining the load of each full node; and determining the full node with the smallest load in the blockchain node set as the full node called by the server from the blockchain node set to provide services to the client.
[0034] In this application, the server determines the full node with the smallest load in the blockchain node set as the full node called by the server from the blockchain node set to provide services to the client, that is, the server can call the full node with the smallest load to provide services to the client, which can improve the effectiveness of service calls. In addition, it can also ensure that API requests are sufficiently dispersed to avoid overloading of some full nodes.
[0035] In a second aspect, a service calling system is provided. The service calling system includes a client and a server; the client is used to send a service calling request to the server, and the service calling request includes a user's identifier; the server is used to receive the service calling request of the client, and determine a blockchain node set that matches the user's identifier according to the service calling request, and call a full node from the blockchain node set to provide services to the client, and the blockchain node set includes: one or more full nodes whose block height is greater than or equal to a height threshold, and the height threshold is determined according to the user's identifier.
[0036] In addition, the technical effects of the service calling system described in the second aspect can refer to the technical effects of the method described in the first aspect, and will not be repeated here.
[0037] In a third aspect, a service calling device is provided. The device includes: a receiving module and a processing module; the receiving module is used to receive a service calling request from a client, the service calling request includes a user's identity; the processing module is used to determine a blockchain node set that matches the user's identity according to the service calling request, and call a full node from the blockchain node set to provide services for the client, the blockchain node set includes: one or more full nodes whose block height is greater than or equal to a height threshold, the height threshold is determined according to the user's identity.
[0038] In addition, the technical effects of the service calling device described in the third aspect can refer to the technical effects of the method described in the first aspect, and will not be repeated here.
[0039] In a fourth aspect, a service invocation device is provided. The service invocation device includes: a module for executing the method described in the first aspect, such as a transceiver module and a processing module. For example, the transceiver module is used to execute the transceiver function of the service invocation device, and the processing module is used to execute the functions of the service invocation device other than the transceiver function.
[0040] Optionally, the transceiver module may include a sending module and a receiving module, wherein the sending module is used to implement the sending function of the service calling device described in the second aspect, and the receiving module is used to implement the receiving function of the service calling device described in the third aspect.
[0041] Optionally, the service calling device described in the fourth aspect may further include a storage module, wherein the storage module stores a program or instruction. When the processing module executes the program or instruction, the service calling device may execute the method described in the first aspect.
[0042] It can be understood that the service calling device described in the fourth aspect can be a terminal or a network device, or a chip (system) or other parts or components that can be set in a terminal or a network device, or a device that includes a terminal or a network device, and this application does not limit this.
[0043] In addition, the technical effects of the service calling device described in the fourth aspect can refer to the technical effects of the other aspects mentioned above, and will not be repeated here.
[0044] In a fifth aspect, a service invocation device is provided, wherein the service invocation device comprises: a processor, wherein the processor is configured to execute the method described in the first aspect.
[0045] In a possible design solution, the service invocation device described in the fifth aspect may further include a transceiver. The transceiver may be a transceiver circuit or an interface circuit. The transceiver may be used for the service invocation device described in the fifth aspect to communicate with other devices.
[0046] In a possible design scheme, the service calling device described in the fifth aspect may also include a memory. The memory may be integrated with the processor or may be separately provided. The memory may be used to store the computer program and / or data involved in the method described in the first aspect.
[0047] In an embodiment of the present application, the communication device described in the fifth aspect may be the terminal or network device described in the first aspect, or a chip (system) or other parts or components that may be set in the terminal or network device, or a device that includes the terminal or network device.
[0048] In addition, the technical effects of the service calling device described in the fifth aspect can refer to the technical effects of the method described in the first aspect, and will not be repeated here.
[0049] In a sixth aspect, a service invocation device is provided. The communication device comprises: a processor, the processor is coupled to a memory, and the processor is used to execute a computer program stored in the memory, so that the service invocation device executes the method described in the first aspect.
[0050] In a possible design solution, the service invocation device described in the sixth aspect may further include a transceiver. The transceiver may be a transceiver circuit or an interface circuit. The transceiver may be used for the service invocation device described in the sixth aspect to communicate with other devices.
[0051] In an embodiment of the present application, the service calling device described in the sixth aspect may be the terminal or network device described in the first aspect, or a chip (system) or other parts or components that may be set in the terminal or network device, or a device that includes the terminal or network device.
[0052] In addition, the technical effects of the service calling device described in the sixth aspect can refer to the technical effects of the method described in the first aspect, and will not be repeated here.
[0053] In a seventh aspect, a service calling device is provided, comprising: a processor and a memory; the memory is used to store a computer program, and when the processor executes the computer program, the service calling device executes the method described in the first aspect.
[0054] In a possible design solution, the service invocation device described in the seventh aspect may further include a transceiver. The transceiver may be a transceiver circuit or an interface circuit. The transceiver may be used for the service invocation device described in the seventh aspect to communicate with other devices.
[0055] In an embodiment of the present application, the service calling device described in the seventh aspect may be the terminal or network device described in the first aspect, or a chip (system) or other parts or components that may be set in the terminal or network device, or a device that includes the terminal or network device.
[0056] In addition, the technical effects of the service calling device described in the seventh aspect can refer to the technical effects of the method described in the first aspect, and will not be repeated here.
[0057] In an eighth aspect, a computing device cluster is provided, comprising at least one computing device, each computing device comprising a processor and a memory; the processor of the at least one computing device is used to execute instructions stored in the memory of the at least one computing device, so that the computing device cluster executes the method described in the first aspect.
[0058] In a ninth aspect, a computer program product comprising instructions is provided. When the instructions are executed by a computing device cluster, the computing device cluster executes the method described in the first aspect.
[0059] In a tenth aspect, a computer-readable storage medium is provided, comprising computer program instructions. When the computer program instructions are executed by a computing device cluster, the computing device cluster executes the method described in the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0060] Figure 1 A schematic diagram of a network architecture of a service calling system provided in an embodiment of the present application is shown;
[0061] Figure 2A schematic diagram of a process flow of a service calling method provided in an embodiment of the present application is shown;
[0062] Figure 3 A schematic diagram showing a flow chart of another service calling method provided in an embodiment of the present application;
[0063] Figure 4 A schematic diagram showing a method for calculating a user upload height threshold provided in an embodiment of the present application is shown;
[0064] Figure 5 A schematic diagram showing the principle of a server calling a full node to provide services to a client provided by an embodiment of the present application is shown;
[0065] Figure 6 A schematic diagram of a process in which a server calls a target full node to provide services to a client is shown in an embodiment of the present application;
[0066] Figure 7 A schematic diagram of the structure of a service calling device provided in an embodiment of the present application is shown;
[0067] Figure 8 A schematic diagram of the structure of a computing device provided in an embodiment of the present application is shown;
[0068] Fig. 9 A schematic diagram of the structure of a computing device cluster provided in an embodiment of the present application is shown;
[0069] Fig.10 A schematic diagram of a network architecture of a computing device cluster provided in an embodiment of the present application is shown. DETAILED DESCRIPTION
[0070] To facilitate understanding of the solutions provided by the embodiments of the present application, some concepts involved in the present application are explained before introducing the solutions provided by the embodiments of the present application.
[0071] Blockchain is a chain of blocks, each of which stores certain information, and they are connected into a chain in the order of their generation. Blockchain technology is a new distributed infrastructure and computing paradigm that uses block chain data structures to verify and store data, uses distributed node consensus algorithms to generate and update data, uses cryptography to ensure the security of data transmission and access, and uses smart contracts composed of automated script codes to program and operate data. In the embodiment of the present application, the full nodes included in the blockchain node set can belong to the same blockchain or different blockchains.
[0072] Remote procedure call (RPC) is a computer communication protocol in distributed computing. The protocol allows a program running on one computer to call a subroutine in another address space (usually a legacy computer on an open network), and the programmer does not need to program this interaction additionally, just like calling a local program. RPC is a client-server model, and the classic implementation is a system that exchanges information by sending requests and receiving responses. In the embodiment of the present application, the server can call a blockchain full node in the form of RPC to provide services to the client.
[0073] Blockchain finality, blockchain technology has the property of being tamper-proof. However, transactions on the blockchain are not final after confirmation, on the contrary, they have the possibility of being reversed. The guarantee that transactions cannot be changed or reversed is called blockchain finality. In the embodiments of the present application, blocks in a stable state can be understood as having blockchain finality.
[0074] The number of finalized blocks of the blockchain, in a blockchain with probabilistic finality, such as a proof-of-work chain, as more blocks are added to the chain, the higher the probability of stability of the block in front of the chain. Blockchain nodes follow the rule of the longest chain to determine the most stable blockchain, while other shorter blockchains will be considered illegal, and illegal blockchains can also be considered as forks. In practice, Bitcoin users must wait for 6 block confirmations (about an hour) before their transactions are considered final. At this point, 6 blocks are the number of finalized blocks of the blockchain on the Bitcoin blockchain. Blockchains with different probabilistic finality have different numbers of finalized blocks of the blockchain. If the blockchain uses a deterministic consensus mechanism, the number of finalized blocks is 0. The number of stable blocks in the embodiment of the present application can be understood as the number of finalized blocks of the target blockchain.
[0075] Currently, a blockchain can contain multiple full nodes, each of which stores the full data of the blockchain. Due to the requirement of decentralization, full nodes in the blockchain are deployed in a distributed manner. In order to reach a consensus on the data on the blockchain, nodes need to communicate with each other to confirm the latest block data. However, due to the characteristics of the distributed deployment system, the time required for the same message to be delivered to different full nodes in the blockchain is different. This will cause the client to get different results when requesting data from different full nodes. This inconsistency greatly affects the user experience and may even cause customer losses.
[0076] The blockchain RPC service provider maintains multiple blockchain full nodes. If the client's request is sent to the same blockchain consensus node, there will be no consistency problem. However, providing data access only through a single consensus node will greatly limit the scalability and reliability of the blockchain RPC service and violate the principle of decentralization.
[0077] A simple way to improve the scalability of blockchain RPC services is to use a load balancer. However, the load balancer improves the scalability of blockchain RPC services by scheduling transactions to different full nodes through some strategies. This will inevitably lead to the inconsistency problem mentioned above.
[0078] In actual applications, in order to ensure data consistency, blockchain RPC service providers usually run additional consensus algorithms between the full nodes they maintain to ensure that consistent and correct requests are returned to users. However, the consensus algorithm requires all full nodes in the blockchain to participate, and data will not be returned to the client until all full nodes reach a consensus, which affects the efficiency of data acquisition.
[0079] Based on this, an embodiment of the present application provides a service calling method, in which the server can determine the height threshold corresponding to each user based on the identifier of each user. Since the blockchain node set includes one or more full nodes whose block height is greater than or equal to the height threshold, the server can call any full node whose block height is greater than or equal to the height threshold to provide services to the client, which can effectively implement the service calling process and improve the efficiency of data acquisition.
[0080] The service calling method, device, computing device and storage medium provided in the embodiments of the present application are applied to blockchain scenarios (including but not limited to scenarios where a full node in a blockchain is called to provide services to a client). After the server receives a service calling request from a client, it can determine a blockchain node set that matches the user's identifier based on the service calling request, and call a full node from the blockchain node set to provide services to the client.
[0081] In order to enable ordinary persons in the art to better understand the technical solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the accompanying drawings.
[0082] It is understood that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the attached claims.
[0083] It should also be understood that the term “comprising” indicates the presence of described features, integers, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements and / or components.
[0084] The service calling method provided in the embodiment of the present application can be executed by a server, which can be an application installed and running on a computing device. The service calling method provided in the embodiment of the present application can act on the computing device to implement the calling process of the relevant full node.
[0085] The service invocation method, apparatus, computing device, and storage medium provided in the embodiments of the present application can be applied to a service invocation system. Figure 1 As shown, the service calling system includes computing device 101, computing device 102, node 103, node 104 and node 105. Among them, node 103, node 104 and node 105 are full nodes in the blockchain. Usually, in practical applications, the connection between the above-mentioned devices can be a wireless connection. In order to conveniently and intuitively represent the connection relationship between the various devices, Figure 1 Solid lines are used to indicate this.
[0086] Among them, a client is installed and running on the computing device 101, and a server is securely running on the computing device 102.
[0087] Specifically, the client can send a service call request to the server, and then the server can determine the blockchain node set that matches the user's identifier based on the service call request, and call a full node (such as node 103) from the blockchain set to provide services to the client, and the block height of node 103 is greater than or equal to the height threshold.
[0088] In one example, the computing device 101 may be a terminal, which may also be referred to as user equipment (UE), access terminal, subscriber unit, user station, mobile station (MS), mobile station, remote station, remote terminal, mobile device, user terminal, terminal, wireless communication device, user agent or user device. The terminal in the embodiments of the present application can be a mobile phone, a cellular phone, a smart phone, a tablet computer, a wireless data card, a personal digital assistant (PDA), a wireless modem, a handset, a laptop computer, a machine type communication (MTC) terminal, a computer with a wireless transceiver function, a virtual reality (VR) terminal, an augmented reality (AR) terminal, a smart home device (for example, a refrigerator, a television, an air conditioner, an electric meter, etc.), an intelligent robot, a robotic arm, a workshop equipment, a wireless terminal in industrial control, a wireless terminal in self driving, a wireless terminal in remote medical, a wireless terminal in a smart grid, a wireless terminal in transportation safety, a wireless terminal in a smart city, a wireless terminal in a smart home, a vehicle-mounted terminal, a roadside unit with a terminal function, and a wireless terminal in a smart city. The terminal of the present application may also be a vehicle-mounted module, a vehicle-mounted module, a vehicle-mounted component, a vehicle-mounted chip or a vehicle-mounted unit built into a vehicle as one or more components or units. The terminal may also be other devices with terminal functions, for example, the terminal may also be a device that functions as a terminal in device to device (D2D) communication.
[0089] The embodiments of the present application do not limit the device form of the terminal. The device for realizing the function of the terminal can be a terminal; it can also be a device that can support the terminal to realize the function, such as a chip system. The device can be installed in the terminal, or used in combination with the terminal. In the embodiments of the present application, the chip system can be composed of chips, or it can include chips and other discrete devices.
[0090] In another example, the computing device 102 may be a server, which may be an independent physical server, or a server cluster or distributed system composed of multiple physical servers. It may also be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, network acceleration services (content delivery network, CDN), as well as big data and artificial intelligence platforms.
[0091] In combination with the description of the above embodiments, the service calling method provided in the embodiments of the present application can be executed by the server. Figure 2 As shown, the service calling method provided in the embodiment of the present application may include S101-S102.
[0092] S101, the client sends a service call request to the server.
[0093] Corresponding to the process of S101, the server receives the service call request from the client.
[0094] The service call request includes a user identifier.
[0095] It should be understood that the service call request is used to request the server to call a full node in the blockchain to provide services to the client.
[0096] In an optional implementation, the above-mentioned service call request can be an RPC call request, which is used to support the client (or user) to use the blockchain RPC service, specifically to access the blockchain full node in an RPC-based manner.
[0097] S102: The server determines a set of blockchain nodes that matches the user's identifier according to the service call request, and calls a full node from the blockchain node set to provide services to the client.
[0098] Among them, the blockchain node set includes: one or more full nodes whose block height is greater than or equal to a height threshold, and the height threshold is determined based on the user's identification.
[0099] It should be understood that the height threshold can be understood as the block height of a full node in a stable state in the blockchain. The height threshold can also be referred to as a stable block height corresponding to the user (or customized by the user).
[0100] Specifically, the server can determine the height threshold based on the user's identifier, and determine the full nodes whose block height is greater than or equal to the height threshold from all the full nodes included in the network, that is, to form a blockchain node set, which matches the user's identifier. Finally, the server can call a full node from the blockchain node set to provide services to the client.
[0101] In an optional implementation, the server calling a full node from the blockchain node set to provide services to the client may specifically include the server sending a service indication to the full node to instruct the full node to provide services to the client.
[0102] Optionally, the full nodes included in the above blockchain node set may belong to the same blockchain or to different blockchains.
[0103] In an embodiment of the present application, after receiving a service call request from a client, the server can determine a height threshold based on the user's identifier included in the service call request, and determine a full node with a block height greater than or equal to the height threshold from all full nodes included in the network, and obtain a blockchain node set that matches the user's identifier. Finally, the server can call a full node from the blockchain node set to provide services to the client. In an embodiment of the present application, the server can determine the height threshold corresponding to each user based on the identifier of each user, and because the blockchain node set includes one or more full nodes with a block height greater than or equal to the height threshold, the server can call any full node with a block height greater than or equal to the height threshold to provide services to the client, which can effectively implement the service call process and improve the efficiency of data acquisition.
[0104] In one implementation of the embodiment of the present application, the height threshold is greater than or equal to the first block height, and the first block height is the block height of the full node that last provided services to the client.
[0105] It should be understood that since the blockchain is a chain structure, the data in the blockchain needs to be continuously superimposed and cannot be rolled back. The block height (or ledger height) of the full node that can currently provide services to the client must be greater than or equal to the block height (i.e., the first block height) of the full node that last provided services to the client. In this way, it can ensure that consistent and correct data is returned to the client.
[0106] In another implementation of the embodiment of the present application, when the height threshold is less than the first block height, the server may issue an alarm message.
[0107] It is understandable that when the height threshold is less than the first block height, that is, the height threshold is less than the block height of the full node that provided services to the client last time. This indicates that there is an abnormality in the full node in the blockchain, such as book rollback, soft fork or hard fork, and there may be no data that meets the requirements. At this time, the server sends an alarm message to prevent the client from obtaining inconsistent data.
[0108] In one case, when the height threshold is greater than or equal to the second block height, the block height of each full node included in the blockchain node set is less than or equal to the maximum block height, the second block height is the difference between the maximum block height and the stable block number, the maximum block height is the maximum value of the block heights in the full node to be called corresponding to the client, the stable block number is the number of blocks in a stable state in the target blockchain, and the target blockchain is the blockchain to which the full node to be called belongs.
[0109] Specifically, the second block height can represent the number of blocks in the target blockchain that are in an unstable state. When the height threshold is greater than or equal to the second block height, it means that the full nodes with a block height greater than the maximum block height are unstable (or do not meet the requirements), and the data stored in these full nodes may change at any time. At this time, the server can determine the full nodes with a block height less than or equal to the maximum block height as stable and compliant full nodes, that is, determine that the block height of each full node included in the blockchain node set is less than or equal to the maximum block height. It can ensure that stable and consistent data is returned to the client.
[0110] In another case, when the height threshold is less than the second block height, the block height of each full node included in the blockchain node set is less than or equal to the second block height.
[0111] In the embodiment of the present application, when the height threshold is less than the second block height, it means that the full nodes with a block height greater than the second block height are unstable, and the data stored in these full nodes may change at any time. At this time, the server can determine the full nodes with a block height less than or equal to the second block height as stable and qualified full nodes, that is, determine that the block height of each full node included in the blockchain node set is less than or equal to the second block height. It can ensure that stable and consistent data is returned to the client.
[0112] Combining the above two situations, the block height of each full node included in the blockchain node set can satisfy the following formula:
[0113]
[0114] Among them, h * Indicates the height threshold, hmax It represents the maximum block height, and s represents the stable block number.
[0115] In order to ensure the load balance of all nodes in the blockchain, a load balancing module can be configured in the server. The load balancing module can determine the load of each full node included in the blockchain node set, and call the full node with the smallest load to provide services to the client. Based on this, the service calling method provided in the embodiment of the present application can also include steps A to C.
[0116] Step A: The server obtains the load evaluation index of each full node included in the blockchain node set.
[0117] Among them, the load evaluation index of a full node includes a combination of one or more of the following indicators: the size of resources consumed by the full node, the resource utilization of the full node, the bandwidth occupancy rate of the full node, and the number of service indications received by the full node in a historical time period.
[0118] It should be understood that the size of resources consumed by a full node includes the size of computing resources consumed by the full node and / or the size of storage resources consumed by the full node. The resource utilization of the full node includes the central processing unit (CPU) utilization and / or memory (MEM) utilization of the full node. The service indication is used to indicate that the full node provides services for a certain client.
[0119] In the embodiment of the present application, a service indication can be understood as an application programming interface (API) request.
[0120] Step B: The server determines the load of each full node based on the load evaluation index of each full node.
[0121] In an optional implementation, the load evaluation index of a full node includes the size of resources consumed by the full node, the resource utilization rate of the full node, the bandwidth occupancy rate of the full node, and the number of service indications received by the full node in the historical time period. At this time, the server can determine the sum of the four indicators (or the product of the four indicators) as the load of the full node. Or the server can assign weight parameters to the four indicators and determine the load of the full node based on the weighted summation method.
[0122] Step C: The server determines the full node with the smallest load in the blockchain node set as the full node called by the server from the blockchain node set to provide services to the client.
[0123] It is understandable that the server determines the full node with the smallest load in the blockchain node set as the full node called by the server from the blockchain node set to provide services to the client, that is, the server can call the full node with the smallest load to provide services to the client, which can improve the effectiveness of service calls. In addition, it can also ensure that API requests are sufficiently dispersed to avoid overloading of some full nodes.
[0124] Combination Figure 2 ,like Figure 3 As shown, the service calling method provided in the embodiment of the present application may also include S103-S104.
[0125] S103: The server determines a target calling strategy based on the user's identification.
[0126] The target call strategy is used to indicate the full node to be called by the client.
[0127] Specifically, the full node to be called can be understood as the full node that the client can call or the node range that the client requests to call.
[0128] S104: The server determines a height threshold based on the target calling strategy.
[0129] It should be understood that the target call strategy is a unique strategy corresponding to the user and used to determine the height threshold. In this way, the server can accurately and effectively determine the height threshold based on the target call strategy.
[0130] In an optional implementation, the target call strategy includes a calculation function and the node information of the full node to be called. The server determines the height threshold based on the target call strategy, which may specifically include S1041-S1042.
[0131] S1041. The server obtains the block height of the full node to be called based on the node information of the full node to be called.
[0132] The node information includes a combination of one or more of the following information: the type of the full node to be called and the identifier of the full node to be called.
[0133] Optionally, the type of a full node can be ether (ETH), bitcoin (BTC) or binance smart chain (BSC), etc.
[0134] In an optional implementation, the server may store an information height relationship, which includes multiple node information and the block heights corresponding to each of the multiple node information. The server may query the information height relationship based on the node information of the full node to be called, determine that the node information of the full node to be called exists in the information height relationship, and determine the block height corresponding to the node information of the full node to be called in the information height relationship as the block height of the full node to be called.
[0135] Exemplarily, the following Table 1 is an example of the information height relationship of the embodiment of the present application. Specifically, the information height relationship includes 4 node information (one node information includes a node identifier), including identifier 1, identifier 2, identifier 3 and identifier 4, and the block heights corresponding to each of the 4 node information. Specifically, the block height corresponding to identifier 1 is 95, the block height corresponding to identifier 2 is 99, the block height corresponding to identifier 3 is 103, and the block height corresponding to identifier 4 is 92.
[0136] Table 1
[0137] Node Information Block height Logo 1 95 Logo 2 99 Logo 3 103 Logo 4 92
[0138] Assuming that the node information of the full node to be called is identifier 3, the server determines that the block height of the full node to be called is 103.
[0139] It should be understood that all full nodes in the network can be deployed in M (M≥1) regions, each region includes N full nodes (N≥1, the number of full nodes included in each region can be the same or different). K (K≥1) blockchains in the network support interaction with clients (or users).
[0140] The server can use the heartbeat mechanism to confirm the block heights of all full nodes included in the network, and instruct all full nodes to return their respective block heights. The server can then store the block heights of all full nodes in the above information height relationship.
[0141] In an optional implementation, the server can determine whether the local cache stores the node information of the full node to be called. When the local cache stores the node information, the server can obtain the block height of the node to be called from the local cache based on the node information. This can improve the efficiency of obtaining the block height, thereby improving the efficiency of service calls.
[0142] In another optional implementation, when the node information of the full node to be called is not stored in the local cache, the server can obtain the block height of the full node to be called from the database based on the node information. In this way, it can be ensured that the server can obtain the block height of the full node to be called, ensuring the reliability of the service call.
[0143] Optionally, the server may store the above information height relationship in a local cache and a database, so that the server can obtain the block height of each full node from the local cache and the database.
[0144] S1042. The server determines the block height that satisfies the calculation function among the block heights of the full node to be called as the height threshold.
[0145] It should be understood that the calculation function can represent the calculation method of the height threshold. Through this calculation function, the server can determine the height threshold from the block height of the full node to be called.
[0146] In an optional implementation, the calculation function may be the latest, the slowest, or the majority.
[0147] Specifically, the latest represents the full node with the largest block height, the most stable represents the full node with the smallest block height, and more than half represents the full nodes with block heights exceeding the average.
[0148] For example, it is assumed that there are 4 full nodes to be called, including node 1, node 2, node 3 and node 4, and the block heights of the 4 nodes are 100, 120, 110 and 105 respectively. If the calculation function is the most stable, the server determines the height threshold to be 100.
[0149] In the embodiment of the present application, the node information of the full node to be called included in the target call strategy can represent the node range of the full node that the client can call, and the calculation function included in the target call strategy can represent the calculation method of the height threshold. Through the node range and the calculation method, the server can accurately determine the height threshold corresponding to the user, and locally execute the target call strategy without the need for an additional consensus process, thereby improving the efficiency of service calls and ensuring that accurate data is obtained.
[0150] In one implementation of the embodiment of the present application, the server stores the original call policy corresponding to the user. Before the server receives the service call request sent by the client, the service call method provided by the embodiment of the present application may also include steps D-E.
[0151] Step D: The server receives the policy update instruction sent by the client.
[0152] The policy update indication includes a target calling policy.
[0153] It should be understood that the calculation function included in the target call function is different from the calculation function included in the original call policy, and / or the node information included in the target call function is different from the node information included in the original call policy. The policy update indication is used to instruct the server to update the original call policy to the target call policy.
[0154] Specifically, the user can select the calculation function and node information through a preset operation mode, and send the calculation function and node information to the server after selection. The preset operation mode includes a combination of one or more of the following operations: a drop-down menu selection operation, a point selection operation, a name input operation, and a graphical selection operation.
[0155] Optionally, if the user does not select at least one of the calculation function and / or node information, the server adopts a default setting.
[0156] Step E: The server updates the original call policy to the target call policy based on the policy update indication.
[0157] In the embodiment of the present application, after receiving the policy update instruction sent by the client, the server can update the stored original call policy corresponding to the user to the target call policy, and can indicate the corresponding node range and the calculation method of the height threshold in a customized manner. In addition, the server can provide different levels of service according to different definitions of users, thereby providing differentiated customized services.
[0158] In an optional implementation, a data plane module may be configured in the server, and the data plane module is used to store the above-mentioned original calling strategy and the target calling strategy.
[0159] In the embodiment of the present application, the node information of a full node can be represented in the form of a tuple. For example, assuming that the node information of a full node is (a, b), where a is the type of the full node and b is the identifier of the full node.
[0160] For example, Figure 4 As shown, the network includes 12 full block nodes, and the node information of the 12 full blockchain nodes is (0, 0), (0, 1), (0, 2), (0, 3), (1, 0), (1, 1), (1, 2), (2, 0), (2, 1), (2, 2), (2, 3) and (2, 4). First, the node range selected by the user based on the client includes (2, 0), (2, 1), (2, 2), (2, 3) and (2, 4), and the selected calculation function is the latest. Then the client can upload the calculation method of the height threshold (including the node range and calculation function) to the server (specifically the data surface module in the server). Finally, the server can store the calculation method of the height threshold in the database.
[0161] An embodiment of the present application also provides a service calling system, which includes a client and a server.
[0162] Specifically, the client is used to send a service call request to the server, and the service call request includes a user identifier.
[0163] The server is used to receive the service call request of the client, and determine a blockchain node set that matches the user's identifier according to the service call request, and call a full node from the blockchain node set to provide services for the client, wherein the blockchain node set includes: one or more full nodes whose block height is greater than or equal to a height threshold, and the height threshold is determined according to the user's identifier.
[0164] Optionally, the server is further configured to receive a policy update indication sent by the client, and instruct the policy update indication to update an original calling policy corresponding to the user to a target calling policy.
[0165] Optionally, the server is also used to send a service call response to the client, where the service call response includes relevant results (or relevant data) of the service provided by the above-mentioned full node (specifically, the full node called by the server from the blockchain node set to provide services to the client) to the client.
[0166] For example, Figure 5 As shown, the service calling system includes a client 501, a server 502, a full node 503, a full node 504, a full node 505 and a full node 506. The server 502 includes a data plane module 5021, a load balancing module 5022 and a database 5023.
[0167] First, the client can send a service call request to the server 502. After obtaining the service call request, the data plane module 5021 can determine the first block height (i.e., the block height of the full node that provided services to the client 501 last time) from the database 5023 based on the user's identifier included in the service call request. In addition, the data plane module 5021 can also obtain the information height relationship from the local cache, and determine the blockchain node set based on the information height relationship and the calculation method of the height threshold (including calculation function and node information). Afterwards, the load balancing module 5022 can determine the load of each full node included in the blockchain node set, and determine the full node with the smallest load (assuming it is full node 506). Then, the server 502 can call the full node 506 to provide services to the client 501. Finally, the full node 506 returns a service call response to the client 501 via the server 502.
[0168] The following is a complete example to illustrate the specific process of the server calling a full node in the blockchain node set (hereinafter referred to as the target full node) in the embodiment of the present application to provide services to the client. Figure 6 As shown, the specific process includes S201-S215.
[0169] S201: The user selects a calculation method and a calculation range for a height threshold.
[0170] The calculation method is the calculation function in the above target adjustment strategy, and the calculation range is the node information of the full node to be called included in the target adjustment strategy.
[0171] S202: The client sends a policy update instruction to the server.
[0172] The policy update indication includes a target calling policy.
[0173] S203: The server updates the original calling policy corresponding to the user to a target calling policy, and stores the target calling policy.
[0174] Specifically, the server may store the calculation method and calculation range of the height threshold.
[0175] S204. The server periodically sends heartbeat requests to all blockchain full nodes.
[0176] Among them, the heartbeat request is used to obtain the block height of each blockchain full node.
[0177] S205. Each blockchain node queries its own block height.
[0178] S206. The server saves the block height of each blockchain full node.
[0179] S207: The client sends a service call request to the server.
[0180] The service call request includes a user identifier.
[0181] S208. The server queries the first block height based on the user's identifier.
[0182] The first block height is the block height of the full node that last provided services to the client.
[0183] S209: The server queries the height threshold defined by the user.
[0184] S210, the server queries the block height of each blockchain full node from the local cache and database.
[0185] S211. The server determines a set of blockchain nodes.
[0186] Among them, the block height of each full node included in the blockchain node set is greater than or equal to the height threshold.
[0187] S212. The server calls the target full node to provide services to the client.
[0188] Among them, the target full node is the full node with the smallest load in the blockchain node set.
[0189] S213. The target full node processes the service instruction sent by the server.
[0190] S214. The target full node returns a service call response to the server.
[0191] The service call response includes relevant results (or relevant data) of the service provided by the target full node to the client.
[0192] S215. The client receives the service call response sent by the server.
[0193] In an embodiment of the present application, the user can select the calculation method and calculation range of the height threshold in the client, and the target adjustment strategy can be obtained. The client can then send a policy update indication to the server, and the policy update indication includes the target adjustment strategy. After receiving the policy update indication, the server can update the stored original adjustment strategy to the target adjustment strategy, that is, it can indicate the corresponding node range and the calculation method of the height threshold in a customized manner. In addition, the server can provide different levels of service levels according to different definitions of users, thereby providing differentiated customized services. In addition, the blockchain node can also periodically obtain the block height of each blockchain full node included in the network based on the heartbeat mechanism.
[0194] Afterwards, the client can send a service call request to the server. After receiving the service call request, the server can query the first block height (i.e., the block height of the full node that provided services to the client last time), the user-defined height threshold, and the block height of each blockchain full node based on the user's identity, thereby determining the blockchain node set that matches the user's identity. Then the server can determine the target full node with the smallest load from one or more full nodes with a block height greater than or equal to the height threshold included in the blockchain node set, and call the target full node to provide services to the client. The final target full node can process the service indication sent by the server and return a service call response to the client via the server. In the embodiment of the present application, since the blockchain node set includes one or more full nodes with a block height greater than or equal to the height threshold, and the target blockchain node is the full node with the smallest load among the full nodes with one or more block heights greater than or equal to the height threshold, that is, the server can call the full node with a block height greater than or equal to the height threshold and a smaller load to provide services to the client, while improving the effectiveness of the service call, it can also avoid causing some full nodes to be overloaded.
[0195] It is understandable that in order to implement the functions in the above embodiments, the client and the server include hardware structures and / or software modules corresponding to the execution of each function. It should be easy for those skilled in the art to realize that, in combination with the units and method steps of each example described in the embodiments disclosed in this application, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application scenario and design constraints of the technical solution.
[0196] Combined with the above Figures 1 to 6 , describes in detail the service calling method provided by this embodiment, and will now be combined with Figure 7 , describing the service calling device provided according to this embodiment.
[0197] The present application also provides a service calling device, such as Figure 7 As shown, the service calling device 70 includes: a receiving module 701 and a processing module 702.
[0198] The receiving module is used to receive a service call request sent by a client, where the service call request includes a user identifier.
[0199] A processing module is used to determine a set of blockchain nodes that match the user's identifier according to the service call request, and call a full node from the blockchain node set to provide services for the client, wherein the blockchain node set includes: one or more full nodes whose block height is greater than or equal to a height threshold, and the height threshold is determined according to the user's identifier.
[0200] Optionally, the service calling device 70 further includes a determination module 703 .
[0201] The determination module 703 is used to determine a target calling strategy based on the identifier of the user, where the target calling strategy is used to indicate the full node to be called corresponding to the client.
[0202] The determination module 703 is further configured to determine the height threshold based on the target calling strategy.
[0203] Optionally, the service calling device 70 stores an original calling strategy corresponding to the user.
[0204] The receiving module 701 is further configured to receive a policy update indication sent by the client, where the policy update indication includes the target calling policy.
[0205] The processing module 702 is further configured to update the original calling policy to the target calling policy based on the policy update indication.
[0206] Optionally, the target calling strategy includes a calculation function and node information of the full node to be called, and the service calling device 70 also includes an acquisition module 704.
[0207] The acquisition module 704 is used to acquire the block height of the full node to be called based on the node information.
[0208] The determination module 703 is specifically used to determine the block height that satisfies the calculation function among the block heights of the full node to be called as the height threshold.
[0209] Optionally, the acquisition module 704 is specifically used to obtain the block height of the full node to be called from the local cache based on the node information when the node information is stored in the local cache.
[0210] Optionally, the acquisition module 704 is specifically used to obtain the block height of the full node to be called from the database based on the node information when the node information is not stored in the local cache.
[0211] Optionally, the above-mentioned node information includes a combination of one or more of the following information: the type of the full node to be called and the identifier of the full node to be called.
[0212] Optionally, the height threshold is greater than or equal to a first block height, where the first block height is the block height of the full node that last provided services to the client.
[0213] Optionally, the service calling device 70 further includes an alarm module 705 .
[0214] The alarm module 705 is used to issue an alarm message when the height threshold is less than the first block height, where the first block height is the block height of the full node that last provided services to the client.
[0215] Optionally, when the above-mentioned height threshold is greater than or equal to the second block height, the block height of each full node included in the blockchain node set is less than or equal to the maximum block height, the second block height is the difference between the maximum block height and the stable block number, the maximum block height is the maximum value of the block heights in the full node to be called corresponding to the client, the stable block number is the number of blocks in a stable state in the target blockchain, and the target blockchain is the blockchain to which the full node to be called belongs.
[0216] Optionally, when the above-mentioned height threshold is less than the second block height, the block height of each full node included in the blockchain node set is less than or equal to the second block height, the second block height is the difference between the maximum block height and the stable block number, the maximum block height is the maximum value of the block heights in the full node to be called corresponding to the client, the stable block number is the number of blocks in a stable state in the target blockchain, and the target blockchain is the blockchain to which the full node to be called belongs.
[0217] Optionally, the full node called by the above-mentioned server from the blockchain node set to provide services to the client is the full node with the smallest load in the blockchain node set.
[0218] Optionally, the load of a full node is determined based on a load evaluation index of the full node, and the load evaluation index of the full node includes a combination of one or more of the following indicators: the size of resources consumed by the full node, the resource utilization of the full node, the bandwidth occupancy of the full node, and the number of service indications received by the full node in a historical time period.
[0219] Optionally, the acquisition module 704 is further used to obtain a load evaluation index of each full node included in the blockchain node set, wherein the load evaluation index of a full node includes a combination of one or more of the following indicators: the size of resources consumed by the full node, the resource utilization of the full node, the bandwidth occupancy rate of the full node, and the number of service indications received by the full node in a historical time period.
[0220] The determination module 703 is further configured to determine the load of each full node based on the load evaluation index of each full node.
[0221] The determination module 703 is also used to determine the full node with the smallest load in the blockchain node set as the full node called by the server from the blockchain node set to provide services to the client.
[0222] Among them, the receiving module 701, the processing module 702, the determining module 703, the obtaining module 704 and the alarm module 705 can all be implemented by software, or can be implemented by hardware. Exemplarily, the following takes the determining module 703 as an example to introduce the implementation of the determining module 703. Similarly, the implementation of the receiving module 701, the processing module 702, the obtaining module 704 and the alarm module 705 can refer to the implementation of the determining module 703.
[0223] As an example of a software functional unit, the module 703 can include code running on a computing instance. Among them, the computing instance can include at least one of a physical host (computing device), a virtual machine, and a container. Further, the above-mentioned computing instance can be one or more. For example, the module 703 can include code running on multiple hosts / virtual machines / containers. It should be noted that the multiple hosts / virtual machines / containers used to run the code can be distributed in the same region (region) or in different regions. Furthermore, the multiple hosts / virtual machines / containers used to run the code can be distributed in the same availability zone (AZ) or in different AZs, each AZ including a data center or multiple data centers with close geographical locations. Among them, usually a region can include multiple AZs.
[0224] Similarly, multiple hosts / virtual machines / containers used to run the code can be distributed in the same virtual private cloud (VPC) or in multiple VPCs. Usually, a VPC is set up in a region. For cross-region communication between two VPCs in the same region and between VPCs in different regions, a communication gateway needs to be set up in each VPC to achieve interconnection between VPCs through the communication gateway.
[0225] As an example of a hardware functional unit, the determination module 703 may include at least one computing device, such as a server, etc. Alternatively, the determination module may also be a device implemented using an application-specific integrated circuit (ASIC) or a programmable logic device (PLD). The PLD may be a complex programmable logical device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL) or any combination thereof.
[0226] The multiple computing devices included in the determination module 703 may be distributed in the same region or in different regions. The multiple computing devices included in the determination module 703 may be distributed in the same AZ or in different AZs. Similarly, the multiple computing devices included in the determination module 703 may be distributed in the same VPC or in multiple VPCs. The multiple computing devices may be any combination of computing devices such as servers, ASICs, PLDs, CPLDs, FPGAs, and GALs.
[0227] It should be noted that, in other embodiments, the determination module 703 can be used to execute any step in the service calling method, the receiving module 701 can be used to execute any step in the service calling method, the processing module 702 can be used to execute any step in the service calling method, the acquisition module 704 can be used to execute any step in the service calling method, and the alarm module 705 can also be used to execute any step in the service calling method. The steps that the determination module 703, the receiving module 701, the processing module 702, the acquisition module 704, and the alarm module 705 are responsible for implementing can be specified as needed, and the determination module 703, the receiving module 701, the processing module 702, the acquisition module 704, and the alarm module 705 respectively implement different steps in the service calling method to realize the full functions of the service calling device.
[0228] The present application also provides a computing device 800. Figure 8 As shown, the computing device 800 includes: a bus 802, a processor 804, a memory 806, and a communication interface 808. The processor 804, the memory 806, and the communication interface 808 communicate through the bus 802. The computing device 800 can be a server or a terminal device. It should be understood that the present application does not limit the number of processors and memories in the computing device 800.
[0229] The bus 802 may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 8 The bus 804 is represented by only one line, but does not mean that there is only one bus or one type of bus. The bus 804 may include a path for transmitting information between various components of the computing device 800 (eg, the memory 806, the processor 804, and the communication interface 808).
[0230] The processor 804 may include any one or more processors such as a CPU, a graphics processing unit (GPU), a microprocessor (MP), or a digital signal processor (DSP).
[0231] The memory 806 may include a volatile memory, such as a random access memory (RAM). The processor 804 may also include a non-volatile memory, such as a read-only memory (ROM), a flash memory, a hard disk drive (HDD), or a solid state drive (SSD).
[0232] The memory 806 stores executable program codes, and the processor 804 executes the executable program codes to respectively implement the functions of the aforementioned determination module, receiving module, processing module, acquisition module, and alarm module, thereby implementing the service calling method. That is, the memory 806 stores instructions for executing the service calling method.
[0233] The communication interface 803 uses a transceiver module such as, but not limited to, a network interface card or a transceiver to implement communication between the computing device 800 and other devices or a communication network.
[0234] The embodiment of the present application also provides a computing device cluster. The computing device cluster includes at least one computing device. The computing device can be a server, such as a central server, an edge server, or a local server in a local data center. In some embodiments, the computing device can also be a terminal device such as a desktop computer, a laptop computer, or a smart phone.
[0235] like Fig. 9 As shown, the computing device cluster includes at least one computing device 800. The memory 806 in one or more computing devices 800 in the computing device cluster may store the same instructions for executing the service calling method.
[0236] In some possible implementations, the memory 806 of one or more computing devices 800 in the computing device cluster may also store partial instructions for executing the service calling method. In other words, the combination of one or more computing devices 800 may jointly execute instructions for executing the service calling method.
[0237] It should be noted that the memory 806 in different computing devices 800 in the computing device cluster can store different instructions, which are respectively used to execute part of the functions of the service calling device. That is, the instructions stored in the memory 806 in different computing devices 800 can implement the functions of one or more modules of the determination module, the receiving module, the processing module, the acquisition module and the alarm module.
[0238] In some possible implementations, one or more computing devices in the computing device cluster may be connected via a network, which may be a wide area network or a local area network. Fig.10 A possible implementation is shown. Fig.10 As shown, two computing devices 800A and 800B are connected via a network. Specifically, the network is connected via a communication interface in each computing device. In this type of possible implementation, the memory 806 in the computing device 800A stores instructions for executing the functions of the receiving module, the obtaining module, and the alarm module. At the same time, the memory 806 in the computing device 800B stores instructions for executing the functions of the determining module and the processing module.
[0239] Fig.10 The connection mode between the computing device clusters shown may be considered to be that the service calling method provided by the present application requires a large number of determination processes and processing processes, so it is considered that the functions implemented by the determination module and the sending module are handed over to the computing device 800B for execution.
[0240] It should be understood that Fig.10The functions of the computing device 800A shown in FIG. 8 may also be completed by multiple computing devices 800. Similarly, the functions of the computing device 800B may also be completed by multiple computing devices 800.
[0241] The present application embodiment also provides another computing device cluster. The connection relationship between the computing devices in the computing device cluster can be similar to that of Fig. 9 and Fig.10 The connection mode of the computing device cluster is different in that the memory 806 in one or more computing devices 800 in the computing device cluster may store the same instructions for executing the service calling method.
[0242] In some possible implementations, the memory 806 of one or more computing devices 800 in the computing device cluster may also store partial instructions for executing the service calling method. In other words, the combination of one or more computing devices 800 may jointly execute instructions for executing the service calling method.
[0243] The embodiment of the present application also provides a computer program product including instructions. The computer program product may be software or a program product including instructions that can be run on a computing device or stored in any available medium. When the computer program product is run on at least one computing device, the at least one computing device executes a service call method.
[0244] The embodiment of the present application also provides a computer-readable storage medium. The computer-readable storage medium can be any available medium that can be stored by a computing device or a data storage device such as a data center containing one or more available media. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk). The computer-readable storage medium includes instructions that instruct the computing device to execute the service call method.
[0245] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the protection scope of the technical solutions of the embodiments of the present invention.
Claims
1. A service calling method, characterized in that: The method is executed by the server, and includes: Receiving a service call request from a client, wherein the service call request includes a user identifier; Determine a blockchain node set that matches the user's identifier according to the service call request, and call a full node from the blockchain node set to provide services to the client, wherein the blockchain node set includes: one or more full nodes whose block height is greater than or equal to a height threshold, and the height threshold is determined according to the user's identifier.
2. The service calling method according to claim 1, characterized in that: The method further comprises: Determine a target call strategy based on the user's identifier, where the target call strategy is used to indicate the full node to be called corresponding to the client; Based on the target invocation strategy, the height threshold is determined.
3. The service calling method according to claim 2, characterized in that: The server stores an original call policy corresponding to the user. Before receiving the service call request sent by the client, the method further includes: Receiving a policy update indication sent by the client, wherein the policy update indication includes the target invocation policy; Based on the policy update indication, the original calling policy is updated to the target calling policy.
4. The service calling method according to claim 2, characterized in that: The target call strategy includes a calculation function and node information of the full node to be called, and determining the height threshold based on the call strategy includes: Based on the node information, obtain the block height of the full node to be called; The block height that satisfies the calculation function among the block heights of the full node to be called is determined as the height threshold.
5. The service calling method according to claim 4, characterized in that: The obtaining, based on the node information, the block height of the full node to be called includes: When the node information is stored in the local cache, the block height of the full node to be called is obtained from the local cache based on the node information.
6. The service calling method according to claim 4 or 5, characterized in that: The obtaining, based on the node information, the block height of the full node to be called includes: When the node information is not stored in the local cache, the block height of the full node to be called is obtained from the database based on the node information.
7. The service calling method according to any one of claims 4 to 6, characterized in that: The node information includes a combination of one or more of the following information: the type of the full node to be called and the identifier of the full node to be called.
8. The service calling method according to any one of claims 1 to 7, characterized in that: The height threshold is greater than or equal to a first block height, where the first block height is the block height of the full node that last provided services to the client.
9. The service calling method according to any one of claims 1 to 8, characterized in that: The method further comprises: When the height threshold is less than the first block height, an alarm message is issued, where the first block height is the block height of the full node that last provided services to the client.
10. The service calling method according to any one of claims 1 to 9, characterized in that: When the height threshold is greater than or equal to the second block height, the block height of each full node included in the blockchain node set is less than or equal to the maximum block height, the second block height is the difference between the maximum block height and the stable block number, the maximum block height is the maximum value of the block heights in the full node to be called corresponding to the client, the stable block number is the number of blocks in a stable state in the target blockchain, and the target blockchain is the blockchain to which the full node to be called belongs.
11. The service calling method according to any one of claims 1 to 10, characterized in that: When the height threshold is less than the second block height, the block height of each full node included in the blockchain node set is less than or equal to the second block height, the second block height is the difference between the maximum block height and the stable block number, the maximum block height is the maximum value of the block heights in the full node to be called corresponding to the client, the stable block number is the number of blocks in a stable state in the target blockchain, and the target blockchain is the blockchain to which the full node to be called belongs.
12. The service calling method according to any one of claims 1 to 12, characterized in that: The full node called by the server from the blockchain node set to provide services to the client is the full node with the smallest load in the blockchain node set.
13. The service calling method according to claim 12, characterized in that: The load of a full node is determined based on the load evaluation index of the full node, and the load evaluation index of the full node includes a combination of one or more of the following indicators: the size of resources consumed by the full node, the resource utilization of the full node, the bandwidth occupancy rate of the full node, and the number of service indications received by the full node in a historical time period.
14. The service calling method according to any one of claims 1 to 13, characterized in that: The method further comprises: Obtaining a load evaluation index of each full node included in the blockchain node set, wherein the load evaluation index of a full node includes a combination of one or more of the following indicators: the size of resources consumed by the full node, the resource utilization rate of the full node, the bandwidth occupancy rate of the full node, and the number of service indications received by the full node in a historical time period; Determining the load of each full node based on the load evaluation index of each full node; The full node with the smallest load in the blockchain node set is determined as the full node called by the server from the blockchain node set to provide services to the client.
15. A service calling system, characterized in that: The service calling system includes a client and a server; The client is used to send a service call request to the server, wherein the service call request includes a user identifier; The server is used to receive a service call request from the client, and determine a blockchain node set that matches the user's identifier according to the service call request, and call a full node from the blockchain node set to provide services for the client, wherein the blockchain node set includes: one or more full nodes whose block height is greater than or equal to a height threshold, and the height threshold is determined according to the user's identifier.
16. A service calling device, characterized in that: The device comprises: a receiving module and a processing module; The receiving module is used to receive a service call request from a client, wherein the service call request includes a user identifier; The processing module is used to determine a set of blockchain nodes matching the identifier of the user according to the service call request, and call a full node from the set of blockchain nodes to provide services for the client, wherein the set of blockchain nodes includes: one or more full nodes whose block height is greater than or equal to a height threshold, and the height threshold is determined according to the identifier of the user.
17. A computing device cluster, characterized in that: comprising at least one computing device, each computing device comprising a processor and a memory; The processor of the at least one computing device is used to execute instructions stored in the memory of the at least one computing device, so that the computing device cluster executes the service calling method according to any one of claims 1 to 14.
18. A computer program product comprising instructions, characterized in that When the instructions are executed by a computing device cluster, the computing device cluster executes the service calling method according to any one of claims 1 to 14.
19. A computer-readable storage medium, characterized in that: The method comprises computer program instructions. When the computer program instructions are executed by a computing device cluster, the computing device cluster executes the service calling method according to any one of claims 1 to 14.