injector

package
v0.0.0-...-b4c7e06 Latest Latest
Warning

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

Go to latest
Published: May 9, 2021 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func P2SHRetrieveData

func P2SHRetrieveData(rawTxBytes []byte) ([]byte, error)

P2SHRetrieveData takes a list of transaction inputs and decodes the signature scripts that contain the file

Types

type Injection

type Injection struct {
	Network   *chaincfg.Params
	FeeRate   int
	Addresses []*InjectionAddress
	// contains filtered or unexported fields
}

Injection holds all necessary information to inject arbitrary data on the Bitcoin network

func NewInjection

func NewInjection(data []byte, feeRate int, key *btcec.PrivateKey, network *chaincfg.Params) (*Injection, error)

NewInjection creates a new data injection structure

func (*Injection) BuildTX

func (i *Injection) BuildTX(txOut *wire.TxOut) (*wire.MsgTx, error)

BuildTX constructs the final transaction containing the file

func (*Injection) EstimateCost

func (i *Injection) EstimateCost() (int64, int64, error)

EstimateCost creates a dummy transaction containing all signature scripts required to store the file This allows us to estimate the final transaction size in bytes

func (*Injection) NumInputs

func (i *Injection) NumInputs() int

NumInputs counts the number of inputs required to store the file

func (*Injection) WaitPayments

func (i *Injection) WaitPayments(onPayment func(addr string, num int)) error

WaitPayments waits until all required UTXOs are created on all pre-generated P2SH-P2WSH addresses

type InjectionAddress

type InjectionAddress struct {
	Address *btcutil.AddressScriptHash
	UTXO    *wire.OutPoint
	Amount  int64
	Chunks  [][]byte
}

InjectionAddress holds informations about a script hash address The P2SH-P2WSH address is derived from the user's public key and the file's data The user must sends coins to this script hash address. The UTXO can be redeemed by providing a signature script containing the corresponding file

Jump to

Keyboard shortcuts

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