Post
Topic
Board Armory
Re: SOLVED - MADE SCRIPT: signing raw transactions from bitcoind with armory
by
PhantomPhreak
on 09/07/2014, 01:59:15 UTC
"However, even if that was fixed, you still need the previous TxOut scripts in order to execute signing, which have to be retrieved from the blockchain -- again something else that Armory's TxDP structure bundles with it, but a raw unsigned tx from Bitcoin Core does not have."

I think  you could make an additional query to the blockchain from bitcoin-core to find this info, AFAIK that is what we are doing now, but the answer to the above question is basically Armory has metadata that has to be fetched while online first, if going from bitcoin-core tx -> Armory tx

etothepi, could you let us know what exactly that info is?

https://github.com/bitcoin/bips/blob/master/bip-0010.mediawiki

With multi-sig coming, that whole message format changed, and BIP 10 is obsolete.  But at least right now, everything you need to know is there.  It's "draft" because I was the only one doing offline tx and no one wanted to contribute to making a  standard out of it.

The new version for multi-sig also natively handles offline tx (it's just a 1-of-1 "multi"-sig).  I'll document it once design flux settles down.

Hi. I don't mean to necro-bump! I'm trying to implement bip-0010 with no signing and no multi-sig. Here's what I have now (Python 3):

Code:
txdp = []                                                           
dpid = base58_encode(hashlib.sha256(unsigned_tx).digest())[:8]     
txdp.append(('-----BEGIN-TRANSACTION-' + dpid + '-----').ljust(80,'-'))
                                                                               
magic_bytes = binascii.hexlify(config.MAGIC_BYTES).decode('utf-8') 
varIntTxSize = binascii.hexlify(len(unsigned_tx).to_bytes(2, byteorder='big')).decode('utf-8')
txdp.append('_TXDIST_{}_{}_{}'.format(magic_bytes, dpid, varIntTxSize))
tx_list = unsigned_tx_hex                                           
for coin in inputs:                                                 
        tx_list += get_raw_transaction(coin['txid'], json=False)       
for byte in range(0,len(tx_list),80):                               
        txdp.append(tx_list[byte:byte+80] )                             
                                                                               
for index, coin in enumerate(inputs):                               
        index_fill = str(index).zfill(2)                               
        value = '{0:.8f}'.format(coin['amount'])                       
        txdp.append('_TXINPUT_{}_{}'.format(index_fill, value))         
                                                                               
txdp.append(('-----END-TRANSACTION-' + dpid + '-----').ljust(80,'-'))
output = '\n'.join(txdp)                                   

And here is some example output:
Code:
-----BEGIN-TRANSACTION-ENeepxUG-------------------------------------------------
_TXDIST_f9beb4d9_ENeepxUG_0164
0100000003f4c768004d9cbf49b408d6f25397a2a9cab849e5765acf50bea755c2ea434f8c000000
001976a914f8195d523aa0c10d9d20eca785041815257f3ec888acffffffffef3c6c5629ece542e9
1b1bd1e77608227c1609e55e1e644ed5767cc1118ed0aa000000001976a914f8195d523aa0c10d9d
20eca785041815257f3ec888acffffffff59f6458fbdb0b891318d04cab86972df09672a30cb14d8
a5869223e82fd50823000000001976a914f8195d523aa0c10d9d20eca785041815257f3ec888acff
ffffff03771e0000000000001976a914f8195d523aa0c10d9d20eca785041815257f3ec888ac771e
000000000000475121035bceeb417f25beaa28d133ee7b28faa1e4f5c2f76b8daf12c3fab1826171
8790211c434e545250525459000000000000000000000001000000001dcd65000000000052ae451b
0000000000001976a914f8195d523aa0c10d9d20eca785041815257f3ec888ac0000000001000000
0178671be6c7687711cb89f86855b4dda19b29c37e3400a93edabfb1340a06d231010000006a4730
44022014356ce70459773236bc5005128856342a8d8c74fc3c2d48ac7b1ca80ec259f402207492c2
e0816ce7bc15c61f649edfac504382ece9aace3f0a96664fae9bb443010121035bceeb417f25beaa
28d133ee7b28faa1e4f5c2f76b8daf12c3fab18261718790ffffffff036c2a0000000000001976a9
14f8195d523aa0c10d9d20eca785041815257f3ec888ac6c2a000000000000475121035bceeb417f
25beaa28d133ee7b28faa1e4f5c2f76b8daf12c3fab18261718790211c434e545250525459000000
000000000000062fac00000000000186a00000000052aebd92bf01000000001976a914f8195d523a
a0c10d9d20eca785041815257f3ec888ac00000000010000000176ebe92afc372a7ce8f6d5ca18c6
fc801ebd1671f5894b2513453e183de191df020000006b483045022100e876eebed951dd4c7f6076
bf3df9a91c276e1ad6538e65ea0c2a4e44d849799d02203b50c8ce3fbf440b94fb6cb028f7be49c7
5595111787e7fdaf841118eccf21520121035bceeb417f25beaa28d133ee7b28faa1e4f5c2f76b8d
af12c3fab18261718790ffffffff036c2a0000000000001976a914f8195d523aa0c10d9d20eca785
041815257f3ec888ac6c2a000000000000475121035bceeb417f25beaa28d133ee7b28faa1e4f5c2
f76b8daf12c3fab18261718790211c434e545250525459000000000000000000000001000000001d
cd65000000000052aec1168900000000001976a914f8195d523aa0c10d9d20eca785041815257f3e
c888ac0000000001000000014dc91b94b0812f68c4df320ace1b061310aa30b8e26a161318bf6686
22b24c5e040000006a47304402207fc35dfea6232a859f80009d285e14b60df33f1f585bb4c2775a
8961752a7d3d022025cbe954f9edea01bca313a08a73948a4b86f587d9612ad177dc88730032738d
0121035bceeb417f25beaa28d133ee7b28faa1e4f5c2f76b8daf12c3fab18261718790ffffffff03
6b2a0000000000001976a914f8195d523aa0c10d9d20eca785041815257f3ec888ac6b2a00000000
0000475121035bceeb417f25beaa28d133ee7b28faa1e4f5c2f76b8daf12c3fab18261718790211c
434e545250525459000000000000000000000001000000001dcd65000000000052aec8dc85000000
00001976a914f8195d523aa0c10d9d20eca785041815257f3ec888ac00000000
_TXINPUT_00_0.00010860
_TXINPUT_01_0.00010860
_TXINPUT_02_0.00010859
-----END-TRANSACTION-ENeepxUG---------------------------------------------------


When I paste this into Armory, running offline with --debug, I don't get any error messages except the following:

Code:
X Error: BadMatch (invalid parameter attributes) 8
  Major opcode: 42 (X_SetInputFocus)
  Resource id:  0x2600043

The signing window reads only "Unrecognized!". Thoughts on what I'm doing wrong? (It must be something obvious.) Any help would be greatly appreciated!