Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix IPFS issue #24

Merged
merged 1 commit into from
Aug 3, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion zkdb/src/storage-engine/ipfs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import fs from 'fs';
import { Binary } from '../utilities/binary.js';
import { multiaddr } from '@multiformats/multiaddr';
import { StorageEngineBase } from './base.js';
import { identifyService } from 'libp2p/identify';

export interface IIPFSDirRecord {
name: string;
Expand Down Expand Up @@ -101,10 +102,11 @@ export const newLibP2p = async (
const config: Libp2pOptions = {
services: {
dht: kadDHT({ allowQueryWithZeroPeers: true }),
identify: identifyService(),
chiro-hiro marked this conversation as resolved.
Show resolved Hide resolved
},
start: true,
addresses: {
listen: ['/ip4/127.0.0.1/tcp/0'],
listen: ['/ip4/0.0.0.0/tcp/0'],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do listen on 0.0.0.0 is dangerous?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I know, it is necessary as we want our node to be accessible to the public network

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Public network can access our node via NAT, so i don't think listen on 0.0.0.0 is a good thing.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe I have some gaps in the computer network, but in this case 127.0.0.1 will be enough? Should not we specify the private network address?

},
peerRouters: [delegatedPeerRouting(client)],
connectionEncryption: [noise()],
Expand Down Expand Up @@ -254,6 +256,12 @@ export class StorageEngineIPFS extends StorageEngineBase<
clearInterval(interval);
}
}, 1000);
console.log(
chiro-hiro marked this conversation as resolved.
Show resolved Hide resolved
'Your node has been successfully initialized and is listening at the following addresses:'
);
nodeLibp2p
.getMultiaddrs()
.forEach((address) => console.log(address.toString()));
}

// Try to resolve IPNS entry to CID
Expand Down