{"name":"@chainsafe/libp2p-gossipsub","version":"13.0.0","keywords":["libp2p","pubsub","gossip"],"author":{"name":"Cayman Nava"},"license":"Apache-2.0","_id":"@chainsafe/libp2p-gossipsub@13.0.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":"b1dfa5c2d455d77ab8dfc97f5eb8961861bb623e","tarball":"http://registry-npm.ywwl.com/@chainsafe/libp2p-gossipsub/download/@chainsafe/libp2p-gossipsub-13.0.0.tgz","fileCount":155,"integrity":"sha512-2q+v429uZjMl6N3d+j9QCMj8YO0aiYvLSN1t0aTdpMXQHCHLJaaT9PtNn845B1Li7/uZjYESmikgVt8r7keH0w==","signatures":[{"sig":"MEUCIBnsSLSX3P9Js61WfsBO0blgC9VFKwqvDM/+UN2orhsRAiEA4CTBdX/6YfkM9yVr0REwrbfpjL4p9IETUKWrVHVGZcQ=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":1093196,"size":244573,"noattachment":false,"key":"/@chainsafe/libp2p-gossipsub/-/@chainsafe/libp2p-gossipsub-13.0.0.tgz"},"type":"module","types":"dist/src/index.d.ts","engines":{"npm":">=8.7.0"},"exports":{".":{"types":"./dist/src/index.d.ts","import":"./dist/src/index.js"},"./score":{"types":"./dist/src/score/index.d.ts","import":"./dist/src/score/index.js"},"./types":{"types":"./dist/src/types.d.ts","import":"./dist/src/types.js"},"./message":{"types":"./dist/src/message/index.d.ts","import":"./dist/src/message/index.js"},"./metrics":{"types":"./dist/src/metrics.d.ts","import":"./dist/src/metrics.js"}},"gitHead":"ff620fda077da6bea89f3da1408b29c5151ab581","scripts":{"lint":"aegir lint","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.19.4","description":"A typescript implementation of gossipsub","directories":{},"sideEffects":false,"_nodeVersion":"16.20.2","dependencies":{"denque":"^2.1.0","it-pipe":"^3.0.1","it-pushable":"^3.2.3","uint8arrays":"^5.0.1","multiformats":"^13.0.1","@libp2p/crypto":"^4.0.1","@libp2p/pubsub":"^9.0.8","uint8arraylist":"^2.4.8","@libp2p/peer-id":"^4.0.5","protons-runtime":"5.4.0","@libp2p/interface":"^1.1.2","it-length-prefixed":"^9.0.4","@multiformats/multiaddr":"^12.1.14","@libp2p/interface-internal":"^1.0.7"},"eslintConfig":{"extends":"ipfs","ignorePatterns":["src/message/rpc*","!.aegir.js"]},"typesVersions":{"*":{"*":["*","dist/src/*","dist/src/*/index"]}},"_hasShrinkwrap":false,"devDependencies":{"aegir":"^42.2.2","delay":"^6.0.0","sinon":"^17.0.1","mkdirp":"^3.0.1","p-defer":"^4.0.0","p-event":"^6.0.0","p-retry":"^6.2.0","protons":"^7.5.0","ts-sinon":"^2.0.2","p-wait-for":"^5.0.2","time-cache":"^0.3.0","@types/node":"^20.11.6","@libp2p/logger":"^4.0.5","datastore-core":"^9.2.7","@libp2p/floodsub":"^9.0.9","@libp2p/peer-store":"^10.0.8","@dapplion/benchmark":"^0.2.4","@chainsafe/as-sha256":"^0.4.1","@libp2p/peer-id-factory":"^4.0.5","@libp2p/interface-compliance-tests":"^5.2.0"},"_npmOperationalInternal":{"tmp":"tmp/libp2p-gossipsub_13.0.0_1709090389792_0.924784626853701","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":1709090390029,"maintainers":[{"name":"wemeetagain","email":"caymannava@gmail.com"},{"name":"mpetrunic","email":"marin.petrunic@gmail.com"}],"_cnpm_publish_time":1709090390029,"dist-tags":{"latest":"14.1.2"}}