Quick question:
I was wondering if it was possible to sign an unsigned transaction (hex encoded) essentially produced by bitcoind's createrawtransaction (i.e. long hex string starting with 010000000) in offline armory, assuming that my offline armory wallet has the necessary private keys of course.
I tried producing one using and pasting it into armory's Sign and/or Broadcast Transaction text box, but it says "Unrecognized", along with "Transaction data is invalid and cannot be shown". The txn is valid (if signed in bitcoind it will broadcast fine, and it decodes properly with
https://blockchain.info/decode-tx). I've noticed the format that armory appears to produce for its raw transactions has header and footer lines, as well as _TXDIST/_TXINPUT, and the hex encoded transaction is wrapped at a certain line width. Do I need to somehow encode the raw bitcoin transaction to match this form for armory to be able to work with it?
Thanks!
EDIT: So I figured it out and wrote a script to do this, which will take a bitcoind hex raw txn and convert to an armory style txn, which should be good for signing and/or broadcasting (if already signed) I would think. I couldn't get the system path hack to fully work... it still complained about not being able to import a module in the jsonrpc folder. That being the case, you could just throw this script in /usr/lib/armory on the online armory box (with a full or watch-only wallet) and run it. Starts armory up, loads the blockchain, and spits out the armory-formatted txn.
Any suggestions to the script are welcome (and feel free to add this to the armory extras folder):
import sys
sys.path.append("/usr/lib/armory")
from armoryengine import *
#See https://bitcoinarmory.com/developers/python-scripting/
if len(sys.argv) != 3:
print "Please pass wallet file, followed by hex encoded unsigned raw txn"
sys.exit(2)
walletPath = sys.argv[1]
hexRawTxn = sys.argv[2]
wlt = PyBtcWallet().readWalletFile(walletPath)
# Register wallet and start blockchain scan
TheBDM.registerWallet(wlt)
TheBDM.setBlocking(True)
TheBDM.setOnlineMode(True) # will take 20 min for rescan
# Need "syncWithBlockchain" every time TheBDM is updated
wlt.syncWithBlockchain()
#Translate raw txn
pytx = PyTx()
print("Encoding raw txn: %s" % hexRawTxn)
binTxn = hex_to_binary(hexRawTxn)
pytx.unserialize(binTxn)
tx = PyTxDistProposal(pytx)
print("\n\nOutput is:\n%s" % tx.serializeAscii())
TheBDM.execCleanShutdown()