Transactions Inputs#

TxInput#

class defichain.transactions.rawtransactions.TxInput(txid: str, vout: int, scriptSig: str = '', sequence: str = 'ffffffff')#

Input to spend from given txid

Parameters:
  • txid (str) – (required) previous transaction id

  • vout (int) – (required) previous transaction output number

  • scriptSig (str) – (optional) signature of P2PKH input

  • sequence (str) – (optional) makes input replaceable when not “ffffffff”

static deserialize(network: Any, hex: str) TxInput#

Deserializes unsigned transaction input into input object: TxInput.

Deserializes signed transaction input in the corresponding input object. Only works for TxP2PKHInput | TxP2SHInput | TxCoinbaseInput

Parameters:
  • network (Network) – (required) the corresponding network from the raw transaction

  • hex (str) – (required) the raw transaction input as hexadecimal sting

Returns:

“TxInput”

to_json() {}#

Returns information about the transaction object in json format :return: “{}” - information about the object that was used to call this method

TxP2PKHInput#

class defichain.transactions.rawtransactions.TxP2PKHInput(txid: str, vout: int, address: str = '', value: int | None = None, sequence: str = 'ffffffff')#

Input to spend from P2PKH address

Parameters:
  • txid (str) – (required) previous transaction id

  • vout (int) – (required) previous transaction output number

  • address (str) – (optional) address from which the UTXO are spend - (required for signing of the input)

  • value (int) – (optional) previous transaction output value

  • sequence (str) – (optional) makes input replaceable when not “ffffffff”

static deserialize(network: Any, hex: str) TxP2PKHInput#

Deserializes unsigned transaction input into input object: TxInput.

Deserializes signed transaction input in the corresponding input object. Only works for TxP2PKHInput | TxP2SHInput | TxCoinbaseInput

Parameters:
  • network (Network) – (required) the corresponding network from the raw transaction

  • hex (str) – (required) the raw transaction input as hexadecimal sting

Returns:

“TxInput”

to_json() {}#

Returns information about the transaction object in json format :return: “{}” - information about the object that was used to call this method

TxP2SHInput#

class defichain.transactions.rawtransactions.TxP2SHInput(txid: str, vout: int, address: str = '', value: int | None = None, sequence: str = 'ffffffff')#

Input to spend from P2SH address

Parameters:
  • txid (str) – (required) previous transaction id

  • vout (int) – (required) previous transaction output number

  • address (str) – (optional) address from which the UTXO are spend - (required for signing of the input)

  • value (int) – (optional) previous transaction output value - (required for signing of the input)

  • sequence (str) – (optional) makes input replaceable when not “ffffffff”

static deserialize(network: Any, hex: str) TxP2SHInput#

Deserializes unsigned transaction input into input object: TxInput.

Deserializes signed transaction input in the corresponding input object. Only works for TxP2PKHInput | TxP2SHInput | TxCoinbaseInput

Parameters:
  • network (Network) – (required) the corresponding network from the raw transaction

  • hex (str) – (required) the raw transaction input as hexadecimal sting

Returns:

“TxInput”

to_json() {}#

Returns information about the transaction object in json format :return: “{}” - information about the object that was used to call this method

TxP2WPKHInput#

class defichain.transactions.rawtransactions.TxP2WPKHInput(txid: str, vout: int, address: str = '', value: int | None = None, sequence: str = 'ffffffff')#

Input to spend from P2WPKH address

Parameters:
  • txid (str) – (required) previous transaction id

  • vout (int) – (required) previous transaction output number

  • address (str) – (optional) address from which the UTXO are spend - (required for signing of the input)

  • value (int) – (optional) previous transaction output value - (required for signing of the input)

  • sequence (str) – (optional) makes input replaceable when not “ffffffff”

static deserialize(network: Any, hex: str) TxP2WPKHInput#

Deserializes unsigned transaction input into input object: TxInput.

Deserializes signed transaction input in the corresponding input object. Only works for TxP2PKHInput | TxP2SHInput | TxCoinbaseInput

Parameters:
  • network (Network) – (required) the corresponding network from the raw transaction

  • hex (str) – (required) the raw transaction input as hexadecimal sting

Returns:

“TxInput”

to_json() {}#

Returns information about the transaction object in json format :return: “{}” - information about the object that was used to call this method

TxCoinbaseInput#

class defichain.transactions.rawtransactions.TxCoinbaseInput(scriptSig: str = '')#

Input that generates UTXO from minting a block (Coinbase input)

Parameters:

scriptSig (str) – (optional) number of the minded block

static deserialize(network: Any, hex: str) TxCoinbaseInput#

Deserializes unsigned transaction input into input object: TxInput.

Deserializes signed transaction input in the corresponding input object. Only works for TxP2PKHInput | TxP2SHInput | TxCoinbaseInput

Parameters:
  • network (Network) – (required) the corresponding network from the raw transaction

  • hex (str) – (required) the raw transaction input as hexadecimal sting

Returns:

“TxInput”

to_json() {}#

Returns information about the transaction object in json format :return: “{}” - information about the object that was used to call this method