kadence/hashcash~ HashCashPlugin

Requires proof of work to process messages and performs said work before issuing RPC messages to peers

Constructor

new HashCashPlugin(node, optionsopt)

Parameters:
NameTypeAttributesDescription
nodeobject
optionsobject<optional>
Properties
NameTypeAttributesDefaultDescription
methodsArray.<string><optional>
[]

RPC methods to enforce hashcash

difficultynumber<optional>
8

Leading zero bits in stamp

timeframenumber<optional>
172800000

Timestamp valid window

Methods

(static) parse(header) → {module:kadence/hashcash~HashCashPlugin~stamp}

Parses hashcash stamp header into an object

Parameters:
NameTypeDescription
headerstring

Hashcash header proof stamp

prove()

Add proof of work to outgoing message

verify()

Verifies the proof of work on the request object

Type Definitions

stamp

Properties
NameTypeDescription
vernumber

Hashcash version

bitsnumber

Number of zero bits of difficulty

datenumber

UNIX timestamp

resourcestring

Sender and target node identities

extstring

Empty string

randstring

String encoded random number

counternumber

Base 16 counter

toStringfunction

Reserializes the parsed header