1.0.3 • Published 8 years ago

dapid-payment-hashcash v1.0.3

Weekly downloads
7
License
ISC
Repository
github
Last release
8 years ago

Hashcash payment protocol

The Hashcash-protocol for DAPID-payments.

See the wikipedia article to learn what hashcash is.

Proof of work

The hashing-function is sha3_256. The 'value' of an hash is defined by the amount of beginning chars which are numbers and not letters.

Usage in DapiD

var Dapid = require('dapid');
var hashcashProtocol = require('dapid-payment-hashcash');
var storageEngine = require('memdown'); //any level-down module

var dapid = new Dapid(storageEngine, 'any_db_prefix');

var hashcashProtocolInstance = hashcashProtocol.get('any_other_db_prefix', storageEngine, {
    paybackTokenLifetime: 50 * 1, //timeframe in which the paybackTokens are valid. default: 1000 * 60 * 60 * 24ms
    solutionValidTime: 50 //timeframe until found solutions are not valid. default:  1000 * 20ms
}),

dapid.addPaymentProtocol(hashcashProtocolInstance);

paymentOptionData

The paymentOptionData has a price-attribute which defines the difficulty of a single hash. The multiplier defines how many of the hashes must be found to have valid paymentData.

  {
    "price": 5,
    "multiplier": 10
  }

TODOs

  • Multithreading in util.solveChallenge()
1.0.3

8 years ago

1.0.2

9 years ago

1.0.1

9 years ago

1.0.0

9 years ago