transaction

package
v0.4.6 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EmptyBlinder string = types.EmptyBlinder
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ConfidentialTxApi

type ConfidentialTxApi interface {
	// Create This function create the elements transaction.
	Create(version uint32, locktime uint32, txinList []*types.InputConfidentialTxIn, txoutList []*types.InputConfidentialTxOut, pegoutAddressList *[]string) (tx *types.ConfidentialTx, err error)
	// Add This function add the inputs and outputs.
	Add(tx *types.ConfidentialTx, txinList []*types.InputConfidentialTxIn, txoutList []*types.InputConfidentialTxOut, pegoutAddressList *[]string) error
	// Blind This function change to the blinded transaction.
	Blind(tx *types.ConfidentialTx, txinList []*types.BlindInputData, txoutList []*types.BlindOutputData, option *types.BlindTxOption) error
	UnblindTxOut(tx *types.ConfidentialTx, index uint32, blindingKey *types.Privkey) (utxoData *types.ElementsUtxoData, err error)
	// AddPubkeySign This function add the pubkey hash sign.
	AddPubkeySign(tx *types.ConfidentialTx, outpoint *types.OutPoint, hashType types.HashType, pubkey *types.Pubkey, signature string) error
	// AddPubkeySign This function add the pubkey hash sign by output descriptor.
	AddPubkeySignByDescriptor(tx *types.ConfidentialTx, outpoint *types.OutPoint, outputDescriptor *types.Descriptor, signature string) error
	// AddScriptSign add script hash sign.
	AddScriptSign(tx *types.ConfidentialTx, outpoint *types.OutPoint, hashType types.HashType, signList []*types.SignParameter, redeemScript *types.Script) error
	// AddScriptSign add script hash sign by descriptor.
	AddScriptSignByDescriptor(tx *types.ConfidentialTx, outpoint *types.OutPoint, outputDescriptor *types.Descriptor, signList []*types.SignParameter) error
	AddTxMultisigSign(tx *types.ConfidentialTx, outpoint *types.OutPoint, hashType types.HashType, signList []*types.SignParameter, redeemScript *types.Script) error
	AddTxMultisigSignByDescriptor(tx *types.ConfidentialTx, outpoint *types.OutPoint, outputDescriptor *types.Descriptor, signList []*types.SignParameter) error
	SignWithPrivkey(tx *types.Transaction, outpoint *types.OutPoint, privkey *types.Privkey, sighashType types.SigHashType, txinUtxoList []*types.UtxoData) error
	VerifySign(tx *types.ConfidentialTx, outpoint *types.OutPoint, txinUtxoList []*types.ElementsUtxoData) (isVerify bool, reason string, err error)
	// VerifyEcSignatureByUtxo ...
	VerifyEcSignatureByUtxo(tx *types.ConfidentialTx, outpoint *types.OutPoint, utxo *types.ElementsUtxoData, signature *types.SignParameter) (isVerify bool, err error)
	GetCommitment(amount int64, amountBlindFactor, assetBlindFactor, asset string) (amountCommitment, assetCommitment string, err error)
	UnblindByTxOut(txout *types.ConfidentialTxOut, blindingkey *types.Privkey) (unblindedData *types.UnblindData, err error)
	FilterUtxoByTxInList(tx *types.ConfidentialTx, utxoList []*types.ElementsUtxoData) (txinUtxoList []*types.ElementsUtxoData, err error)
	GetTxid(tx *types.ConfidentialTx) string
	GetPegoutAddress(tx *types.ConfidentialTx, index uint32) (pegoutAddress *types.Address, isPegoutOutput bool, err error)
	GetSighash(tx *types.ConfidentialTx, outpoint *types.OutPoint, sighashType types.SigHashType, utxoList []*types.ElementsUtxoData) (sighash *types.ByteData, err error)
	GetAll(tx *types.ConfidentialTx, hasWitness bool) (data *types.TransactionData, txinList []*types.ConfidentialTxIn, txoutList []*types.ConfidentialTxOut, err error)
	GetAllWithAddress(tx *types.ConfidentialTx, hasWitness bool) (data *types.TransactionData, txinList []*types.ConfidentialTxIn, txoutList []*types.ConfidentialTxOut, err error)
	GetTxIn(txHex string, outpoint *types.OutPoint) (txin *types.ConfidentialTxIn, err error)
}

ConfidentialTxApi This interface defines the API to operate Elements Confidential Transaction.

type ConfidentialTxApiImpl

type ConfidentialTxApiImpl struct {
	cfdErrors.HasInitializeError
	// contains filtered or unexported fields
}

ConfidentialTxApiImpl Create confidential transaction utility.

func NewConfidentialTxApi

func NewConfidentialTxApi(options ...config.CfdConfigOption) *ConfidentialTxApiImpl

NewConfidentialTxApi This function returns a struct that implements ConfidentialTxApi.

func (*ConfidentialTxApiImpl) Add

func (t *ConfidentialTxApiImpl) Add(tx *types.ConfidentialTx, txinList []*types.InputConfidentialTxIn, txoutList []*types.InputConfidentialTxOut, pegoutAddressList *[]string) error

func (*ConfidentialTxApiImpl) AddPubkeySign

func (t *ConfidentialTxApiImpl) AddPubkeySign(tx *types.ConfidentialTx, outpoint *types.OutPoint, hashType types.HashType, pubkey *types.Pubkey, signature string) error

AddPubkeySign ...

func (*ConfidentialTxApiImpl) AddPubkeySignByDescriptor

func (t *ConfidentialTxApiImpl) AddPubkeySignByDescriptor(tx *types.ConfidentialTx, outpoint *types.OutPoint, outputDescriptor *types.Descriptor, signature string) error

AddPubkeySignByDescriptor ...

func (*ConfidentialTxApiImpl) AddScriptSign added in v0.3.11

func (t *ConfidentialTxApiImpl) AddScriptSign(tx *types.ConfidentialTx, outpoint *types.OutPoint, hashType types.HashType, signList []*types.SignParameter, redeemScript *types.Script) error

AddScriptSign ...

func (*ConfidentialTxApiImpl) AddScriptSignByDescriptor added in v0.3.11

func (t *ConfidentialTxApiImpl) AddScriptSignByDescriptor(tx *types.ConfidentialTx, outpoint *types.OutPoint, outputDescriptor *types.Descriptor, signList []*types.SignParameter) error

AddScriptSignByDescriptor ...

func (*ConfidentialTxApiImpl) AddTxMultisigSign added in v0.3.11

func (t *ConfidentialTxApiImpl) AddTxMultisigSign(tx *types.ConfidentialTx, outpoint *types.OutPoint, hashType types.HashType, signList []*types.SignParameter, redeemScript *types.Script) error

func (*ConfidentialTxApiImpl) AddTxMultisigSignByDescriptor added in v0.3.11

func (t *ConfidentialTxApiImpl) AddTxMultisigSignByDescriptor(tx *types.ConfidentialTx, outpoint *types.OutPoint, outputDescriptor *types.Descriptor, signList []*types.SignParameter) error

func (*ConfidentialTxApiImpl) Blind

func (t *ConfidentialTxApiImpl) Blind(tx *types.ConfidentialTx, txinList []*types.BlindInputData, txoutList []*types.BlindOutputData, option *types.BlindTxOption) error

Blind ...

func (*ConfidentialTxApiImpl) Create

func (t *ConfidentialTxApiImpl) Create(version uint32, locktime uint32, txinList []*types.InputConfidentialTxIn, txoutList []*types.InputConfidentialTxOut, pegoutAddressList *[]string) (tx *types.ConfidentialTx, err error)

func (*ConfidentialTxApiImpl) FilterUtxoByTxInList

func (t *ConfidentialTxApiImpl) FilterUtxoByTxInList(tx *types.ConfidentialTx, utxoList []*types.ElementsUtxoData) (txinUtxoList []*types.ElementsUtxoData, err error)

func (*ConfidentialTxApiImpl) GetAll

func (t *ConfidentialTxApiImpl) GetAll(tx *types.ConfidentialTx, hasWitness bool) (data *types.TransactionData, txinList []*types.ConfidentialTxIn, txoutList []*types.ConfidentialTxOut, err error)

GetAll ...

func (*ConfidentialTxApiImpl) GetAllWithAddress added in v0.3.12

func (t *ConfidentialTxApiImpl) GetAllWithAddress(tx *types.ConfidentialTx, hasWitness bool) (data *types.TransactionData, txinList []*types.ConfidentialTxIn, txoutList []*types.ConfidentialTxOut, err error)

GetAllWithAddress ...

func (*ConfidentialTxApiImpl) GetCommitment added in v0.3.13

func (t *ConfidentialTxApiImpl) GetCommitment(amount int64, amountBlindFactor, assetBlindFactor, asset string) (amountCommitment, assetCommitment string, err error)

func (*ConfidentialTxApiImpl) GetPegoutAddress

func (t *ConfidentialTxApiImpl) GetPegoutAddress(tx *types.ConfidentialTx, index uint32) (pegoutAddress *types.Address, isPegoutOutput bool, err error)

GetPegoutAddress ...

func (*ConfidentialTxApiImpl) GetSighash

func (t *ConfidentialTxApiImpl) GetSighash(tx *types.ConfidentialTx, outpoint *types.OutPoint, sighashType types.SigHashType, utxoList []*types.ElementsUtxoData) (sighash *types.ByteData, err error)

GetSighash ...

func (*ConfidentialTxApiImpl) GetTxIn

func (t *ConfidentialTxApiImpl) GetTxIn(txHex string, outpoint *types.OutPoint) (txin *types.ConfidentialTxIn, err error)

func (*ConfidentialTxApiImpl) GetTxid

GetTxid ...

func (*ConfidentialTxApiImpl) SignWithPrivkey added in v0.4.0

func (t *ConfidentialTxApiImpl) SignWithPrivkey(tx *types.Transaction, outpoint *types.OutPoint, privkey *types.Privkey, sighashType types.SigHashType, utxoList []*types.UtxoData) error

func (*ConfidentialTxApiImpl) UnblindByTxOut added in v0.3.16

func (t *ConfidentialTxApiImpl) UnblindByTxOut(txout *types.ConfidentialTxOut, blindingkey *types.Privkey) (unblindedData *types.UnblindData, err error)

func (*ConfidentialTxApiImpl) UnblindTxOut added in v0.3.12

func (t *ConfidentialTxApiImpl) UnblindTxOut(tx *types.ConfidentialTx, index uint32, blindingKey *types.Privkey) (utxoData *types.ElementsUtxoData, err error)

func (*ConfidentialTxApiImpl) VerifyEcSignatureByUtxo added in v0.3.13

func (t *ConfidentialTxApiImpl) VerifyEcSignatureByUtxo(tx *types.ConfidentialTx, outpoint *types.OutPoint, utxo *types.ElementsUtxoData, signature *types.SignParameter) (isVerify bool, err error)

func (*ConfidentialTxApiImpl) VerifySign

func (t *ConfidentialTxApiImpl) VerifySign(tx *types.ConfidentialTx, outpoint *types.OutPoint, txinUtxoList []*types.ElementsUtxoData) (isVerify bool, reason string, err error)

VerifySign ...

func (*ConfidentialTxApiImpl) WithBitcoinAddressApi added in v0.3.10

func (p *ConfidentialTxApiImpl) WithBitcoinAddressApi(addressApi address.AddressApi) *ConfidentialTxApiImpl

WithBitcoinAddressApi This function set a bitcoin address api.

func (*ConfidentialTxApiImpl) WithBitcoinTxApi added in v0.3.10

func (p *ConfidentialTxApiImpl) WithBitcoinTxApi(transactionApi TransactionApi) *ConfidentialTxApiImpl

WithBitcoinTxApi This function set a bitcoin transaction api.

func (*ConfidentialTxApiImpl) WithElementsDescriptorApi added in v0.3.10

func (p *ConfidentialTxApiImpl) WithElementsDescriptorApi(descriptorApi descriptor.DescriptorApi) *ConfidentialTxApiImpl

WithElementsDescriptorApi This function set a elements descriptor api.

func (*ConfidentialTxApiImpl) WithPubkeyApi added in v0.3.13

func (p *ConfidentialTxApiImpl) WithPubkeyApi(pubkeyApi key.PubkeyApi) *ConfidentialTxApiImpl

WithPubkeyApi This function set a pubkey api.

type LedgerLiquidLibApi added in v0.3.11

type LedgerLiquidLibApi interface {
	// GetAuthorizeSignature returns the authorize signature.
	GetAuthorizeSignature(tx *types.ConfidentialTx, key *types.Privkey) (signature *types.ByteData, err error)
}

ConfidentialTxApi This interface defines the API to operate Elements Confidential Transaction.

type LedgerLiquidLibApiImpl added in v0.3.11

type LedgerLiquidLibApiImpl struct {
	cfdErrors.HasInitializeError
	// contains filtered or unexported fields
}

ConfidentialTxApiImpl Create confidential transaction utility.

func NewLedgerLiquidLibApi added in v0.3.11

func NewLedgerLiquidLibApi(options ...config.CfdConfigOption) *LedgerLiquidLibApiImpl

NewLedgerLiquidLibApi returns a struct that implements LedgerLiquidLibApi.

func (*LedgerLiquidLibApiImpl) GetAuthorizeSignature added in v0.3.11

func (t *LedgerLiquidLibApiImpl) GetAuthorizeSignature(tx *types.ConfidentialTx, key *types.Privkey) (signature *types.ByteData, err error)

func (*LedgerLiquidLibApiImpl) WithPrivkeyApi added in v0.3.11

func (t *LedgerLiquidLibApiImpl) WithPrivkeyApi(privkeyApi key.PrivkeyApi) *LedgerLiquidLibApiImpl

WithPrivkeyApi sets a privkey api.

type TransactionApi

type TransactionApi interface {
	Create(version uint32, locktime uint32, txinList []*types.InputTxIn, txoutList []*types.InputTxOut) (tx *types.Transaction, err error)
	Add(tx *types.Transaction, txinList []*types.InputTxIn, txoutList []*types.InputTxOut) error
	AddPubkeySign(tx *types.Transaction, outpoint *types.OutPoint, hashType types.HashType, pubkey *types.Pubkey, signature string) error
	AddPubkeySignByDescriptor(tx *types.Transaction, outpoint *types.OutPoint, outputDescriptor *types.Descriptor, signature string) error
	SignWithPrivkey(tx *types.Transaction, outpoint *types.OutPoint, privkey *types.Privkey, sighashType types.SigHashType, utxoList []*types.UtxoData) error
	VerifySign(tx *types.Transaction, outpoint *types.OutPoint, amount int64, txinUtxoList []*types.UtxoData) (isVerify bool, reason string, err error)
	GetTxid(tx *types.Transaction) string
	GetTxOut(tx *types.Transaction, vout uint32) (txout *types.TxOut, err error)
}

type TransactionApiImpl

type TransactionApiImpl struct {
	cfdErrors.HasInitializeError
	// contains filtered or unexported fields
}

func NewTransactionApi

func NewTransactionApi(options ...config.CfdConfigOption) *TransactionApiImpl

NewTransactionApi This function returns a struct that implements TransactionApi.

func (*TransactionApiImpl) Add

func (t *TransactionApiImpl) Add(tx *types.Transaction, txinList []*types.InputTxIn, txoutList []*types.InputTxOut) error

func (*TransactionApiImpl) AddPubkeySign

func (t *TransactionApiImpl) AddPubkeySign(tx *types.Transaction, outpoint *types.OutPoint, hashType types.HashType, pubkey *types.Pubkey, signature string) error

AddPubkeySign ...

func (*TransactionApiImpl) AddPubkeySignByDescriptor

func (t *TransactionApiImpl) AddPubkeySignByDescriptor(tx *types.Transaction, outpoint *types.OutPoint, outputDescriptor *types.Descriptor, signature string) error

AddPubkeySignByDescriptor ...

func (*TransactionApiImpl) Create

func (t *TransactionApiImpl) Create(version uint32, locktime uint32, txinList []*types.InputTxIn, txoutList []*types.InputTxOut) (tx *types.Transaction, err error)

func (*TransactionApiImpl) GetTxOut

func (t *TransactionApiImpl) GetTxOut(tx *types.Transaction, vout uint32) (txout *types.TxOut, err error)

func (*TransactionApiImpl) GetTxid

func (t *TransactionApiImpl) GetTxid(tx *types.Transaction) string

func (*TransactionApiImpl) SignWithPrivkey

func (t *TransactionApiImpl) SignWithPrivkey(tx *types.Transaction, outpoint *types.OutPoint, privkey *types.Privkey, sighashType types.SigHashType, utxoList []*types.UtxoData) error

SignWithPrivkey ...

func (*TransactionApiImpl) VerifySign

func (t *TransactionApiImpl) VerifySign(tx *types.Transaction, outpoint *types.OutPoint, amount int64, txinUtxoList []*types.UtxoData) (isVerify bool, reason string, err error)

VerifySign ...

func (*TransactionApiImpl) WithBitcoinDescriptorApi added in v0.3.10

func (p *TransactionApiImpl) WithBitcoinDescriptorApi(descriptorApi descriptor.DescriptorApi) *TransactionApiImpl

WithBitcoinDescriptorApi This function set a bitcoin descriptor api.

Directories

Path Synopsis
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.

Jump to

Keyboard shortcuts

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