def __init__(self, key_pair: KeyPair, listen_ip: str, listen_port: int, chain: BaseBeaconChain, security_protocol_ops: Dict[(TProtocol, BaseSecureTransport)]=None, muxer_protocol_ops: Dict[(TProtocol, IMuxedConn)]=None, gossipsub_params: Optional[GossipsubParams]=None, cancel_token: CancelToken=None, bootstrap_nodes: Tuple[(Multiaddr, ...)]=None, preferred_nodes: Tuple[(Multiaddr, ...)]=None) -> None:
    super().__init__(cancel_token)
    self.listen_ip = listen_ip
    self.listen_port = listen_port
    self.key_pair = key_pair
    self.bootstrap_nodes = bootstrap_nodes
    self.preferred_nodes = preferred_nodes
    if (security_protocol_ops is None):
        security_protocol_ops = {PLAINTEXT_PROTOCOL_ID: InsecureTransport(key_pair)}
    if (muxer_protocol_ops is None):
        muxer_protocol_ops = {MPLEX_PROTOCOL_ID: Mplex}
    network: INetwork = initialize_default_swarm(key_pair=key_pair, transport_opt=[self.listen_maddr], muxer_opt=muxer_protocol_ops, sec_opt=security_protocol_ops, peerstore_opt=None, disc_opt=None)
    self.host = BasicHost(network=network, router=None)
    if (gossipsub_params is None):
        gossipsub_params = GossipsubParams()
    gossipsub_router = GossipSub(protocols=[GOSSIPSUB_PROTOCOL_ID], degree=gossipsub_params.DEGREE, degree_low=gossipsub_params.DEGREE_LOW, degree_high=gossipsub_params.DEGREE_HIGH, time_to_live=gossipsub_params.FANOUT_TTL, gossip_window=gossipsub_params.GOSSIP_WINDOW, gossip_history=gossipsub_params.GOSSIP_HISTORY, heartbeat_interval=gossipsub_params.HEARTBEAT_INTERVAL)
    self.pubsub = Pubsub(host=self.host, router=gossipsub_router, my_id=self.peer_id)
    self.chain = chain
    self.handshaked_peers = PeerPool()
    self.run_task(self.start())
def __init__(self, key_pair: KeyPair, listen_ip: str, listen_port: int, chain: BaseBeaconChain, security_protocol_ops: Dict[(TProtocol, BaseSecureTransport)]=None, muxer_protocol_ops: Dict[(TProtocol, IMuxedConn)]=None, gossipsub_params: Optional[GossipsubParams]=None, cancel_token: CancelToken=None, bootstrap_nodes: Tuple[(Multiaddr, ...)]=None, preferred_nodes: Tuple[(Multiaddr, ...)]=None) -> None:
    super().__init__(cancel_token)
    self.listen_ip = listen_ip
    self.listen_port = listen_port
    self.key_pair = key_pair
    self.bootstrap_nodes = bootstrap_nodes
    self.preferred_nodes = preferred_nodes
    if (security_protocol_ops is None):
        security_protocol_ops = {PLAINTEXT_PROTOCOL_ID: InsecureTransport(key_pair)}
    if (muxer_protocol_ops is None):
        muxer_protocol_ops = {MPLEX_PROTOCOL_ID: Mplex}
    network: INetwork = initialize_default_swarm(key_pair=key_pair, transport_opt=[self.listen_maddr], muxer_opt=muxer_protocol_ops, sec_opt=security_protocol_ops, peerstore_opt=None, disc_opt=None)
    self.host = BasicHost(network=network, router=None)
    if (gossipsub_params is None):
        gossipsub_params = GossipsubParams()
    gossipsub_router = GossipSub(protocols=[GOSSIPSUB_PROTOCOL_ID], degree=gossipsub_params.DEGREE, degree_low=gossipsub_params.DEGREE_LOW, degree_high=gossipsub_params.DEGREE_HIGH, time_to_live=gossipsub_params.FANOUT_TTL, gossip_window=gossipsub_params.GOSSIP_WINDOW, gossip_history=gossipsub_params.GOSSIP_HISTORY, heartbeat_interval=gossipsub_params.HEARTBEAT_INTERVAL)
    self.pubsub = Pubsub(host=self.host, router=gossipsub_router, my_id=self.peer_id)
    self.chain = chain
    self.handshaked_peers = PeerPool()
    self.run_task(self.start())