Closed Anyass3 closed 3 years ago
I got my answer I should be using this instead
- const HypercoreProtocol = require('hypercore-protocol');
+ const DHT = require('@hyperswarm/dht');
- const swarm1 = new Hyperswarm({ keyPair: HypercoreProtocol.keyPair() });
+ const swarm1 = new Hyperswarm({ keyPair: DHT.keyPair() });
for those who need the reason, it's because HypercoreProtocol.keyPair() gives 32bits secretKey which is not compatible with the new API; DHT.keyPair() gives secretKey as 64bits
Also, I guess the error above should be more informative as the main cause of the error is keyPair not because the server is already listening
If you checked properly it seems the server is not even listening on this keypair as before it calls that listen function, it first checks if it's not listening then it calls it.
Thanks for the feedback, we’ll try to improve the error message :)
thanks
hyperswarm@3.0.0-beta3
when I run it without custom a keypair it works as expected But with a custom keyPair it gives an error
error