shachain

package
v0.1.1-alpha Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2017 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HyperShaChain

type HyperShaChain struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

HyperShaChain... * https://github.com/rustyrussell/ccan/blob/master/ccan/crypto/shachain/design.txt

func New

func New() *HyperShaChain

NewHyperShaChain

  • used to track their preimages

func NewFromSeed

func NewFromSeed(seed *[32]byte, deriveTo uint64) (*HyperShaChain, error)

NewHyperShaChainFromSeed...

  • used to derive your own preimages

func (*HyperShaChain) AddNextHash

func (h *HyperShaChain) AddNextHash(hash [32]byte) error

addHash

func (*HyperShaChain) CurrentPreImage

func (h *HyperShaChain) CurrentPreImage() *chainhash.Hash

CurrentPreImage...

func (*HyperShaChain) CurrentRevocationHash

func (h *HyperShaChain) CurrentRevocationHash() []byte

CurrentRevocationHash... TODO(roasbeef): *chainhash.Hash vs [wire.HashSize]byte ?

func (*HyperShaChain) Decode

func (h *HyperShaChain) Decode(b io.Reader) error

UnmarshallBinary...

func (*HyperShaChain) Encode

func (h *HyperShaChain) Encode(b io.Writer) error

MarshallBinary...

func (*HyperShaChain) GetHash

func (h *HyperShaChain) GetHash(index uint64) (*[32]byte, error)

getHash... index should be commitment #

func (*HyperShaChain) LocatePreImage

func (h *HyperShaChain) LocatePreImage(outputScript []byte) (uint64, *[32]byte)

LocatePreImage... Alice just broadcasted an old commitment tx, we need the revocation hash to claim the funds so we don't get cheated. However, we aren't storing all the preimages in memory. So which shachain index # did she broadcast?

Jump to

Keyboard shortcuts

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