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: 7 Imported by: 0

Documentation

Overview

Package evidences defines blockchainfossilizer evidence types.

Index

Constants

View Source
const (
	// BlockchainFossilizerName is the name used as the blockchain proof backend.
	BlockchainFossilizerName = "blockchainfossilizer"

	// Version1_0_0 uses canonical-JSON to serialize a timestamped hash along
	// with a transaction ID.
	Version1_0_0 = "1.0.0"

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

Variables

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

Errors used by the blockchain evidence.

Functions

This section is empty.

Types

type BlockchainProof

type BlockchainProof struct {
	Data          []byte              `json:"data"`
	Timestamp     int64               `json:"timestamp"`
	TransactionID types.TransactionID `json:"txid"`
}

BlockchainProof implements the chainscript.Proof interface. It contains the data that was stored on the blockchain and the ID of the transaction that stored that data. It also includes a server timestamp (not trusted).

func New

func New(data []byte, txid []byte) *BlockchainProof

New creates a new blockchain proofs.

func UnmarshalProof

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

UnmarshalProof unmarshals the blockchain proof contained in an evidence.

func (*BlockchainProof) Evidence

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

Evidence wraps the proof in a versioned evidence.

func (*BlockchainProof) Time

func (p *BlockchainProof) Time() uint64

Time returns the server timestamp.

func (*BlockchainProof) Verify

func (p *BlockchainProof) Verify(data interface{}) bool

Verify returns true if the proof is correct for the given data.

Jump to

Keyboard shortcuts

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