Using pybitcoin tools to sign transactions offline

+1 vote
I'm having trouble using pybitcoin tools to sign transactions offline : https://github.com/vbuterin/pybitcointools

I'm using multichain-cli to create the raw transaction:

1) createrawtransaction '[{"txid":"f098143b389bf7ff19c26d8d051ac4351f255cdb1f41735cf4fa723b9e38893","vout":0}]'  '{}'

Output: 01000000019388e3b923a74fcf3517f4b1cd54251f35c41a058d6dc219fff79b383b1498f00000000000ffffffff0000000000

2) appendrawdata 01000000019388e3b923a74fcf3517f4b1cd54251f35c41a058d6dc219fff79b383b1498f00000000000ffffffff0000000000 5554584f732046545721

Output: 01000000019388e3b923a74fcf3517f4b1cd54251f35c41a058d6dc219fff79b383b1498f00000000000ffffffff0100000000000000000c6a0a5554584f73204654572100000000

3) And then using pybitcoin tools...

tx = \
'01000000019388e3b923a74fcf3517f4b1cd54251f35c41a058d6dc219fff79b383b1498f00000000000ffffffff0100000000000000000c6a0a5554584f73204654572100000000'

signed_tx = sign(tx, 0, 'c19baef3f8c7cd8df7aab108ef8578dd6694fed976c85cd8213cdaec3d7e4ebd')

4) When calling sendrawtransaction using the hex result from signing in step 3, I get the following error.

error code: -26
error message:
16: ConnectInputs failed

Any advice??
asked Aug 21, 2017 by anonymous

1 Answer

0 votes

Perhaps you are using the wrong txid/vout when building the transaction, or the asset or native currency quantities in the inputs and outputs are not balanced. Please try using createrawsendfrom instead, which is an easier way to build a raw transaction for external signing. This tutorial might help: https://www.multichain.com/developers/external-key-management/

answered Aug 21, 2017 by MultiChain
I unfortunately got the same error message when trying with createrawsendfrom... Is pybitcointools just not compatible?
First instead of using sendrawtransaction on the signed transaction, try using decoderawtransaction to see what's going on, and if every input is signed.

Second there are various other things that could be wrong, such as the format you're passing the transaction or private key to pybitcoin. You should work through a series of steps or instructions for Bitcoin Core first, to make sure you're doing everything right with pybitcoin, then try porting it across to MultiChain.

Third it might be easier to start by using a MultiChain blockchain with bitcoin-compatible addressing. Please see here for how: https://www.multichain.com/developers/address-key-format/

Also BTW it seems that you're not signing the transaction with the metadata included (i.e. the version output by appendrawdata).
Started over with a  new transaction, hopefully the formatting is readable... This time different addresses were used. The error is different as well. The blockchain was set up with the parameters specified at  https://www.multichain.com/developers/address-key-format/. For pybitcointools, I passed in the hex output as the transaction, 0 as index (? not sure about this one, but I tried 1 and that didn't work), and private key from dumpprivkey for the 13J address.
chain-46: listpermissions issue
{"method":"listpermissions","params":["issue"],"id":1,"chain_name":"chain-46"}
[
    {
        "address" : "1142qTmxarfHC9T6YuRhrues7tm8G4Prpn",
        "for" : null,
        "type" : "issue",
        "startblock" : 0,
        "endblock" : 4294967295
    },
    {
        "address" : "13JLeUbkMeS7zh6CqC8YFSsptv3eAa4svz",
        "for" : null,
        "type" : "issue",
        "startblock" : 0,
        "endblock" : 4294967295
    }
]
chain-46: issue 13JLeUbkMeS7zh6CqC8YFSsptv3eAa4svz asset8 100 0.1
{"method":"issue","params":["13JLeUbkMeS7zh6CqC8YFSsptv3eAa4svz","asset8",100,0.10000000],"id":1,"chain_name":"chain-46"}

944181c0d2426f31e33a9c29dee390bdb94f99cfd27c0b8a30166825e98bf7fe
chain-46: getnewaddress
{"method":"getnewaddress","params":[],"id":1,"chain_name":"chain-46"}

14q8aVt4pT4Up8GbCTtJkCesQBskqDmEpA
chain-46: grant 14q8aVt4pT4Up8GbCTtJkCesQBskqDmEpA send
{"method":"grant","params":["14q8aVt4pT4Up8GbCTtJkCesQBskqDmEpA","send"],"id":1,"chain_name":"chain-46"}

b7b43c45715fdcf72079dfd6a88d8b64dcd2f472d230b7f27df5e8b6f4f6f9ac
chain-46: grant 14q8aVt4pT4Up8GbCTtJkCesQBskqDmEpA receive
{"method":"grant","params":["14q8aVt4pT4Up8GbCTtJkCesQBskqDmEpA","receive"],"id":1,"chain_name":"chain-46"}

cf633d07a38f997e10b7d1b47845f2f2736173ac96ac82e3f0c177183e6256b5
chain-46: listunspent 0 9999 '["13JLeUbkMeS7zh6CqC8YFSsptv3eAa4svz"]'
{"method":"listunspent","params":[0,9999,["13JLeUbkMeS7zh6CqC8YFSsptv3eAa4svz"]],"id":1,"chain_name":"chain-46"}

[
    {
        "txid" : "944181c0d2426f31e33a9c29dee390bdb94f99cfd27c0b8a30166825e98bf7fe",
        "vout" : 2,
        "address" : "13JLeUbkMeS7zh6CqC8YFSsptv3eAa4svz",
        "account" : "",
        "scriptPubKey" : "76a9141937b901f01fd882a4bd4deafa677475ea1c1e6288ac",
        "amount" : 0.00000000,
        "confirmations" : 4,
        "cansend" : true,
        "spendable" : true,
        "assets" : [
        ],
        "permissions" : [
        ]
    },
    {
        "txid" : "b7b43c45715fdcf72079dfd6a88d8b64dcd2f472d230b7f27df5e8b6f4f6f9ac",
        "vout" : 1,
        "address" : "13JLeUbkMeS7zh6CqC8YFSsptv3eAa4svz",
        "account" : "",
        "scriptPubKey" : "76a9141937b901f01fd882a4bd4deafa677475ea1c1e6288ac1c73706b71bd90e3de299c3ae3316f42d2c0814194e80300000000000075",
        "amount" : 0.00000000,
        "confirmations" : 3,
        "cansend" : true,
        "spendable" : true,
        "assets" : [
            {
                "name" : "asset8",
                "assetref" : "139-266-16788",
                "qty" : 100.00000000
            }
        ],
        "permissions" : [
        ]
    },
    {
        "txid" : "cf633d07a38f997e10b7d1b47845f2f2736173ac96ac82e3f0c177183e6256b5",
        "vout" : 1,
        "address" : "13JLeUbkMeS7zh6CqC8YFSsptv3eAa4svz",
        "account" : "",
        "scriptPubKey" : "76a9141937b901f01fd882a4bd4deafa677475ea1c1e6288ac1c73706b717d2a1db715c9138537d6238abbeb7893bc0200000000000075",
        "amount" : 0.00000000,
        "confirmations" : 3,
        "cansend" : true,
        "spendable" : true,
        "assets" : [
            {
                "name" : "asset0",
                "assetref" : "73-265-30867",
                "qty" : 70.00000000
            }
        ],
        "permissions" : [
        ]
    }
]
chain-46: createrawtransaction '[{"txid":"b7b43c45715fdcf72079dfd6a88d8b64dcd2f72d230b7f27df5e8b6f4f6f9ac","vout":1}]' '{"14q8aVt4pT4Up8GbCTtJkCesQBskqDmEpA":{"
asset8":20}}'                                                                 '

{"method":"createrawtransaction","params":[[{"txid":"b7b43c45715fdcf72079dfd6a88d8b64dcd2f472d230b7f27df5e8b6f4f6f9ac","vout":1}],{"14q8aVt4pT4Up8GbCTtJkCesQBskqDmEpA":{"asset8":20}}],"id":1,"chain_name":"chain-46"}

0100000001acf9f6f4b6e8f57df2b730d272f4d2dc648b8da8d6df7920f7dc5f71453cb4b70100000000ffffffff0100000000000000003776a9142a02ab3f84cc0186eb3e54dc8cb2dca7ba72637788ac1c73706b71bd90e3de299c3ae3316f42d2c0814194c8000000000000007500000000
chain-46: decoderawtransaction 0100000001acf9f6f4b6e8f57df2b730d272f4d2dc648b8da8d6df7920f7dc5f71453cb4b70100000000ffffffff0100000000000000003776a9142a02ab3f84cc0186eb3e54dc8cb2dca7ba72637788ac1c73706b71bd90e3de299c3ae3316f42d2c0814194c8000000000000007500000000
{"method":"decoderawtransaction","params":["0100000001acf9f6f4b6e8f57df2b730d272f4d2dc648b8da8d6df7920f7dc5f71453cb4b70100000000ffffffff0100000000000000003776a9142a02ab3f84cc0186eb3e54dc8cb2dca7ba72637788ac1c73706b71bd90e3de299c3ae3316f42d2c0814194c8000000000000007500000000"],"id":1,"chain_name":"chain-46"}

{
    "txid" : "b1860da5866cc09b0b530ae6dfc980110bb627e6bdfa886b7887384bf000462f",
    "version" : 1,
    "locktime" : 0,
    "vin" : [
        {
            "txid" : "b7b43c45715fdcf72079dfd6a88d8b64dcd2f472d230b7f27df5e8b6f4f6f9ac",
            "vout" : 1,
            "scriptSig" : {
                "asm" : "",
                "hex" : ""
            },
            "sequence" : 4294967295
        }
    ],
    "vout" : [
        {
            "value" : 0.00000000,
            "n" : 0,
            "scriptPubKey" : {
                "asm" : "OP_DUP OP_HASH160 2a02ab3f84cc0186eb3e54dc8cb2dca7ba726377 OP_EQUALVERIFY OP_CHECKSIG 73706b71bd90e3de299c3ae3316f42d2c0814194c800000000000000 OP_DROP",
                "hex" : "76a9142a02ab3f84cc0186eb3e54dc8cb2dca7ba72637788ac1c73706b71bd90e3de299c3ae3316f42d2c0814194c80000000000000075",
                "reqSigs" : 1,
                "type" : "pubkeyhash",
                "addresses" : [
                    "14q8aVt4pT4Up8GbCTtJkCesQBskqDmEpA"
                ]
            },
            "assets" : [
                {
                    "name" : "asset8",
                    "issuetxid" : "944181c0d2426f31e33a9c29dee390bdb94f99cfd27c0b8a30166825e98bf7fe",
                    "assetref" : "139-266-16788",
                    "qty" : 20.00000000,
                    "raw" : 200,
                    "type" : "transfer"
                }
            ],
            "permissions" : [
            ],
            "items" : [
            ]
        }
    ],
    "data" : [
    ]
}
chain-46: appendrawchange 0100000001acf9f6f4b6e8f57df2b730d272f4d2dc648b8da8d6df7920f7dc5f71453cb4b70100000000ffffffff0100000000000000003776a9142a02ab3f84cc0186eb3e54dc8cb2dca7ba72637788ac1c73706b71bd90e3de299c3ae3316f42d2c0814194c8000000000000007500000000 13JLeUbkMeS7zh6CqC8YFSsptv3eAa4svz
{"method":"appendrawchange","params":["0100000001acf9f6f4b6e8f57df2b730d272f4d2dc648b8da8d6df7920f7dc5f71453cb4b70100000000ffffffff0100000000000000003776a9142a02ab3f84cc0186eb3e54dc8cb2dca7ba72637788ac1c73706b71bd90e3de299c3ae3316f42d2c0814194c8000000000000007500000000","13JLeUbkMeS7zh6CqC8YFSsptv3eAa4svz"],"id":1,"chain_name":"chain-46"}

0100000001acf9f6f4b6e8f57df2b730d272f4d2dc648b8da8d6df7920f7dc5f71453cb4b70100000000ffffffff0200000000000000003776a9142a02ab3f84cc0186eb3e54dc8cb2dca7ba72637788ac1c73706b71bd90e3de299c3ae3316f42d2c0814194c8000000000000007500000000000000003776a9141937b901f01fd882a4bd4deafa677475ea1c1e6288ac1c73706b71bd90e3de299c3ae3316f42d2c081419420030000000000007500000000
chain-46: decoderawtransaction 0100000001acf9f6f4b6e8f57df2b730d272f4d2dc648b8da8d6df7920f7dc5f71453cb4b70100000000ffffffff0200000000000000003776a9142a02ab3f84cc0186eb3e54dc8cb2dca7ba72637788ac1c73706b71bd90e3de299c3ae3316f42d2c0814194c8000000000000007500000000000000003776a9141937b901f01fd882a4bd4deafa677475ea1c1e6288ac1c73706b71bd90e3de299c3ae3316f42d2c081419420030000000000007500000000
{"method":"decoderawtransaction","params":["0100000001acf9f6f4b6e8f57df2b730d272f4d2dc648b8da8d6df7920f7dc5f71453cb4b70100000000ffffffff0200000000000000003776a9142a02ab3f84cc0186eb3e54dc8cb2dca7ba72637788ac1c73706b71bd90e3de299c3ae3316f42d2c0814194c8000000000000007500000000000000003776a9141937b901f01fd882a4bd4deafa677475ea1c1e6288ac1c73706b71bd90e3de299c3ae3316f42d2c081419420030000000000007500000000"],"id":1,"chain_name":"chain-46"}

{
    "txid" : "8dc7eb2d0c2fea81cda9ee0603d3c973fd2e693cc0e282d46117bbe057f17fda",
    "version" : 1,
    "locktime" : 0,
    "vin" : [
        {
            "txid" : "b7b43c45715fdcf72079dfd6a88d8b64dcd2f472d230b7f27df5e8b6f4f6f9ac",
            "vout" : 1,
            "scriptSig" : {
                "asm" : "",
                "hex" : ""
            },
            "sequence" : 4294967295
        }
    ],
    "vout" : [
        {
            "value" : 0.00000000,
            "n" : 0,
            "scriptPubKey" : {
                "asm" : "OP_DUP OP_HASH160 2a02ab3f84cc0186eb3e54dc8cb2dca7ba726377 OP_EQUALVERIFY OP_CHECKSIG 73706b71bd90e3de299c3ae3316f42d2c0814194c800000000000000 OP_DROP",
                "hex" : "76a9142a02ab3f84cc0186eb3e54dc8cb2dca7ba72637788ac1c73706b71bd90e3de299c3ae3316f42d2c0814194c80000000000000075",
                "reqSigs" : 1,
                "type" : "pubkeyhash",
                "addresses" : [
                    "14q8aVt4pT4Up8GbCTtJkCesQBskqDmEpA"
                ]
            },
            "assets" : [
                {
                    "name" : "asset8",
                    "issuetxid" : "944181c0d2426f31e33a9c29dee390bdb94f99cfd27c0b8a30166825e98bf7fe",
                    "assetref" : "139-266-16788",
                    "qty" : 20.00000000,
                    "raw" : 200,
                    "type" : "transfer"
                }
            ],
            "permissions" : [
            ],
            "items" : [
            ]
        },
        {
            "value" : 0.00000000,
            "n" : 1,
            "scriptPubKey" : {
                "asm" : "OP_DUP OP_HASH160 1937b901f01fd882a4bd4deafa677475ea1c1e62 OP_EQUALVERIFY OP_CHECKSIG 73706b71bd90e3de299c3ae3316f42d2c08141942003000000000000 OP_DROP",
                "hex" : "76a9141937b901f01fd882a4bd4deafa677475ea1c1e6288ac1c73706b71bd90e3de299c3ae3316f42d2c0814194200300000000000075",
                "reqSigs" : 1,
                "type" : "pubkeyhash",
                "addresses" : [
                    "13JLeUbkMeS7zh6CqC8YFSsptv3eAa4svz"
                ]
            },
            "assets" : [
                {
                    "name" : "asset8",
                    "issuetxid" : "944181c0d2426f31e33a9c29dee390bdb94f99cfd27c0b8a30166825e98bf7fe",
                    "assetref" : "139-266-16788",
                    "qty" : 80.00000000,
                    "raw" : 800,
                    "type" : "transfer"
                }
            ],
            "permissions" : [
            ],
            "items" : [
            ]
        }
    ],
    "data" : [
    ]
}
PYBITCOINTOOLS:
tx = '0100000001acf9f6f4b6e8f57df2b730d272f4d2dc648b8da8d6df7920f7dc5f71453cb4b70100000000ffffffff0200000000000000003776a9142a02ab3f84cc0186eb3e54dc8cb2dca7ba72637788ac1c73706b71bd90e3de299c3ae3316f42d2c0814194c8000000000000007500000000000000003776a9141937b901f01fd882a4bd4deafa677475ea1c1e6288ac1c73706b71bd90e3de299c3ae3316f42d2c081419420030000000000007500000000'
index = 0
privkey = "KyBRDehKPB7XBb9wusL4b6UCCuj2XGYU61pkaVJJHMBQdqrt3ZYB"
signed = sign(tx, index, privkey)
print signed
OUTPUT: 0100000001acf9f6f4b6e8f57df2b730d272f4d2dc648b8da8d6df7920f7dc5f71453cb4b7010000006a473044022022da2c890d44fcfa864cec8dd1266224a187dac343e4d37d41336ac3d031b36f02200830eb6886f6c3d2d29966010b1247eae786117f820395c3048ea09214ff658f012103db453cdf1c87bec572988af08d36436e715c5db115e341ae754615bd56100c3effffffff0200000000000000003776a9142a02ab3f84cc0186eb3e54dc8cb2dca7ba72637788ac1c73706b71bd90e3de299c3ae3316f42d2c0814194c8000000000000007500000000000000003776a9141937b901f01fd882a4bd4deafa677475ea1c1e6288ac1c73706b71bd90e3de299c3ae3316f42d2c081419420030000000000007500000000
chain-46: decoderawtransaction 0100000001acf9f6f4b6e8f57df2b730d272f4d2dc648b8da8d6df7920f7dc5f71453cb4b7010000006a473044022022da2c890d44fcfa864cec8dd1266224a187dac343e4d37d41336ac3d031b36f02200830eb6886f6c3d2d29966010b1247eae786117f820395c3048ea09214ff658f012103db453cdf1c87bec572988af08d36436e715c5db115e341ae754615bd56100c3effffffff0200000000000000003776a9142a02ab3f84cc0186eb3e54dc8cb2dca7ba72637788ac1c73706b71bd90e3de299c3ae3316f42d2c0814194c8000000000000007500000000000000003776a9141937b901f01fd882a4bd4deafa677475ea1c1e6288ac1c73706b71bd90e3de299c3ae3316f42d2c081419420030000000000007500000000
{"method":"decoderawtransaction","params":["0100000001acf9f6f4b6e8f57df2b730d272f4d2dc648b8da8d6df7920f7dc5f71453cb4b7010000006a473044022022da2c890d44fcfa864cec8dd1266224a187dac343e4d37d41336ac3d031b36f02200830eb6886f6c3d2d29966010b1247eae786117f820395c3048ea09214ff658f012103db453cdf1c87bec572988af08d36436e715c5db115e341ae754615bd56100c3effffffff0200000000000000003776a9142a02ab3f84cc0186eb3e54dc8cb2dca7ba72637788ac1c73706b71bd90e3de299c3ae3316f42d2c0814194c8000000000000007500000000000000003776a9141937b901f01fd882a4bd4deafa677475ea1c1e6288ac1c73706b71bd90e3de299c3ae3316f42d2c081419420030000000000007500000000"],"id":1,"chain_name":"chain-46"}

{
    "txid" : "deace0fde2fb78bdd2873ddecce19dd05c925153060f7943c766ab10448a121b",
    "version" : 1,
    "locktime" : 0,
    "vin" : [
        {
            "txid" : "b7b43c45715fdcf72079dfd6a88d8b64dcd2f472d230b7f27df5e8b6f4f6f9ac",
            "vout" : 1,
            "scriptSig" : {
                "asm" : "3044022022da2c890d44fcfa864cec8dd1266224a187dac343e4d37d41336ac3d031b36f02200830eb6886f6c3d2d29966010b1247eae786117f820395c3048ea09214ff658f01 03db453cdf1c87bec572988af08d36436e715c5db115e341ae754615bd56100c3e",
                "hex" : "473044022022da2c890d44fcfa864cec8dd1266224a187dac343e4d37d41336ac3d031b36f02200830eb6886f6c3d2d29966010b1247eae786117f820395c3048ea09214ff658f012103db453cdf1c87bec572988af08d36436e715c5db115e341ae754615bd56100c3e"
            },
            "sequence" : 4294967295
        }
    ],
    "vout" : [
        {
            "value" : 0.00000000,
            "n" : 0,
            "scriptPubKey" : {
                "asm" : "OP_DUP OP_HASH160 2a02ab3f84cc0186eb3e54dc8cb2dca7ba726377 OP_EQUALVERIFY OP_CHECKSIG 73706b71bd90e3de299c3ae3316f42d2c0814194c800000000000000 OP_DROP",
                "hex" : "76a9142a02ab3f84cc0186eb3e54dc8cb2dca7ba72637788ac1c73706b71bd90e3de299c3ae3316f42d2c0814194c80000000000000075",
                "reqSigs" : 1,
                "type" : "pubkeyhash",
                "addresses" : [
                    "14q8aVt4pT4Up8GbCTtJkCesQBskqDmEpA"
                ]
            },
            "assets" : [
                {
                    "name" : "asset8",
                    "issuetxid" : "944181c0d2426f31e33a9c29dee390bdb94f99cfd27c0b8a30166825e98bf7fe",
                    "assetref" : "139-266-16788",
                    "qty" : 20.00000000,
                    "raw" : 200,
                    "type" : "transfer"
                }
            ],
            "permissions" : [
            ],
            "items" : [
            ]
        },
        {
            "value" : 0.00000000,
            "n" : 1,
            "scriptPubKey" : {
                "asm" : "OP_DUP OP_HASH160 1937b901f01fd882a4bd4deafa677475ea1c1e62 OP_EQUALVERIFY OP_CHECKSIG 73706b71bd90e3de299c3ae3316f42d2c08141942003000000000000 OP_DROP",
                "hex" : "76a9141937b901f01fd882a4bd4deafa677475ea1c1e6288ac1c73706b71bd90e3de299c3ae3316f42d2c0814194200300000000000075",
                "reqSigs" : 1,
                "type" : "pubkeyhash",
                "addresses" : [
                    "13JLeUbkMeS7zh6CqC8YFSsptv3eAa4svz"
                ]
            },
            "assets" : [
                {
                    "name" : "asset8",
                    "issuetxid" : "944181c0d2426f31e33a9c29dee390bdb94f99cfd27c0b8a30166825e98bf7fe",
                    "assetref" : "139-266-16788",
                    "qty" : 80.00000000,
                    "raw" : 800,
                    "type" : "transfer"
                }
            ],
            "permissions" : [
            ],
            "items" : [
            ]
        }
    ],
    "data" : [
    ]
}

chain-46: sendrawtransaction 0100000001acf9f6f4b6e8f57df2b730d272f4d2dc648b8da8d6df7920f7dc5f71453cb4b7010000006a473044022022da2c890d44fcfa864cec8dd1266224a187dac343e4d37d41336ac3d031b36f02200830eb6886f6c3d2d29966010b1247eae786117f820395c3048ea09214ff658f012103db453cdf1c87bec572988af08d36436e715c5db115e341ae754615bd56100c3effffffff0200000000000000003776a9142a02ab3f84cc0186eb3e54dc8cb2dca7ba72637788ac1c73706b71bd90e3de299c3ae3316f42d2c0814194c8000000000000007500000000000000003776a9141937b901f01fd882a4bd4deafa677475ea1c1e6288ac1c73706b71bd90e3de299c3ae3316f42d2c081419420030000000000007500000000
{"method":"sendrawtransaction","params":["0100000001acf9f6f4b6e8f57df2b730d272f4d2dc648b8da8d6df7920f7dc5f71453cb4b7010000006a473044022022da2c890d44fcfa864cec8dd1266224a187dac343e4d37d41336ac3d031b36f02200830eb6886f6c3d2d29966010b1247eae786117f820395c3048ea09214ff658f012103db453cdf1c87bec572988af08d36436e715c5db115e341ae754615bd56100c3effffffff0200000000000000003776a9142a02ab3f84cc0186eb3e54dc8cb2dca7ba72637788ac1c73706b71bd90e3de299c3ae3316f42d2c0814194c8000000000000007500000000000000003776a9141937b901f01fd882a4bd4deafa677475ea1c1e6288ac1c73706b71bd90e3de299c3ae3316f42d2c081419420030000000000007500000000"],"id":1,"chain_name":"chain-46"}

error code: -26
error message:
18: bad-txns-inputs-spent
First of all, last error "bad-txns-inputs-spent" has nothing to do with the signature. It only means that previous output (""txid" : "b7b43c45715fdcf72079dfd6a88d8b64dcd2f472d230b7f27df5e8b6f4f6f9ac","vout":1) was not found. This may have several reasons, most likely, there was some transaction we don't  see in your output, spending this input.

Now, to the signature question. I'm afraid  https://github.com/vbuterin/pybitcointools cannot be used for signing MultiChain (and non-standard Bitcoin) transactions generally speaking.  Bitcoin signature depends not only on tx, vout and private key of the signer, but also on scriptPubKey of the previous output (https://en.bitcoin.it/wiki/OP_CHECKSIG). As you may see, you cannot even pass this scriptPubKey to the pybitcoin sign procedure. How does it work then? For standard Bitcoin transactions (https://bitcoin.org/en/developer-guide#standard-transactions), this scriptPubKey can be derived from private key. Even more,  pybitcoin sign procedure works only for very specific (but most commonly used) standard output script - Pay To Public Key Hash (P2PKH).

MultiChain uses script extensions for storing assets, permissions and other MultiChain specific data. And, of course, MultiChain script cannot be derived only from private key.

The best thing you can do is to prepare input without assets and permissions (using 'preparelockunspent 13JLeUbkMeS7zh6CqC8YFSsptv3eAa4svz 0', for example). I suppose input generated by this API can be signed by pybitcoin. But you cannot send MultiChain assets this way.
Okay thanks!
...