async init() {
		try {
			// Dynamically import libp2p modules
			const [
				{ createLibp2p }, 
				{ tcp }, 
				{ yamux }, 
				{ noise }, 
				{ mdns }, 
				{ bootstrap }, 
				{ gossipsub }, 
				{ ping }, 
				{ webSockets }, 
				{ multiaddr },
				{ identify },
				{ kadDHT, removePrivateAddressesMapper }
			] = await Promise.all([
				import('libp2p'),
				import('@libp2p/tcp'),
				import('@chainsafe/libp2p-yamux'),
				import('@chainsafe/libp2p-noise'),
				import('@libp2p/mdns'),
				import('@libp2p/bootstrap'),
				import('@chainsafe/libp2p-gossipsub'),
				import('@libp2p/ping'),
				import('@libp2p/websockets'),
				import('@multiformats/multiaddr'),
				import('@libp2p/identify'),
				import('@libp2p/kad-dht')
			]);
			
			// Store multiaddr and pipe for later use
			this.multiaddr = multiaddr;
			// this.pipe = pipe;

			// Create protocol string
			this.protocol = `/${this.protocolName}/${this.protocolVersion}`;
			
			// Load or generate persistent peer ID
			let peerId;
			peerId = await this._loadOrGeneratePeerId();
			
			const listenAddresses = await this._getListenAddresses();

			// Create and configure libp2p node
			this.node = await createLibp2p({
				privateKey: peerId,
				addresses: {
					listen: [
						`/ip4/0.0.0.0/tcp/${5000}`,
						`/ip4/0.0.0.0/tcp/${5001}/ws`,
						`/ip6/::/tcp/${5000}`,
						`/ip6/::/tcp/${5001}/ws`
					],
					appendAnnounce: _.uniq(listenAddresses)
				},
				transports: [
					tcp(),
					webSockets()
				],
				streamMuxers: [yamux()],
				connectionEncrypters: [noise()],
				peerDiscovery: [
					mdns({
						interval: 20000
					}),
					bootstrap({
						list: [
							// Default bootstrap nodes
							'/ip4/104.131.131.82/tcp/4001/ipfs/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ',
							'/dnsaddr/bootstrap.libp2p.io/ipfs/QmNnooDu7bfjPFoTZYxMNLWUQJyrVwtbZg5gBMjTezGAJN',
							'/dnsaddr/bootstrap.libp2p.io/ipfs/QmQCU2EcMqAqQPR2i9bChDtGNJchTbq5TbXJJ16u19uLTa'
						],
						interval: 60000
					})
				],
				services: {
					identify: identify(),
					ping: ping(),
					pubsub: gossipsub({
						allowPublishToZeroPeers: false,
						emitSelf: false
					}),
					dht: kadDHT({
						// protocol: '/rats/kad/1.0.0',
						clientMode: false, // Run as a full DHT node
					}),
					// aminoDHT: kadDHT({
					// 	protocol: '/ipfs/kad/1.0.0',
					// 	peerInfoMapper: removePrivateAddressesMapper
					// }),
				}
			});

			// Store the node's PeerId for use in the RATS protocol
			this.peerId = this.node.peerId.toString();
			logT('p2p', 'Using libp2p node PeerId:', this.peerId);
			
			// Set up event listeners
			this._setupEventListeners();
			
			// Subscribe to topics
			this._setupTopicHandlers();
			
			// Start the node
			await this.node.start();
			logT('p2p', 'libp2p node started successfully');

			// Set up intervals and store their IDs for cleanup
			this.intervals = {};
			
			this.intervals.stats = setInterval(() => {
				this.printPeerStats();
			}, 10000);

			// Add peer pool management
			this.intervals.peerPool = setInterval(() => {
				this._managePeerPool();
			}, 30000);

			logT('p2p', 'my multiaddresses', this.node.getMultiaddrs());

			// debug
			// setTimeout(() => {
			// 	this.add({
			// 		id: '12D3KooWEtimiSnXThfMsPrc5e8NG28bMQ4vmYpo39wLyGYF3ycb',
			// 		addresses: [
			// 			'/ip4/167.71.11.56/tcp/5000',
			// 			'/ip4/167.71.11.56/tcp/5001/ws'
			// 		]
			// 	}, { protocol: true })
			// }, 1000);

			// Start DHT peer discovery
			this._startDhtDiscovery();

			return this;
		} catch (err) {
			logTE('p2p', 'Failed to initialize libp2p node:', err);
			throw err;
		}
	}
Initialize the P2P node
@returns {Promise<P2P>} This instance