Class: ShardContract

Database. ShardContract


new ShardContract(properties)

Describes a contract between two peers for shard storage
Parameters:
Name Type Description
properties object
Properties
Name Type Argument Default Description
version number <optional>
2 Version of the contract type
ownerParentKey string HD key for the shard owner
ownerIndex number <optional>
0 HD index for the shard owner
ownerIdentity string Identity key of the shard owner
ownerSignature string Valid signature from owner
providerParentKey string HD key for the shard owner
providerIndex number <optional>
0 HD index for the shard owner
providerIdentity string Identity key of the shard owner
providerSignature string Valid signature from provider
shardSize number Number of bytes in the shard
shardHash string RMD160 SHA256 hash of shard
auditLeaves Array.<string> Lower leaves of audit merkle tree
auditInterval number Expect a challenge every N ms
accessPolicies Array.<string> IMP-10 access policy strings
fundingDestination string <optional>
none Reserved for future
Source:

Methods


<static> methods.checkAccessPolicy(contact)

Returns which, if any, methods are allowed by the access policy for the given contact
Parameters:
Name Type Description
contact object
Properties
Name Type Description
0 string Identity key
1 object Contact information
Source:
Returns:
Type
Array.<string>

<static> methods.getSigningString()

Returns the stringified version of the contract for signing
Source:
Returns:
Type
string

<static> methods.sign(actor, secret)

Applies signature to contract as the given actor
Parameters:
Name Type Description
actor string One of provider|owner
secret buffer SECP256K1 private key
Source:
Returns:
Type
string

<static> methods.signExternal()

Creates a signature of the contract given the SECP256K1 key
Source:
Returns:
Type
string

<static> methods.verify(actor)

Verifies that the given actor signature is valid
Parameters:
Name Type Description
actor string One of provider|owner
Source:
Returns:
Type
boolean

<static> methods.verifyExternal()

Verifies the signature against a given public key
Source:
Returns:
Type
boolean

<static> statics.diff()

Returns the property names that are different between two contracts
Source:
Returns:
Type
Array.<string>