Trying orbitdb with jsipfs and webrtc

Hi,

I am trying to use private network configuration for IPFS node setup.

Tried with custom bootstrap server over aws it worked fine but for better implementation wanted to try WebRTC implementation with IPFS

Requirement is to connect between multiple js-ipfs node through singling server (WebRTC (hosted over public ip)).

For peer discovery i deployed WebRTC server over an public instance made access to ports and everything. Now i just want to use WebRTC server no bootstrap mechanism for peer discovery.

I tried with lot of configuration and but nothing seems to be working if i remove private bootstrap server then ipfs node is taking all public bootstrap nodes by default.

There are no logs of connectivity on WebRTC server deployed

Not sure what should i do.

Should i stick with custom bootstrap implementation or i am not doing something right in configuration

Thanks for help in advance

Hey there,

For general js-ipfs debugging tips and trick like logging I’d recommend checking out this video:

WebRTC debugging in the browser can be a bit confusing because it doesn’t normally show in the Network tab of the debugger tools. With chrome, you can use the chrome://webrtc-internals.

Can you share more information about what kind of WebRTC Server you’re running?
Is is js-libp2p-webrtc-star/packages/webrtc-star-signalling-server at master · libp2p/js-libp2p-webrtc-star · GitHub?

Requirement is to connect between multiple js-ipfs node through singling server (WebRTC (hosted over public ip)).

I presume you’re trying to establish a connection between multiple browsers.

When instantiating js-ipfs in the browser, you should be adding the WebRTC star nodes to the swarm config:

  this.ipfs = await Ipfs.create({
    config: {
      Addresses: {
        Swarm: [
          '/dns4/YOU_WEBRTC_STAR_SERVER/tcp/443/wss/p2p-webrtc-star/',
        ]
      },
    }
  });

Would be great if you can share more information about your setup (packages, versions) and how you’re instantiating js-ipfs.

Hi,

Thanks for quick response?

I am trying server to server connection between two ipfs nodes using WebRTC

i am using jsipfs to create node ,

{
      repo: 'repo_name',
      start: true,
      // eslint-disable-next-line @typescript-eslint/ban-ts-comment
      //@ts-ignore
      preload: {
        enabled: true,
      },
      EXPERIMENTAL: {
        ipnsPubsub: true,
      },
      relay: {
        enabled: true,
        hop: {
          enabled: true
        }
      },
      config: {
        Addresses: {
          Swarm: [
            // When running outside of the browser we can support TCP connections
            '/ip4/0.0.0.0/tcp/4015/',
            '/ip4/0.0.0.0/tcp/4023/ws',
            '/ip4/<public_ip_webrtc>/tcp/13579/wss/p2p-webrtc-star'
          ]
        },
        Bootstrap: [
          '/ip4/<Bootstrap server ip>/tcp/4003/ws/p2p/12D3KooWDuuNp8dSiuZPX7293Yx8HXTmyb2cALk8x4JiZkVBogcv',
          // '/ip4/127.0.0.1/tcp/4001/ws/p2p/12D3KooWGQdBm2ceUSgggojHNmCdesywimN7tiVcgEYcYViKS8y5',
          // '/dns4/ipfs-staging.steer.finance/tcp/4422/ws/p2p/12D3KooWGQdBm2ceUSgggojHNmCdesywimN7tiVc/gEYcYViKS8y5',
        ],
        Discovery: {
          // MDNS: {
          //   Enabled: true,
          //   Interval: 10
          // },
          webRTCStar: {
            Enabled: true,
          },
        },
      },
    }

I have tried with one more configuration which is below

{
    repo: 'your-repo-path',
    config: {
      Addresses: {
        Swarm: [
          "/ip4/0.0.0.0/tcp/4002",
          "/ip4/127.0.0.1/tcp/4003/ws",
          // "/dns4/wrtc-star1.par.dwebops.pub/tcp/443/wss/p2p-webrtc-star",
          // "/dns4/wrtc-star2.sjc.dwebops.pub/tcp/443/wss/p2p-webrtc-star",
          '/ip4/<PUBLIC_IP_WEBRTC_SERVER>/tcp/13579/wss/p2p-webrtc-star'
        ]
      }
    },
    libp2p: {
      modules: {
        transport: [webRTCStar]
      },
      config: {
        peerDiscovery: {
          webRTCStar: { // <- note the lower-case w - simport * as IPFS from 'ipfs-core'ee https://github.com/libp2p/js-libp2p/issues/576
            enabled: true
          }
        },
        transport: {
          WebRTCStar: { // <- note the upper-case w- see https://github.com/libp2p/js-libp2p/issues/576
            wrtc
          }
        },
        Bootstrap: []
      }
    }
  }

WebRTC server js-libp2p-webrtc-star/packages/webrtc-star-signalling-server at master · libp2p/js-libp2p-webrtc-star · GitHub

Let me know if any other information is required

Thanks

You cannot connect two IPFS nodes running in Node.js with WebRTC since Node.js doesn’t have native WebRTC support.

You can connect two js-ipfs nodes in Node.js with either TCP or WebSockets.

Hi danieln,

Thanks for your reply.

Is it doable server to server connection (peer to perr) without browser using WebRTC on Go-ipfs

We are trying to implement rendezvous strategy for peer discovery. So for documentation we figured out its is good to use WebRTC

What should be our implementation in case of this requirement of server to server peer discovery for rendezvous strategy

Thanks

I recommend checking out this page https://connectivity.libp2p.io/
to better understand connectivity options.

If you main goal is to connect kubo (go-ipfs) nodes to each other, TCP and QUIC would be your choices (potentially web sockets too but that’s over TCP anyway)

If you plan on connecting browsers to those kubo nodes, that’s where WebRTC would be handy.