Author

Topic: Trouble preparing raw transactions (Read 2111 times)

jr. member
Activity: 34
Merit: 4
May 12, 2016, 08:39:19 AM
#20
Hello, this is my first post. I am posting here because this is exactly the topic I need help in. If necesary I will start a new thread.

I have successfully managed to prepare and sign raw transactions using Coinb.in and broadcast them. I would like instructions on using bitcoin-tx. So far I have managed to get the raw hex output for an unsigned transaction from bitcoin-tx and get it signed using Coinb.in, but this is ugly and I would like to do the signing part also using bitcoin-tx.
newbie
Activity: 24
Merit: 3
February 28, 2016, 04:40:30 PM
#19
Thank you for your help.

There is Electrum and Armory that support offline signing.  Armory is no longer being actively developed, plus it has a lot of dependencies and I haven't been able to get it to build on raspbian.  Electrum I have, but it isn't clear at all how to do the offline signing without creating a wallet/importing the private key into the online version.  Also I don't like Electrum's mnemonic seed inner-workings (it uses a hash of the words you type rather than map the words to a wordlist, also a non-standard wordlist).  Also Electrum has a lot of dependencies as well.

Signing offline is a requirement for cold storage.  There should be a foolproof user-friendly way to do it, and there isn't.
It's rather disappointing.

legendary
Activity: 1890
Merit: 1086
Ian Knowles - CIYAM Lead Developer
February 28, 2016, 01:45:27 PM
#18
You might want to try one of the wallets that offers "cold storage" as a feature (am pretty sure at least a couple of those exist) and the other thing that might be suitable for you is a hardware device (such as the Trezor).

I understand that dealing with raw txs is "not for the average person" and agree that if you are at all worried about doing that then it would probably be best not to (hopefully at least you've learned a little more about how Bitcoin works at the lower-level although perhaps that is more than you really wanted to learn about that).

I created the CIYAM Safe as a means to securely do "cold storage" and it does work well but it isn't very user friendly (as you're finding out). If someone wanted to help improve the UX then maybe it could be turned into something you'd actually want to use (but unfortunately I am far too busy to do more work on that at the moment).
newbie
Activity: 24
Merit: 3
February 28, 2016, 01:41:53 PM
#17
I'm not familiar with the other tool - but unless there was a copy and paste error that would seemingly indicate the UTXO was somehow non-standard (is it supposed to just be a simple P2PKH UTXO we are talking about?).

It didn't work with the other script hash either.

This all seems rather complicated to be fool-proof.  The point being is to be able to handle larger amounts of funds down the line, and without a tool to be able to create and sign transactions offline, I feel there is no way to use bitcoin as securely as I'd like.

Having to use bitcoin-cli as a requisite for this tool makes me wonder why not just use the wallet software itself.  Unfortunately I've already tried that also and is not straightforward.

legendary
Activity: 1890
Merit: 1086
Ian Knowles - CIYAM Lead Developer
February 28, 2016, 01:19:05 PM
#16
I'm not familiar with the other tool - but unless there was a copy and paste error that would seemingly indicate the UTXO was somehow non-standard (is it supposed to just be a simple P2PKH UTXO we are talking about?).

newbie
Activity: 24
Merit: 3
February 28, 2016, 01:16:20 PM
#15
You'll need to use bitcoin-qt at least in order to execute the "createrawtransaction" command (that webpage can't create a raw tx itself) and yes it is just the hex string after the HASH160 that is what you need for the "Script Public Key" field.

Just tried it all with the coinb.in tool, but I think I got the script field wrong.
I get:

! 64: scriptsig-not-pushonly

...when I try to push the signed transaction.

legendary
Activity: 1890
Merit: 1086
Ian Knowles - CIYAM Lead Developer
February 28, 2016, 01:11:11 PM
#14
Still trying to figure this part out.  But I'm trying to stay away from bitcoin-cli, and just with info from blockchain.info for now.
There is only one script field for my one input, so it's just the hash160 part in the middle from that txid?  trying....

You'll need to use bitcoin-qt at least in order to execute the "createrawtransaction" command (that webpage can't create a raw tx itself) and yes it is just the hex string after the HASH160 that is what you need for the "Script Public Key" field (conveniently you can just double click on it to highlight it for copying and pasting).

The final result will be a "signrawtransaction" command which you would then feed into your offline Bitcoin software (that has the private key).

The QR code stuff is not necessary (but is arguably the most secure way that you can move the "signrawtransaction" information from online to offline).

If not using QR codes then you'd most likely want to perhaps use a new USB flash drive to move the information (remembering also that you'll need to move the signed raw transaction hex code back).

You can push the signed raw transaction using: https://blockchain.info/pushtx
newbie
Activity: 24
Merit: 3
February 28, 2016, 01:08:29 PM
#13
You would then copy and paste that hex response into the Raw Tx field below and now we come to the Script Public Key part.

To find that we go back to the blockchain.info tx page and scroll down to the Output Scripts part (at the bottom of the page) where you see the following:

Code:
OP_DUP OP_HASH160 06c1991c6466a550b66931ea48970cfd17ff51b3 OP_EQUALVERIFY OP_CHECKSIG
OP_DUP OP_HASH160 a0f6c5d380117dfdbacb3eee969905553868e74d OP_EQUALVERIFY OP_CHECKSIG

You simply copy and paste from the first output (which is vout 0) the hex stuff in the middle (so 06c1991c6466a550b66931ea48970cfd17ff51b3) and then click on the "Sign Raw Transaction Info" button to create the "signrawtransaction" command.

Still trying to figure this part out.  But I'm trying to stay away from bitcoin-cli, and just with info from blockchain.info for now.
There is only one script field for my one input, so it's just the hash160 part in the middle from that txid?  trying....

legendary
Activity: 1890
Merit: 1086
Ian Knowles - CIYAM Lead Developer
February 28, 2016, 01:06:08 PM
#12
What goes in 'script'?  Where do I get that?

Read above (I edited it - sorry it takes a bit of time to explain properly).

This is all kinda complicated and too much room for error.  If I don't specify a 2nd output, for example, the remaining balance gets spent on the transaction fee accidently.

Indeed this is a very simplistic approach that only expects to use one output (so whatever input value that is not sent to the output is the fee amount).
newbie
Activity: 24
Merit: 3
February 28, 2016, 01:01:55 PM
#11
Now that is what you'd then need to copy and paste into the bitcoin-qt Help->Debug Window->Console window in order to get the raw transaction hex bytes (or use bitcoin-cli to execute the same command).

What goes in 'script'?  Where do I get that?

This is all kinda complicated and too much room for error.  If I don't specify a 2nd output, for example, the remaining balance gets spent on the transaction fee accidently.

legendary
Activity: 1890
Merit: 1086
Ian Knowles - CIYAM Lead Developer
February 28, 2016, 12:56:34 PM
#10
If we fill in the remaining fields at the top of the helper page with 1BTCeX2cQJCgWFttvoWQWPfBaY7dKFNu3v as the Destination Address and 0.01 as the Amount of BTC to Send and then click on the Create Raw Transaction Command button you'll see the following appear below that button:

Code:
createrawtransaction "[{\"txid\":\"135e55010a9caccd412d2c793a18236e9eebbb38412e97dca2b09aa8c354e1c0\",\"vout\":0}]" "{\"1BTCeX2cQJCgWFttvoWQWPfBaY7dKFNu3v\":0.01}]"

Now that is what you'd then need to copy and paste into the bitcoin-qt Help->Debug Window->Console window in order to get the raw transaction hex bytes (or use bitcoin-cli to execute the same command).

You would then copy and paste that hex response into the Raw Tx field below and now we come to the Script Public Key part.

To find that we go back to the blockchain.info tx page and scroll down to the Output Scripts part (at the bottom of the page) where you see the following:

Code:
OP_DUP OP_HASH160 06c1991c6466a550b66931ea48970cfd17ff51b3 OP_EQUALVERIFY OP_CHECKSIG
OP_DUP OP_HASH160 a0f6c5d380117dfdbacb3eee969905553868e74d OP_EQUALVERIFY OP_CHECKSIG

You simply copy and paste from the first output (which is vout 0) the hex stuff in the middle (so 06c1991c6466a550b66931ea48970cfd17ff51b3) and then click on the "Sign Raw Transaction Info" button to create the "signrawtransaction" command.
newbie
Activity: 24
Merit: 3
February 28, 2016, 12:55:10 PM
#9
(hope you are still with me this far)

...folowing you in realtime.  Trying it now!

legendary
Activity: 1890
Merit: 1086
Ian Knowles - CIYAM Lead Developer
February 28, 2016, 12:50:15 PM
#8
Assuming you've done this you'll notice this:

Code:
1ciyam3htJit1feGa26p2wQ4aw6KFTejU (CIYAM Pty. Ltd. ) - (Unspent) 0.01317234 BTC
1Fg6jmMWbyr7QWKo8QLprcHb392NUc6s5x - (Spent) 0.49262766 BTC

Which identifies a UTXO of 0.01317234 for the 1ciyam address.

Because that UTXO is the "first output" then its "vout" number is 0 (if the second one was the unspent output then its vout would be 1).

The txid is 135e55010a9caccd412d2c793a18236e9eebbb38412e97dca2b09aa8c354e1c0 for this tx (you can copy and paste that from blockchain.info).

So back in the "helper" page we paste in the txid where it asks for:

Code:
Enter 'txid':

and we type in 0 where it asks for:

Code:
Unspent Output 'vout' #:

(hope you are still with me this far)
legendary
Activity: 1890
Merit: 1086
Ian Knowles - CIYAM Lead Developer
February 28, 2016, 12:41:39 PM
#7
And seriously, I am puzzled.  Does no one sign transactions offline anymore?

I do that (using my own tools) - so as you asked I'll try to explain the usage of http://ciyam.org/rawtx_helper.html for you (which might help with your usage of other such tools as well).

Firstly you need to understand that the key thing about being sent bitcoins is that "you are not being sent coins" but instead what are called UTXOs (Unspent TX Outputs).

You could perhaps consider these as being more like "cheques" than coins (in that the value of them can be any value but not in the sense of having to worry that they might "bounce").

To give you some illustration of what I mean please look at the following: https://blockchain.info/address/1ciyam3htJit1feGa26p2wQ4aw6KFTejU (these are the txs from the 1ciyam address in my sig).

So if you had been sent "coins" to an address then you could type that address into a website like blockchain.info to come up with a similar looking set of txs.

The next thing is to look at a particular tx such as this one: https://blockchain.info/tx/135e55010a9caccd412d2c793a18236e9eebbb38412e97dca2b09aa8c354e1c0 and to see the full details there is a "Show scripts & coinbase" link you can click on (on the RHS - last line of the Inputs and Outputs table).
newbie
Activity: 24
Merit: 3
February 28, 2016, 12:31:03 PM
#6
It does assume a fair degree of knowledge about Bitcoin (sorry) but I'll try and help explain it to you here if you like (it was created for the CIYAM Safe but actually can be used without it).

The coinb.in transaction page is the same, also requiring these same fields under inputs.
Also no documentation that I can find on what to put in them.

I would definitely like to know where to copy-and-paste these fields from/to.  I'm assuming the txid(s) are all the transaction IDs that originally fed bitcoins to the originating address.  But what goes in the transaction input number/voit and script fields?

And isn't there something simpler out there?  I am willing to prepare the transaction online, so there should be a tool.  Like the strongcoin example I pointed out which I presume used to work...

And seriously, I am puzzled.  Does no one sign transactions offline anymore?

legendary
Activity: 1890
Merit: 1086
Ian Knowles - CIYAM Lead Developer
February 28, 2016, 03:17:49 AM
#5
It does assume a fair degree of knowledge about Bitcoin (sorry) but I'll try and help explain it to you here if you like (it was created for the CIYAM Safe but actually can be used without it).
legendary
Activity: 1176
Merit: 1134
February 28, 2016, 03:13:40 AM
#4
You might want to look at the bitcoin-tx utility (that was fairly recently added to Bitcoin).

If you are dealing with a very simple tx (i.e. just the one UTXO) then you might find this helpful also: http://ciyam.org/rawtx_helper.html (it still requires using bitcoin-cli or the debug console in bitcoin-qt to issue the "createrawtransaction" command but might make the process easier for you).

I saw this, but I have no idea how to use it.  Are there instructions?
It seems more complicated than it should be.  Which transaction id (txid)?  What do you put in Unspent Output 'vout' #?  Script Public Key?

After reviewing the site for instructions, I thought it was related to a product which I didn't have so I disregarded it, because what I am looking for seems like it should be more straightforward.


https://coinb.in/#newTransaction
newbie
Activity: 24
Merit: 3
February 28, 2016, 03:09:48 AM
#3
You might want to look at the bitcoin-tx utility (that was fairly recently added to Bitcoin).

If you are dealing with a very simple tx (i.e. just the one UTXO) then you might find this helpful also: http://ciyam.org/rawtx_helper.html (it still requires using bitcoin-cli or the debug console in bitcoin-qt to issue the "createrawtransaction" command but might make the process easier for you).

I saw this, but I have no idea how to use it.  Are there instructions?
It seems more complicated than it should be.  Which transaction id (txid)?  What do you put in Unspent Output 'vout' #?  Script Public Key?

After reviewing the site for instructions, I thought it was related to a product which I didn't have so I disregarded it, because what I am looking for seems like it should be more straightforward.

legendary
Activity: 1890
Merit: 1086
Ian Knowles - CIYAM Lead Developer
February 28, 2016, 02:59:08 AM
#2
You might want to look at the bitcoin-tx utility (that was fairly recently added to Bitcoin).

If you are dealing with a very simple tx (i.e. just the one UTXO) then you might find this helpful also: http://ciyam.org/rawtx_helper.html (it still requires using bitcoin-cli or the debug console in bitcoin-qt to issue the "createrawtransaction" command but might make the process easier for you).
newbie
Activity: 24
Merit: 3
February 28, 2016, 02:55:40 AM
#1
I'd like to be able to prepare transactions and sign them offline.  I believe I can sign and broadcast the transaction once I have it, but I have yet to find a tool to prepare a raw transaction.  The closest I've seen after days of searching is this tool, which looks like it hasn't been maintained since 2011.  But it is the general idea of what I am looking for:  a simple tool which does not depend on electrum/armory/whatever wallet software with too many dependencies.  Bitcoin Core dependency is ok, so long as it doesn't require the private key to prepare the transaction, but I suspect this is not possible (or at least not documented).

After researching this topic which must have been asked a thousand times, I cannot find anything recent that still works.  It seems offline transaction preparation and signing would be crucial to bitcoin operations, so I am puzzled why there no longer appears to be anything manual out there.  How are people doing this these days?  (excluding hardware wallets, electrum, or armory?)

Jump to: