transaction

package
v0.0.0-...-89d61c9 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2019 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateAndPublish

func CreateAndPublish(
	txData *TransactionData,
	chain *chain.BTC,
	signer *Signer,
	networkParams *chaincfg.Params,
) (string, error)

func CreateUnsigned

func CreateUnsigned(
	sourceTxHashString string,
	sourceTxOutputIndex uint32,
	sourceTxOutputAmount uint64,
	outputAddress1 string,
	outputAddress2 string,
	outputAmount1 uint64,
	outputAmount2 uint64,
	networkParams *chaincfg.Params,
) (*wire.MsgTx, error)

func Serialize

func Serialize(msgTx *wire.MsgTx) ([]byte, error)

Serialize encodes a bitcoin transaction message to a hexadecimal format.

Types

type Signer

type Signer struct {
	// contains filtered or unexported fields
}

func NewSigner

func NewSigner(wif string) (*Signer, error)

NewSigner initializes a new signer with a private key decoded from WIF.

func (*Signer) SignNoWitness

func (s *Signer) SignNoWitness(
	msgTx *wire.MsgTx,
	subscript []byte,
	inputToSignIndex uint32,
) error

func (*Signer) SignWitness

func (s *Signer) SignWitness(
	msgTx *wire.MsgTx,
	sourceOutputScript []byte,
	inputToSignIndex uint32,
	sourceTxOutputAmount uint64,
) error

type TransactionData

type TransactionData struct {
	// Source transaction
	SourceTxHash         string `json:"sourceTxHash"`
	SourceTxOutputIndex  uint32 `json:"sourceTxOutputIndex"`
	SourceTxOutputAmount uint64 `json:"sourceTxOutputAmount"`
	SourceTxOutputScript string `json:"sourceTxOutputScript"`
	// Output 1
	DestinationAddress1 string `json:"output1Address"`
	FundingAmount       uint64 `json:"output1Amount"`
	// Output 2
	DestinationAddress2 string `json:"output2Address"`
	Fee                 uint64 `json:"fee"`
}

func ReadTransactionData

func ReadTransactionData(filePath string) (*TransactionData, error)

Jump to

Keyboard shortcuts

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