Home

Awesome

@libp2p/example-delegated-routing-example <!-- omit in toc -->

libp2p.io Discuss codecov CI

How to configure libp2p delegated routers

Table of contents <!-- omit in toc -->

Delegated routing allows a libp2p node running in a constrained environment (for example a browser) to offload network operations and queries to a more capable node running elsewhere.

The libp2p node created by this app has no transports, connection encrypters or muxers - it uses only a Delegated Routing V1 HTTP API client to look up CID providers and Peer Info from a more capable libp2p node running in a separate process.

Running this example

  1. Install the example dependencies
    $ npm i
    
  2. Start the Helia node in ./server.js - this is the node we will delegate operations to
    $ node ./server.js
    
  3. Start the lightweight browser libp2p node
    $ npm start
    

This should open your browser to http://localhost:3000. If it does not, go ahead and do that now.

Finding Content Providers via the Delegate

  1. Enter the CID of the block you wish to find providers for, one is pre-filled for your convenience
  2. Click "Find Providers"
  3. If any exist, provders will start to appear in the box beneath the input fields

Finding Peers via the Delegate

  1. Enter the PeerId of the peer you wish to find, one is pre-filled for your convenience
  2. Click "Find PeerInfo"
  3. If found, multiaddrs for the peer will appear in the box beneath the input fields

Need help?

License

Licensed under either of

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.