Documentation ¶
Index ¶
- Constants
- Variables
- func BlindPsetWithMasterKey(args BlindPsetWithMasterKeyArgs) (string, error)
- func BlindPsetWithOwnedInputs(args BlindPsetWithOwnedInputsArgs) (string, error)
- func CreatePset(args CreatePsetArgs) (string, error)
- func EstimateFees(inputs []Input, outputs []Output, millisatsPerByte uint64) uint64
- func EstimateTxSize(inputs []Input, outputs []Output) uint64
- func FinalizeAndExtractTransaction(args FinalizeAndExtractTransactionArgs) (string, string, error)
- func UpdatePset(args UpdatePsetArgs) (string, error)
- type BlindPsetWithMasterKeyArgs
- type BlindPsetWithOwnedInputsArgs
- type CreatePsetArgs
- type FinalizeAndExtractTransactionArgs
- type Input
- type Output
- type UpdatePsetArgs
Constants ¶
const ( P2PK = iota P2PKH P2MS P2SH_P2WPKH P2SH_P2WSH P2WPKH P2WSH )
Variables ¶
var ( ErrMissingOwnedInputs = fmt.Errorf("missing list of owned inputs") ErrMissingBlindingMasterKey = fmt.Errorf("missing blinding master key") ErrBlindInvalidInputIndex = fmt.Errorf("input index to blind is out of range") )
var ( ErrInputMissingTxid = fmt.Errorf("input is missing txid") ErrInputInvalidTxid = fmt.Errorf("invalid input txid length: must be exactly 32 bytes") )
var ( ErrOutputMissingAsset = fmt.Errorf("output is missing asset") ErrOutputInvalidAsset = fmt.Errorf("invalid output asset length: must be exactly 32 bytes") ErrOutputInvalidScript = fmt.Errorf("invalid output script") ErrOutputInvalidBlindingKey = fmt.Errorf("invalid output blinding key") )
var ( ErrMissingPset = fmt.Errorf("missing pset base64") ErrMissingInputs = fmt.Errorf("at least one input is mandatory to create a partial transaction with one or more confidential outputs") ErrInvalidSignatures = fmt.Errorf("transaction contains invalid signature(s)") DummyFeeAmount = uint64(700) )
Functions ¶
func BlindPsetWithMasterKey ¶
func BlindPsetWithMasterKey( args BlindPsetWithMasterKeyArgs, ) (string, error)
func BlindPsetWithOwnedInputs ¶
func BlindPsetWithOwnedInputs( args BlindPsetWithOwnedInputsArgs, ) (string, error)
func CreatePset ¶
func CreatePset(args CreatePsetArgs) (string, error)
CreatePset creates a new partial transaction with given inputs and outputs.
func EstimateFees ¶
EstimateFees estimates the virtual size of the transaciton composed of the given Inputs and Outputs and then returns the corresponding fee amount based on the given mSats/Byte ratio.
func EstimateTxSize ¶
EstimateTxSize makes an estimation of the virtual size of a transaction for which is required to specify the type of the inputs and outputs according to those of the Bitcoin standard (P2PK, P2PKH, P2MS, P2SH(P2WPKH), P2SH(P2WSH), P2WPKH, P2WSH). The estimation might not be accurate in case of one or more P2MS inputs since the method is not able to retrieve the size of redeem script containg all pubkeys, nor it expects anyone as arg.
func FinalizeAndExtractTransaction ¶
func FinalizeAndExtractTransaction(args FinalizeAndExtractTransactionArgs) (string, string, error)
FinalizeAndExtractTransaction attempts to finalize the provided partial transaction and eventually extracts the final raw transaction, returning it in hex string format, along with its transaction id.
func UpdatePset ¶
func UpdatePset(args UpdatePsetArgs) (string, error)
UpdatesPset adds inputs and outputs to the given partial transaction.
Types ¶
type CreatePsetArgs ¶
type FinalizeAndExtractTransactionArgs ¶
type FinalizeAndExtractTransactionArgs struct {
PsetBase64 string
}
type Input ¶
type Input struct { TxID string TxIndex uint32 Value uint64 Asset string Script []byte ValueBlinder []byte AssetBlinder []byte ValueCommitment []byte AssetCommitment []byte Nonce []byte RangeProof []byte SurjectionProof []byte DerivationPath string RedeemScript []byte ScriptSigSize int WitnessSize int }
Input is the data structure representing an input to be added to a partial transaction, therefore including the previous outpoint as long as all the info about the prevout itself (and the derivation path generating its script as extra info).
func (Input) Prevout ¶
func (i Input) Prevout() *transaction.TxOutput
func (Input) ScriptType ¶
type Output ¶
type Output psetv2.OutputArgs
Output is the data structure representing an output to be added to a partial transaction, therefore inclusing asset, amount and address.