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

polyswarm-registry

v1.0.0

Published

Generate & sign worker registry json file.

Downloads

2

Readme

PolySwarm Registry CLI

This command line tool assists in the creation of worker descriptions that enable developers to claim microengines and add metadata so that Ambassadors can find them. Worker descriptions must match our JSON schema, which includes required signatures of various blocks. Creating a matching JSON file manually can be time consuming, so we released this to simplify the process.

Install polyswarm-registry

Yarn

yarn global add polyswarm-registry

NPM

npm install -g polyswarm-registry

Usage

polyswarm-registry [command]

Commands:
  polyswarm-registry generate [filename]    interactively generate a worker
                                            description
  polyswarm-registry upload [filename]      upload a worker description
  [wallet] [keystore]
  polyswarm-registry register [hash]        Register your worker description on
  [wallet]                                  Ethereum

Options:
  --version  Show version number                                       [boolean]
  --help     Show help                                                 [boolean]

There are three subcommands to assist through the generation, adding to IPFS, and finally, submitting the IPFS hash to our smart-contract on Ethereum.

Generating JSON

polyswarm-registry generate [filename]

interactively generate a worker description

Positionals:
  filename  output filename

Options:
  --version  Show version number                                       [boolean]
  --help     Show help                                                 [boolean]

The generate subcommand takes you on a guided tour to build a worker description JSON file. When you start the generator, it will give you a choice of several actions. After each choice is completed, it will bring you back to the main screen, depicted below. It is easy enough to follow top to bottom, but you can choose to add a microengine before adding the developer info. You must enter both developer info, and at least one microengine. You can add as many microengines as you like.

When adding a microengine, it will do more than ask for the information you see in the schema. It will also prompt for a keystore directory, and a password. With the keystore and password, it will sign the given microengine data, and add it as en entry in signatures. The directory defaults to /home/[username]/.ethereum/, but you can enter whatever directory you would like. However, the directory you choose must contain another directory named keystore/ which has a the keyfile for the given addres inside.

Once you have entered in all required information, try the Validate option. This will tell you any remainging fields to be filled in.

Once validated, hit export to write out the JSON file.

? Choose an action. (Use arrow keys)
❯ Enter developer info
  Add a microengine
  ──────────────
  Validate
  Export

Upload JSON to IPFS

polyswarm-registry upload [filename]

upload a worker description

Positionals:
  filename  worker description json to upload

Options:
  --version  Show version number                                       [boolean]
  --help     Show help                                                 [boolean]

The upload subcommand takes an input file and puts it on ipfs. Then, it spits out the IPFS hash.

Register the description on Ethereum

polyswarm-registry register [hash] [wallet-address]

Register your worker description on Ethereum

Positionals:
  hash    IPFS hash of the worker description.
  wallet-address  Wallet address to send transaction from.

Options:
  --version   Show version number                                      [boolean]
  --help      Show help                                                [boolean]
  --update    Update the current worker description for this address
                                                                [default: false]
  --keystore  Directory containing the 'keystore/' directory.
                                              [default: "/home/user/.ethereum/"]
  --contract                        [default: "0x00000000000000000000000000000"]
  --eth-uri                                   [default: "http://localhost:8545"]

The register subcommand will push the IPFS hash you created to our smart-contract on Ethereum. Once there, it will be parsed, validated and made accessible at https://gamma-registry.polyswarm.network/[address].

Use --eth-uri to specify the infura address with your token. If you have you own local geth listening at the default rpc port 8545, there is no need to use this option.

Use --keystore to specify the location of your key file.

Use --contract to specify an alternate contract address.

Use --update if you are submitting with an address that has an existing worker description.

You can use the following one-liner to upload and registry all at once. Make sure to fill in your informaion before executing it.

polyswarm-registry register --eth-uri=https://mainnet.infura.io/[key] --keystore /path/to/keystore $(polyswarm-registry upload [file]) [address]