BlockSci icon indicating copy to clipboard operation
BlockSci copied to clipboard

First appearance of `blocksci.WitnessUnknownAddress` object is suspicous

Open crantini opened this issue 6 years ago • 1 comments

Hello,

I should preface by saying that I am unsure if this is a failure or not. What I can say, is that despite extensive BlockSci experience I have never encountered the issue before (nor since) this block height (which is itself deep into SegWit territory), and this makes me concerned.

If this behavior is as expected then please disregard this report. If so, then I will simply ignore this transaction output.

Reproduction Steps

import blocksci
chain = blocksci.Blockchain(CONF)
for out in chain.blocks[608548].outputs:
    if out.address_type not in {blocksci.address_type.nulldata}:
        for output_address in [out.address]:
            try:
                output_address.address_string
            except AttributeError as e:
                print(out.address_type)
                print(out)
                print(output_address)
                print(e)

Script output:

Pay to witness unknown
TxOut(spending_tx_index=0, address=WitnessUnknownScript(), value=5431)
WitnessUnknownScript()
'blocksci.WitnessUnknownAddress' object has no attribute 'address_string'

System Information

Using AMI: no
BlockSci version: v0.6 / f074eea40a80d9d51ce08c35e85b70c37793451b Blockchain: Bitcoin Parser: Disk Total memory: 64 GB

crantini avatar Dec 21 '19 21:12 crantini

I'm not super familiar with the Segwit format, but the pubkey script looks like a witness output (version byte + 2-40 byte witness program). However, the version number is 1 whereas current normal witness outputs should have version 0. In that regard I think the WitnessUnknownScript is the correct type.

If I understand BIP 173 correctly, then the Bech address format should apply to all witness versions, so we should be able to return an address_string for the unknown scripts.

maltemoeser avatar Jan 07 '20 17:01 maltemoeser