trezor / connect

:link: A platform for easy integration of Trezor into 3rd party services
Other
348 stars 262 forks source link

Sign BIP49 SegWit Multisig raw transaction? #75

Closed hoangan closed 7 years ago

hoangan commented 7 years ago

Is there a way to sign BIP49 Segwit Multisig raw transaction?

Like this signing code from bitcoinjs-lib:

txb.sign(0, keyPairs[0], redeemScript, null, unspent.value, witnessScript)
txb.sign(0, keyPairs[2], redeemScript, null, unspent.value, witnessScript)
txb.sign(0, keyPairs[3], redeemScript, null, unspent.value, witnessScript)

Thanks

prusnak commented 7 years ago

No, TREZOR does not sign raw transactions. You need to parse them and provided parsed data to TREZOR.

hoangan commented 7 years ago

Hi Prusnak,

So it does support BIP49 Segwit Multisig Transaction?

For example, the following tx:

{
    "addresses": [
        "2N1W1RGyLvrV2b2Y778dVHRPC8ZtM2p1T1U", 
        "2N77hupTQoyfSUQCBenEodd73CcFrpAtqyk"
    ], 
    "block_height": -1, 
    "block_index": -1, 
    "confirmations": 0, 
    "double_spend": false, 
    "fees": 30000, 
    "hash": "b76187aa66939da78d8cd0228e86b35aa2fd853687b9b9a29ad61341d93f28ef", 
    "inputs": [
        {
            "addresses": [
                "2N1W1RGyLvrV2b2Y778dVHRPC8ZtM2p1T1U"
            ], 
            "age": 1196100, 
            "output_index": 1, 
            "output_value": 1000000, 
            "prev_hash": "600c691ed64faa9a1584f5fba940ddbd6ddc24ccc4701cff44c52f735549c055", 
            "script": "2200202a20d272da768947d3aea18fe6c401305fe0d8424f02cdabf14cddaee4270db9", 
            "script_type": "pay-to-script-hash", 
            "sequence": 4294967295, 
            "witness": [
                "", 
                "3044022058522ff7a71b8ed12bd58e19d71d6423a2f46379d1eeb429671025c0b559dd27022012971d3ded366368f9f25e2e550cd9ee2873c2bc19b79c078648ae5c114164fd01", 
                "3045022100e58f237d7b16454af25c98c048065a8a61a2b92d384ffc1a8f35a7c740b4f37f022023b3782b1c3773311545ce0cb9dbbef75e736f4c8a85016f48ea8b87d70b59d901", 
                "522103a1af804ac108a8a51782198c2d034b28bf90c8803f5a53f76276fa69a4eae77f2103d3c0c9882c564dac791af0066a0fb2bb9a6065729b1388dfd744b814696528a2210255abcf9df14070d1e010ad07a5f85944fe7fecaf539aa4efcdbce92e6e7b4adb53ae"
            ]
        }
    ], 
    "outputs": [
        {
            "addresses": [
                "2N77hupTQoyfSUQCBenEodd73CcFrpAtqyk"
            ], 
            "script": "a9149825be0377829cf801c5f61081b52dbecbe95d0887", 
            "script_type": "pay-to-script-hash", 
            "value": 100000
        }, 
        {
            "addresses": [
                "2N1W1RGyLvrV2b2Y778dVHRPC8ZtM2p1T1U"
            ], 
            "script": "a9145a8cc0e81455c797e43bdb0fcfe01f0078defc7687", 
            "script_type": "pay-to-script-hash", 
            "value": 870000
        }
    ], 
    "preference": "high", 
    "received": "2017-09-20T02:57:43.419969146Z", 
    "relayed_by": "54.196.30.148", 
    "size": 150, 
    "total": 970000, 
    "ver": 1, 
    "vin_sz": 1, 
    "vout_sz": 2
}

Thanks