Awesome
@libp2p/example-delegated-routing-example <!-- omit in toc -->
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
- Install the example dependencies
$ npm i
- Start the Helia node in
./server.js
- this is the node we will delegate operations to$ node ./server.js
- 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
- Enter the CID of the block you wish to find providers for, one is pre-filled for your convenience
- Click "Find Providers"
- If any exist, provders will start to appear in the box beneath the input fields
Finding Peers via the Delegate
- Enter the PeerId of the peer you wish to find, one is pre-filled for your convenience
- Click "Find PeerInfo"
- If found, multiaddrs for the peer will appear in the box beneath the input fields
Need help?
- Read the js-libp2p documentation
- Check out the js-libp2p API docs
- Check out the general libp2p documentation for tips, how-tos and more
- Read the libp2p specs
- Ask a question on the js-libp2p discussion board
License
Licensed under either of
- Apache 2.0, (LICENSE-APACHE / http://www.apache.org/licenses/LICENSE-2.0)
- MIT (LICENSE-MIT / http://opensource.org/licenses/MIT)
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.