METHOD AND APPARATUS FOR COMMUNICATION BETWEEN BLOCKCHAIN NODES
A communication request sent by a second node in a blockchain network is received by a first node in the blockchain network. Whether the second node has a mapping relationship with the first node is determined by the first node. A communication connection to the second node is established by the first node in response to determining that the second node has a mapping relationship with the first node. Establishment of a communication connection to the second node is refused by the first node in response to determining that the second node does not have a mapping relationship with the first node.
1 . A computer-implemented method, comprising:
receiving, by a first node in a blockchain network, a communication request sent by a second node in the blockchain network;
determining, by the first node, whether the second node has a mapping relationship with the first node;
in response to determining that the second node has a mapping relationship with the first node, establishing, by the first node, a communication connection to the second node; and
in response to determining that the second node does not have a mapping relationship with the first node, refusing to establish, by the first node, a communication connection to the second node.
2 . The computer-implemented method of claim 1 , wherein the first node and the second node are services nodes, and wherein service nodes exchange data through a communication program to execute a service.
3 . The computer-implemented method of claim 2 , wherein, when the first node is a service node participating in a first service, and when the second node is a service node participating in the first service, the first node and the second node have a mapping relationship.
4 . The computer-implemented method of claim 2 , wherein, when the first node is a service node participating in a first service, and when the second node is a service node participating in a different second service, the first node and the second node do not have a mapping relationship.
5 . The computer-implemented method of claim 1 , wherein the blockchain network further comprises at least one consensus node, and wherein, for each service node, at least one of:
a consensus node that performs consensus verification on service data generated by the service node has a mapping relationship with the service node; or
different consensus nodes that perform consensus verification on service data generated by the service node have a mapping relationship.
6 . The computer-implemented method of claim 1 , wherein the communication request sent by the second node comprises a digital certificate of the second node.
7 . The computer-implemented method of claim 6 , wherein the digital certificate of the second node comprises a node identifier of the second node; and
determining, by the first node, whether the second node has a mapping relationship with the first node comprises:
obtaining the node identifier from the digital certificate of the second node; and
determining, based on the obtained node identifier, whether the node identifier has a mapping relationship with a node identifier of the first node.
8 . The computer-implemented method of claim 1 , wherein establishing the communication connection to the second node comprises:
after the first node receives the communication request from the second node, sending a verification request from the first node to the second node, wherein, based on the verification request, the second node determines whether the first node has a mapping relationship with the second node;
in response to the second node determining that the first node has a mapping relationship with the second node, establishing, by the second node, a communication connection to the first node; and
in response to the second node determining that the first node does not have a mapping relationship with the second node, refusing, by the second node, to establish a communication connection to the first node.
9 . A non-transitory, computer-readable medium storing one or more instructions executable by a computer system to perform operations comprising:
receiving, by a first node in a blockchain network, a communication request sent by a second node in the blockchain network;
determining, by the first node, whether the second node has a mapping relationship with the first node;
in response to determining that the second node has a mapping relationship with the first node, establishing, by the first node, a communication connection to the second node; and
in response to determining that the second node does not have a mapping relationship with the first node, refusing to establish, by the first node, a communication connection to the second node.
10 . The non-transitory, computer-readable medium of claim 9 , wherein the first node and the second node are services nodes, and wherein service nodes exchange data through a communication program to execute a service.
11 . The non-transitory, computer-readable medium of claim 10 , wherein, when the first node is a service node participating in a first service, and when the second node is a service node participating in the first service, the first node and the second node have a mapping relationship.
12 . The non-transitory, computer-readable medium of claim 10 , wherein, when the first node is a service node participating in a first service, and when the second node is a service node participating in a different second service, the first node and the second node do not have a mapping relationship.
13 . The non-transitory, computer-readable medium of claim 9 , wherein the blockchain network further comprises at least one consensus node, and wherein, for each service node, at least one of:
a consensus node that performs consensus verification on service data generated by the service node has a mapping relationship with the service node; or
different consensus nodes that perform consensus verification on service data generated by the service node have a mapping relationship.
14 . The non-transitory, computer-readable medium of claim 9 , wherein the communication request sent by the second node comprises a digital certificate of the second node.
15 . The non-transitory, computer-readable medium of claim 14 , wherein the digital certificate of the second node comprises a node identifier of the second node; and
determining, by the first node, whether the second node has a mapping relationship with the first node comprises:
obtaining the node identifier from the digital certificate of the second node; and
determining, based on the obtained node identifier, whether the node identifier has a mapping relationship with a node identifier of the first node.
16 . The non-transitory, computer-readable medium of claim 9 , wherein establishing the communication connection to the second node comprises:
after the first node receives the communication request from the second node, sending a verification request from the first node to the second node, wherein, based on the verification request, the second node determines whether the first node has a mapping relationship with the second node;
in response to the second node determining that the first node has a mapping relationship with the second node, establishing, by the second node, a communication connection to the first node; and
in response to the second node determining that the first node does not have a mapping relationship with the second node, refusing, by the second node, to establish a communication connection to the first node.
17 . A computer-implemented system, comprising:
one or more computers; and
one or more computer memory devices interoperably coupled with the one or more computers and having tangible, non-transitory, machine-readable media storing one or more instructions that, when executed by the one or more computers, perform one or more operations comprising:
receiving, by a first node in a blockchain network, a communication request sent by a second node in the blockchain network;
determining, by the first node, whether the second node has a mapping relationship with the first node;
in response to determining that the second node has a mapping relationship with the first node, establishing, by the first node, a communication connection to the second node; and
in response to determining that the second node does not have a mapping relationship with the first node, refusing to establish, by the first node, a communication connection to the second node.
18 . The computer-implemented system of claim 17 , wherein the first node and the second node are services nodes, and wherein service nodes exchange data through a communication program to execute a service; wherein, when the first node is a service node participating in a first service, and when the second node is a service node participating in the first service, the first node and the second node have a mapping relationship; and wherein, when the first node is a service node participating in a first service, and when the second node is a service node participating in a different second service, the first node and the second node do not have a mapping relationship.
19 . The computer-implemented system of claim 17 , wherein the blockchain network further comprises at least one consensus node, and wherein, for each service node, at least one of:
a consensus node that performs consensus verification on service data generated by the service node has a mapping relationship with the service node; or
different consensus nodes that perform consensus verification on service data generated by the service node have a mapping relationship.
20 . The computer-implemented system of claim 17 , wherein the communication request sent by the second node comprises a digital certificate of the second node; and wherein the digital certificate of the second node comprises a node identifier of the second node; and
determining, by the first node, whether the second node has a mapping relationship with the first node comprises:
obtaining the node identifier from the digital certificate of the second node; and
determining, based on the obtained node identifier, whether the node identifier has a mapping relationship with a node identifier of the first node.