My code is:
const ipfs2 = await IPFS.create({
repo: ‘./ipfs2’,
config: {
Addresses: {
Swarm: [
‘/ip4/0.0.0.0/tcp/4013’,
‘/ip4/127.0.0.1/tcp/4013/ws’
],
API: ‘/ip4/127.0.0.1/tcp/5012’,
Gateway: ‘/ip4/127.0.0.1/tcp/9191’
}
}
})
ipfs = ipfs2;
let ipfsId = await ipfs2.id()
peerId = ipfsId.id
ipfs2.libp2p.connectionManager.on(‘peer:connect’, connection => {
console.log(peer connect: ${connection.remotePeer.toB58String()}
)
})
ipfs2.libp2p.connectionManager.on(‘peer:disconnect’, connection => {
console.log(peer disconnect: ${connection.remotePeer.toB58String()}
)
})
try {
await ipfs2.swarm.connect(IPFS.multiaddr("/ip4/xx.xx.xx.xx/tcp/4013/p2p/QmZy5ceAfDsmXYpExCYaE4MPVvy4BgNJtrAaML3dS2yiJX"))
} catch (error) {
console.log(error)
}
/ip4/xx.xx.xx.xx/tcp/4013/p2p/QmZy5ceAfDsmXYpExCYaE4MPVvy4BgNJtrAaML3dS2yiJX is the address that the other machine is listening on.
Got Error:
AggregateError:
Error: socket hang up
at Array.map ()
at maybeSettle (/Users/charlesliu/Desktop/learn_ipfs/orbitDB-demo copy/node_modules/p-some/index.js:31:11)
at /Users/charlesliu/Desktop/learn_ipfs/orbitDB-demo copy/node_modules/p-some/index.js:69:23
Error: Error occurred during XX handshake: Error occurred while verifying signed payload: Peer ID doesn’t match libp2p public key.
at Noise.performXXHandshake (/Users/charlesliu/Desktop/learn_ipfs/orbitDB-demo copy/node_modules/libp2p-noise/dist/src/noise.js:166:19)
Error: The operation was aborted
at AbortSignal.onAbort (/Users/charlesliu/Desktop/learn_ipfs/orbitDB-demo copy/node_modules/libp2p-tcp/src/index.js:86:14)
at AbortSignal.dispatchEvent (/Users/charlesliu/Desktop/learn_ipfs/orbitDB-demo copy/node_modules/event-target-shim/dist/event-target-shim.js:818:35)
at abortSignal (/Users/charlesliu/Desktop/learn_ipfs/orbitDB-demo copy/node_modules/abort-controller/dist/abort-controller.js:52:12)
at AbortController.abort (/Users/charlesliu/Desktop/learn_ipfs/orbitDB-demo copy/node_modules/abort-controller/dist/abort-controller.js:91:9)
at AbortSignal.onAbort (/Users/charlesliu/Desktop/learn_ipfs/orbitDB-demo copy/node_modules/any-signal/index.js:13:16)
at AbortSignal.dispatchEvent (/Users/charlesliu/Desktop/learn_ipfs/orbitDB-demo copy/node_modules/event-target-shim/dist/event-target-shim.js:818:35)
at abortSignal (/Users/charlesliu/Desktop/learn_ipfs/orbitDB-demo copy/node_modules/abort-controller/dist/abort-controller.js:52:12)
at AbortController.abort (/Users/charlesliu/Desktop/learn_ipfs/orbitDB-demo copy/node_modules/abort-controller/dist/abort-controller.js:91:9)
at AbortSignal.onAbort (/Users/charlesliu/Desktop/learn_ipfs/orbitDB-demo copy/node_modules/any-signal/index.js:13:16)
at AbortSignal.dispatchEvent (/Users/charlesliu/Desktop/learn_ipfs/orbitDB-demo copy/node_modules/event-target-shim/dist/event-target-shim.js:818:35)
Error: The operation was aborted
at AbortSignal.onAbort (/Users/charlesliu/Desktop/learn_ipfs/orbitDB-demo copy/node_modules/libp2p-tcp/src/index.js:86:14)
at AbortSignal.dispatchEvent (/Users/charlesliu/Desktop/learn_ipfs/orbitDB-demo copy/node_modules/event-target-shim/dist/event-target-shim.js:818:35)
at abortSignal (/Users/charlesliu/Desktop/learn_ipfs/orbitDB-demo copy/node_modules/abort-controller/dist/abort-controller.js:52:12)
at AbortController.abort (/Users/charlesliu/Desktop/learn_ipfs/orbitDB-demo copy/node_modules/abort-controller/dist/abort-controller.js:91:9)
at AbortSignal.onAbort (/Users/charlesliu/Desktop/learn_ipfs/orbitDB-demo copy/node_modules/any-signal/index.js:13:16)
at AbortSignal.dispatchEvent (/Users/charlesliu/Desktop/learn_ipfs/orbitDB-demo copy/node_modules/event-target-shim/dist/event-target-shim.js:818:35)
at abortSignal (/Users/charlesliu/Desktop/learn_ipfs/orbitDB-demo copy/node_modules/abort-controller/dist/abort-controller.js:52:12)
at AbortController.abort (/Users/charlesliu/Desktop/learn_ipfs/orbitDB-demo copy/node_modules/abort-controller/dist/abort-controller.js:91:9)
at AbortSignal.onAbort (/Users/charlesliu/Desktop/learn_ipfs/orbitDB-demo copy/node_modules/any-signal/index.js:13:16)
at AbortSignal.dispatchEvent (/Users/charlesliu/Desktop/learn_ipfs/orbitDB-demo copy/node_modules/event-target-shim/dist/event-target-shim.js:818:35)
at maybeSettle (/Users/charlesliu/Desktop/learn_ipfs/orbitDB-demo copy/node_modules/p-some/index.js:31:11)
at /Users/charlesliu/Desktop/learn_ipfs/orbitDB-demo copy/node_modules/p-some/index.js:69:23
at processTicksAndRejections (internal/process/task_queues.js:97:5) {
code: ‘ERR_TIMEOUT’
Need Help! What am I missing for making it works?