bitcoinlib.main module


This is a decorator which can be used to mark functions as deprecated. It will result in a warning being emitted when the function is used.


Derive address encoding (base58 or bech32) from transaction witness type.

Returns ‘base58’ for legacy and p2sh-segwit witness type and ‘bech32’ for segwit


witness_type (str) – Witness type: legacy, p2sh-segwit or segwit

Return str:

bitcoinlib.main.script_type_default(witness_type=None, multisig=False, locking_script=False)[source]

Determine default script type for provided witness type and key type combination used in this library.

>>> script_type_default('segwit', locking_script=True)
  • witness_type (str) – Witness type used: standard, p2sh-segwit or segwit

  • multisig (bool) – Multi-signature key or not, default is False

  • locking_script (bool) – Limit search to locking_script. Specify False for locking scripts and True for unlocking scripts

Return str:

Default script type