evidences

package
v0.4.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 1, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package evidences defines batchfossilizer evidence types.

Index

Constants

View Source
const (
	// BatchFossilizerName is the name used as the BatchProof backend.
	BatchFossilizerName = "batchfossilizer"

	// Version1_0_0 uses canonical-JSON to serialize a timestamped merkle path
	// and a merkle root.
	Version1_0_0 = "1.0.0"

	// Version used for new batch proofs.
	Version = Version1_0_0
)

Variables

View Source
var (
	ErrInvalidBackend = errors.New("backend is not batchfossilizer")
	ErrUnknownVersion = errors.New("unknown evidence version")
)

Errors used by the batch evidence.

Functions

This section is empty.

Types

type BatchProof

type BatchProof struct {
	Timestamp int64        `json:"timestamp"`
	Root      []byte       `json:"merkleRoot"`
	Path      mktypes.Path `json:"merklePath"`
	Proof     []byte       `json:"proof"`
}

BatchProof implements the chainscript.Proof interface. The data is put in the leaf of a merkle tree and we provide a merkle proof for that leaf. The batch proof needs a separate fossilizer to produce a proof of the merkle root: that proof can be found in the `Proof` field.

func UnmarshalProof

func UnmarshalProof(e *chainscript.Evidence) (*BatchProof, error)

UnmarshalProof unmarshals the batch proof contained in an evidence.

func (*BatchProof) Evidence

func (p *BatchProof) Evidence(provider string) (*chainscript.Evidence, error)

Evidence wraps the proof in a versioned evidence.

func (*BatchProof) Time

func (p *BatchProof) Time() uint64

Time returns the timestamp from the block header.

func (*BatchProof) Verify

func (p *BatchProof) Verify(_ interface{}) bool

Verify returns true if the proof of a given linkHash is correct.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL