MCPcopy Index your code
hub / github.com/petertodd/python-bitcoinlib / from_scriptPubKey

Method from_scriptPubKey

bitcoin/wallet.py:43–55  ·  view source on GitHub ↗

Convert a scriptPubKey to a subclass of CBitcoinAddress

(cls, scriptPubKey)

Source from the content-addressed store, hash-verified

41
42 @classmethod
43 def from_scriptPubKey(cls, scriptPubKey):
44 """Convert a scriptPubKey to a subclass of CBitcoinAddress"""
45 try:
46 return CBech32BitcoinAddress.from_scriptPubKey(scriptPubKey)
47 except CBitcoinAddressError:
48 pass
49
50 try:
51 return CBase58BitcoinAddress.from_scriptPubKey(scriptPubKey)
52 except CBitcoinAddressError:
53 pass
54
55 raise CBitcoinAddressError('scriptPubKey is not in a recognized address format')
56
57
58class CBitcoinAddressError(Exception):

Callers 15

from_scriptPubKeyMethod · 0.45
from_scriptPubKeyMethod · 0.45
from_redeemScriptMethod · 0.45
TMethod · 0.45
TMethod · 0.45
spend-p2wpkh.pyFile · 0.45

Calls 1