segregated witness – The example signature in BIP143 doesn’t validate?

    0
    6


    In BIP143 the primary instance
    has a witness signature and it would not seem to validate/be right?! I wrote a brilliant easy python program to exhibit

    import ecdsa
    import asn1
    
    #Importing the three items of knowledge from the instance to byte arrays
    pub = bytearray.fromhex("025476c2e83188368da1ff3e292e7acafcdb3566bb0ad253f62fc70f07aeee6357")
    sighash = bytearray.fromhex("c37af31116d1b27caf68aae9e3ac82f1477929014d5b917657d0eb49478cb670")
    dersigscript = bytearray.fromhex("304402203609e17b84f6a7d30c80bfa610b5b4542f32a8a0d5447a12fb1366d7f01cc44a0220573a954c4518331561406f90300e8f3358f51928d43c212a8caed02de67eebee")
    
    #deocding the DEC encoding
    decoder = asn1.Decoder()
    decoder.begin(bytes(dersigscript))
    tag, sigscript = decoder.learn()
    
    #stripping off the script  potion so we simply have a signature
    sig = bytearray(sigscript)[2:66]
    
    vk = ecdsa.VerifyingKey.from_string(pub,  curve=ecdsa.SECP256k1)
    vk.confirm(sig, sighash)
    

    If anybody can shed some gentle on what silly factor I’m doing, or an instance reference that breaks it down, so it really works, that may be actually useful. I’ve additionally tried reversing byte order on all eight mixtures of the three inputs. That being mentioned I’ve used the non-public and public key posted to do my very own signatures/validation, so I’m pretty assured they’re in right order, simply much less positive in regards to the sig.

    Thanks!!