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

devp2p

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

devp2p

A javascript libary implementing RPLx the ethereum p2p protocol

  • 0.0.3
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

node-devp2p Build Status

Implements the RPLx transport.

#API

Network

new Network([options])

Creates new Network object with the following arguments

Network options

When creating a Network the following options can be used to configure its behavoir.

  • timeout - The lenght of time in milliseconds to wait for a peer to response after connecting to it
  • maxPeers - The max number of peer the network will try to connect to
  • clientId - specifies the client software identity, as a human-readable string
  • publicIp - The public ip of this node
  • secretKey - a 32 byte Buffer use to encrypte packets and identify the node.
  • subprotocols - a hash containing the subprotocol name and its corisponding version number

Network methods

network.listen([port], [host])

start the tcp server

  • host - The hostname or IP address the server is bound to. Defaults to 0.0.0.0 which means any available network
  • port - The TPC port the server is listening to. Defaults to port 30303
network.connect(peer, [callback])

connect to a peer

  • peer - a POJO containing
    • host - the hostname or IP of the peer
    • port - the port of the peer
    • id - the id/public key of the peer
  • callback - a callback function
network.close([callback])

stops the tcp server and disconnects any peers

Network events

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

  • connection - fires whever we connect with a peetr
    • peer - The peer that emitted the event

Peer

The peer represents a peer on the ethereum network. Peer objects cannot be created directly.

Peer methods

peer.sendHello([callback])

Sends the hello message

peer.sendDisconnect(reason, [callback])

Sends the disconnect message, where reason is one of the following integers

  • 0x00 - Disconnect requested
  • 0x01 - TCP sub-system error
  • 0x02 - Bad protocol
  • 0x03 - Useless peer
  • 0x04 - Too many peers
  • 0x05 - Already connected
  • 0x06 - Wrong genesis block
  • 0x07 - Incompatible network protocols
  • 0x08 - Client quitting
peer.sendPing([callback])

Send Ping

peer.sendPong([callback])

Send Pong

##Peer events peer events are the same as Network events

LICENSE

GPL

Keywords

FAQs

Package last updated on 07 Oct 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