The proof class represents a proof that a given instance with its data is either present or absent in the global state. It does this by proving three different things:

1. that there is a valid chain of blocks from the genesis to the latest block
2. a copy of the latest block to get the root hash of the global state trie
3. an inclusion proof against the root hash that can be positive (element is there) or negative (absence of element)

As the element that is proven is always an instance, this class also has convenience methods to access the instance data in case it is a proof of existence. For absence proofs, these methods will throw an error.

### Hierarchy

- Message<Proof>
  - Proof

## Index

### Constructors

- constructor

### Properties

- $type
- inclusionproof
- latest
- links
- $type
- latestID

### Accessors

- contractID
- darcID
- key
- stateChangeBody
- value

### Methods

- exists
- getVerifiedInstance
- matchContract
- toJSON
- toString
- verify
- verifyFrom
- create
- decode
- decodeDelimited
- encode
- encodeDelimited
- fromObject
- register
- toObject
- verify

## Constructors

### constructor

- new Proof(props: Properties<Proof>): Proof

- Overrides Message.__constructor

  - Defined in src/byzcoin/proof.ts:81

  #### Parameters

  - ##### props: Properties<Proof>

  #### Returns Proof

## Properties

### $type

$type: Type

Inherited from Message.$type

- Defined in node_modules/protobufjs/index.d.ts:524

Reference to the reflected type.

### inclusionproof

inclusionproof: InclusionProof

- Defined in src/byzcoin/proof.ts:79

### latest

latest: SkipBlock

- Defined in src/byzcoin/proof.ts:80

### links

links: ForwardLink[]

- Defined in src/byzcoin/proof.ts:81

### Static $type

$type: Type

Inherited from Message.$type

- Defined in node_modules/protobufjs/index.d.ts:521

Reference to the reflected type.

### Static Private latestID

latestID: InstanceID | undefined

- Defined in src/byzcoin/proof.ts:77

## Accessors

### contractID

- get contractID(): string

- - Defined in src/byzcoin/proof.ts:39

  Returns the contractID this proof represents. Throws an error if it is a proof of absence.

  #### Returns string

  the contract ID as a buffer

### darcID

- get darcID(): Buffer

- - Defined in src/byzcoin/proof.ts:48

  Get the darc ID of the instance

  #### Returns Buffer

  the darcID responsible for the instanceID this proof represents.

### key

- get key(): Buffer

- - Defined in src/byzcoin/proof.ts:66

  Get the instance ID for the proof

  #### Returns Buffer

  the instance ID as a buffer

### stateChangeBody

- get stateChangeBody(): StateChangeBody

- - Defined in src/byzcoin/proof.ts:29

  Get the state change stored in the inclusion proof

  #### Returns StateChangeBody

  the state change body

### value

- get value(): Buffer

- - Defined in src/byzcoin/proof.ts:57

  The value of the instance is different from the value stored in the global state.

  #### Returns Buffer

  the value of the instance this proof represents.

## Methods

### exists

- exists(key: Buffer): boolean

- - Defined in src/byzcoin/proof.ts:194

  Check if the key exists in the proof

  throws

    for corrupted proofs

  #### Parameters

  - ##### key: Buffer

  #### Returns boolean

  true when it exists, false otherwise

### getVerifiedInstance

- getVerifiedInstance(genesisID: InstanceID, contractID: string): Promise<Instance>

- - Defined in src/byzcoin/proof.ts:97

  Verifies that the proof is of the given type and starts at the given byzcoin-id.

  throws

    an error if the proof is not based on genesisID, if it is a proof of absence, or if the instance is not of type contractID.

  deprecated

    this function is unsecure

  #### Parameters

  - ##### genesisID: InstanceID

    the hash of the first block, the byzcoin-id

  - ##### contractID: string

    what contract the instance is supposed to be of

  #### Returns Promise<Instance>

### matchContract

- matchContract(cid: string): boolean

- - Defined in src/byzcoin/proof.ts:202

  #### Parameters

  - ##### cid: string

    contractID to check

  #### Returns boolean

  true if it is a proof of existence and the given type of contract matches.

### toJSON

- toJSON(): object

- Inherited from Message.toJSON

  - Defined in node_modules/protobufjs/index.d.ts:589

  Converts this message to JSON.

  #### Returns object

  JSON object

  - ##### [k: string]: any

### toString

- toString(): string

- - Defined in src/byzcoin/proof.ts:209

  #### Returns string

  a nicely formatted representation of the proof.

### verify

- verify(latestID: InstanceID): Error | undefined

- - Defined in src/byzcoin/proof.ts:137

  Verify that the proof contains a correct chain from the given genesis. Note that this function doesn't verify the first roster of the chain.

  deprecated

    use verifyFrom for a complete verification

  #### Parameters

  - ##### latestID: InstanceID

    ID of the latest known and trusted block the proof is based upon

  #### Returns Error | undefined

  an error if something is wrong, null otherwise

### verifyFrom

- verifyFrom(block: SkipBlock): Error

- - Defined in src/byzcoin/proof.ts:117

  Verify that the proof contains a correct chain from the given block.

  #### Parameters

  - ##### block: SkipBlock

    the first block of the proof

  #### Returns Error

  an error if something is wrong, null otherwise

### Static create

- create<T>(this: Constructor<T>, properties?: object): Message<T>

- Inherited from Message.create

  - Defined in node_modules/protobufjs/index.d.ts:531

  Creates a new message of this type using the specified properties.

  #### Type parameters

  - #### T: Message<Proof>

  #### Parameters

  - ##### this: Constructor<T>

  - ##### Optional properties: object

    - ##### [k: string]: any

  #### Returns Message<T>

  Message instance

### Static decode

- decode<T>(this: Constructor<T>, reader: Reader | Uint8Array): T

- Inherited from Message.decode

  - Defined in node_modules/protobufjs/index.d.ts:554

  Decodes a message of this type.

  #### Type parameters

  - #### T: Message<Proof>

  #### Parameters

  - ##### this: Constructor<T>

  - ##### reader: Reader | Uint8Array

    Reader or buffer to decode

  #### Returns T

  Decoded message

### Static decodeDelimited

- decodeDelimited<T>(this: Constructor<T>, reader: Reader | Uint8Array): T

- Inherited from Message.decodeDelimited

  - Defined in node_modules/protobufjs/index.d.ts:561

  Decodes a message of this type preceeded by its length as a varint.

  #### Type parameters

  - #### T: Message<Proof>

  #### Parameters

  - ##### this: Constructor<T>

  - ##### reader: Reader | Uint8Array

    Reader or buffer to decode

  #### Returns T

  Decoded message

### Static encode

- encode<T>(this: Constructor<T>, message: T | object, writer?: Writer): Writer

- Inherited from Message.encode

  - Defined in node_modules/protobufjs/index.d.ts:539

  Encodes a message of this type.

  #### Type parameters

  - #### T: Message<Proof>

  #### Parameters

  - ##### this: Constructor<T>

  - ##### message: T | object

    Message to encode

  - ##### Optional writer: Writer

  #### Returns Writer

  Writer

### Static encodeDelimited

- encodeDelimited<T>(this: Constructor<T>, message: T | object, writer?: Writer): Writer

- Inherited from Message.encodeDelimited

  - Defined in node_modules/protobufjs/index.d.ts:547

  Encodes a message of this type preceeded by its length as a varint.

  #### Type parameters

  - #### T: Message<Proof>

  #### Parameters

  - ##### this: Constructor<T>

  - ##### message: T | object

    Message to encode

  - ##### Optional writer: Writer

  #### Returns Writer

  Writer

### Static fromObject

- fromObject<T>(this: Constructor<T>, object: object): T

- Inherited from Message.fromObject

  - Defined in node_modules/protobufjs/index.d.ts:575

  Creates a new message of this type from a plain object. Also converts values to their respective internal types.

  #### Type parameters

  - #### T: Message<Proof>

  #### Parameters

  - ##### this: Constructor<T>

  - ##### object: object

    Plain object

    - ##### [k: string]: any

  #### Returns T

  Message instance

### Static register

- register(): void

- - Defined in src/byzcoin/proof.ts:73
  see

    README#Message classes

  #### Returns void

### Static toObject

- toObject<T>(this: Constructor<T>, message: T, options?: IConversionOptions): object

- Inherited from Message.toObject

  - Defined in node_modules/protobufjs/index.d.ts:583

  Creates a plain object from a message of this type. Also converts values to other types if specified.

  #### Type parameters

  - #### T: Message<Proof>

  #### Parameters

  - ##### this: Constructor<T>

  - ##### message: T

    Message instance

  - ##### Optional options: IConversionOptions

  #### Returns object

  Plain object

  - ##### [k: string]: any

### Static verify

- verify(message: object): string

- Inherited from Message.verify

  - Defined in node_modules/protobufjs/index.d.ts:568

  Verifies a message of this type.

  #### Parameters

  - ##### message: object

    Plain object to verify

    - ##### [k: string]: any

  #### Returns string

  `null` if valid, otherwise the reason why it is not

Generated using TypeDoc