Post
Topic
Board Beginners & Help
Re: Can someone tell me which is the most secure of the offline wallets?
by
Muhammed Zakir
on 20/02/2015, 14:39:56 UTC
My bad, mixed up armory with electrum somehow. Thanks for correcting.

You are welcome! Converting raw TX to Armory raw TX - not tested:

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.

Any suggestions to the script are welcome (and feel free to add this to the armory extras folder):

Code:
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()

Bitcoin core can sign raw tx using the RPC console so blockchain isn't really required since you can still spend them by signing and broadcasting the transaction.

To get a list of unspent TX outputs(UTXO) with details, you can use block explorer APIs. Recommended : https://blockchain.info/unspent?address=your_address&format=json or http://btc.blockr.io/api/v1/address/unspent/your_address.

Eg:- https://blockchain.info/unspent?address=1MZakirz92c76pK6BNy1NAEmbWYpDcP7mh&format=json or http://btc.blockr.io/api/v1/address/unspent/1MZakirz92c76pK6BNy1NAEmbWYpDcP7mh will show UTXOs of my address.

If you want to get a human-friendly UI, change 'json' to 'html' in Blockchain.info, i.e., https://blockchain.info/unspent?address=your_address&format=html, for mine : https://blockchain.info/unspent?1MZakirz92c76pK6BNy1NAEmbWYpDcP7mh&format=html.

For help, see https://people.xiph.org/~greg/signdemo.txt. More about the words in raw TX:

Each unspent output in the list will have:
  • txid = The transactionID of the transaction that sent you the bitcoins
  • vout = The output index to the specific output from that transaction that sent you the bitcoins
  • scriptPubKey = Not important for our current purpose, but sets up the requirements for spending the output
  • amount = the amount of bitcoins the output would contribute to a transaction if it is used as an input
  • confirmations = the number of confirmations received on the output so far

   -MZ