+

CN111901254B - Bandwidth allocation method and device for all nodes, electronic equipment and storage medium - Google Patents

Bandwidth allocation method and device for all nodes, electronic equipment and storage medium Download PDF

Info

Publication number
CN111901254B
CN111901254B CN202011045080.4A CN202011045080A CN111901254B CN 111901254 B CN111901254 B CN 111901254B CN 202011045080 A CN202011045080 A CN 202011045080A CN 111901254 B CN111901254 B CN 111901254B
Authority
CN
China
Prior art keywords
node
local
full
nodes
bandwidth
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202011045080.4A
Other languages
Chinese (zh)
Other versions
CN111901254A (en
Inventor
荆博
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Baidu Netcom Science and Technology Co Ltd
Original Assignee
Beijing Baidu Netcom Science and Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Baidu Netcom Science and Technology Co Ltd filed Critical Beijing Baidu Netcom Science and Technology Co Ltd
Priority to CN202011045080.4A priority Critical patent/CN111901254B/en
Publication of CN111901254A publication Critical patent/CN111901254A/en
Application granted granted Critical
Publication of CN111901254B publication Critical patent/CN111901254B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/70Admission control; Resource allocation
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5011Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
    • G06F9/5022Mechanisms to release resources
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/70Admission control; Resource allocation
    • H04L47/72Admission control; Resource allocation using reservation actions during connection setup

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

本申请公开了一种全节点的带宽分配方法、装置、电子设备以及存储介质,涉及区块链技术领域,可用于云计算和云服务。具体实现方案为:确定处理轻量级节点所发起的事务处理请求的需求带宽;在本地节点的剩余带宽小于所述需求带宽的情况下,确定是否允许释放与本地节点连接的本地全节点;若是,则释放本地全节点,且基于释放的带宽对所述事务处理请求进行处理。解决了目前区块链网络中无法动态分配全节点带宽的问题,可动态调整全节点的带宽分配比例,将带宽合理的分配给全节点和轻量级节点,在灵活性和通用性上取得了很好的平衡,为动态分配全节点带宽提供了一种新思路。

Figure 202011045080

The present application discloses a full-node bandwidth allocation method, device, electronic device and storage medium, which relate to the field of blockchain technology and can be used for cloud computing and cloud services. The specific implementation scheme is: determine the required bandwidth for processing the transaction processing request initiated by the lightweight node; if the remaining bandwidth of the local node is less than the required bandwidth, determine whether to allow the release of the local full node connected to the local node; if , the local full node is released, and the transaction processing request is processed based on the released bandwidth. It solves the problem that the bandwidth of full nodes cannot be dynamically allocated in the current blockchain network. It can dynamically adjust the bandwidth allocation ratio of full nodes, and allocate bandwidth reasonably to full nodes and lightweight nodes. It has achieved great flexibility and versatility. A good balance provides a new idea for dynamically allocating full-node bandwidth.

Figure 202011045080

Description

全节点的带宽分配方法、装置、电子设备以及存储介质Full-node bandwidth allocation method, device, electronic device and storage medium

技术领域technical field

本申请涉及计算机技术领域,尤其涉及区块链技术,具体涉及一种全节点的带宽分配方法、装置、电子设备以及存储介质。The present application relates to the field of computer technology, in particular to blockchain technology, and in particular to a full-node bandwidth allocation method, device, electronic device, and storage medium.

背景技术Background technique

区块链网络中同时存在轻量级节点和全节点。其中,全节点负责出块、达成共识、同步区块、同步交易以及存储区块账本等操作,而轻量级节点通过连接全节点接入区块链网络,主要提供事务处理请求的创建和查询等操作。There are both lightweight nodes and full nodes in the blockchain network. Among them, full nodes are responsible for operations such as generating blocks, reaching consensus, synchronizing blocks, synchronizing transactions, and storing block ledgers, while lightweight nodes connect to the blockchain network by connecting full nodes, and mainly provide the creation and query of transaction processing requests. and so on.

全节点的带宽是有限的,一部分要用来与其他的全节点建立连接,另一部分要用来与轻量级节点建立连接。一般来说,轻量级节点的数量会远大于全节点的数量,事务处理请求来源于轻量级节点,如果来源于轻量级节点的请求没有得到及时处理,就会影响到用户体验。但是全节点对于整个区块链网络的健壮性、安全性和出块稳定性又有着更重要的作用。那么如何进行带宽分配,来保证整个网络的性能和安全性整体处于最佳状态至关重要。The bandwidth of a full node is limited, and part of it is used to establish connections with other full nodes, and the other part is used to establish connections with lightweight nodes. Generally speaking, the number of lightweight nodes is much larger than the number of full nodes. Transaction processing requests originate from lightweight nodes. If requests from lightweight nodes are not processed in a timely manner, the user experience will be affected. However, full nodes play a more important role in the robustness, security and block generation stability of the entire blockchain network. So how to allocate bandwidth to ensure that the performance and security of the entire network are in the best state is crucial.

发明内容SUMMARY OF THE INVENTION

本公开提供了一种全节点的带宽分配方法、装置、电子设备以及存储介质,以合理的分配全节点的带宽。The present disclosure provides a full-node bandwidth allocation method, apparatus, electronic device, and storage medium, so as to reasonably allocate the full-node bandwidth.

根据本公开的一方面,提供了一种全节点的带宽分配方法,该方法包括:According to an aspect of the present disclosure, there is provided a full-node bandwidth allocation method, the method comprising:

确定处理轻量级节点所发起的事务处理请求的需求带宽;Determine the required bandwidth for processing transaction requests initiated by lightweight nodes;

在本地节点的剩余带宽小于所述需求带宽的情况下,确定是否允许释放与本地节点连接的本地全节点;In the case that the remaining bandwidth of the local node is less than the required bandwidth, determining whether to allow the release of the local full node connected to the local node;

若是,则释放本地全节点,且基于释放的带宽对所述事务处理请求进行处理。If so, the local full node is released, and the transaction request is processed based on the released bandwidth.

根据本公开的另一方面,提供了一种全节点的带宽分配装置,该装置包括:According to another aspect of the present disclosure, a full-node bandwidth allocation apparatus is provided, the apparatus comprising:

需求带宽确定模块,用于确定处理轻量级节点所发起的事务处理请求的需求带宽;The required bandwidth determination module is used to determine the required bandwidth for processing the transaction processing request initiated by the lightweight node;

释放确定模块,用于在本地节点的剩余带宽小于所述需求带宽的情况下,确定是否允许释放与本地节点连接的本地全节点;A release determination module, configured to determine whether to allow the release of the local full node connected to the local node when the remaining bandwidth of the local node is less than the required bandwidth;

释放模块,用于若允许释放与本地节点连接的本地全节点,则释放本地全节点;The release module is used to release the local full node if the local full node connected to the local node is allowed to be released;

处理模块,用于基于释放的带宽对所述事务处理请求进行处理。A processing module, configured to process the transaction processing request based on the released bandwidth.

根据本公开的另一方面,提供了一种电子设备,该电子设备包括:According to another aspect of the present disclosure, there is provided an electronic device comprising:

至少一个处理器;以及at least one processor; and

与所述至少一个处理器通信连接的存储器;其中,a memory communicatively coupled to the at least one processor; wherein,

所述存储器存储有可被所述至少一个处理器执行的指令,所述指令被所述至少一个处理器执行,以使所述至少一个处理器能够执行本申请任一实施例所述的全节点的带宽分配方法。The memory stores instructions executable by the at least one processor, the instructions are executed by the at least one processor to enable the at least one processor to execute the full node according to any embodiment of the present application bandwidth allocation method.

根据本公开的另一方面,提供了一种存储有计算机指令的非瞬时计算机可读存储介质,其中,所述计算机指令用于使所述计算机执行本申请任一实施例所述的全节点的带宽分配方法。According to another aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to cause the computer to execute the full-node process described in any of the embodiments of the present application. Bandwidth allocation method.

根据本申请的技术解决了目前区块链网络中无法动态分配全节点带宽的问题,可动态调整全节点的带宽分配比例,将带宽合理的分配给全节点和轻量级节点,在灵活性和通用性上取得了很好的平衡,为动态分配全节点带宽提供了一种新思路。The technology according to the present application solves the problem that the bandwidth of full nodes cannot be dynamically allocated in the current blockchain network, can dynamically adjust the bandwidth allocation ratio of full nodes, and reasonably allocate bandwidth to full nodes and lightweight nodes. A good balance has been achieved in versatility, providing a new idea for dynamically allocating full-node bandwidth.

应当理解,本部分所描述的内容并非旨在标识本公开的实施例的关键或重要特征,也不用于限制本公开的范围。本公开的其它特征将通过以下的说明书而变得容易理解。It should be understood that what is described in this section is not intended to identify key or critical features of embodiments of the disclosure, nor is it intended to limit the scope of the disclosure. Other features of the present disclosure will become readily understood from the following description.

附图说明Description of drawings

附图用于更好地理解本方案,不构成对本申请的限定。其中:The accompanying drawings are used to better understand the present solution, and do not constitute a limitation to the present application. in:

图1是根据本申请实施例提供的一种全节点的带宽分配方法的流程图;1 is a flowchart of a method for allocating bandwidth to a full node according to an embodiment of the present application;

图2A是根据本申请实施例提供的另一种全节点的带宽分配方法的流程图;2A is a flowchart of another full-node bandwidth allocation method provided according to an embodiment of the present application;

图2B和2C是根据本申请实施例提供的一种全节点的带宽分配节点示意图;2B and 2C are schematic diagrams of a full-node bandwidth allocation node according to an embodiment of the present application;

图3是根据本申请实施例提供的又一种全节点的带宽分配方法的流程图;FIG. 3 is a flowchart of yet another full-node bandwidth allocation method provided according to an embodiment of the present application;

图4是根据本申请实施例提供的一种全节点的带宽分配装置的结构示意图;4 is a schematic structural diagram of a device for allocating bandwidth for all nodes according to an embodiment of the present application;

图5是用来实现本申请实施例的全节点的带宽分配方法的电子设备的框图。FIG. 5 is a block diagram of an electronic device used to implement the bandwidth allocation method for a full node according to an embodiment of the present application.

具体实施方式Detailed ways

以下结合附图对本申请的示范性实施例做出说明,其中包括本申请实施例的各种细节以助于理解,应当将它们认为仅仅是示范性的。因此,本领域普通技术人员应当认识到,可以对这里描述的实施例做出各种改变和修改,而不会背离本申请的范围和精神。同样,为了清楚和简明,以下的描述中省略了对公知功能和结构的描述。Exemplary embodiments of the present application are described below with reference to the accompanying drawings, which include various details of the embodiments of the present application to facilitate understanding, and should be considered as exemplary only. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the present application. Also, descriptions of well-known functions and constructions are omitted from the following description for clarity and conciseness.

图1是根据本申请实施例提供的一种全节点的带宽分配方法的流程图。本申请实施例适用于如何动态分配全节点带宽的情况。该方法可以由全节点的带宽分配装置来执行,该装置可以采用软件和/或硬件的方式实现,并可集成于承载区块链节点的计算设备中。如图1所示,本实施例提供的全节点的带宽分配方法可以包括:FIG. 1 is a flowchart of a method for allocating bandwidth to a full node according to an embodiment of the present application. The embodiments of the present application are applicable to the situation of how to dynamically allocate the bandwidth of a full node. The method can be performed by a bandwidth allocating apparatus of all nodes, which can be implemented in software and/or hardware, and can be integrated into a computing device carrying a blockchain node. As shown in FIG. 1 , the bandwidth allocation method for all nodes provided in this embodiment may include:

S101,确定处理轻量级节点所发起的事务处理请求的需求带宽。S101: Determine the required bandwidth for processing the transaction processing request initiated by the lightweight node.

可以理解的是,区块链网络中的任一全节点均可以与轻量级节点建立通信连接,并可以处理轻量级节点所发起的事务处理请求,其中轻量级节点所发起的事务处理请求可以包括查询请求以及上链请求等。可选的,根据本地节点处理事务处理请求的情况,可以将与本地节点连接的轻量级节点分为两类,第一类轻量级节点为处理中的轻量级节点,第二类轻量级节点为待处理的轻量级节点;其中,所谓处理中的轻量级节点即为本地节点正处理的事务处理请求的发起者,待处理的轻量级节点即为本地节点所获取的未处理的事务处理请求的发起者。本实施例中的轻量级节点为第二类轻量级节点。进一步的,轻量级节点的数量为至少一个。需要说明的是,为了便于区别,本实施例和后续实施例中将以第一类轻量级节点和第二类轻量级节点来进行说明。It can be understood that any full node in the blockchain network can establish a communication connection with the lightweight node, and can process the transaction processing request initiated by the lightweight node. Requests can include query requests and on-chain requests. Optionally, according to the situation of the local node processing transaction processing requests, the lightweight nodes connected to the local node can be divided into two categories. The magnitude node is the lightweight node to be processed; the so-called lightweight node in processing is the initiator of the transaction processing request being processed by the local node, and the lightweight node to be processed is the one obtained by the local node. The originator of the pending transaction request. The lightweight node in this embodiment is the second type of lightweight node. Further, the number of lightweight nodes is at least one. It should be noted that, for the convenience of distinction, the first type of lightweight node and the second type of lightweight node will be used for description in this embodiment and subsequent embodiments.

本实施例中,需求带宽即为本地节点处理第二类轻量级节点所发起的事务处理请求的需求带宽。In this embodiment, the required bandwidth is the required bandwidth for the local node to process the transaction processing request initiated by the second type of lightweight node.

可选的,本地节点可以根据所获取的第二类轻量级节点所发起的事务处理请求的数量、事务处理请求的类型以及复杂度等,确定处理第二类轻量级节点所发起的事务处理请求的需求带宽。Optionally, the local node may determine to process the transaction initiated by the second type of lightweight node according to the obtained number of transaction processing requests initiated by the second type of lightweight node, the type and complexity of the transaction processing request, etc. The required bandwidth to process the request.

S102,在本地节点的剩余带宽小于需求带宽的情况下,确定是否允许释放与本地节点连接的本地全节点。S102, in the case that the remaining bandwidth of the local node is less than the required bandwidth, determine whether to allow the release of the local full node connected to the local node.

可以理解的是,本地全节点即为与区块链网络中与本地节点连接的全节点。本地节点向与本地节点连接的本地全节点传输区块、事务处理请求等需要消耗一定的带宽,同时本地节点本地正处理的事务处理请求也需要消耗本地节点一定的带宽(即本地节点处理第一类轻量级节点所发起的事务处理请求需要消耗本地节点的带宽);本地节点的剩余带宽即为本地节点的总带宽除去所消耗的带宽之后剩余可利用的带宽。It can be understood that the local full node is the full node connected to the local node in the blockchain network. The local node needs to consume a certain amount of bandwidth to transmit blocks, transaction processing requests, etc. to the local full node connected to the local node. At the same time, the transaction processing request being processed locally by the local node also needs to consume a certain bandwidth of the local node (that is, the local node processes the first The transaction processing request initiated by the class lightweight node needs to consume the bandwidth of the local node); the remaining bandwidth of the local node is the remaining available bandwidth after deducting the consumed bandwidth from the total bandwidth of the local node.

可选的,本地节点在确定处理第二类轻量级节点所发起的事务处理请求的需求带宽之后,可以将本地节点的剩余带宽与需求带宽进行比较;在本地节点的剩余带宽等于或者大于需求带宽的情况下,可以直接对第二类轻量级节点所发起的事务处理请求进行处理;在本地节点的剩余带宽小于需求带宽的情况下,可以判断是否允许释放与本地节点连接的本地全节点,进而根据判断结果,确定是否对第二类轻量级节点所发起的事务处理请求进行处理。Optionally, after determining the required bandwidth for processing the transaction processing request initiated by the second type of lightweight node, the local node may compare the remaining bandwidth of the local node with the required bandwidth; the remaining bandwidth of the local node is equal to or greater than the required bandwidth. In the case of bandwidth, the transaction processing request initiated by the second type of lightweight node can be directly processed; when the remaining bandwidth of the local node is less than the required bandwidth, it can be judged whether to allow the release of the local full node connected to the local node. , and then, according to the judgment result, it is determined whether to process the transaction processing request initiated by the second type of lightweight node.

可选的,在本地节点的剩余带宽小于需求带宽的情况下,确定是否允许释放与本地节点连接的本地全节点可以包括下述至少一种,具体为,1)在本地节点的剩余带宽小于需求带宽,且本地节点的剩余带宽不足以处理一个第二类轻量级节点所发起的事务处理请求的情况下,确定是否允许释放与本地节点连接的本地全节点;2)在轻量级节点数量为多个,本地节点的剩余带宽小于需求带宽,但本地节点的剩余带宽可满足对部分第二类轻量级节点所发起的事务处理请求进行处理的情况下,确定是否允许释放与本地节点连接的本地全节点;3)在本地节点的剩余带宽小于需求带宽,且与本地节点连接的第一类轻量级节点一直处理活跃状态(也就是说本地节点此时不可能释放与其连接的第一类轻量级节点)的情况下,确定是否允许释放与本地节点连接的本地全节点等。Optionally, in the case that the remaining bandwidth of the local node is less than the required bandwidth, determining whether to allow the release of the local full node connected to the local node may include at least one of the following, specifically: 1) The remaining bandwidth of the local node is less than the required bandwidth bandwidth, and the remaining bandwidth of the local node is not enough to process a transaction request initiated by a second-type lightweight node, determine whether to allow the release of the local full node connected to the local node; 2) In the number of lightweight nodes If the remaining bandwidth of the local node is less than the required bandwidth, but the remaining bandwidth of the local node can satisfy the processing of transaction requests initiated by some second-type lightweight nodes, determine whether to release the connection with the local node. 3) The remaining bandwidth at the local node is less than the required bandwidth, and the first type of lightweight nodes connected to the local node are always in an active state (that is to say, the local node cannot release the first class connected to it at this time. In the case of a class lightweight node), determine whether to allow the release of the local full node connected to the local node, etc.

示例性的,本地节点在确定本地节点的剩余带宽小于需求带宽的情况下,可以根据区块链网络当前出块速度、与本地节点连接的全节点数量、以及未处理的事务处理请求的数量等,确定是否允许释放与本地节点连接的本地全节点。进一步的,本地节点还可以根据本地部署数据中设定的通用带宽分配策略,确定是否允许释放与本地节点连接的本地全节点,后续实施例将对此进行详细介绍。Exemplarily, when the local node determines that the remaining bandwidth of the local node is less than the required bandwidth, it can be based on the current block production speed of the blockchain network, the number of full nodes connected to the local node, and the number of unprocessed transaction requests, etc. , to determine whether to allow the release of the local full node connected to the local node. Further, the local node may also determine whether to allow the release of the local full node connected to the local node according to the general bandwidth allocation policy set in the local deployment data, which will be described in detail in subsequent embodiments.

S103,若是,则释放本地全节点,且基于释放的带宽对事务处理请求进行处理。S103, if yes, release the local full node, and process the transaction processing request based on the released bandwidth.

可以理解的是,区块链网络中的任一全节点需要连接至少一个其他全节点,因此只有在与本地节点连接的本地全节点数量为至少两个的情况下,才有可能允许释放与本地节点连接的本地全节点。It is understandable that any full node in the blockchain network needs to be connected to at least one other full node, so it is only possible to allow release and local full nodes if the number of local full nodes connected to the local node is at least two. The local full node to which the node is connected.

进而,本地节点在确定允许释放与本地节点连接的本地全节点之后,可以从与本地节点连接的本地全节点中选择待释放全节点,释放待释放全节点,而后基于释放全节点所释放的带宽对第二类轻量级节点所发起的事务处理请求进行处理。Furthermore, after determining that the local node is allowed to release the local full node connected to the local node, it can select the full node to be released from the local full nodes connected to the local node, release the full node to be released, and then release the full node based on the bandwidth released by the full node. The transaction processing requests initiated by the second type of lightweight nodes are processed.

需要说明的是,本实施例可通过灵活释放与本地节点连接的本地全节点,来及时响应轻量级节点的事务处理请求,提升了用户体验;同时本地节点只有在确定允许释放与本地节点连接的本地全节点的情况下,才释放本地全节点,保证了不影响全节点对于整个区块链网络的健壮性、安全性和出块稳定性,在灵活性和通用性上取得了很好的平衡。It should be noted that, in this embodiment, the local full node connected to the local node can be flexibly released to respond to the transaction processing request of the lightweight node in time, thereby improving the user experience. In the case of a local full node, the local full node is released, which ensures that the robustness, security and block generation stability of the entire blockchain network will not be affected by the full node, and has achieved good flexibility and versatility. balance.

本申请实施例的技术方案,在区块链节点本地的剩余带宽下小于处理轻量级节点所发起的事务处理请求的需求带宽的情况下,通过判断是否允许释放与区块链节点连接的本地全节点,并在确定允许释放的情况下,灵活释放本地全节点,进而基于释放的本地全节点所释放的带宽对事务处理请求进行处理。解决了目前区块链网络中无法动态分配全节点带宽的问题,可动态调整全节点的带宽分配比例,将带宽合理的分配给全节点和轻量级节点,在灵活性和通用性上取得了很好的平衡,为动态分配全节点带宽提供了一种新思路。In the technical solution of the embodiments of the present application, in the case where the local remaining bandwidth of the blockchain node is less than the required bandwidth for processing the transaction processing request initiated by the lightweight node, it is judged whether to allow the release of the local node connected to the blockchain node. The full node, and when it is determined that the release is allowed, the local full node is released flexibly, and then the transaction processing request is processed based on the bandwidth released by the released local full node. It solves the problem that the bandwidth of full nodes cannot be dynamically allocated in the current blockchain network. It can dynamically adjust the bandwidth allocation ratio of full nodes, and allocate bandwidth reasonably to full nodes and lightweight nodes. It has achieved great flexibility and versatility. A good balance provides a new idea for dynamically allocating full-node bandwidth.

图2A是根据本申请实施例提供的另一种全节点的带宽分配方法的流程图。本申请实施例在上述实施例的基础上,进一步对确定是否允许释放与本地节点连接的全节点进行解释说明。如图2A所示,本实施例提供的全节点的带宽分配方法可以包括:FIG. 2A is a flowchart of another full-node bandwidth allocation method provided according to an embodiment of the present application. On the basis of the above-mentioned embodiments, the embodiments of the present application further explain the determination of whether to allow the release of the full node connected to the local node. As shown in FIG. 2A , the bandwidth allocation method for all nodes provided in this embodiment may include:

S201,确定处理轻量级节点所发起的事务处理请求的需求带宽。S201: Determine the required bandwidth for processing the transaction processing request initiated by the lightweight node.

S202,在本地节点的剩余带宽小于需求带宽的情况下,确定区块链网络中的第一类网络全节点当前数量。S202, in the case that the remaining bandwidth of the local node is less than the required bandwidth, determine the current number of full nodes of the first type of network in the blockchain network.

为了更合理的分配全节点的带宽,本实施例动态的将区块链网络中的全节点划分为两类,其中,第一类网络全节点也可以称为普通型的全节点,可以承担出块任务、区块同步任务、事务处理请求同步任务、事务处理请求转发任务、区块转发任务以及获取来自轻量级节点的事务处理请求(如查询请求、上链请求等)等。第二类网络全节点也可以称为服务型全节点,专用于供轻量级节点连接,可以不承担出块任务、不承担区块转发任务以及不承担事务处理请求同步任务,但可以承担事务处理请求转发任务,还可以获取来自轻量级节点的事务处理请求,以及承担区块同步任务。进一步的,第一类网络全节点可以向第二类网络全节点转化,第二类网络全节点也可以向第一类网络全节点转化。In order to allocate the bandwidth of the full nodes more reasonably, this embodiment dynamically divides the full nodes in the blockchain network into two types. The first type of network full nodes can also be called ordinary full nodes, which can undertake Block tasks, block synchronization tasks, transaction processing request synchronization tasks, transaction processing request forwarding tasks, block forwarding tasks, and obtaining transaction processing requests (such as query requests, on-chain requests, etc.) from lightweight nodes, etc. The second type of network full nodes can also be called service-type full nodes, which are dedicated to connecting lightweight nodes. They may not undertake block generation tasks, block forwarding tasks, and transaction processing request synchronization tasks, but they can undertake transactions. Handle request forwarding tasks, obtain transaction processing requests from lightweight nodes, and undertake block synchronization tasks. Further, the first type of network full node can be transformed into the second type of network full node, and the second type of network full node can also be transformed into the first type of network full node.

与此同时,区块链网络的部署数据(进一步为系统级智能合约或共识机制等)中可设定通用带宽分配策略,通用带宽分配策略中可以规定区块链网络中任一全节点(包括第一类网络全节点和第二类网络全节点)的带宽可预留M%用于处理轻量级节点的事务处理请求,预留N%用于连接区块链网络中其他全节点。其中,全节点带宽的M%和全节点带宽的N%之和可以等于全节点带宽。进一步的,区块链网络的部署数据(进一步为系统级智能合约或共识机制等)中还可以设定第一数量下限值和第二数量下限值等,其中,第一数量下限值为与本地节点连接的本地全节点数量下限值,第二数量下限值为区块链网络中的第一类网络全节点数量下限值。At the same time, a general bandwidth allocation strategy can be set in the deployment data of the blockchain network (further system-level smart contracts or consensus mechanisms, etc.), and the general bandwidth allocation strategy can specify any full node in the blockchain network (including The bandwidth of the first type of network full node and the second type of network full node) can be reserved M% for processing transaction processing requests of lightweight nodes, and N% for connecting to other full nodes in the blockchain network. The sum of M% of the full-node bandwidth and N% of the full-node bandwidth may be equal to the full-node bandwidth. Further, the deployment data of the blockchain network (further system-level smart contracts or consensus mechanisms, etc.) can also set a lower limit of the first quantity and a lower limit of the second quantity, among which, the lower limit of the first quantity is the lower limit of the number of local full nodes connected to the local node, and the second lower limit of the number is the lower limit of the number of full nodes of the first type of network in the blockchain network.

可选的,区块链网络中的每一全节点均可按照通用带宽分配策略来分配带宽。例如,本地节点预留给轻量级节点的带宽最多能够处理3个轻量级节点的事务处理请求,且本地节点当前正处理3个轻量级节点(即第一类轻量级节点)的事务处理请求,则本地节点的剩余带宽可以为预留给轻量级节点的带宽减去处理3个轻量级节点(即第一类轻量级节点)的事务处理请求所需的带宽之后剩余的带宽,本地节点的剩余带宽可以为0,或者不足以处理一个第二类轻量级节点所发起的事务处理请求。Optionally, each full node in the blockchain network can allocate bandwidth according to a general bandwidth allocation policy. For example, the bandwidth reserved for the lightweight node by the local node can handle transaction processing requests of 3 lightweight nodes at most, and the local node is currently processing the transaction requests of 3 lightweight nodes (ie, the first type of lightweight nodes). For transaction processing requests, the remaining bandwidth of the local node can be the bandwidth reserved for lightweight nodes minus the bandwidth required to process transaction processing requests of 3 lightweight nodes (ie, the first type of lightweight nodes). The remaining bandwidth of the local node can be 0, or not enough to handle a transaction request initiated by a second-type lightweight node.

此时,本地节点可以确定本地节点的剩余带宽小于需求带宽,进而可以根据本地维护的活跃节点列表中全节点相关信息,确定区块链网络中第一类网络全节点当前数量。其中,第一类网络全节点当前数量即为区块链网络中当前已有第一类网络全节点的数量。进一步的,与本地节点连接的本地全节点可以包括第一类网络全节点,还可以包括第二类网络全节点。At this time, the local node can determine that the remaining bandwidth of the local node is less than the required bandwidth, and then can determine the current number of full nodes of the first type of network in the blockchain network according to the relevant information of all nodes in the active node list maintained locally. Among them, the current number of the first type of network full nodes is the current number of the first type of network full nodes in the blockchain network. Further, the local full node connected to the local node may include the first type of network full node, and may also include the second type of network full node.

S203,根据第一类网络全节点当前数量、与本地节点连接的本地全节点数量、第一数量下限值和第二数量下限值,确定是否允许释放与本地节点连接的本地全节点。S203, according to the current number of network full nodes of the first type, the number of local full nodes connected to the local node, the first number lower limit value and the second number lower limit value, determine whether to allow release of the local full nodes connected to the local node.

具体的,本地节点在确定区块链网络中第一类网络全节点当前数量之后,可以根据第一类网络全节点当前数量、与本地节点连接的本地全节点数量以及部署数据中设定的第一数量下限值和第二数量下限值等,确定是否允许释放与本地节点连接的本地全节点。例如,可以将第一类网络全节点当前数量与第二数量下限值进行比较,以及将与本地节点连接的本地全节点数量与第一数量下限值进行比较,进而可以根据比较结果,确定是否允许释放与本地节点连接的本地全节点。Specifically, after the local node determines the current number of full nodes of the first type of network in the blockchain network, it can determine the current number of full nodes of the first type of network, the number of local full nodes connected to the local node, and the number of full nodes set in the deployment data. A number lower limit value and a second number lower limit value, etc., determine whether to allow the release of the local full node connected to the local node. For example, the current number of full nodes in the first type of network may be compared with the second lower limit of the number, and the number of local full nodes connected to the local node may be compared with the first lower limit of the number, and then according to the comparison result, determine Whether to allow the release of the local full node connected to the local node.

进一步的,本地节点可以为第一类网络全节点,也可以为第二类网络全节点,且本地节点为第一类网络全节点时确定是否允许释放与本地节点连接的本地全节点的条件,与本地节点为第二类网络全节点时确定是否允许释放与本地节点连接的本地全节点的条件不同。Further, the local node may be the first type of network full node, or may be the second type of network full node, and when the local node is the first type of network full node, the condition for determining whether to allow the release of the local full node connected to the local node, It is different from the condition for determining whether to allow the release of the local full node connected to the local node when the local node is the second type of network full node.

可选的,在本地节点为第一类网络全节点的情况下,若第一类网络全节点当前数量大于第二数量下限值,且与本地节点连接的本地全节点数量大于第一数量下限值,则允许释放与本地节点连接的本地全节点。例如,第一类网络全节点当前数量为10,第二数量下限值为3,此时第一类网络全节点当前数量10大于第二数量下限值3,说明本地节点有机会向第二类网络全节点转化;若此时确定与本地节点连接的本地全节点数量大于第一数量下限值,则说明本地节点可以释放与本地节点连接的本地全节点,向第二类网络全节点退化,例如,图2B所示的与轻量级节点连接的第一类网络全节点转化为图2C所示的第二类网络全节点。即本地节点可以降低预留给区块链网络中其他全节点的带宽,并增加预留给轻量级节点的带宽。Optionally, in the case where the local node is the first type of network full node, if the current number of the first type of network full node is greater than the lower limit of the second number, and the number of local full nodes connected to the local node is greater than the first number lower limit limit, the local full node connected to the local node is allowed to be released. For example, the current number of full nodes in the first type of network is 10, and the lower limit of the second number is 3. At this time, the current number of full nodes in the first type of network, 10, is greater than the lower limit of the second number of 3, indicating that the local node has the opportunity to send to the second Class network full-node transformation; if it is determined that the number of local full-nodes connected to the local node is greater than the first lower limit of the number, it means that the local node can release the local full-node connected to the local node and degrade to the second-type network full-node For example, the first type of network full node shown in FIG. 2B connected with the lightweight node is transformed into the second type of network full node shown in FIG. 2C. That is, the local node can reduce the bandwidth reserved for other full nodes in the blockchain network and increase the bandwidth reserved for lightweight nodes.

进一步的,区块链网络的部署数据(进一步为系统级智能合约或共识机制等)中还可以设定第三数量临界值,其中,第三数量临界值为与本地节点连接的本地全节点数量临界值,且第三数量临界值大于第一数量下限值;可选的,第三数量临界值是本地节点作为第一类网络全节点和本地节点作为第二类网络全节点的分界线,具体的,在与本地节点连接的本地全节点数量小于或等于第三数量临界值的情况下,本地节点为第二类网络全节点;在与本地节点连接的本地全节点数量大于第三数量临界值的情况下,本地节点为第一类网络全节点。Further, a third critical value can also be set in the deployment data of the blockchain network (further system-level smart contracts or consensus mechanisms, etc.), where the third critical value is the number of local full nodes connected to the local node. critical value, and the third critical value of the number is greater than the lower limit of the first number; optional, the third critical value of the number is the boundary between the local node serving as the full node of the first type of network and the local node serving as the full node of the second type of network, Specifically, when the number of local full nodes connected to the local node is less than or equal to the third critical value, the local node is the second type of network full nodes; when the number of local full nodes connected to the local node is greater than the third critical number In the case of value, the local node is the first type of network full node.

进而若第一类网络全节点当前数量大于第二数量下限值,且与本地节点连接的本地全节点数量等于第一数量下限值,则说明本地节点此时没有可释放的本地全节点,且此时本地节点为第二类网络全节点,本地节点可以拒绝处理第二类轻量级节点所发起的事务处理请求,或者等待处理中的事务处理请求(即第一类轻量级节点的事务处理请求)处理完之后,再处理未处理的事务处理请求(即第二类轻量级节点所发起的事务处理请求)。Furthermore, if the current number of full nodes in the first type of network is greater than the lower limit of the second number, and the number of local full nodes connected to the local node is equal to the lower limit of the first number, it means that the local node has no releasable local full nodes at this time. And at this time, the local node is the second type of network full node, the local node can refuse to process the transaction processing request initiated by the second type of lightweight node, or wait for the transaction processing request in processing (that is, the first type of lightweight node After the transaction processing request) is processed, the unprocessed transaction processing request (that is, the transaction processing request initiated by the second type of lightweight node) is processed.

示例性的,在本地节点为第二类网络全节点的情况下,若第一类网络全节点当前数量大于第二数量下限值,与本地节点连接的本地全节点数量小于第三数量临界值,但本地节点连接的本地全节点数量大于第一数量下限值,则说明本地节点可以释放与本地节点连接的本地全节点,且最多可释放数量为与本地节点连接的本地全节点数量和第一数量下限值之差。Exemplarily, in the case where the local node is the second type of network full node, if the current number of the first type of network full node is greater than the second lower limit value, the number of local full nodes connected to the local node is less than the third critical value. , but the number of local full nodes connected to the local node is greater than the first lower limit value, it means that the local node can release the local full nodes connected to the local node, and the maximum number that can be released is the number of local full nodes connected to the local node and the first The difference between the lower limit of a quantity.

又如,在本地节点为第二类网络全节点的情况下,若第一类网络全节点当前数量小于或等于第二数量下限值,与本地节点连接的本地全节点数量小于第三数量临界值,但本地节点连接的本地全节点数量大于第一数量下限值,则说明本地节点可以释放与本地节点连接的本地全节点,且最多可释放数量为与本地节点连接的本地全节点数量和第一数量下限值之差。For another example, in the case where the local node is the second type of network full node, if the current number of the first type of network full node is less than or equal to the second lower limit value, the number of local full nodes connected to the local node is less than the third critical number. value, but the number of local full nodes connected to the local node is greater than the first lower limit value, it means that the local node can release the local full nodes connected to the local node, and the maximum number that can be released is the number of local full nodes connected to the local node and The difference between the lower limit values of the first quantity.

需要说明的是,在本地节点为第二类网络全节点的情况下,由于本地节点此时已经作为第二类网络全节点,进而也可以不关注第一类网络全节点当前数量和第二数量下限值之间的关系。It should be noted that, in the case where the local node is the full node of the second type of network, since the local node is already the full node of the second type of network at this time, it is also possible not to pay attention to the current number and the second number of full nodes of the first type of network. The relationship between the lower limit values.

又如,在本地节点为第一类网络全节点的情况下,若第一类网络全节点当前数量小于或等于第二数量下限值,则本地节点可以直接拒绝释放与本地节点连接的本地全节点,即拒绝处理第二类轻量级节点所发起的事务处理请求,或者等待第一类轻量级节点的事务处理请求处理完之后,再处理未第二类轻量级节点的事务处理请求;或者,本地节点可以确定与本地节点连接的本地全节点数量是否大于第三数量临界值,若是,则允许释放与本地节点连接的本地全节点,且最多可释放数量为与本地节点连接的本地全节点数量和第三数量临界值之差并减1。若否,则本地节点可以直接拒绝释放与本地节点连接的本地全节点。值得注意的是,这种情况下,本地节点即使释放与其连接的本地全节点,也不会退化为第二类网络全节点,以保证不影响全节点对于整个区块链网络的健壮性、安全性和出块稳定性。For another example, in the case where the local node is the first type of network full node, if the current number of the first type of network full node is less than or equal to the lower limit of the second number, the local node may directly refuse to release the local full node connected to the local node. The node, that is, refuses to process the transaction processing request initiated by the second type of lightweight node, or waits for the transaction processing request of the first type of lightweight node to be processed before processing the transaction processing request of the second type of lightweight node. ; Or, the local node can determine whether the number of local full nodes connected to the local node is greater than the third critical value, and if so, it is allowed to release the local full nodes connected to the local node, and the maximum number that can be released is the number of local full nodes connected to the local node. The difference between the number of full nodes and the third threshold is subtracted by 1. If not, the local node may directly refuse to release the local full node connected to the local node. It is worth noting that in this case, even if the local node releases the local full node connected to it, it will not degenerate into the second type of network full node, so as to ensure that the robustness and security of the full node to the entire blockchain network are not affected. performance and block stability.

需要说明的是,本实施例通过在区块链网络的部署数据(进一步为系统级智能合约或共识机制等)中设定第一数量下限值、第二数量下限值以及第三数量临界值等,对本地节点释放与其连接的本地全节点的条件进行了控制,避免了区块链中的全节点随意释放与其连接的全节点,导致区块链网络运行不稳定的现象,进一步确保区块链中区块数据具备高安全性。It should be noted that, in this embodiment, the first quantity lower limit value, the second quantity lower limit value and the third quantity threshold are set in the deployment data of the blockchain network (further system-level smart contracts or consensus mechanisms, etc.) It controls the conditions for the local node to release the local full node connected to it, avoiding the random release of the full node connected to it by the full node in the blockchain, resulting in the unstable operation of the blockchain network, and further ensuring the regional The block data in the blockchain has high security.

S204,若是,则释放本地全节点,且基于释放的带宽对事务处理请求进行处理。S204, if yes, release the local full node, and process the transaction processing request based on the released bandwidth.

本申请实施例的技术方案,通过引入第一数量下限值和第二数量下限值等,对区块链网络中的全节点释放与其连接的全节点的条件进行控制,便于对全节点释放与其连接的全节点进行管理和控制,在能够及时响应轻量级节点的事务处理请求同时,保证整个区块链网络的健壮性、安全性和出块稳定性,为动态分配全节点带宽提供了一种新思路。The technical solutions of the embodiments of the present application control the conditions for all nodes in the blockchain network to release all nodes connected to them by introducing a first lower limit value and a second lower limit value, etc., so as to facilitate the release of all nodes. It manages and controls the full nodes connected to it, and can respond to the transaction processing requests of lightweight nodes in a timely manner, while ensuring the robustness, security and block generation stability of the entire blockchain network, providing dynamic allocation of full node bandwidth. A new way of thinking.

可以理解的是,本实施例中第一类网络全节点可以向第二类网络全节点转化,第二类网络全节点也可以向第一类网络全节点转化。可选的,若本地节点为第二类网络全节点,则本地节点可以根据第一类网络全节点当前数量和第二数量下限值,确定恢复概率;并根据恢复概率,从当前的第二类网络全节点转会为第一类网络全节点。It can be understood that, in this embodiment, the first type of network full nodes can be converted to the second type of network full nodes, and the second type of network full nodes can also be converted to the first type of network full nodes. Optionally, if the local node is the second type of network full node, the local node can determine the recovery probability according to the current number of the first type of network full nodes and the lower limit of the second number; and according to the recovery probability, from the current second The network full node is transferred to the first network full node.

可选的,本地节点可以根据本地维护的活跃节点列表中全节点相关信息,确定区块链网络中第一类网络全节点当前数量;并可以将第一类网络全节点当前数量与第二数量下限值进行比较,若第一类网络全节点当前数量小于第二数量下限值,则本地节点有机会恢复为(即转化为)第一类网络全节点。Optionally, the local node can determine the current number of full nodes of the first type of network in the blockchain network according to the relevant information of all nodes in the list of active nodes maintained locally; and can compare the current number of full nodes of the first type of network with the second number. The lower limit value is compared. If the current number of full nodes of the first type of network is less than the lower limit of the second number, the local node has the opportunity to recover (ie, be converted into) the full node of the first type of network.

具体的,本地节点可以采用第一类网络全节点当前数量除以第二数量下限值,并采用1减去除法运算得到的商,得到恢复概率;之后,可以根据恢复概率,从当前的第二类网络全节点转会为第一类网络全节点。进一步的,恢复概率越大,本地节点从当前的第二类网络全节点转化为第一类网络全节点的概率越大。Specifically, the local node can divide the current number of all nodes in the first type of network by the lower limit of the second number, and use 1 to subtract the quotient obtained by the division operation to obtain the recovery probability; The second type of network full node is transferred to the first type of network full node. Further, the greater the recovery probability, the greater the probability that the local node is transformed from the current second type of network full node to the first type of network full node.

需要说明的是,通过引入恢复概率,以便第二类网络全节点可向第一类网络全节点转化,进一步增加了方案的灵活度。It should be noted that by introducing the recovery probability, the second type of network full nodes can be transformed into the first type of network full nodes, which further increases the flexibility of the scheme.

图3是根据本申请实施例提供的又一种全节点的带宽分配方法的流程图。本申请实施例在上述实施例的基础上,进一步对释放本地全节点进行解释说明。如图3所示,本实施例提供的全节点的带宽分配方法可以包括:FIG. 3 is a flowchart of yet another full-node bandwidth allocation method according to an embodiment of the present application. Based on the foregoing embodiments, the embodiments of the present application further explain the release of the local full node. As shown in FIG. 3 , the bandwidth allocation method for all nodes provided in this embodiment may include:

S301,确定处理轻量级节点所发起的事务处理请求的需求带宽。S301: Determine the required bandwidth for processing the transaction processing request initiated by the lightweight node.

S302,在本地节点的剩余带宽小于需求带宽的情况下,确定是否允许释放与本地节点连接的本地全节点。S302, in the case that the remaining bandwidth of the local node is less than the required bandwidth, determine whether to allow the release of the local full node connected to the local node.

S303,若是,则根据需求带宽和本地节点的剩余带宽,确定需释放带宽。S303, if yes, determine the bandwidth to be released according to the required bandwidth and the remaining bandwidth of the local node.

具体的,可以采用需求带宽减去本地节点的剩余带宽,进而得到需释放带宽。本实施例中,需释放带宽即为处理第二类轻量级节点所发起的事务处理请求还需释放的带宽。Specifically, the required bandwidth can be subtracted from the remaining bandwidth of the local node to obtain the bandwidth to be released. In this embodiment, the bandwidth to be released is the bandwidth that needs to be released to process the transaction processing request initiated by the second type of lightweight node.

S304,根据需释放带宽,从与本地节点连接的本地全节点中选择待释放全节点。S304, according to the need to release the bandwidth, select the full node to be released from the local full nodes connected to the local node.

可以理解的是,释放一个本地全节点可以释放本地节点向该本地全节点传输区块和传输事务处理请求等所用的带宽。It can be understood that releasing a local full node can release the bandwidth used by the local node to transmit blocks and transmit transaction processing requests to the local full node.

可选的,本实施例可以根据需释放带宽和最多可释放的全节点数量,从与本地节点连接的本地全节点中选择待释放全节点。其中,若本地节点为第二类网络全节点,则最多可释放数量为与本地节点连接的本地全节点数量和第一数量下限值之差;若本地节点为第一类网络全节点,且第一类网络全节点当前数量大于第二数量下限值,则最多可释放数量为与本地节点连接的本地全节点数量和第一数量下限值之差;若本地节点为第一类网络全节点,且第一类网络全节点当前数量小于或等于第二数量下限值,则最多可释放数量为与本地节点连接的本地全节点数量和第三数量临界值之差并减1。Optionally, in this embodiment, the full node to be released may be selected from the local full nodes connected to the local node according to the bandwidth to be released and the maximum number of full nodes that can be released. Among them, if the local node is the second type of network full node, the maximum releaseable quantity is the difference between the number of local full nodes connected to the local node and the lower limit of the first quantity; if the local node is the first type of network full node, and The current number of full nodes in the first type of network is greater than the lower limit of the second quantity, and the maximum releaseable quantity is the difference between the number of local full nodes connected to the local node and the lower limit of the first number; nodes, and the current number of full nodes in the first type of network is less than or equal to the lower limit of the second number, then the maximum releaseable number is the difference between the number of local full nodes connected to the local node and the threshold of the third number minus 1.

进一步的,本实施例还可以根据需释放带宽、最多可释放数量和本地全节点性能,从与本地节点连接的本地全节点中选择待释放全节点。其中,本地全节点性能可以通过本地全节点的硬件配置以及本地节点向本地全节点传输数据的速度等综合衡量。Further, in this embodiment, the full node to be released may be selected from the local full nodes connected to the local node according to the required release bandwidth, the maximum amount that can be released, and the performance of the local full node. Among them, the performance of the local full node can be comprehensively measured by the hardware configuration of the local full node and the speed of data transmission from the local node to the local full node.

S305,释放待释放全节点,且基于释放的带宽对事务处理请求进行处理。S305 , release all nodes to be released, and process the transaction processing request based on the released bandwidth.

具体的,在确定待释放全节点之后,可以释放待释放全节点,并可以基于释放的带宽对第二类轻量级节点所发起的事务处理请求进行处理。Specifically, after the full node to be released is determined, the full node to be released can be released, and the transaction processing request initiated by the second type of lightweight node can be processed based on the released bandwidth.

进一步的,待释放全节点的可释放带宽等于或大于需释放带宽,则可以直接对第二类轻量级节点所发起的事务处理请求进行处理,此时无需关注轻量级节点的数量。Further, if the releasable bandwidth of the full node to be released is equal to or greater than the bandwidth to be released, the transaction processing request initiated by the second type of lightweight nodes can be directly processed, and there is no need to pay attention to the number of lightweight nodes at this time.

作为本申请实施例的一种可选方式,在轻量级节点(即第二类轻量级节点)的数量为至少两个的情况下,若待释放全节点的可释放带宽小于需释放带宽,则可以根据事务处理请求的接收时间和/或轻量级节点(即第二类轻量级节点)的活跃度,从发起事务处理请求的轻量级节点(即第二类轻量级节点)中选择可处理轻量级节点,并对可处理轻量级节点的事务处理请求进行处理。本实施例中,第二类轻量级的活跃度可以根据第二轻量级节点的历史连接记录进行确定。As an optional method of this embodiment of the present application, when the number of lightweight nodes (that is, the second type of lightweight nodes) is at least two, if the releasable bandwidth of the full node to be released is less than the bandwidth to be released , then according to the reception time of the transaction request and/or the activity of the lightweight node (ie, the second type of lightweight node), from the lightweight node that initiated the transaction request (ie the second type of lightweight node ), select a node that can process lightweight nodes, and process transaction processing requests that can process lightweight nodes. In this embodiment, the activity of the second lightweight node may be determined according to the historical connection record of the second lightweight node.

需要说明的是,本实施例通过将可释放带宽与需释放带宽进行比较,在可释放带宽小于需释放带宽,且第二类轻量级节点数量为多个的情况下,引入接收时间和活跃度等因素,从多个第二类轻量级节点中选择可处理轻量级节点,进一步提升了用户的体验,同时增加了方案的灵活度。It should be noted that, in this embodiment, by comparing the releasable bandwidth with the required releasable bandwidth, when the releasable bandwidth is less than the required releasable bandwidth, and the number of the second type of lightweight nodes is multiple, the receiving time and active According to factors such as degree, select from multiple second-class lightweight nodes that can handle lightweight nodes, which further improves the user experience and increases the flexibility of the solution.

本申请实施例的技术方案,区块链节点在确定允许释放与其连接的本地全节点的情况下,通过引入需释放带宽,从与区块链节点连接的本地全节点中选择待释放全节点,进行释放,为释放全节点提供了一种可选方式。同时基于需释放带宽选择待释放全节点,还可以保证区块链节点的带宽能够被充分利用。In the technical solution of the embodiment of the present application, when the blockchain node determines that the local full node connected to it is allowed to be released, the full node to be released is selected from the local full nodes connected to the blockchain node by introducing the bandwidth to be released, Release, which provides an optional way to release full nodes. At the same time, the full nodes to be released are selected based on the bandwidth to be released, which can also ensure that the bandwidth of the blockchain nodes can be fully utilized.

图4是根据本申请实施例提供的一种全节点的带宽分配装置的结构示意图。该装置可实现本申请实施例所述的全节点的带宽分配方法。该装置可集成于承载区块链网络中全节点的计算设备中。该全节点的带宽分配装置400具体包括:FIG. 4 is a schematic structural diagram of a device for allocating bandwidth for all nodes according to an embodiment of the present application. The device can implement the bandwidth allocation method for all nodes described in the embodiments of the present application. The device can be integrated into a computing device that carries full nodes in a blockchain network. The full-node bandwidth allocation device 400 specifically includes:

需求带宽确定模块401,用于确定处理轻量级节点所发起的事务处理请求的需求带宽;The required bandwidth determination module 401 is used for determining the required bandwidth for processing the transaction processing request initiated by the lightweight node;

释放确定模块402,用于在本地节点的剩余带宽小于需求带宽的情况下,确定是否允许释放与本地节点连接的本地全节点;The release determination module 402 is used to determine whether to allow the release of the local full node connected to the local node when the remaining bandwidth of the local node is less than the required bandwidth;

释放模块403,用于若允许释放与本地节点连接的本地全节点,则释放本地全节点;The release module 403 is used to release the local full node if the local full node connected to the local node is allowed to be released;

处理模块404,用于基于释放的带宽对事务处理请求进行处理。The processing module 404 is configured to process the transaction processing request based on the released bandwidth.

本申请实施例的技术方案,在区块链节点本地的剩余带宽下小于处理轻量级节点所发起的事务处理请求的需求带宽的情况下,通过判断是否允许释放与区块链节点连接的本地全节点,并在确定允许释放的情况下,灵活释放本地全节点,进而基于释放的本地全节点所释放的带宽对事务处理请求进行处理。解决了目前区块链网络中无法动态分配全节点带宽的问题,可动态调整全节点的带宽分配比例,将带宽合理的分配给全节点和轻量级节点,在灵活性和通用性上取得了很好的平衡,为动态分配全节点带宽提供了一种新思路。In the technical solution of the embodiments of the present application, in the case where the local remaining bandwidth of the blockchain node is less than the required bandwidth for processing the transaction processing request initiated by the lightweight node, it is judged whether to allow the release of the local node connected to the blockchain node. The full node, and when it is determined that the release is allowed, the local full node is released flexibly, and then the transaction processing request is processed based on the bandwidth released by the released local full node. It solves the problem that the bandwidth of full nodes cannot be dynamically allocated in the current blockchain network. It can dynamically adjust the bandwidth allocation ratio of full nodes, and allocate bandwidth reasonably to full nodes and lightweight nodes. It has achieved great flexibility and versatility. A good balance provides a new idea for dynamically allocating full-node bandwidth.

示例性的,释放确定模块402包括:Exemplarily, the release determination module 402 includes:

当前数量确定单元,用于确定区块链网络中的第一类网络全节点当前数量;The current quantity determination unit is used to determine the current quantity of the first type of network full nodes in the blockchain network;

释放确定单元,用于根据第一类网络全节点当前数量、与本地节点连接的本地全节点数量、第一数量下限值和第二数量下限值,确定是否允许释放与本地节点连接的本地全节点;其中,第一数量下限值为与本地节点连接的本地全节点数量下限值,第二数量下限值为区块链网络中的第一类网络全节点数量下限值。The release determination unit is configured to determine whether to allow the release of local nodes connected to the local node according to the current number of network full nodes of the first type, the number of local full nodes connected to the local node, the lower limit of the first number and the lower limit of the second number. Full nodes; wherein, the first lower limit of the number is the lower limit of the number of local full nodes connected to the local node, and the second lower limit of the number is the lower limit of the number of the first type of network full nodes in the blockchain network.

示例性的,若本地节点为第一类网络全节点,则释放确定单元具体用于:Exemplarily, if the local node is a full node of the first type of network, the release determination unit is specifically used for:

若第一类网络全节点当前数量大于第二数量下限值,且本地全节点数量大于第一数量下限值,则允许释放与本地节点连接的本地全节点。If the current number of network full nodes of the first type is greater than the second lower limit value, and the number of local full nodes is greater than the first number lower limit value, the local full nodes connected to the local node are allowed to be released.

示例性的,若本地节点为第一类网络全节点,则所述释放确定单元还具体用于:Exemplarily, if the local node is a full node of the first type of network, the release determination unit is further specifically used for:

若第一类网络全节点当前数量小于或等于第二数量下限值,且本地全节点数量大于第三数量临界值,则允许释放与本地节点连接的本地全节点;其中,第三数量临界值为与本地节点连接的本地全节点数量临界值。If the current number of full nodes in the first type of network is less than or equal to the second lower limit value, and the number of local full nodes is greater than the third critical value, the local full nodes connected to the local nodes are allowed to be released; wherein, the third critical value is the threshold for the number of local full nodes connected to the local node.

示例性的,若本地节点为第二类网络全节点,则释放确定单元具体用于:Exemplarily, if the local node is the second type of network full node, the release determination unit is specifically used for:

若第一类网络全节点当前数量大于第二数量下限值,本地全节点数量小于第三数量临界值,且本地全节点数量大于第一数量下限值,则允许释放与本地节点连接的本地全节点;其中,第三数量临界值为与本地节点连接的本地全节点数量临界值。If the current number of network full nodes of the first type is greater than the second number lower limit value, the local full node number is less than the third number threshold value, and the local full node number is greater than the first number lower limit value, then the local nodes connected to the local nodes are allowed to be released. Full nodes; wherein, the third critical value is the critical value of the number of local full nodes connected to the local node.

示例性的,释放模块403具体用于:Exemplarily, the release module 403 is specifically used for:

根据需求带宽和本地节点的剩余带宽,确定需释放带宽;Determine the bandwidth to be released according to the required bandwidth and the remaining bandwidth of the local node;

根据需释放带宽,从与本地节点连接的本地全节点中选择待释放全节点;To release bandwidth as needed, select the full node to be released from the local full nodes connected to the local node;

释放待释放全节点。Release the full node to be released.

示例性的,若轻量级节点数量为至少两个,则处理模块404具体用于:Exemplarily, if the number of lightweight nodes is at least two, the processing module 404 is specifically configured to:

若待释放全节点的可释放带宽小于需释放带宽,则根据事务处理请求的接收时间和/或轻量级节点的活跃度,从发起事务处理请求的轻量级节点中选择可处理轻量级节点;If the releasable bandwidth of the full node to be released is less than the bandwidth to be released, select the light-weight node that can process the transaction request from the light-weight nodes that initiate the transaction request according to the reception time of the transaction request and/or the activity of the light-weight node node;

对可处理轻量级节点的事务处理请求进行处理。Handles transaction processing requests that can handle lightweight nodes.

示例性的,若本地节点为第二类网络全节点,则上述装置还包括:Exemplarily, if the local node is a full node of the second type of network, the above-mentioned apparatus further includes:

概率确定模块,用于根据第一类网络全节点当前数量和第二数量下限值,确定恢复概率;a probability determination module, configured to determine the recovery probability according to the current number of full nodes in the first type of network and the lower limit of the second number;

转化模块,用于根据恢复概率,从当前的第二类网络全节点转化为第一类网络全节点。The transformation module is used to transform the current second-type network full node into the first-type network full node according to the recovery probability.

示例性的,第一类网络全节点承担出块任务,第二类网络全节点不承担出块任务。Exemplarily, the first type of network full nodes undertake the task of producing blocks, and the second type of network full nodes do not undertake the task of producing blocks.

根据本申请的实施例,本申请还提供了一种电子设备和一种可读存储介质。According to the embodiments of the present application, the present application further provides an electronic device and a readable storage medium.

如图5所示,是根据本申请实施例的全节点的带宽分配方法的电子设备的框图。电子设备旨在表示各种形式的数字计算机,诸如,膝上型计算机、台式计算机、工作台、个人数字助理、服务器、刀片式服务器、大型计算机、和其它适合的计算机。电子设备还可以表示各种形式的移动装置,诸如,个人数字处理、蜂窝电话、智能电话、可穿戴设备和其它类似的计算装置。本文所示的部件、它们的连接和关系、以及它们的功能仅仅作为示例,并且不意在限制本文中描述的和/或者要求的本申请的实现。As shown in FIG. 5 , it is a block diagram of an electronic device of a bandwidth allocation method for a full node according to an embodiment of the present application. Electronic devices are intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. Electronic devices may also represent various forms of mobile devices, such as personal digital processors, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are by way of example only, and are not intended to limit implementations of the application described and/or claimed herein.

如图5所示,该电子设备包括:一个或多个处理器501、存储器502,以及用于连接各部件的接口,包括高速接口和低速接口。各个部件利用不同的总线互相连接,并且可以被安装在公共主板上或者根据需要以其它方式安装。处理器可以对在电子设备内执行的指令进行处理,包括存储在存储器中或者存储器上以在外部输入/输出装置(诸如,耦合至接口的显示设备)上显示GUI的图形信息的指令。在其它实施方式中,若需要,可以将多个处理器和/或多条总线与多个存储器和多个存储器一起使用。同样,可以连接多个电子设备,各个设备提供部分必要的操作(例如,作为服务器阵列、一组刀片式服务器、或者多处理器系统)。图5中以一个处理器501为例。As shown in FIG. 5, the electronic device includes: one or more processors 501, a memory 502, and interfaces for connecting various components, including a high-speed interface and a low-speed interface. The various components are interconnected using different buses and may be mounted on a common motherboard or otherwise as desired. The processor may process instructions executed within the electronic device, including instructions stored in or on memory to display graphical information of the GUI on an external input/output device, such as a display device coupled to the interface. In other embodiments, multiple processors and/or multiple buses may be used with multiple memories and multiple memories, if desired. Likewise, multiple electronic devices may be connected, each providing some of the necessary operations (eg, as a server array, a group of blade servers, or a multiprocessor system). A processor 501 is taken as an example in FIG. 5 .

存储器502即为本申请所提供的非瞬时计算机可读存储介质。其中,所述存储器存储有可由至少一个处理器执行的指令,以使所述至少一个处理器执行本申请所提供的全节点的带宽分配方法。本申请的非瞬时计算机可读存储介质存储计算机指令,该计算机指令用于使计算机执行本申请所提供的全节点的带宽分配方法。The memory 502 is the non-transitory computer-readable storage medium provided by the present application. Wherein, the memory stores instructions executable by at least one processor, so that the at least one processor executes the full-node bandwidth allocation method provided by the present application. The non-transitory computer-readable storage medium of the present application stores computer instructions, and the computer instructions are used to cause the computer to execute the bandwidth allocation method for a full node provided by the present application.

存储器502作为一种非瞬时计算机可读存储介质,可用于存储非瞬时软件程序、非瞬时计算机可执行程序以及模块,如本申请实施例中的全节点的带宽分配方法对应的程序指令/模块(例如,附图4所示的需求带宽确定模块401、释放确定模块402、释放模块403和处理模块404)。处理器501通过运行存储在存储器502中的非瞬时软件程序、指令以及模块,从而执行服务器的各种功能应用以及数据处理,即实现上述方法实施例中的全节点的带宽分配方法。As a non-transitory computer-readable storage medium, the memory 502 can be used to store non-transitory software programs, non-transitory computer-executable programs and modules, such as program instructions/modules ( For example, the demand bandwidth determination module 401, the release determination module 402, the release module 403 and the processing module 404 shown in FIG. 4). The processor 501 executes various functional applications and data processing of the server by running the non-transitory software programs, instructions and modules stored in the memory 502, ie, implements the bandwidth allocation method for all nodes in the above method embodiments.

存储器502可以包括存储程序区和存储数据区,其中,存储程序区可存储操作系统、至少一个功能所需要的应用程序;存储数据区可存储根据全节点的带宽分配方法的电子设备的使用所创建的数据等。此外,存储器502可以包括高速随机存取存储器,还可以包括非瞬时存储器,例如至少一个磁盘存储器件、闪存器件、或其他非瞬时固态存储器件。在一些实施例中,存储器502可选包括相对于处理器501远程设置的存储器,这些远程存储器可以通过网络连接至全节点的带宽分配方法的电子设备。上述网络的实例包括但不限于互联网、企业内部网、局域网、区块链网络、移动通信网及其组合。The memory 502 may include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required by at least one function; the storage data area may store a storage data area created according to the use of the electronic device of the full node bandwidth allocation method. data etc. Additionally, memory 502 may include high-speed random access memory, and may also include non-transitory memory, such as at least one magnetic disk storage device, flash memory device, or other non-transitory solid-state storage device. In some embodiments, memory 502 may optionally include memory located remotely relative to processor 501, and these remote memories may be connected to electronic devices of the full-node bandwidth allocation method via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, blockchain networks, mobile communication networks, and combinations thereof.

全节点的带宽分配方法的电子设备还可以包括:输入装置503和输出装置504。处理器501、存储器502、输入装置503和输出装置504可以通过总线或者其他方式连接,图5中以通过总线连接为例。The electronic device for the full-node bandwidth allocation method may further include: an input device 503 and an output device 504 . The processor 501 , the memory 502 , the input device 503 and the output device 504 may be connected by a bus or in other ways, and the connection by a bus is taken as an example in FIG. 5 .

输入装置503可接收输入的数字或字符信息,以及产生与全节点的带宽分配方法的电子设备的用户设置以及功能控制有关的键信号输入,例如触摸屏、小键盘、鼠标、轨迹板、触摸板、指示杆、一个或者多个鼠标按钮、轨迹球、操纵杆等输入装置。输出装置504可以包括显示设备、辅助照明装置(例如,LED)和触觉反馈装置(例如,振动电机)等。该显示设备可以包括但不限于,液晶显示器(LCD)、发光二极管(LED)显示器和等离子体显示器。在一些实施方式中,显示设备可以是触摸屏。The input device 503 can receive input numerical or character information, and generate key signal input related to user settings and function control of the electronic equipment of the full-node bandwidth allocation method, such as a touch screen, a keypad, a mouse, a trackpad, a touchpad, An input device such as a pointing stick, one or more mouse buttons, trackball, joystick, etc. Output devices 504 may include display devices, auxiliary lighting devices (eg, LEDs), haptic feedback devices (eg, vibration motors), and the like. The display device may include, but is not limited to, a liquid crystal display (LCD), a light emitting diode (LED) display, and a plasma display. In some implementations, the display device may be a touch screen.

此处描述的系统和技术的各种实施方式可以在数字电子电路系统、集成电路系统、专用ASIC(专用集成电路)、计算机硬件、固件、软件、和/或它们的组合中实现。这些各种实施方式可以包括:实施在一个或者多个计算机程序中,该一个或者多个计算机程序可在包括至少一个可编程处理器的可编程系统上执行和/或解释,该可编程处理器可以是专用或者通用可编程处理器,可以从存储系统、至少一个输入装置、和至少一个输出装置接收数据和指令,并且将数据和指令传输至该存储系统、该至少一个输入装置、和该至少一个输出装置。Various implementations of the systems and techniques described herein can be implemented in digital electronic circuitry, integrated circuit systems, application specific ASICs (application specific integrated circuits), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include being implemented in one or more computer programs executable and/or interpretable on a programmable system including at least one programmable processor that The processor, which may be a special purpose or general-purpose programmable processor, may receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device an output device.

这些计算程序(也称作程序、软件、软件应用、或者代码)包括可编程处理器的机器指令,并且可以利用高级过程和/或面向对象的编程语言、和/或汇编/机器语言来实施这些计算程序。如本文使用的,术语“机器可读介质”和“计算机可读介质”指的是用于将机器指令和/或数据提供给可编程处理器的任何计算机程序产品、设备、和/或装置(例如,磁盘、光盘、存储器、可编程逻辑装置(PLD)),包括,接收作为机器可读信号的机器指令的机器可读介质。术语“机器可读信号”指的是用于将机器指令和/或数据提供给可编程处理器的任何信号。These computational programs (also referred to as programs, software, software applications, or codes) include machine instructions for programmable processors, and may be implemented using high-level procedural and/or object-oriented programming languages, and/or assembly/machine languages calculation program. As used herein, the terms "machine-readable medium" and "computer-readable medium" refer to any computer program product, apparatus, and/or apparatus for providing machine instructions and/or data to a programmable processor ( For example, magnetic disks, optical disks, memories, programmable logic devices (PLDs), including machine-readable media that receive machine instructions as machine-readable signals. The term "machine-readable signal" refers to any signal used to provide machine instructions and/or data to a programmable processor.

为了提供与用户的交互,可以在计算机上实施此处描述的系统和技术,该计算机具有:用于向用户显示信息的显示装置(例如,CRT(阴极射线管)或者LCD(液晶显示器)监视器);以及键盘和指向装置(例如,鼠标或者轨迹球),用户可以通过该键盘和该指向装置来将输入提供给计算机。其它种类的装置还可以用于提供与用户的交互;例如,提供给用户的反馈可以是任何形式的传感反馈(例如,视觉反馈、听觉反馈、或者触觉反馈);并且可以用任何形式(包括声输入、语音输入或者、触觉输入)来接收来自用户的输入。To provide interaction with a user, the systems and techniques described herein may be implemented on a computer having: a display device (eg, a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user ); and a keyboard and pointing device (eg, a mouse or trackball) through which a user can provide input to the computer. Other kinds of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (eg, visual feedback, auditory feedback, or tactile feedback); and can be in any form (including acoustic input, voice input, or tactile input) to receive input from the user.

可以将此处描述的系统和技术实施在包括后台部件的计算系统(例如,作为数据服务器)、或者包括中间件部件的计算系统(例如,应用服务器)、或者包括前端部件的计算系统(例如,具有图形用户界面或者网络浏览器的用户计算机,用户可以通过该图形用户界面或者该网络浏览器来与此处描述的系统和技术的实施方式交互)、或者包括这种后台部件、中间件部件、或者前端部件的任何组合的计算系统中。可以通过任何形式或者介质的数字数据通信(例如,通信网络)来将系统的部件相互连接。通信网络的示例包括:局域网(LAN)、广域网(WAN)、互联网和区块链网络。The systems and techniques described herein can be implemented on a computing system that includes back-end components (eg, as a data server), or a computing system that includes middleware components (eg, an application server), or a computing system that includes front-end components (eg, a user computer having a graphical user interface or web browser through which a user can interact with implementations of the systems and techniques described herein), or including such backend components, middleware components, Or any combination of front-end components in a computing system. The components of the system may be interconnected by any form or medium of digital data communication (eg, a communication network). Examples of communication networks include: Local Area Networks (LANs), Wide Area Networks (WANs), the Internet, and blockchain networks.

计算机系统可以包括客户端和服务器。客户端和服务器一般远离彼此并且通常通过通信网络进行交互。通过在相应的计算机上运行并且彼此具有客户端-服务器关系的计算机程序来产生客户端和服务器的关系。服务器可以是云服务器,又称为云计算服务器或云主机,是云计算服务体系中的一项主机产品,以解决了传统物理主机与VPS服务中,存在的管理难度大,业务扩展性弱的缺陷。A computer system can include clients and servers. Clients and servers are generally remote from each other and usually interact through a communication network. The relationship of client and server arises by computer programs running on the respective computers and having a client-server relationship to each other. The server can be a cloud server, also known as a cloud computing server or a cloud host. It is a host product in the cloud computing service system to solve the traditional physical host and VPS services, which are difficult to manage and weak in business scalability. defect.

根据本申请实施例的技术方案,在区块链节点本地的剩余带宽下小于处理轻量级节点所发起的事务处理请求的需求带宽的情况下,通过判断是否允许释放与区块链节点连接的本地全节点,并在确定允许释放的情况下,灵活释放本地全节点,进而基于释放的本地全节点所释放的带宽对事务处理请求进行处理。解决了目前区块链网络中无法动态分配全节点带宽的问题,可动态调整全节点的带宽分配比例,将带宽合理的分配给全节点和轻量级节点,在灵活性和通用性上取得了很好的平衡,为动态分配全节点带宽提供了一种新思路。According to the technical solutions of the embodiments of the present application, in the case where the local remaining bandwidth of the blockchain node is less than the required bandwidth for processing the transaction processing request initiated by the lightweight node, it is determined whether to allow the release of the blockchain node connected to the blockchain node. The local full node, and if it is determined that the release is allowed, the local full node is flexibly released, and then the transaction processing request is processed based on the bandwidth released by the released local full node. It solves the problem that the bandwidth of full nodes cannot be dynamically allocated in the current blockchain network. It can dynamically adjust the bandwidth allocation ratio of full nodes, and allocate bandwidth reasonably to full nodes and lightweight nodes. It has achieved great flexibility and versatility. A good balance provides a new idea for dynamically allocating full-node bandwidth.

应该理解,可以使用上面所示的各种形式的流程,重新排序、增加或删除步骤。例如,本发申请中记载的各步骤可以并行地执行也可以顺序地执行也可以不同的次序执行,只要能够实现本申请公开的技术方案所期望的结果,本文在此不进行限制。It should be understood that steps may be reordered, added or deleted using the various forms of flow shown above. For example, the steps described in the present application can be performed in parallel, sequentially or in different orders, and as long as the desired results of the technical solutions disclosed in the present application can be achieved, no limitation is imposed herein.

上述具体实施方式,并不构成对本申请保护范围的限制。本领域技术人员应该明白的是,根据设计要求和其他因素,可以进行各种修改、组合、子组合和替代。任何在本申请的精神和原则之内所作的修改、等同替换和改进等,均应包含在本申请保护范围之内。The above-mentioned specific embodiments do not constitute a limitation on the protection scope of the present application. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modifications, equivalent replacements and improvements made within the spirit and principles of this application shall be included within the protection scope of this application.

Claims (18)

1. A bandwidth allocation method of a full node comprises the following steps:
determining the required bandwidth for processing a transaction processing request initiated by a lightweight node;
determining whether to allow release of a local full node connected with the local node under the condition that the residual bandwidth of the local node is smaller than the required bandwidth;
and if so, releasing the local full node, and processing the transaction processing request based on the released bandwidth.
2. The method of claim 1, wherein determining whether to allow release of the local full node connected to the local node comprises:
determining the current number of the first type of network full nodes in the block chain network; the first type network full node undertakes a block task, a transaction request synchronization task and a block forwarding task;
determining whether to allow the release of the local full nodes connected with the local nodes according to the current number of the first type network full nodes, the number of the local full nodes connected with the local nodes, a first number lower limit value and a second number lower limit value; the first lower limit value of the number is a lower limit value of the number of local full nodes connected with the local nodes, and the second lower limit value of the number is a lower limit value of the number of first type network full nodes in the block chain network.
3. The method of claim 2, wherein if the local node is a first type network full node, determining whether to allow the release of the local full node connected to the local node according to the current number of the first type network full nodes, the number of local full nodes connected to the local node, a first number lower limit value and a second number lower limit value comprises:
and if the current number of the first type of network full nodes is greater than the second number lower limit value and the number of the local full nodes is greater than the first number lower limit value, allowing the local full nodes connected with the local nodes to be released.
4. The method of claim 2, wherein if the local node is a first type network full node, determining whether to allow the release of the local full node connected to the local node according to the current number of the first type network full nodes, the number of local full nodes connected to the local node, a first number lower limit value and a second number lower limit value comprises:
if the current number of the first type network full nodes is less than or equal to the second number lower limit value and the number of the local full nodes is greater than a third number critical value, allowing the local full nodes connected with the local nodes to be released; the third quantity critical value is a local full-node quantity critical value connected with the local node, and is a boundary line between the local node as a first-class network full node and the local node as a second-class network full node, and the third quantity critical value is greater than the first quantity lower limit value; the second type network whole nodes do not undertake the block task, the transaction request synchronization task and the block forwarding task.
5. The method of claim 2, wherein if the local node is a second type of network full node, determining whether to allow the release of the local full node connected to the local node according to the current number of the first type of network full nodes, the number of local full nodes connected to the local node, a first number lower limit value and a second number lower limit value comprises:
if the current number of the first type network full nodes is larger than the second number lower limit value, the number of the local full nodes is smaller than a third number critical value, and the number of the local full nodes is larger than the first number lower limit value, the local full nodes connected with the local nodes are allowed to be released; the third quantity critical value is a local full-node quantity critical value connected with the local node, and is a boundary line between the local node as a first-class network full node and the local node as a second-class network full node, and the third quantity critical value is greater than the first quantity lower limit value; the second type network whole nodes do not undertake the block task, the transaction request synchronization task and the block forwarding task.
6. The method of claim 1, wherein releasing the local full node comprises:
determining the bandwidth to be released according to the required bandwidth and the residual bandwidth of the local node;
selecting a full node to be released from the local full nodes connected with the local node according to the bandwidth to be released;
and releasing the full node to be released.
7. The method of claim 6, wherein if the number of lightweight nodes is at least two, processing the transaction request based on the released bandwidth comprises:
if the releasable bandwidth of the full node to be released is smaller than the bandwidth to be released, selecting a processable lightweight node from the lightweight nodes initiating the transaction processing request according to the receiving time of the transaction processing request and/or the activity of the lightweight nodes;
and processing the transaction processing request of the processable lightweight node.
8. The method of claim 2, if the local node is a second type of network full node, the method further comprising:
determining the recovery probability according to the current number of the first type of network full nodes and the lower limit value of the second number;
and converting the current second type network full node into the first type network full node according to the recovery probability.
9. A full-node bandwidth allocation apparatus, comprising:
the demand bandwidth determining module is used for determining the demand bandwidth for processing the transaction processing request initiated by the lightweight node;
a release determining module, configured to determine whether to allow release of a local full node connected to a local node when a remaining bandwidth of the local node is smaller than the required bandwidth;
the release module is used for releasing the local full node if the release of the local full node connected with the local node is allowed;
and the processing module is used for processing the transaction processing request based on the released bandwidth.
10. The apparatus of claim 9, wherein the release determination module comprises:
a current number determination unit, configured to determine a current number of all nodes of a first type network in a blockchain network; the first type network full node undertakes a block task, a transaction request synchronization task and a block forwarding task;
a release determining unit, configured to determine whether to allow release of the local full node connected to the local node according to the current number of the first-class network full nodes, the number of the local full nodes connected to the local node, a first number lower limit value, and a second number lower limit value; the first lower limit value of the number is a lower limit value of the number of local full nodes connected with the local nodes, and the second lower limit value of the number is a lower limit value of the number of first type network full nodes in the block chain network.
11. The apparatus according to claim 10, wherein if the local node is a first-class network full node, the release determining unit is specifically configured to:
and if the current number of the first type of network full nodes is greater than the second number lower limit value and the number of the local full nodes is greater than the first number lower limit value, allowing the local full nodes connected with the local nodes to be released.
12. The apparatus according to claim 10, wherein if the local node is a first-class network full node, the release determining unit is further specifically configured to:
if the current number of the first type network full nodes is less than or equal to the second number lower limit value and the number of the local full nodes is greater than a third number critical value, allowing the local full nodes connected with the local nodes to be released; the third quantity critical value is a local full-node quantity critical value connected with the local node, and is a boundary line between the local node as a first-class network full node and the local node as a second-class network full node, and the third quantity critical value is greater than the first quantity lower limit value; the second type network whole nodes do not undertake the block task, the transaction request synchronization task and the block forwarding task.
13. The apparatus according to claim 10, wherein if the local node is a second-class network full node, the release determining unit is specifically configured to:
if the current number of the first type network full nodes is larger than the second number lower limit value, the number of the local full nodes is smaller than a third number critical value, and the number of the local full nodes is larger than the first number lower limit value, the local full nodes connected with the local nodes are allowed to be released; the third quantity critical value is a local full-node quantity critical value connected with the local node, and is a boundary line between the local node as a first-class network full node and the local node as a second-class network full node, and the third quantity critical value is greater than the first quantity lower limit value; the second type network whole nodes do not undertake the block task, the transaction request synchronization task and the block forwarding task.
14. The apparatus according to claim 9, wherein the release module is specifically configured to:
determining the bandwidth to be released according to the required bandwidth and the residual bandwidth of the local node;
selecting a full node to be released from the local full nodes connected with the local node according to the bandwidth to be released;
and releasing the full node to be released.
15. The apparatus according to claim 14, wherein if the number of lightweight nodes is at least two, the processing module is specifically configured to:
if the releasable bandwidth of the full node to be released is smaller than the bandwidth to be released, selecting a processable lightweight node from the lightweight nodes initiating the transaction processing request according to the receiving time of the transaction processing request and/or the activity of the lightweight nodes;
and processing the transaction processing request of the processable lightweight node.
16. The apparatus of claim 10, if the local node is a second type network full node, the apparatus further comprising:
a probability determination module, configured to determine a recovery probability according to the current number of the first class of network full nodes and the lower limit value of the second number;
and the conversion module is used for converting the current second type network full node into the first type network full node according to the recovery probability.
17. An electronic device, comprising:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of full-node bandwidth allocation of any one of claims 1-8.
18. A non-transitory computer readable storage medium storing computer instructions for causing a computer to perform the full-node bandwidth allocation method of any one of claims 1-8.
CN202011045080.4A 2020-09-28 2020-09-28 Bandwidth allocation method and device for all nodes, electronic equipment and storage medium Active CN111901254B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011045080.4A CN111901254B (en) 2020-09-28 2020-09-28 Bandwidth allocation method and device for all nodes, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011045080.4A CN111901254B (en) 2020-09-28 2020-09-28 Bandwidth allocation method and device for all nodes, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN111901254A CN111901254A (en) 2020-11-06
CN111901254B true CN111901254B (en) 2021-01-08

Family

ID=73223984

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011045080.4A Active CN111901254B (en) 2020-09-28 2020-09-28 Bandwidth allocation method and device for all nodes, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN111901254B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113608923B (en) * 2021-06-28 2023-07-14 苏州浪潮智能科技有限公司 A method, system and terminal for dynamically adjusting the resynchronization speed of a hyperactive volume

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2017198291A1 (en) * 2016-05-18 2017-11-23 Rwe International Se Peer-to-peer network and node of a peer-to-peer network
WO2017220115A1 (en) * 2016-06-20 2017-12-28 Rwe International Se Software defined networking system
CN108881459A (en) * 2018-07-02 2018-11-23 甘肃山呼信息技术有限公司 A kind of public block catenary system of Highly Scalable towards practical application
CN109150972A (en) * 2018-07-17 2019-01-04 湖南宸瀚信息科技有限责任公司 A kind of the common recognition mechanism and its working method of the efficient block chain of bilayer fragment
CN110959281A (en) * 2017-08-05 2020-04-03 普罗克鲁斯科技有限公司 Method and system for securing blockchain using transaction proof

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2017198291A1 (en) * 2016-05-18 2017-11-23 Rwe International Se Peer-to-peer network and node of a peer-to-peer network
WO2017220115A1 (en) * 2016-06-20 2017-12-28 Rwe International Se Software defined networking system
CN110959281A (en) * 2017-08-05 2020-04-03 普罗克鲁斯科技有限公司 Method and system for securing blockchain using transaction proof
CN108881459A (en) * 2018-07-02 2018-11-23 甘肃山呼信息技术有限公司 A kind of public block catenary system of Highly Scalable towards practical application
CN109150972A (en) * 2018-07-17 2019-01-04 湖南宸瀚信息科技有限责任公司 A kind of the common recognition mechanism and its working method of the efficient block chain of bilayer fragment

Also Published As

Publication number Publication date
CN111901254A (en) 2020-11-06

Similar Documents

Publication Publication Date Title
CN113377520B (en) Resource scheduling method, device, equipment and storage medium
CN111694646B (en) Resource scheduling method, device, electronic equipment and computer readable storage medium
CN111831450A (en) Method, apparatus, electronic device and storage medium for allocating server resources
CN113407347B (en) Resource scheduling method, device, equipment and computer storage medium
CN112153167B (en) Internet interconnection protocol management method, device, electronic equipment and storage medium
CN111506401B (en) Automatic driving simulation task scheduling method and device, electronic equipment and storage medium
CN110995504B (en) Microservice node exception handling method, device and system
CN113742075A (en) Task processing method, device and system based on cloud distributed system
CN113849312A (en) Data processing task allocation method and device, electronic equipment and storage medium
CN114356547B (en) Low-priority blocking method and device based on processor virtualization environment
CN114742000A (en) SoC chip verification system, verification method and device based on FPGA cluster
CN111459645A (en) Task scheduling method and device and electronic equipment
CN114217977A (en) Resource allocation method, device, equipment and storage medium
CN111796940B (en) Resource allocation method and device and electronic equipment
CN111966502A (en) Method, apparatus, electronic device, and readable storage medium for adjusting the number of instances
CN111770176B (en) Traffic scheduling method and device
CN111858030B (en) Resource processing methods, devices, electronic equipment and readable storage media for operations
CN111901254B (en) Bandwidth allocation method and device for all nodes, electronic equipment and storage medium
CN114924882A (en) Distributed service processing method, device, equipment and storage medium
CN114416357A (en) Method and device for creating container group, electronic equipment and medium
WO2022199204A1 (en) Method and apparatus for determining resources
CN111176838B (en) Method and device for distributing embedded vector to node in bipartite graph
CN111737362B (en) Block chain processing method, device, equipment and storage medium
CN114416349A (en) Resource allocation method, apparatus, device, storage medium, and program product
CN114900562A (en) Resource acquisition method and device, electronic equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载