denial-of-service mitigation through modified hashcash algorithm for message delivery

Usage no npm install needed!

<script type="module">
  import kadHashcash from 'https://cdn.skypack.dev/kad-hashcash';


Kad HashCash

Build Status Coverage Status NPM

HashCash is a proof-of-work algorithm originally designed to prevent email spam. A modified version of HashCash is implemented in this package to mitigate spam and denial of service attacks on Kad networks.


Install with NPM.

npm install kad kad-hashcash --save

Integrate with your Kad project.

const kad = require('kad');
const hashcash = require('kad-hashcash');
const node = kad({ /* options */ });

  // optional list of methods to enforce proofs - leave empty for all
  methods: [],
  // optional difficulty - default is 4
  difficulty: 4,
  // optional timeframe grace period - default is 2 days
  timeframe: 172800000


Kad HashCash - DoS Mitigation for Kademlia
Copyright (C) 2017 Gordon Hall

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with this program. If not, see http://www.gnu.org/licenses/.