Code Monkey home page Code Monkey logo

Comments (3)

jacobheun avatar jacobheun commented on August 22, 2024

The conversion of /p2p to /ipfs only applies to the string representation, the codecs are equivalent. Over the wire representation won't matter, as any other nodes on the network should know the codec.

We will be migrating over to /p2p by default soon, libp2p/libp2p#79, so the string representation will always be /p2p as we migrate away from using /ipfs.

In regards to the errors you're seeing, those lead me to believe that the node being dialed isn't correct. Pierre may be able to help more in terms of joining the substrate network as I am not familiar with doing that currently.

Error: dialed to the wrong peer, Ids do not match

This indicates that you were able to connect to the node, but SECIO failed because the node you actually connected to is not QmPiGU1jwL9UDw2FMyMQFr9FdpF9hURKxkfy6PWw6aLsur.

Error: No available transports to dial peer

This means no transports are dialing, so TCP is likely failing since that's a TCP address. I turned on debugging for my local node to check the errors and TCP is getting an ECONNREFUSED error. So the boot nodes may not be available.

from js-multiaddr.

folex avatar folex commented on August 22, 2024

Error: dialed to the wrong peer, Ids do not match

I faced similar issue when connecting Rust & JS via libp2p. The problem is that peer-id JS computes peer id from public key like this:

const computeDigest = (pubKey, cb) => {
  if (pubKey.bytes.length <= 42) {
    const digest = mh.encode(pubKey.bytes, 'identity') // This get's executed
    cb(null, digest)
  } else {
    pubKey.hash((err, digest) => {
      cb(err, digest)
    })
  }
}

Result is that in JS mh.encode(pubKey.bytes, 'identity') results in addresses of format 12D3KooWSwNXzEeGjgwEocRJBzbdoDqxbz3LdrwgSuKmKeGvbM4G, while in Rust PeerId for the same public key looks like QmTESkr2vWDCKqiHVsyvf4iRQCBgvNDqBJ6P3yTTDb6haw.

Error then happens in libp2p-secio/src/handshake/crypto.js in identify function in JS:

if (state.id.remote.toB58String() !== remoteId.toB58String()) { // <-- remoteId here is computed from public key in 12D3 format, while state.id.remote is in Qm format
    return callback(new Error('dialed to the wrong peer, Ids do not match'))
}

Currently, I don't have a solution for that except to patch either JS or Rust.

from js-multiaddr.

achingbrain avatar achingbrain commented on August 22, 2024

This issue is very stale - the modules referenced have been updated several times, some such as secio aren't used any more.

Please open a new issue if this is still a problem.

from js-multiaddr.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.