Explorer cannot load transaction

+1 vote

Dear Team,

I'm working with MC 2.0.2  and last version of explorer.  After installing and running with --no-serve I have the following error:

...

block_tx 281 296
block_tx 282 297
Exception at 83395
Failed to catch up {'blkfile_offset': 0, 'blkfile_number': 100000, 'chain_id': 1, 'loader': u'default', 'conf': None, 'dirname': u'/home/fabio/.multichain/testnet04', 'id': 3}
Traceback (most recent call last):
  File "Mce/DataStore.py", line 2903, in catch_up
    store.catch_up_dir(dircfg)
  File "Mce/DataStore.py", line 3215, in catch_up_dir
    store.import_blkdat(dircfg, ds, blkfile['name'])
  File "Mce/DataStore.py", line 3347, in import_blkdat
    store.import_block(b, chain = chain)
  File "Mce/DataStore.py", line 1201, in import_block
    tx['tx_id'] = store.import_tx(tx, pos == 0, chain)
  File "Mce/DataStore.py", line 2128, in import_tx
    store.spent_txout_assets(txin['prevout_hash'], txin['prevout_n'], chain, tx['hash'], pos)
  File "Mce/DataStore.py", line 2159, in spent_txout_assets
    address = util.hash_to_address_multichain(vers, pubkey_hash, checksum)
  File "Mce/util.py", line 171, in hash_to_address_multichain
    vh += hash[pos:pos + 5]
TypeError: cannot concatenate 'str' and 'list' objects

 

This problem is not new. You already suggested a way out here:

https://www.multichain.com/qa/16963/explorer-attributeerror-nonetype-object-attribute-startswith?show=16963#q16963

but in my case it doesn't solve.

Can you help me?

Thanks for your support.

  Fabio

 

asked Dec 16, 2020 by Fabio
Do you know the exact transaction which is causing this problem? If so it would be helpful to see the full raw transaction hexadecimal to we can try to reproduce it.

1 Answer

0 votes

I add the following snippet at the line #1320 to DataStore.py in order to print out the block height:
 store.log.info("%d",b['height'])

After that I run the command:
python -m Mce.abe --config testnet04.conf --commit-bytes 100000 --no-serve

So I can guess the issue comes from block height #275 or #276

genesis transaction unavailable via RPC; see import-tx in abe.conf
RPC service lacks full txindex
catch_up_rpc: abort
Opened /home/fabio/.multichain/testnet04/blocks/blk00000.dat
Chain 1 genesis tx: 01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff1c04ffff00200104144d756c7469436861696e20746573746e65743034ffffffff0200000000000000002f76a914fcc0ec61c6b3cf66ccb6d052b61418d7bcc8ee1388ac1473706b703731000000000000ffffffffd8a9885e750000000000000000131073706b6e0200040101000104726f6f74756a00000000
block_tx 1 1
0
block_tx 2 2
1
block_tx 3 3
.....

block_tx 282 297
275
Exception at 83395
...
  File "Mce/util.py", line 171, in hash_to_address_multichain
    vh += hash[pos:pos + 5]
TypeError: cannot concatenate 'str' and 'list' objects

 

testnet04: getblock 275
{"method":"getblock","params":["275"],"id":"16870779-1608222794","chain_name":"testnet04"}

{
    "hash" : "00abe5041925a696feeed909884ed5bac1da58c5227daf9202d857dbefc8cb8b",
    "miner" : "1CDo6iRvGwssyuGhg6VQnH5TqxeGEPiUgw",
    "confirmations" : 1326,
    "size" : 266,
    "height" : 275,
    "version" : 3,
    "merkleroot" : "3aa5904c49727cb41315de15ae222c4bb073c3b42828c3a248668353b3188332",
    "tx" : [
        "3aa5904c49727cb41315de15ae222c4bb073c3b42828c3a248668353b3188332"
    ],
    "time" : 1586961806,
    "nonce" : 316,
    "bits" : "2000ffff",
    "difficulty" : 5.96046447753906e-8,
    "chainwork" : "0000000000000000000000000000000000000000000000000000000000011400",
    "previousblockhash" : "004f99e53175c91ae09036a82820efac2db3a108cd00fc0f9635e5c1bad9fc9d",
    "nextblockhash" : "00ea0cdf130d22b81814ecd3d014108f9b53a1a0c0ef2566876f2a89feba540a"
}
testnet04: getrawtransaction 3aa5904c49727cb41315de15ae222c4bb073c3b42828c3a248668353b3188332

01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff0c0213010101062f503253482fffffffff010000000000000000716a4c6e53504b6246304402207fa0e55eb7c0b87a35a78dfaf09e95d66b1cfa1dc420e02850d64fc0a3bd660902203c83975ed1d514b7a1b3f88a8c2bf1d0c196026a049c22277bf7bed8da31494a032103e5075c429eb67faa6935fa82a662acb5069570645da911e3786f4a07ef252e3900000000

testnet04: getblock 276
{"method":"getblock","params":["276"],"id":"29525511-1608223268","chain_name":"testnet04"}

{
    "hash" : "00ea0cdf130d22b81814ecd3d014108f9b53a1a0c0ef2566876f2a89feba540a",
    "miner" : "1Q3SPtj1dfWMTjXkHU3Z3tXq53uRvMUXXh",
    "confirmations" : 1325,
    "size" : 728,
    "height" : 276,
    "version" : 3,
    "merkleroot" : "2b93f3d6a209252b36e3b6ef0cba96c5fc0147a2d3a9468b39dfddfa451112f0",
    "tx" : [
        "27ca3eb28933cde621bc126e4e7e6e083d8bf0b0aeb77be9fa52a4b5a45e6ce4",
        "de7d5511e09d2c45f0d9cedb8eaf2e73344aecbd88a7093f5fe3b3e3f5f64620"
    ],
    "time" : 1586962233,
    "nonce" : 415,
    "bits" : "2000ffff",
    "difficulty" : 5.96046447753906e-8,
    "chainwork" : "0000000000000000000000000000000000000000000000000000000000011500",
    "previousblockhash" : "00abe5041925a696feeed909884ed5bac1da58c5227daf9202d857dbefc8cb8b",
    "nextblockhash" : "00f1771cfdf8510f2e4ead97841ad8d4832a3733d64b96d717e56194a2410c33"
}
testnet04: getrawtransaction "27ca3eb28933cde621bc126e4e7e6e083d8bf0b0aeb77be9fa52a4b5a45e6ce4"

01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff0c0214010101062f503253482fffffffff0240420f00000000001976a914fcc0ec61c6b3cf66ccb6d052b61418d7bcc8ee1388ac0000000000000000716a4c6e53504b6246304402204727c625c547e34847fbe6a3387cab2b7ed1c90153a841631589b09353cc565c02201bc3d25ec22142801e1a8f6ae1df0c2610ad33d3288a43002f1a1ff9c8822f3b0321036349a030d9cc6106b946e30be13d298f23f455250ddaa6a51c2a206d4d0e958000000000


testnet04: getrawtransaction  "de7d5511e09d2c45f0d9cedb8eaf2e73344aecbd88a7093f5fe3b3e3f5f64620"
{"method":"getrawtransaction","params":["de7d5511e09d2c45f0d9cedb8eaf2e73344aecbd88a7093f5fe3b3e3f5f64620"],"id":"27490772-1608224678","chain_name":"testnet04"}

0100000002e9c8fc11856034460971824d58bc692b835a103253a428afe9c6495c6298eec9010000006b483045022100d827e40b8f48d1c72ce287e7b66dded77d1807a6ab2bd8c76d6265dd4a73e0d7022018101175f3d75edac525b71e2ffce2c563c14a47d6f68745f0efc37b37223c5701210348db2420274bae4ea597d702bd9c9ef239e71c27d50602b27b5264d18078d9f3ffffffffc59480c52a0eaf57fb0d737a78c051a6753713fd3f5e1c304d8b4105df40a619010000006b48304502210093bf49c88dc54aa5030aaea16f0d055904c86a215623c3b7e43a9f58b6e9d89702202e9784439021ac1870c078e7208c890ce6b8a20ed82ad66e1926a34aa34167e701210348db2420274bae4ea597d702bd9c9ef239e71c27d50602b27b5264d18078d9f3ffffffff0240548900000000001976a914a8b66ee206ee4d61a11bc28f31f596e609bd6c1588ac00000000000000004f76a9145caf151636d7e72840cc6137aa334e147a43b9e888ac0573706b6601750f73706b645f686173685f76616c7565751c73706b71bf39079da69c856a9573e7d44366049c01000000000000007500000000

answered Dec 17, 2020 by fabio
I elaborated further.

The issue arose from an UNKNOWN_TYPE script. I added the following lines to DataStore.py:
            if the_script_type is Chain.SCRIPT_TYPE_UNKNOWN:
                print("UNK")
                print(type(data))
                for x in range(len(data)):
                    print data[x]

and i got the following:

UNK
<type 'list'>
(118, None)
(169, None)
(20, '\xa8\xb6n\xe2\x06\xeeMa\xa1\x1b\xc2\x8f1\xf5\x96\xe6\t\xbdl\x15')
(136, None)
(172, None)
(5, 'spkf\x01')
(117, None)
(15, 'spkd_hash_value')
(117, None)

{
    "hex" : "0100000002e9c8fc11856034460971824d58bc692b835a103253a428afe9c6495c6298eec9010000006b483045022100d827e40b8f48d1c72ce287e7b66dded77d1807a6ab2bd8c76d6265dd4a73e0d7022018101175f3d75edac525b71e2ffce2c563c14a47d6f68745f0efc37b37223c5701210348db2420274bae4ea597d702bd9c9ef239e71c27d50602b27b5264d18078d9f3ffffffffc59480c52a0eaf57fb0d737a78c051a6753713fd3f5e1c304d8b4105df40a619010000006b48304502210093bf49c88dc54aa5030aaea16f0d055904c86a215623c3b7e43a9f58b6e9d89702202e9784439021ac1870c078e7208c890ce6b8a20ed82ad66e1926a34aa34167e701210348db2420274bae4ea597d702bd9c9ef239e71c27d50602b27b5264d18078d9f3ffffffff0240548900000000001976a914a8b66ee206ee4d61a11bc28f31f596e609bd6c1588ac00000000000000004f76a9145caf151636d7e72840cc6137aa334e147a43b9e888ac0573706b6601750f73706b645f686173685f76616c7565751c73706b71bf39079da69c856a9573e7d44366049c01000000000000007500000000",
    "txid" : "de7d5511e09d2c45f0d9cedb8eaf2e73344aecbd88a7093f5fe3b3e3f5f64620",
    "version" : 1,
    "locktime" : 0,
    "vin" : [
        {
            "txid" : "c9ee98625c49c6e9af28a45332105a832b69bc584d8271094634608511fcc8e9",
            "vout" : 1,
            "scriptSig" : {
                "asm" : "3045022100d827e40b8f48d1c72ce287e7b66dded77d1807a6ab2bd8c76d6265dd4a73e0d7022018101175f3d75edac525b71e2ffce2c563c14a47d6f68745f0efc37b37223c5701 0348db2420274bae4ea597d702bd9c9ef239e71c27d50602b27b5264d18078d9f3",
                "hex" : "483045022100d827e40b8f48d1c72ce287e7b66dded77d1807a6ab2bd8c76d6265dd4a73e0d7022018101175f3d75edac525b71e2ffce2c563c14a47d6f68745f0efc37b37223c5701210348db2420274bae4ea597d702bd9c9ef239e71c27d50602b27b5264d18078d9f3"
            },
            "sequence" : 4294967295
        },
        {
            "txid" : "19a640df05418b4d301c5e3ffd133775a651c0787a730dfb57af0e2ac58094c5",
            "vout" : 1,
            "scriptSig" : {
                "asm" : "304502210093bf49c88dc54aa5030aaea16f0d055904c86a215623c3b7e43a9f58b6e9d89702202e9784439021ac1870c078e7208c890ce6b8a20ed82ad66e1926a34aa34167e701 0348db2420274bae4ea597d702bd9c9ef239e71c27d50602b27b5264d18078d9f3",
                "hex" : "48304502210093bf49c88dc54aa5030aaea16f0d055904c86a215623c3b7e43a9f58b6e9d89702202e9784439021ac1870c078e7208c890ce6b8a20ed82ad66e1926a34aa34167e701210348db2420274bae4ea597d702bd9c9ef239e71c27d50602b27b5264d18078d9f3"
            },
            "sequence" : 4294967295
        }
    ],
    "vout" : [
        {
            "value" : 0.09,
            "n" : 0,
            "scriptPubKey" : {
                "asm" : "OP_DUP OP_HASH160 a8b66ee206ee4d61a11bc28f31f596e609bd6c15 OP_EQUALVERIFY OP_CHECKSIG",
                "hex" : "76a914a8b66ee206ee4d61a11bc28f31f596e609bd6c1588ac",
                "reqSigs" : 1,
                "type" : "pubkeyhash",
                "addresses" : [
                    "1GP54uSDS3HADEL317Axo6eGUiSRPtU8wL"
                ]
            }
        },
        {
            "value" : 0,
            "n" : 1,
            "scriptPubKey" : {
                "asm" : "OP_DUP OP_HASH160 5caf151636d7e72840cc6137aa334e147a43b9e8 OP_EQUALVERIFY OP_CHECKSIG 73706b6601 OP_DROP 73706b645f686173685f76616c7565 OP_DROP 73706b71bf39079da69c856a9573e7d44366049c0100000000000000 OP_DROP",
                "hex" : "76a9145caf151636d7e72840cc6137aa334e147a43b9e888ac0573706b6601750f73706b645f686173685f76616c7565751c73706b71bf39079da69c856a9573e7d44366049c010000000000000075",
                "reqSigs" : 1,
                "type" : "pubkeyhash",
                "addresses" : [
                    "19T4uav65jmkftb6ND9K4mocn66dJYqvxk"
                ]
            },
            "assets" : [
                {
                    "name" : "asset_2",
                    "issuetxid" : "9c046643d4e773956a859ca69d0739bf8a05294621ca630944579f91ce1e6c5a",
                    "assetref" : "93-299-1180",
                    "qty" : 1,
                    "raw" : 1,
                    "type" : "transfer"
                }
            ],
            "data" : [
                {
                    "text" : "_hash_value"
                }
            ]
        }
    ],
    "blockhash" : "00ea0cdf130d22b81814ecd3d014108f9b53a1a0c0ef2566876f2a89feba540a",
    "confirmations" : 1367,
    "time" : 1586962233,
    "blocktime" : 1586962233
}


Can you kindly help me ?
Yes, we will look into this asap.
The most useful thing would be to see the value of binscript in the case where "the_script_type is Chain.SCRIPT_TYPE_UNKNOWN". That would let us understand which txout is being spent that the Explorer is choking on.

You could also consider just inserting here:

 if the_script_type is Chain.SCRIPT_TYPE_UNKNOWN:
   return

Since there is nothing for this function to do when spending an unknown type of txout anyway.
...