Python bitcoin.core.x() Examples
The following are 30
code examples of bitcoin.core.x().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
bitcoin.core
, or try the search function
.
Example #1
Source File: test_connectors.py From cert-issuer with MIT License | 7 votes |
def mock_listunspent(self, addrs): output1 = {'outpoint': COutPoint(lx('34eb81bc0d1a822369f75174fd4916b1ec490d8fbcba33168e820cc78a52f608'), 0), 'confirmations': 62952, 'address': P2PKHBitcoinAddress('mz7poFND7hVGRtPWjiZizcCnjf6wEDWjjT'), 'spendable': False, 'amount': 49000000, 'solvable': False, 'scriptPubKey': CScript( [OP_DUP, OP_HASH160, x('cc0a909c4c83068be8b45d69b60a6f09c2be0fda'), OP_EQUALVERIFY, OP_CHECKSIG]), 'account': ''} output2 = {'address': P2PKHBitcoinAddress('mz7poFND7hVGRtPWjiZizcCnjf6wEDWjjT'), 'amount': 2750, 'account': '', 'spendable': False, 'solvable': False, 'confirmations': 62932, 'outpoint': COutPoint(lx('6773785b4dc5d2cced67d26fc0820329307a8e10dfaef50d506924984387bf0b'), 1), 'scriptPubKey': CScript( [OP_DUP, OP_HASH160, x('cc0a909c4c83068be8b45d69b60a6f09c2be0fda'), OP_EQUALVERIFY, OP_CHECKSIG])} output3 = {'address': P2PKHBitcoinAddress('mz7poFND7hVGRtPWjiZizcCnjf6wEDWjjT'), 'amount': 2750, 'account': '', 'spendable': False, 'solvable': False, 'confirmations': 62932, 'outpoint': COutPoint(lx('6773785b4dc5d2cced67d26fc0820329307a8e10dfaef50d506924984387bf0b'), 5), 'scriptPubKey': CScript( [OP_DUP, OP_HASH160, x('cc0a909c4c83068be8b45d69b60a6f09c2be0fda'), OP_EQUALVERIFY, OP_CHECKSIG])} unspent_outputs = [output1, output2, output3] return unspent_outputs
Example #2
Source File: test_script.py From checklocktimeverify-demos with GNU General Public License v3.0 | 6 votes |
def test_has_canonical_pushes_with_invalid_truncated_script(self): def T(hex_script): script = CScript(x(hex_script)) self.assertEqual(script.has_canonical_pushes(), False) T('01') T('02ff') T('4b') T('4c01') T('4c02ff') T('4d') T('4d0100') T('4d0200ff') T('4e') T('4e01000000') T('4e02000000ff')
Example #3
Source File: test_script.py From checklocktimeverify-demos with GNU General Public License v3.0 | 6 votes |
def test_equality(self): # Equality is on the serialized script, not the logical meaning. # This is important for P2SH. def T(serialized1, serialized2, are_equal): script1 = CScript(x(serialized1)) script2 = CScript(x(serialized2)) if are_equal: self.assertEqual(script1, script2) else: self.assertNotEqual(script1, script2) T('', '', True) T('', '00', False) T('00', '00', True) T('00', '01', False) T('01ff', '01ff', True) T('fc01ff', '01ff', False) # testing equality on an invalid script is legal, and evaluates based # on the serialization T('4e', '4e', True) T('4e', '4e00', False)
Example #4
Source File: test_script.py From checklocktimeverify-demos with GNU General Public License v3.0 | 6 votes |
def test_invalid_scripts(self): def T(serialized): with self.assertRaises(CScriptInvalidError): list(CScript(x(serialized))) T('01') T('02') T('0201') T('4b') T('4b' + 'ff'*0x4a) T('4c') T('4cff' + 'ff'*0xfe) T('4d') T('4dff') T('4dffff' + 'ff'*0xfffe) T('4e') T('4effffff') T('4effffffff' + 'ff'*0xfffe) # not going to test with 4GiB-1...
Example #5
Source File: test_script.py From replace-by-fee-tools with GNU General Public License v3.0 | 6 votes |
def test_to_p2sh_scriptPubKey(self): def T(redeemScript, expected_hex_bytes): redeemScript = CScript(redeemScript) actual_script = redeemScript.to_p2sh_scriptPubKey() self.assertEqual(b2x(actual_script), expected_hex_bytes) T([], 'a914b472a266d0bd89c13706a4132ccfb16f7c3b9fcb87') T([1,x('029b6d2c97b8b7c718c325d7be3ac30f7c9d67651bce0c929f55ee77ce58efcf84'),1,OP_CHECKMULTISIG], 'a91419a7d869032368fd1f1e26e5e73a4ad0e474960e87') T([b'\xff'*517], 'a9140da7fa40ebf248dfbca363c79921bdd665fed5ba87') with self.assertRaises(ValueError): CScript([b'a' * 518]).to_p2sh_scriptPubKey()
Example #6
Source File: test_script.py From checklocktimeverify-demos with GNU General Public License v3.0 | 6 votes |
def test_has_canonical_pushes_with_invalid_truncated_script(self): def T(hex_script): script = CScript(x(hex_script)) self.assertEqual(script.has_canonical_pushes(), False) T('01') T('02ff') T('4b') T('4c01') T('4c02ff') T('4d') T('4d0100') T('4d0200ff') T('4e') T('4e01000000') T('4e02000000ff')
Example #7
Source File: test_script.py From replace-by-fee-tools with GNU General Public License v3.0 | 6 votes |
def test_is_push_only_on_invalid_pushdata(self): def T(hex_script): invalid_script = CScript(x(hex_script)) self.assertFalse(invalid_script.is_push_only()) T('01') T('02ff') T('4b') T('4c01') T('4c02ff') T('4d') T('4d0100') T('4d0200ff') T('4e') T('4e01000000') T('4e02000000ff')
Example #8
Source File: test_script.py From checklocktimeverify-demos with GNU General Public License v3.0 | 6 votes |
def test_to_p2sh_scriptPubKey(self): def T(redeemScript, expected_hex_bytes): redeemScript = CScript(redeemScript) actual_script = redeemScript.to_p2sh_scriptPubKey() self.assertEqual(b2x(actual_script), expected_hex_bytes) T([], 'a914b472a266d0bd89c13706a4132ccfb16f7c3b9fcb87') T([1,x('029b6d2c97b8b7c718c325d7be3ac30f7c9d67651bce0c929f55ee77ce58efcf84'),1,OP_CHECKMULTISIG], 'a91419a7d869032368fd1f1e26e5e73a4ad0e474960e87') T([b'\xff'*517], 'a9140da7fa40ebf248dfbca363c79921bdd665fed5ba87') with self.assertRaises(ValueError): CScript([b'a' * 518]).to_p2sh_scriptPubKey()
Example #9
Source File: test_bloom.py From checklocktimeverify-demos with GNU General Public License v3.0 | 6 votes |
def test(self): def T(expected, seed, data): self.assertEqual(MurmurHash3(seed, x(data)), expected) T(0x00000000, 0x00000000, "") T(0x6a396f08, 0xFBA4C795, "") T(0x81f16f39, 0xffffffff, "") T(0x514e28b7, 0x00000000, "00") T(0xea3f0b17, 0xFBA4C795, "00") T(0xfd6cf10d, 0x00000000, "ff") T(0x16c6b7ab, 0x00000000, "0011") T(0x8eb51c3d, 0x00000000, "001122") T(0xb4471bf8, 0x00000000, "00112233") T(0xe2301fa8, 0x00000000, "0011223344") T(0xfc2e4a15, 0x00000000, "001122334455") T(0xb074502c, 0x00000000, "00112233445566") T(0x8034d2a0, 0x00000000, "0011223344556677") T(0xb4698def, 0x00000000, "001122334455667788")
Example #10
Source File: test_script.py From replace-by-fee-tools with GNU General Public License v3.0 | 6 votes |
def test_has_canonical_pushes_with_invalid_truncated_script(self): def T(hex_script): script = CScript(x(hex_script)) self.assertEqual(script.has_canonical_pushes(), False) T('01') T('02ff') T('4b') T('4c01') T('4c02ff') T('4d') T('4d0100') T('4d0200ff') T('4e') T('4e01000000') T('4e02000000ff')
Example #11
Source File: test_wallet.py From checklocktimeverify-demos with GNU General Public License v3.0 | 6 votes |
def test_from_valid_pubkey(self): """Create P2PKHBitcoinAddress's from valid pubkeys""" def T(pubkey, expected_str_addr): addr = P2PKHBitcoinAddress.from_pubkey(pubkey) self.assertEqual(str(addr), expected_str_addr) T(x('0378d430274f8c5ec1321338151e9f27f4c676a008bdf8638d07c0b6be9ab35c71'), '1C7zdTfnkzmr13HfA2vNm5SJYRK6nEKyq8') T(x('0478d430274f8c5ec1321338151e9f27f4c676a008bdf8638d07c0b6be9ab35c71a1518063243acd4dfe96b66e3f2ec8013c8e072cd09b3834a19f81f659cc3455'), '1JwSSubhmg6iPtRjtyqhUYYH7bZg3Lfy1T') T(CPubKey(x('0378d430274f8c5ec1321338151e9f27f4c676a008bdf8638d07c0b6be9ab35c71')), '1C7zdTfnkzmr13HfA2vNm5SJYRK6nEKyq8') T(CPubKey(x('0478d430274f8c5ec1321338151e9f27f4c676a008bdf8638d07c0b6be9ab35c71a1518063243acd4dfe96b66e3f2ec8013c8e072cd09b3834a19f81f659cc3455')), '1JwSSubhmg6iPtRjtyqhUYYH7bZg3Lfy1T')
Example #12
Source File: test_wallet.py From checklocktimeverify-demos with GNU General Public License v3.0 | 6 votes |
def test_from_invalid_pubkeys(self): """Create P2PKHBitcoinAddress's from invalid pubkeys""" # first test with accept_invalid=True def T(invalid_pubkey, expected_str_addr): addr = P2PKHBitcoinAddress.from_pubkey(invalid_pubkey, accept_invalid=True) self.assertEqual(str(addr), expected_str_addr) T(x(''), '1HT7xU2Ngenf7D4yocz2SAcnNLW7rK8d4E') T(x('0378d430274f8c5ec1321338151e9f27f4c676a008bdf8638d07c0b6be9ab35c72'), '1L9V4NXbNtZsLjrD3nkU7gtEYLWRBWXLiZ') # With accept_invalid=False we should get CBitcoinAddressError's with self.assertRaises(CBitcoinAddressError): P2PKHBitcoinAddress.from_pubkey(x('')) with self.assertRaises(CBitcoinAddressError): P2PKHBitcoinAddress.from_pubkey(x('0378d430274f8c5ec1321338151e9f27f4c676a008bdf8638d07c0b6be9ab35c72')) with self.assertRaises(CBitcoinAddressError): P2PKHBitcoinAddress.from_pubkey(CPubKey(x('0378d430274f8c5ec1321338151e9f27f4c676a008bdf8638d07c0b6be9ab35c72')))
Example #13
Source File: test_script.py From checklocktimeverify-demos with GNU General Public License v3.0 | 6 votes |
def test_pushdata(self): def T(data, expected): data = x(data) expected = x(expected) serialized_data = CScriptOp.encode_op_pushdata(data) self.assertEqual(serialized_data, expected) T('', '00') T('00', '0100') T('0011223344556677', '080011223344556677') T('ff'*0x4b, '4b' + 'ff'*0x4b) T('ff'*0x4c, '4c4c' + 'ff'*0x4c) T('ff'*0x4c, '4c4c' + 'ff'*0x4c) T('ff'*0xff, '4cff' + 'ff'*0xff) T('ff'*0x100, '4d0001' + 'ff'*0x100) T('ff'*0xffff, '4dffff' + 'ff'*0xffff) T('ff'*0x10000, '4e00000100' + 'ff'*0x10000)
Example #14
Source File: test_script.py From checklocktimeverify-demos with GNU General Public License v3.0 | 6 votes |
def test_invalid_scripts(self): def T(serialized): with self.assertRaises(CScriptInvalidError): list(CScript(x(serialized))) T('01') T('02') T('0201') T('4b') T('4b' + 'ff'*0x4a) T('4c') T('4cff' + 'ff'*0xfe) T('4d') T('4dff') T('4dffff' + 'ff'*0xfffe) T('4e') T('4effffff') T('4effffffff' + 'ff'*0xfffe) # not going to test with 4GiB-1...
Example #15
Source File: test_script.py From checklocktimeverify-demos with GNU General Public License v3.0 | 6 votes |
def test_equality(self): # Equality is on the serialized script, not the logical meaning. # This is important for P2SH. def T(serialized1, serialized2, are_equal): script1 = CScript(x(serialized1)) script2 = CScript(x(serialized2)) if are_equal: self.assertEqual(script1, script2) else: self.assertNotEqual(script1, script2) T('', '', True) T('', '00', False) T('00', '00', True) T('00', '01', False) T('01ff', '01ff', True) T('fc01ff', '01ff', False) # testing equality on an invalid script is legal, and evaluates based # on the serialization T('4e', '4e', True) T('4e', '4e00', False)
Example #16
Source File: block_analyzer.py From hashmal with GNU General Public License v3.0 | 6 votes |
def deserialize_block_or_header(raw): """Deserialize hex-encoded block/block header. Returns: Two-tuple of (block, block_header) """ try: raw = x(raw) if len(raw) == BlockHeader.header_length(): block_header = BlockHeader.deserialize(raw) return (None, block_header) else: # We don't use block.get_header() in case the header is # correct but the rest of the block isn't. block_header = BlockHeader.deserialize(raw[0:BlockHeader.header_length()]) block = Block.deserialize(raw) return (block, block_header) except Exception as e: return (None, None)
Example #17
Source File: test_script.py From checklocktimeverify-demos with GNU General Public License v3.0 | 6 votes |
def test_pushdata(self): def T(data, expected): data = x(data) expected = x(expected) serialized_data = CScriptOp.encode_op_pushdata(data) self.assertEqual(serialized_data, expected) T('', '00') T('00', '0100') T('0011223344556677', '080011223344556677') T('ff'*0x4b, '4b' + 'ff'*0x4b) T('ff'*0x4c, '4c4c' + 'ff'*0x4c) T('ff'*0x4c, '4c4c' + 'ff'*0x4c) T('ff'*0xff, '4cff' + 'ff'*0xff) T('ff'*0x100, '4d0001' + 'ff'*0x100) T('ff'*0xffff, '4dffff' + 'ff'*0xffff) T('ff'*0x10000, '4e00000100' + 'ff'*0x10000)
Example #18
Source File: tx_builder.py From hashmal with GNU General Public License v3.0 | 6 votes |
def deserialize_raw(self, rawtx): """Update editor widgets with rawtx's data.""" self.needsFocus.emit() try: tx = Transaction.deserialize(x(rawtx)) except Exception: return else: self.version_edit.set_amount(tx.nVersion) self.inputs_tree.model.set_tx(tx) self.outputs_tree.model.set_tx(tx) self.locktime_edit.set_amount(tx.nLockTime) for name, w in self.tx_field_widgets: if name in ['nVersion', 'vin', 'vout', 'nLockTime']: continue try: value = getattr(tx, name) except AttributeError: continue if isinstance(w, AmountEdit): w.set_amount(value) else: w.setText(str(value)) self.build_transaction()
Example #19
Source File: addr_encoder.py From hashmal with GNU General Public License v3.0 | 6 votes |
def encode_address(self): hash160 = str(self.hash_line.text()) if len(hash160) != 40: self.address_line.setText('Hash160 must be 40 characters.') self.error('Hash160 must be 40 characters.') return try: i = int(hash160, 16) except ValueError: self.address_line.setText('Hash160 must contain only hex characters.') self.error('Hash160 must contain only hex characters.') return version = self.addr_version.value() hash160 = x(hash160) addr = encode_address(hash160, version) self.address_line.setText(str(addr)) self.info('Encoded address "%s".' % str(addr))
Example #20
Source File: test_script.py From checklocktimeverify-demos with GNU General Public License v3.0 | 6 votes |
def test_to_p2sh_scriptPubKey(self): def T(redeemScript, expected_hex_bytes): redeemScript = CScript(redeemScript) actual_script = redeemScript.to_p2sh_scriptPubKey() self.assertEqual(b2x(actual_script), expected_hex_bytes) T([], 'a914b472a266d0bd89c13706a4132ccfb16f7c3b9fcb87') T([1,x('029b6d2c97b8b7c718c325d7be3ac30f7c9d67651bce0c929f55ee77ce58efcf84'),1,OP_CHECKMULTISIG], 'a91419a7d869032368fd1f1e26e5e73a4ad0e474960e87') T([b'\xff'*517], 'a9140da7fa40ebf248dfbca363c79921bdd665fed5ba87') with self.assertRaises(ValueError): CScript([b'a' * 518]).to_p2sh_scriptPubKey()
Example #21
Source File: item_types.py From hashmal with GNU General Public License v3.0 | 6 votes |
def coerce_item(cls, data): # Coerce binary string. def coerce_string(v): return Block.deserialize(v) # Coerce hex string. def coerce_hex_string(v): return Block.deserialize(x(v)) # Coerce block instance. def coerce_block(v): return Block.from_block(v) for i in [coerce_string, coerce_hex_string, coerce_block]: try: value = i(data) except Exception: continue else: if value: return cls(value)
Example #22
Source File: test_bloom.py From checklocktimeverify-demos with GNU General Public License v3.0 | 6 votes |
def test(self): def T(expected, seed, data): self.assertEqual(MurmurHash3(seed, x(data)), expected) T(0x00000000, 0x00000000, "") T(0x6a396f08, 0xFBA4C795, "") T(0x81f16f39, 0xffffffff, "") T(0x514e28b7, 0x00000000, "00") T(0xea3f0b17, 0xFBA4C795, "00") T(0xfd6cf10d, 0x00000000, "ff") T(0x16c6b7ab, 0x00000000, "0011") T(0x8eb51c3d, 0x00000000, "001122") T(0xb4471bf8, 0x00000000, "00112233") T(0xe2301fa8, 0x00000000, "0011223344") T(0xfc2e4a15, 0x00000000, "001122334455") T(0xb074502c, 0x00000000, "00112233445566") T(0x8034d2a0, 0x00000000, "0011223344556677") T(0xb4698def, 0x00000000, "001122334455667788")
Example #23
Source File: test_bloom.py From checklocktimeverify-demos with GNU General Public License v3.0 | 6 votes |
def test_create_insert_serialize(self): filter = CBloomFilter(3, 0.01, 0, CBloomFilter.UPDATE_ALL) def T(elem): """Filter contains elem""" elem = x(elem) filter.insert(elem) self.assertTrue(filter.contains(elem)) def F(elem): """Filter does not contain elem""" elem = x(elem) self.assertFalse(filter.contains(elem)) T('99108ad8ed9bb6274d3980bab5a85c048f0950c8') F('19108ad8ed9bb6274d3980bab5a85c048f0950c8') T('b5a2c786d9ef4658287ced5914b37a1b4aa32eee') T('b9300670b4c5366e95b2699e8b18bc75e5f729c5') self.assertEqual(filter.serialize(), x('03614e9b050000000000000001'))
Example #24
Source File: test_bloom.py From checklocktimeverify-demos with GNU General Public License v3.0 | 6 votes |
def test_create_insert_serialize_with_tweak(self): # Same test as bloom_create_insert_serialize, but we add a nTweak of 100 filter = CBloomFilter(3, 0.01, 2147483649, CBloomFilter.UPDATE_ALL) def T(elem): """Filter contains elem""" elem = x(elem) filter.insert(elem) self.assertTrue(filter.contains(elem)) def F(elem): """Filter does not contain elem""" elem = x(elem) self.assertFalse(filter.contains(elem)) T('99108ad8ed9bb6274d3980bab5a85c048f0950c8') F('19108ad8ed9bb6274d3980bab5a85c048f0950c8') T('b5a2c786d9ef4658287ced5914b37a1b4aa32eee') T('b9300670b4c5366e95b2699e8b18bc75e5f729c5') self.assertEqual(filter.serialize(), x('03ce4299050000000100008001'))
Example #25
Source File: item_types.py From hashmal with GNU General Public License v3.0 | 6 votes |
def coerce_item(cls, data): # Coerce binary string. def coerce_string(v): return Transaction.deserialize(v) # Coerce hex string. def coerce_hex_string(v): return Transaction.deserialize(x(v)) # Coerce transaction instance. def coerce_tx(v): return Transaction.from_tx(v) for i in [coerce_string, coerce_hex_string, coerce_tx]: try: value = i(data) except Exception: continue else: if value: return cls(value)
Example #26
Source File: test_wallet.py From checklocktimeverify-demos with GNU General Public License v3.0 | 6 votes |
def test_create_from_string(self): """Create CBitcoinAddress's from strings""" def T(str_addr, expected_bytes, expected_nVersion, expected_class): addr = CBitcoinAddress(str_addr) self.assertEqual(addr.to_bytes(), expected_bytes) self.assertEqual(addr.nVersion, expected_nVersion) self.assertEqual(addr.__class__, expected_class) T('1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa', x('62e907b15cbf27d5425399ebf6f0fb50ebb88f18'), 0, P2PKHBitcoinAddress) T('37k7toV1Nv4DfmQbmZ8KuZDQCYK9x5KpzP', x('4266fc6f2c2861d7fe229b279a79803afca7ba34'), 5, P2SHBitcoinAddress)
Example #27
Source File: test_wallet.py From checklocktimeverify-demos with GNU General Public License v3.0 | 6 votes |
def test_from_non_canonical_scriptPubKey(self): def T(hex_scriptpubkey, expected_str_address): scriptPubKey = CScript(x(hex_scriptpubkey)) addr = P2PKHBitcoinAddress.from_scriptPubKey(scriptPubKey) self.assertEqual(str(addr), expected_str_address) # now test that CBitcoinAddressError is raised with accept_non_canonical_pushdata=False with self.assertRaises(CBitcoinAddressError): P2PKHBitcoinAddress.from_scriptPubKey(scriptPubKey, accept_non_canonical_pushdata=False) T('76a94c14000000000000000000000000000000000000000088ac', '1111111111111111111114oLvT2') T('76a94d1400000000000000000000000000000000000000000088ac', '1111111111111111111114oLvT2'), T('76a94e14000000000000000000000000000000000000000000000088ac', '1111111111111111111114oLvT2') # make sure invalid scripts raise CBitcoinAddressError with self.assertRaises(CBitcoinAddressError): P2PKHBitcoinAddress.from_scriptPubKey(x('76a94c14'))
Example #28
Source File: test_wallet.py From checklocktimeverify-demos with GNU General Public License v3.0 | 6 votes |
def test_from_invalid_pubkeys(self): """Create P2PKHBitcoinAddress's from invalid pubkeys""" # first test with accept_invalid=True def T(invalid_pubkey, expected_str_addr): addr = P2PKHBitcoinAddress.from_pubkey(invalid_pubkey, accept_invalid=True) self.assertEqual(str(addr), expected_str_addr) T(x(''), '1HT7xU2Ngenf7D4yocz2SAcnNLW7rK8d4E') T(x('0378d430274f8c5ec1321338151e9f27f4c676a008bdf8638d07c0b6be9ab35c72'), '1L9V4NXbNtZsLjrD3nkU7gtEYLWRBWXLiZ') # With accept_invalid=False we should get CBitcoinAddressError's with self.assertRaises(CBitcoinAddressError): P2PKHBitcoinAddress.from_pubkey(x('')) with self.assertRaises(CBitcoinAddressError): P2PKHBitcoinAddress.from_pubkey(x('0378d430274f8c5ec1321338151e9f27f4c676a008bdf8638d07c0b6be9ab35c72')) with self.assertRaises(CBitcoinAddressError): P2PKHBitcoinAddress.from_pubkey(CPubKey(x('0378d430274f8c5ec1321338151e9f27f4c676a008bdf8638d07c0b6be9ab35c72')))
Example #29
Source File: transaction.py From clove with GNU General Public License v3.0 | 6 votes |
def __init__( self, network, sender_address: str, recipient_address: str, value: float, solvable_utxo: list, secret_hash: str=None, tx_locktime: int=0 ): self.sender_address = sender_address super().__init__(network, recipient_address, value, solvable_utxo, tx_locktime) self.secret = None self.secret_hash = x(secret_hash) if secret_hash else None self.locktime = None self.contract = None
Example #30
Source File: base.py From clove with GNU General Public License v3.0 | 6 votes |
def deserialize_raw_transaction(raw_transaction: str) -> CTransaction: ''' Checking if transaction can be deserialized (is not corrupted). Args: raw_transaction (str): transaction to check Returns: CTransaction: transaction object Raises: ImpossibleDeserialization: when transaction is corrupted Example: >>> from clove.network import Litecoin >>> network = Litecoin() >>> network.deserialize_raw_transaction('0100000001aa25fd5f63cb41d6ee7dd495256046b4c3f17d4540a1b258a06bfefac30da60900000000fdff0047304402201c8869d359b5599ecffd51a96f0a8799392c98c4e15242762ba455e37b1f5d6302203f2974e9afc8d641f9363167df48e5a845a8deba1381bf5a1b549ac04718a1ac01410459cdb91eb7298bc2578dc4e7ac2109ac3cfd9dc9818795c5583e720d2114d540724bf26b4541f683ff51968db627a04eecd1f5cff615b6350dad5fb595f8adf420c480afb333623864901c968022a07dd93fe3c06f5684ea728b8113e17fa91bd9514c5163a61450314a793bf317665ecdc54c2e843bb106aeee158876a91485c0522f6e23beb11cc3d066cd20ed732648a4e66704926db75bb17576a914621f617c765c3caa5ce1bb67f6a3e51382b8da296888ac00000000015a7b0100000000001976a91485c0522f6e23beb11cc3d066cd20ed732648a4e688ac00000000') # noqa: E501 CTransaction((CTxIn(COutPoint(lx('09a60dc3fafe6ba058b2a140457df1c3b446602595d47deed641cb635ffd25aa'), 0), CScript([x('304402201c8869d359b5599ecffd51a96f0a8799392c98c4e15242762ba455e37b1f5d6302203f2974e9afc8d641f9363167df48e5a845a8deba1381bf5a1b549ac04718a1ac01'), x('0459cdb91eb7298bc2578dc4e7ac2109ac3cfd9dc9818795c5583e720d2114d540724bf26b4541f683ff51968db627a04eecd1f5cff615b6350dad5fb595f8adf4'), x('c480afb333623864901c968022a07dd93fe3c06f5684ea728b8113e17fa91bd9'), 1, x('63a61450314a793bf317665ecdc54c2e843bb106aeee158876a91485c0522f6e23beb11cc3d066cd20ed732648a4e66704926db75bb17576a914621f617c765c3caa5ce1bb67f6a3e51382b8da296888ac')]), 0x0),), (CTxOut(0.00097114*COIN, CScript([OP_DUP, OP_HASH160, x('85c0522f6e23beb11cc3d066cd20ed732648a4e6'), OP_EQUALVERIFY, OP_CHECKSIG])),), 0, 1, CTxWitness()) # noqa: E501 ''' try: return CTransaction.deserialize(x(raw_transaction)) except Exception: raise ImpossibleDeserialization()