npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@savid/rlpx-pest

v1.2.2

Published

Get the [status](https://github.com/ethereum/devp2p/blob/master/caps/eth.md#status-0x00) of a [RLPx](https://github.com/ethereum/devp2p/blob/master/rlpx.md) peer via the [eth/66](https://eips.ethereum.org/EIPS/eip-2481) protocol.

Downloads

18

Readme

@savid/rlpx-pest

Get the status of a RLPx peer via the eth/66 protocol.

This package is adapted from the @ethereumjs/devp2p project.

Requirements

  • NodeJS v18+
  • ESM only

Install

npm install --save @savid/rlpx-pest

Usage

import pest from '@savid/rlpx-pest';

try {
  const status = await pest({
    enode: 'enode://6f8a80d14311c39f35f516fa664deaaaa13e85b2f7493f37f6144d86991ec012937307647bd3b9a82abe2974e1407241d54947bbb39763a4cac9f77166ad92a0@10.3.58.6:30303',
  });
} catch (error) {
  console.log('something happened', error.code);
}

API

function pest(options: {
  // Enode https://ethereum.org/en/developers/docs/networking-layer/network-addresses#enode
  enode: string;
  // connection timeout
  timeout?: number;
}): Response;

// status https://github.com/ethereum/devp2p/blob/master/caps/eth.md#status-0x00
type Response = {
  // integer identifying the blockchain, see table below
  networkId: bigint;
  // total difficulty of the best chain. Integer, as found in block header.
  td: bigint;
  // the hash of the best (i.e. highest TD) known block
  bestHash: string;
  // the hash of the genesis block
  genesisHash: string;
  // EIP-2124 fork identifier
  fork?: {
    hash: string;
    next: string;
  };
  // peer client id
  client?: string;
};

example response;

{
  networkId: 1n,
  td: 56495485781309105821794n,
  bestHash: '0xe125949899e443bbf1f26b8a89c40f2ac6b504c648b4f90cc79f19738d9a38fd',
  genesisHash: '0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3',
  fork: { hash: '0xf0afd0e3', next: '0x00' },
  client: 'Geth/v1.10.20-stable-8f2416a8/linux-amd64/go1.17.10',
}

Error codes

| Reason | Meaning | |-------------------------------- |:------------------------------------------------| | INITIAL_SOCKET_CONNECT_FAILED | TCP socket failed to initialial connect | | SOCKET_ERROR | TCP socket error | | SOCKET_CLOSED | TCP socket closed unexpectedly | | INCOMING_DATA_STATE | Invalid Auth/Ack/Header/Body state sent by peer | | INVALID_HEADER_SIZE | Invalid header size | | SEND_HELLO_MESSAGE_FAILED | Failed to send hello message to peer | | EMPTY_BODY_MESSAGE | Received unexpected empty message body | | BODY_PARSE_FAILED | Failed to parse message body from peer | | PEER_DISCONNECTED | Peer sent disconnect message |

License

MIT