{"name":"@chainsafe/libp2p-gossipsub","version":"3.2.0","keywords":["libp2p","pubsub","gossip"],"author":{"name":"Cayman Nava"},"license":"Apache-2.0","_id":"@chainsafe/libp2p-gossipsub@3.2.0","contributors":[{"name":"Cayman","email":"caymannava@gmail.com"},{"name":"Vasco Santos","email":"vasco.santos@moxy.studio"},{"name":"Mikerah","email":"mikerahqc@protonmail.com"},{"name":"Tuyen Nguyen","email":"vutuyen2636@gmail.com"},{"name":"Alex Potsides","email":"alex@achingbrain.net"},{"name":"Marin Petrunić","email":"marin.petrunic@gmail.com"},{"name":"Lion - dapplion","email":"35266934+dapplion@users.noreply.github.com"},{"name":"Gregory Markou","email":"16929357+GregTheGreek@users.noreply.github.com"},{"name":"Alan Shaw","email":"alan.shaw@protocol.ai"},{"name":"Tuyen","email":"tuyen@wetrust.io"},{"name":"Jacob Heun","email":"jacobheun@gmail.com"},{"name":"Patrick Michot","email":"k0m0d0tr0n@gmail.com"},{"name":"chainsafe","email":"aidan@chainsafe.io"},{"name":"Hugo Dias","email":"hugomrdias@gmail.com"},{"name":"Franck Royer","email":"franck@royer.one"},{"name":"ChainSafe","email":"superadmin@chainsafe.io"}],"homepage":"https://github.com/ChainSafe/js-libp2p-gossipsub#readme","bugs":{"url":"https://github.com/ChainSafe/js-libp2p-gossipsub/issues"},"dist":{"shasum":"9daf96e63a29aedb724d72e4bf161faa800e1d57","tarball":"http://registry-npm.ywwl.com/@chainsafe/libp2p-gossipsub/download/@chainsafe/libp2p-gossipsub-3.2.0.tgz","fileCount":209,"integrity":"sha512-9rdDHVweWAZsC9Ut3MpN8nZCDkSgDJ0o0p8rxMBROsmARrFzzUmG4kHWBPqKEJ3GGC1O8QlrF53VfRJwN6ZOrA==","signatures":[{"sig":"MEQCIBY2Rm8KQyJ/oHKL1PIrkAZ8KtdXmkgrBnfCCRGlY2DvAiBZUjc70zFvLkxOgmp47tSqRyAhMTtpbAPLvMe/WaZyPQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":1278915,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJi1qCiACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmo+jhAAgpvLQE9dw3qN8Guy+gaa7qta2WpI0fC231q1vC3i3UcLKGWU\r\nWzzCxxuVQ/1xgUxSFWWw5pv9CGINp9mTxU6AX7wd/SpBAILK55kuBzPIYuBD\r\nl1oZP7TgL0ZGqrez+bU2MGim4pYliWG0boXUSHPbpMznH3+Gb84Eps88hYpL\r\n4VVKDAdmUaOoh4P5Zn2CbxueaQEMMrDHtelUwaT1BqFkJXuxZXSeA1YyNnqn\r\nWfOBI6hJ8a/TdOBcP29aWnpOqmvsNXXOUYR5BQ2EKUJs5sEiLB9NHfwcqExz\r\nAe8HTqObolJZ6i9NtXIvbx9H82ewRr2mCpNe3r/v3YRcBH2ObPI2cQ0v4lRv\r\nzqJ4Oe+p2R7DgJoBwsGdIaRsxMwsyiGPPkLBvs7lm1rcPmSabDBCdL5Sn8Yj\r\ntzGt2LJAcXupP1S7t07UR2zrHWHyuYNBoSFxOk8gbIOuyD2b88BZVZqiJwkf\r\nheYUF2tk/fU7/LSkfKCoPlMJEEfQ5kLBdNbrTg5dveWIAXZ5WjFm4hB6DauL\r\nskleVz4DqtBAfElwxEWM3KXLxStWOs1Ggcr7seu0jd25sNIqT5s217oQfOII\r\n1vIU7gdEVAJv8GrQb5gqMUghpak21YwMJWilmYQbI2IiQQ4LJJ7Ow3G/3iZf\r\nl9MNWjC6QbMODFeUv/eaUidSUtsHDWrXIHs=\r\n=6l5n\r\n-----END PGP SIGNATURE-----\r\n","size":291564,"noattachment":false,"key":"/@chainsafe/libp2p-gossipsub/-/@chainsafe/libp2p-gossipsub-3.2.0.tgz"},"type":"module","types":"dist/src/index.d.ts","exports":{".":{"import":"./dist/src/index.js"},"./score":{"import":"./dist/src/score/index.js"},"./types":{"import":"./dist/src/types.js"},"./message":{"import":"./dist/src/message/index.js"},"./metrics":{"import":"./dist/src/metrics.js"}},"gitHead":"2b0a069882ccdaa2ce0c6ee8b9903e7ee7eb2e92","scripts":{"lint":"eslint --ext .ts src test","test":"aegir test -f './dist/test/*.spec.js'","build":"aegir build","prepare":"npm run build","pretest":"npm run build","release":"aegir release --no-types","generate":"protons ./src/message/rpc.proto","test:e2e":"aegir test -f './dist/test/e2e/*.spec.js'","benchmark":"node ./node_modules/.bin/benchmark 'dist/test/benchmark/*.test.js' --local","test:node":"npm run test -- --target node","test:unit":"aegir test -f './dist/test/unit/*.test.js' --target node","pretest:e2e":"npm run build","test:browser":"npm run test -- --target browser"},"_npmUser":{"name":"wemeetagain","email":"caymannava@gmail.com"},"repository":{"url":"git+https://github.com/ChainSafe/js-libp2p-gossipsub.git","type":"git"},"_npmVersion":"8.11.0","description":"A typescript implementation of gossipsub","directories":{},"_nodeVersion":"16.16.0","dependencies":{"denque":"^1.5.0","it-pipe":"^2.0.3","err-code":"^3.0.1","it-pushable":"^3.0.0","uint8arrays":"^3.0.0","multiformats":"^9.6.4","@libp2p/crypto":"^1.0.0","@libp2p/logger":"^2.0.0","@libp2p/pubsub":"^3.0.0","@libp2p/peer-id":"^1.1.13","protons-runtime":"^1.0.4","@libp2p/topology":"^3.0.0","iso-random-stream":"^2.0.2","@libp2p/components":"^2.0.0","@libp2p/interfaces":"^3.0.2","abortable-iterator":"^4.0.2","it-length-prefixed":"^7.0.1","@libp2p/peer-record":"^2.0.0","@libp2p/interface-keys":"^1.0.2","@libp2p/interface-pubsub":"^1.0.1","@libp2p/interface-peer-id":"^1.0.2","@libp2p/interface-registrar":"^2.0.0","@libp2p/interface-connection":"^2.0.0"},"typesVersions":{"*":{"*":["*","dist/src/*","dist/src/*/index"]}},"_hasShrinkwrap":false,"leadMaintainer":"Cayman Nava <caymannava@gmail.com>","devDependencies":{"os":"^0.1.1","util":"^0.12.3","aegir":"^37.2.0","delay":"^5.0.0","sinon":"^11.1.1","eslint":"^7.1.0","lodash":"^4.17.15","it-pair":"^1.0.0","p-defer":"^4.0.0","p-event":"^5.0.1","p-retry":"^4.2.0","p-times":"^2.1.0","protons":"^3.0.4","ts-node":"^10.7.0","prettier":"^2.0.5","ts-sinon":"^2.0.2","benchmark":"^2.1.4","p-wait-for":"^3.2.0","time-cache":"^0.3.0","@types/node":"^17.0.21","detect-node":"^2.1.0","promisify-es6":"^1.0.3","datastore-core":"^7.0.1","@libp2p/floodsub":"^3.0.0","@libp2p/peer-store":"^3.0.0","eslint-plugin-node":"^11.1.0","@dapplion/benchmark":"^0.2.2","@chainsafe/as-sha256":"^0.2.4","eslint-plugin-import":"^2.20.2","eslint-plugin-promise":"^4.2.1","eslint-config-standard":"^14.1.1","eslint-plugin-prettier":"^4.0.0","eslint-plugin-standard":"^4.0.1","@libp2p/interface-mocks":"^3.0.1","@libp2p/peer-id-factory":"^1.0.13","@multiformats/multiaddr":"^10.2.0","@typescript-eslint/parser":"^3.0.2","@typescript-eslint/eslint-plugin":"^3.0.2","@libp2p/interface-pubsub-compliance-tests":"^1.0.4"},"_npmOperationalInternal":{"tmp":"tmp/libp2p-gossipsub_3.2.0_1658232994071_0.1891107096177964","host":"s3://npm-registry-packages"},"readme":"# js-libp2p-gossipsub\n\n[![](https://img.shields.io/badge/made%20by-ChainSafe-blue.svg?style=flat-square)](https://chainsafe.io/)\n[![Travis CI](https://flat.badgen.net/travis/ChainSafe/gossipsub-js)](https://travis-ci.com/ChainSafe/gossipsub-js)\n![ES Version](https://img.shields.io/badge/ES-2017-yellow)\n![Node Version](https://img.shields.io/badge/node-10.x-green)\n\n## Table of Contents\n\n- [js-libp2p-gossipsub](#js-libp2p-gossipsub)\n  - [Lead Maintainer](#lead-maintainer)\n  - [Table of Contents](#table-of-contents)\n  - [Specs](#specs)\n  - [Install](#install)\n  - [Usage](#usage)\n  - [API](#api)\n    - [Create a gossipsub implementation](#create-a-gossipsub-implementation)\n  - [Contribute](#contribute)\n  - [License](#license)\n\n## Specs\n\nGossipsub is an implementation of pubsub based on meshsub and floodsub. You can read the specification [here](https://github.com/libp2p/specs/tree/master/pubsub/gossipsub).\n\n`libp2p-gossipsub` currently implements the [`v1.1`](https://github.com/libp2p/specs/blob/master/pubsub/gossipsub/gossipsub-v1.1.md) of the spec.\n\n## Install\n\n`npm install @chainsafe/libp2p-gossipsub`\n\n## Usage\n\n```javascript\nimport { gossipsub } from '@chainsafe/libp2p-gossipsub'\n\n\nconst libp2p = await createLibp2p({\n  // ...\n  services: {\n    pubsub: gossipsub(options)\n  }\n});\n\nlibp2p.services.pubsub.addEventListener('message', (message) => {\n  console.log(`${message.detail.topic}:`, new TextDecoder().decode(message.detail.data))\n})\n\nlibp2p.services.pubsub.subscribe('fruit')\n\nlibp2p.services.pubsub.publish('fruit', new TextEncoder().encode('banana'))\n```\n\n## API\n\n### Create a gossipsub implementation\n\n```js\nconst options = {…}\nconst gossipsub = gossipsub(options)(libp2p)\n```\n\nOptions is an optional object with the following key-value pairs:\n\n- **`emitSelf`**: boolean identifying whether the node should emit to self on publish, in the event of the topic being subscribed (defaults to **false**).\n- **`gossipIncoming`**: boolean identifying if incoming messages on a subscribed topic should be automatically gossiped (defaults to **true**).\n- **`fallbackToFloodsub`**: boolean identifying whether the node should fallback to the floodsub protocol, if another connecting peer does not support gossipsub (defaults to **true**).\n- **`floodPublish`**: boolean identifying if self-published messages should be sent to all peers, (defaults to **true**).\n- **`doPX`**: boolean identifying whether PX is enabled; this should be enabled in bootstrappers and other well connected/trusted nodes (defaults to **false**).\n- **`msgIdFn`**: a function with signature `(message) => string` defining the message id given a message, used internally to deduplicate gossip (defaults to `(message) => message.from + message.seqno.toString('hex')`)\n- **`signMessages`**: boolean identifying if we want to sign outgoing messages or not (default: `true`)\n- **`strictSigning`**: boolean identifying if message signing is required for incoming messages or not (default: `true`)\n- **`messageCache`**: optional, a customized `MessageCache` instance, see the implementation for the interface.\n- **`scoreParams`**: optional, a customized peer score parameters Object.\n- **`scoreThresholds`**: optional, a customized peer score thresholds Object.\n- **`directPeers`**: optional, an array of `AddrInfo` of peers with which we will maintain direct connections.\n\nFor the remaining API, see [@libp2p/interface-pubsub](https://github.com/libp2p/js-libp2p-interfaces/tree/master/packages/interface-pubsub).\n\n## Contribute\n\nThis module is actively under development. Please check out the issues and submit PRs!\n\n## License\n\nMIT © ChainSafe Systems\n","publish_time":1658232994300,"maintainers":[{"name":"wemeetagain","email":"caymannava@gmail.com"},{"name":"mpetrunic","email":"marin.petrunic@gmail.com"}],"_cnpm_publish_time":1658232994300,"dist-tags":{"latest":"14.1.2"}}