{"name":"@chainsafe/libp2p-gossipsub","version":"14.1.0","description":"A typescript implementation of gossipsub","type":"module","types":"dist/src/index.d.ts","exports":{".":{"types":"./dist/src/index.d.ts","import":"./dist/src/index.js"},"./metrics":{"types":"./dist/src/metrics.d.ts","import":"./dist/src/metrics.js"},"./message":{"types":"./dist/src/message/index.d.ts","import":"./dist/src/message/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"}},"typesVersions":{"*":{"*":["*","dist/src/*","dist/src/*/index"]}},"scripts":{"lint":"aegir lint","release":"aegir release --no-types","build":"aegir build","generate":"protons ./src/message/rpc.proto","prepare":"npm run build","pretest":"npm run build","pretest:e2e":"npm run build","benchmark":"yarn benchmark:files 'test/benchmark/**/*.test.ts'","benchmark:files":"NODE_OPTIONS='--max-old-space-size=4096 --loader=ts-node/esm' benchmark --config .benchrc.yaml --defaultBranch master","test":"aegir test -f './dist/test/*.spec.js'","test:unit":"aegir test -f './dist/test/unit/*.test.js' --target node","test:e2e":"aegir test -f './dist/test/e2e/*.spec.js'","test:node":"npm run test -- --target node","test:browser":"npm run test -- --target browser"},"repository":{"type":"git","url":"git+https://github.com/ChainSafe/js-libp2p-gossipsub.git"},"keywords":["libp2p","pubsub","gossip"],"author":{"name":"Cayman Nava"},"license":"Apache-2.0","bugs":{"url":"https://github.com/ChainSafe/js-libp2p-gossipsub/issues"},"homepage":"https://github.com/ChainSafe/js-libp2p-gossipsub#readme","dependencies":{"@libp2p/crypto":"^5.0.0","@libp2p/interface":"^2.0.0","@libp2p/interface-internal":"^2.0.0","@libp2p/peer-id":"^5.0.0","@libp2p/pubsub":"^10.0.0","@multiformats/multiaddr":"^12.1.14","denque":"^2.1.0","it-length-prefixed":"^9.0.4","it-pipe":"^3.0.1","it-pushable":"^3.2.3","multiformats":"^13.0.1","protons-runtime":"^5.5.0","uint8arraylist":"^2.4.8","uint8arrays":"^5.0.1"},"devDependencies":{"@chainsafe/as-sha256":"^0.4.1","@dapplion/benchmark":"^0.2.4","@libp2p/floodsub":"^10.0.0","@libp2p/interface-compliance-tests":"^6.0.0","@libp2p/logger":"^5.0.0","@libp2p/peer-store":"^11.0.0","@types/node":"^20.11.6","@types/sinon":"^17.0.3","abortable-iterator":"^5.1.0","aegir":"^44.1.1","datastore-core":"^10.0.0","delay":"^6.0.0","it-all":"^3.0.6","mkdirp":"^3.0.1","p-defer":"^4.0.0","p-event":"^6.0.0","p-retry":"^6.2.0","p-wait-for":"^5.0.2","protons":"^7.5.0","sinon":"^18.0.1","sinon-ts":"^2.0.0","time-cache":"^0.3.0"},"engines":{"npm":">=8.7.0"},"eslintConfig":{"extends":"ipfs","ignorePatterns":["src/message/rpc*","!.aegir.js"]},"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"}],"sideEffects":false,"_id":"@chainsafe/libp2p-gossipsub@14.1.0","gitHead":"d9e4374b568be6eb490cadc924f42576ed6cfea4","_nodeVersion":"20.17.0","_npmVersion":"10.8.2","dist":{"integrity":"sha512-nzFBbHOoRFa/bXUSzmJaXOgHI+EttTldhLJ33yWcM0DxnWhLKychHkCDLoJO3THa1+dnzrDJoxj3N3/V0WoPVw==","shasum":"0003a214c2a88b04ab7c256c70ec439717958f09","tarball":"http://registry-npm.ywwl.com/@chainsafe/libp2p-gossipsub/download/@chainsafe/libp2p-gossipsub-14.1.0.tgz","fileCount":155,"unpackedSize":1116743,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCbpHtaZcDz9HHYOOhgoY6P4RvB/bm2TQrtPFI6MlbUFQIgUJDew8wsrRjnyQZ7tFUQLI3YvBWhlya7aQYYxoHt3xQ="}],"size":248420,"noattachment":false,"key":"/@chainsafe/libp2p-gossipsub/-/@chainsafe/libp2p-gossipsub-14.1.0.tgz"},"_npmUser":{"name":"wemeetagain","email":"caymannava@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/libp2p-gossipsub_14.1.0_1726241716502_0.8005115821370443"},"_hasShrinkwrap":false,"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":1726241716906,"maintainers":[{"name":"wemeetagain","email":"caymannava@gmail.com"},{"name":"mpetrunic","email":"marin.petrunic@gmail.com"}],"_cnpm_publish_time":1726241716906,"dist-tags":{"latest":"14.1.2"}}