unlocker

package
v2.1.0-beta.9 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2022 License: ISC Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Getter

type Getter struct {
	PrivateKey *bec.PrivateKey
}

Getter implements the `bt.UnlockerGetter` interface. It unlocks a Tx locally, using a bec PrivateKey.

func (*Getter) Unlocker

func (g *Getter) Unlocker(ctx context.Context, lockingScript *bscript.Script) (bt.Unlocker, error)

Unlocker builds a new `*unlocker.Local` with the same private key as the calling `*local.Getter`.

For an example implementation, see `examples/unlocker_getter/`.

type Simple

type Simple struct {
	PrivateKey *bec.PrivateKey
}

Simple implements the a simple `bt.Unlocker` interface. It is used to build an unlocking script using a bec Private Key.

func (*Simple) UnlockingScript

func (l *Simple) UnlockingScript(ctx context.Context, tx *bt.Tx, params bt.UnlockerParams) (*bscript.Script, error)

UnlockingScript create the unlocking script for a given input using the PrivateKey passed in through the the `unlock.Local` struct.

UnlockingScript generates and uses an ECDSA signature for the provided hash digest using the private key as well as the public key corresponding to the private key used. The produced signature is deterministic (same message and same key yield the same signature) and canonical in accordance with RFC6979 and BIP0062.

For example usage, see `examples/create_tx/create_tx.go`

Jump to

Keyboard shortcuts

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