Psbt

case class Psbt(global: Global, inputs: Seq[Input], outputs: Seq[Output])

A partially signed bitcoin transaction: see https://github.com/bitcoin/bips/blob/master/bip-0174.mediawiki.

Value parameters:
global

global psbt data containing the transaction to be signed.

inputs

signing data for each input of the transaction to be signed (order matches the unsigned tx).

outputs

signing data for each output of the transaction to be signed (order matches the unsigned tx).

Companion:
object
Source:
Psbt.scala
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any

Value members

Concrete methods

def computeFees(): Try[Satoshi]

Compute the fees paid by the PSBT. Note that if some inputs have not been updated yet, the fee cannot be computed.

Compute the fees paid by the PSBT. Note that if some inputs have not been updated yet, the fee cannot be computed.

Source:
Psbt.scala
def extract(): Try[Transaction]

Implements the PSBT extractor role: extracts a valid transaction from the psbt data.

Implements the PSBT extractor role: extracts a valid transaction from the psbt data.

Returns:

a fully signed, ready-to-broadcast transaction.

Source:
Psbt.scala
def finalizeNonWitnessInput(outPoint: OutPoint, scriptSig: Seq[ScriptElt]): Try[Psbt]

Implements the PSBT finalizer role: finalizes a given non-segwit input. This will clear all fields from the input except the utxo, scriptSig and unknown entries.

Implements the PSBT finalizer role: finalizes a given non-segwit input. This will clear all fields from the input except the utxo, scriptSig and unknown entries.

Value parameters:
outPoint

input that should be finalized.

scriptSig

signature script.

Returns:

a psbt with the given input finalized.

Source:
Psbt.scala
def finalizeNonWitnessInput(inputIndex: Int, scriptSig: Seq[ScriptElt]): Try[Psbt]

Implements the PSBT finalizer role: finalizes a given non-segwit input. This will clear all fields from the input except the utxo, scriptSig and unknown entries.

Implements the PSBT finalizer role: finalizes a given non-segwit input. This will clear all fields from the input except the utxo, scriptSig and unknown entries.

Value parameters:
inputIndex

index of the input that should be finalized.

scriptSig

signature script.

Returns:

a psbt with the given input finalized.

Source:
Psbt.scala
def finalizeWitnessInput(outPoint: OutPoint, scriptWitness: ScriptWitness): Try[Psbt]

Implements the PSBT finalizer role: finalizes a given segwit input. This will clear all fields from the input except the utxo, scriptSig, scriptWitness and unknown entries.

Implements the PSBT finalizer role: finalizes a given segwit input. This will clear all fields from the input except the utxo, scriptSig, scriptWitness and unknown entries.

Value parameters:
outPoint

input that should be finalized.

scriptWitness

witness script.

Returns:

a psbt with the given input finalized.

Source:
Psbt.scala
def finalizeWitnessInput(inputIndex: Int, scriptWitness: ScriptWitness): Try[Psbt]

Implements the PSBT finalizer role: finalizes a given segwit input. This will clear all fields from the input except the utxo, scriptSig, scriptWitness and unknown entries.

Implements the PSBT finalizer role: finalizes a given segwit input. This will clear all fields from the input except the utxo, scriptSig, scriptWitness and unknown entries.

Value parameters:
inputIndex

index of the input that should be finalized.

scriptWitness

witness script.

Returns:

a psbt with the given input finalized.

Source:
Psbt.scala
def getInput(outPoint: OutPoint): Option[Input]
Source:
Psbt.scala
def getInput(inputIndex: Int): Option[Input]
Source:
Psbt.scala
def sign(priv: PrivateKey, outPoint: OutPoint): Try[SignPsbtResult]

Implements the PSBT signer role: sign a given input. The caller needs to carefully verify that it wants to spend that input, and that the unsigned transaction matches what it expects.

Implements the PSBT signer role: sign a given input. The caller needs to carefully verify that it wants to spend that input, and that the unsigned transaction matches what it expects.

Value parameters:
outPoint

input that should be signed.

priv

private key used to sign the input.

Returns:

the psbt with a partial signature added (other inputs will not be modified).

Source:
Psbt.scala
def sign(priv: PrivateKey, inputIndex: Int): Try[SignPsbtResult]

Implements the PSBT signer role: sign a given input. The caller needs to carefully verify that it wants to spend that input, and that the unsigned transaction matches what it expects.

Implements the PSBT signer role: sign a given input. The caller needs to carefully verify that it wants to spend that input, and that the unsigned transaction matches what it expects.

Value parameters:
inputIndex

index of the input that should be signed.

priv

private key used to sign the input.

Returns:

the psbt with a partial signature added (other inputs will not be modified).

Source:
Psbt.scala
def updateNonWitnessInput(inputTx: Transaction, outputIndex: Int, redeemScript: Option[Seq[ScriptElt]], sighashType: Option[Int], derivationPaths: Map[PublicKey, KeyPathWithMaster]): Try[Psbt]

Implements the PSBT updater role; adds information about a given non-segwit utxo.

Implements the PSBT updater role; adds information about a given non-segwit utxo.

Value parameters:
derivationPaths

derivation paths for keys used by this utxo.

inputTx

transaction containing the utxo.

outputIndex

index of the utxo in the inputTx.

redeemScript

redeem script if known and applicable (when using p2sh).

sighashType

sighash type if one should be specified.

Returns:

psbt with the matching input updated.

Source:
Psbt.scala
def updateNonWitnessOutput(outputIndex: Int, redeemScript: Option[Seq[ScriptElt]], derivationPaths: Map[PublicKey, KeyPathWithMaster]): Try[Psbt]

Add details for a non-segwit output.

Add details for a non-segwit output.

Value parameters:
derivationPaths

derivation paths for keys used by this output.

outputIndex

index of the output in the psbt.

redeemScript

redeem script if known and applicable (when using p2sh).

Returns:

psbt with the matching output updated.

Source:
Psbt.scala
def updatePreimageChallenges(outPoint: OutPoint, ripemd160: Set[ByteVector], sha256: Set[ByteVector], hash160: Set[ByteVector], hash256: Set[ByteVector]): Try[Psbt]
Source:
Psbt.scala
def updatePreimageChallenges(inputIndex: Int, ripemd160: Set[ByteVector], sha256: Set[ByteVector], hash160: Set[ByteVector], hash256: Set[ByteVector]): Try[Psbt]
Source:
Psbt.scala
def updateWitnessInput(outPoint: OutPoint, txOut: TxOut, redeemScript: Option[Seq[ScriptElt]], witnessScript: Option[Seq[ScriptElt]], sighashType: Option[Int], derivationPaths: Map[PublicKey, KeyPathWithMaster]): Try[Psbt]

Implements the PSBT updater role; adds information about a given segwit utxo. When you have access to the complete input transaction, you should prefer updateWitnessInputTx.

Implements the PSBT updater role; adds information about a given segwit utxo. When you have access to the complete input transaction, you should prefer updateWitnessInputTx.

Value parameters:
derivationPaths

derivation paths for keys used by this utxo.

outPoint

utxo being spent.

redeemScript

redeem script if known and applicable (when using p2sh-embedded segwit).

sighashType

sighash type if one should be specified.

txOut

transaction output for the provided outPoint.

witnessScript

witness script if known and applicable (when using p2wsh).

Returns:

psbt with the matching input updated.

Source:
Psbt.scala
def updateWitnessInputTx(inputTx: Transaction, outputIndex: Int, redeemScript: Option[Seq[ScriptElt]], witnessScript: Option[Seq[ScriptElt]], sighashType: Option[Int], derivationPaths: Map[PublicKey, KeyPathWithMaster]): Try[Psbt]

Implements the PSBT updater role; adds information about a given segwit utxo. Note that we always fill the nonWitnessUtxo (see https://github.com/bitcoin/bips/blob/master/bip-0174.mediawiki#cite_note-7).

Implements the PSBT updater role; adds information about a given segwit utxo. Note that we always fill the nonWitnessUtxo (see https://github.com/bitcoin/bips/blob/master/bip-0174.mediawiki#cite_note-7).

Value parameters:
derivationPaths

derivation paths for keys used by this utxo.

inputTx

transaction containing the utxo.

outputIndex

index of the utxo in the inputTx.

redeemScript

redeem script if known and applicable (when using p2sh-embedded segwit).

sighashType

sighash type if one should be specified.

witnessScript

witness script if known and applicable (when using p2wsh).

Returns:

psbt with the matching input updated.

Source:
Psbt.scala
def updateWitnessOutput(outputIndex: Int, witnessScript: Option[Seq[ScriptElt]], redeemScript: Option[Seq[ScriptElt]], derivationPaths: Map[PublicKey, KeyPathWithMaster]): Try[Psbt]

Add details for a segwit output.

Add details for a segwit output.

Value parameters:
derivationPaths

derivation paths for keys used by this output.

outputIndex

index of the output in the psbt.

redeemScript

redeem script if known and applicable (when using p2sh-embedded segwit).

witnessScript

witness script if known and applicable (when using p2wsh).

Returns:

psbt with the matching output updated.

Source:
Psbt.scala

Inherited methods

def productElementNames: Iterator[String]
Inherited from:
Product
def productIterator: Iterator[Any]
Inherited from:
Product