Class: Node

Node

Extends Kademlia with Orc protocol rules

new Node(options)

Parameters:
Name Type Description
options object
Properties
Name Type Argument Description
privateExtendedKey string HD extended private key
logger object <optional>
Bunyan compatible logger
transport Transport <optional>
database Database
shards Shards
keyDerivationIndex number <optional>
HD derivation index
trustPolicies Array.<object> <optional>
Kadence trust policies
License:
  • AGPL-3.0
Source:

Methods


auditRemoteShards(peer, audits, callback)

Sends the series of hash/challenge pairs to the remote node to request proof-of-storage
Parameters:
Name Type Description
peer array
Properties
Name Type Description
0 string Identity key string
1 string | object Address data for contact
audits Array.<object>
Properties
Name Type Description
hash string Hash of the shard to prove
challenge string Challenge string to prepend to shard
callback Node~auditRemoteShardsCallback
Source:

authorizeConsignment(peer, hashes, callback)

Requests authorization tokens to push file shard(s) to another node
Parameters:
Name Type Description
peer array
Properties
Name Type Description
0 string Identity key string
1 string | object Address data for contact
hashes Array.<string> Hashes of the shards to push
callback Node~authorizeConsignmentCallback
Source:

authorizeRetrieval(peer, hashes, callback)

Requests authorization tokens to pull file shard(s) from another node
Parameters:
Name Type Description
peer array
Properties
Name Type Description
0 string Identity key string
1 string | object Address data for contact
hashes Array.<string> Hashes of the shards to pull
callback Node~authorizeRetrievalCallback
Source:

claimProviderCapacity(peer, descriptor, callback)

Claims capacity from a farming node, given a valid contract
Parameters:
Name Type Description
peer array
Properties
Name Type Description
0 string Identity key string
1 string | object Address data for contact
descriptor object Contract descriptor
callback Node~claimProviderCapacityCallback
Source:

createShardMirror(source, target, callback)

Requests the source node to MIRROR a shard to the supplied destination
Parameters:
Name Type Description
source array
Properties
Name Type Description
0 string Identity key string
1 string | object Address data for contact
target object
Properties
Name Type Description
destination array -
Properties
Name Type Description
0 string Identity key string
1 string | object Address data for contact
hash string Hash of the shard to mirror
token string Authorization token to PUSH shard
callback Node~createShardMirrorCallback
Source:

getBootstrapCandidates()

Returns a list of bootstrap nodes from local profiles
Source:
Returns:
urls
Type
Array.<string>

identifyService(url, callback)

Sends a GET request to the URI and parses the result as a valid contact object with identity
Parameters:
Name Type Description
url string The URL of the node
callback Node~identifyServiceCallback
Source:

listen()

Adds the kademlia rule handlers before calling super#listen()
Source:

reapExpiredShards()

Scans the contract database for stale contracts to reap
Source:

requestContractRenewal(peer, contract, callback)

Requests that the target peer update their local version of the given contract. Used to extend storage time or terminate storage. Peer will respond with an error or their updated, signed record of the renewal.
Parameters:
Name Type Description
peer array
Properties
Name Type Description
0 string Identity key string
1 object Address data for contact
contract object The completed shard descriptor contract
callback Node~requestContractRenewalCallback
Source:

updateFlags(soft)

Performs any periodic updates to the contact flags we include in every message
Parameters:
Name Type Description
soft boolean Don't do iterativeFindNode on update
Source:

Type Definitions


auditRemoteShardsCallback(error, proofs)

Parameters:
Name Type Description
error object | null
proofs Array.<object>
Properties
Name Type Description
hash string Hash of the shard for corresponding proof
proof string compact-merkle-proof
Source:

authorizeConsignmentCallback(error, consignmentTokens)

Parameters:
Name Type Description
error error | null
consignmentTokens Array.<string>
Source:

authorizeRetrievalCallback(error, retrievalTokens)

Parameters:
Name Type Description
error error | null
retrievalTokens Array.<string>
Source:

claimProviderCapacityCallback(error, result)

Parameters:
Name Type Description
error error | null
result array
Properties
Name Type Description
0 object Completed contract result
1 string Consignment token
Source:

createShardMirrorCallback(error)

Parameters:
Name Type Description
error object | null
Source:

identifyServiceCallback(error, contact)

Parameters:
Name Type Description
error error | null
contact array
Source:

requestContractRenewalCallback(error, contract)

Parameters:
Name Type Description
error error | null
contract object See storage-contracts
Source: