hfc.fabric.peer
¶
Module Contents¶
Classes¶
|
A peer node in the network. |
Functions¶
|
Factory method to construct a peer instance |
-
hfc.fabric.peer.
DEFAULT_PEER_ENDPOINT
= localhost:7051¶
-
hfc.fabric.peer.
_logger
¶
-
class
hfc.fabric.peer.
Peer
(name='peer', endpoint=DEFAULT_PEER_ENDPOINT, tls_ca_cert_file=None, client_key_file=None, client_cert_file=None, opts=None)¶ Bases:
object
A peer node in the network.
It has a specific gRPC channel address.
-
send_proposal
(self, proposal)¶ Send an endorsement proposal to endorser
- Parameters
proposal – The endorsement proposal
- Returns
ProposalResponse or exception
- Return type
Response/Exception
-
send_discovery
(self, request)¶ Send an request to discovery server
- Parameters
request – a signed request
- Returns
QueryResult or exception
- Return type
Result/Exception
-
init_with_bundle
(self, info)¶ Init the peer with given info dict :param info: Dict including all info, e.g., endpoint, grpc option :return: True or False
-
get_attrs
(self)¶
-
__str__
(self)¶ Return str(self).
-
property
endpoint
(self)¶ Return the endpoint of the peer.
- Returns
endpoint
-
property
name
(self)¶ Get the peer name
- Returns
The peer name
- Return type
str
-
join
(self, chan)¶ Join a channel
- Parameters
chan – a channel instance
-
property
channels
(self)¶
-
delivery
(self, envelope, scheduler=None, filtered=True)¶ Send an delivery envelop to event service.
- Parameters
envelope – The message envelope
scheduler – defaults to None
filtered (bool) – defaults to True
- Returns
orderer_response or exception
-
set_tls_client_cert_and_key
(self, client_key_file=None, client_cert_file=None)¶ Set tls client’s cert and key for mutual tls
- Parameters
client_key_file (str) – file path for Private key used for TLS when making client connections, defaults to None
client_cert_file (str) – file path for X.509 certificate used for TLS when making client connections, defaults to None
- Returns
set success value
- Return type
bool
-
-
hfc.fabric.peer.
create_peer
(endpoint=DEFAULT_PEER_ENDPOINT, tls_cacerts=None, client_key=None, client_cert=None, opts=None)¶ Factory method to construct a peer instance
- Parameters
endpoint – endpoint, defaults to DEFAULT_PEER_ENDPOINT
tls_cacerts – pem, defaults to None
client_key – pem, defaults to None
client_cert – pem, defaults to None
opts (opts) – opts, defaults to None
- Returns
a peer instance