Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

devp2p-dpt

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

devp2p-dpt

an implemention of ethereum's DHT

  • 0.0.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

SYNOPSIS Build Status

An node.js implementation of devp2p's Distrubuted Peer Table. A DPT is like DHT but just stores peering info.

INSTALL

npm install devp2p-dpt

EXAMPLE

For a basic example see example/

API

DPT

new DPT(options)

Create a New DPT with the following options -options

  • secretKey - a 32 byte Buffer from which the pubic key is derived
  • timeout - an Interger specifing the wait period in milliseconds to wait for peers to respond
  • port - the port external port that this peer is listening to. If not specifed the port that is used in bound will be used
  • address - the external address that this peer is listening to. if not specifed the port that is used in bound will be used

DPT methods

dpt.bind(port, address, [cb])

Binds the port

  • port
  • address
  • cb the callback
dpt.close([cb])

Unbinds the port

dpt.bootstrap(introPeers, [cb])

Bootstraps the DPT given an array of peers to connect to.

  • introPeers - an Array of peers to try to connect to. They should be objects in following format.
{
  address: String
  port: Number
}
dpt.refresh()

Refreshes the nodes and searches for new nodes

DPT events

The DPT object inherits from Events.EventEmitter and emits the following events.

  • ping - Fires when receiving a Ping. Provides a parsed ping packets and the peer it came from
  • pong - Fires when receiving a pong. Provides a parsed ping packets and the peer it came from
  • findNode - Fires when receiving a findNode. Provides a parsed ping packets and the peer it came from
  • neighbors- Fires when receiving a neighbors. Provides a parsed ping packets and the peer it came from
  • error - Provides and error message

CONTRIBUTIONS

Patches welcome! Contributors are listed in the package.json file. Please run the tests before opening a pull request and make sure that you are passing all of them.

If you would like to contribute, but don't know what to work on, check the issues list or ask on the forms or on IRC.

BUGS

When you find issues, please report them:

You can also look for null_radix in #ethereum-dev on irc://irc.freenode.net.

LISCENCE

GPL3

FAQs

Package last updated on 04 Jun 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc