Bitcoin Forum
May 06, 2024, 03:54:19 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Trouble preparing raw transactions  (Read 2087 times)
charlton (OP)
Newbie
*
Offline Offline

Activity: 24
Merit: 3


View Profile
February 28, 2016, 07:55:40 AM
Merited by ABCbits (2)
 #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?)

1715010859
Hero Member
*
Offline Offline

Posts: 1715010859

View Profile Personal Message (Offline)

Ignore
1715010859
Reply with quote  #2

1715010859
Report to moderator
"With e-currency based on cryptographic proof, without the need to trust a third party middleman, money can be secure and transactions effortless." -- Satoshi
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
CIYAM
Legendary
*
Offline Offline

Activity: 1890
Merit: 1075


Ian Knowles - CIYAM Lead Developer


View Profile WWW
February 28, 2016, 07:59:08 AM
Merited by ABCbits (1)
 #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).

With CIYAM anyone can create 100% generated C++ web applications in literally minutes.

GPG Public Key | 1ciyam3htJit1feGa26p2wQ4aw6KFTejU
charlton (OP)
Newbie
*
Offline Offline

Activity: 24
Merit: 3


View Profile
February 28, 2016, 08: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.

jl777
Legendary
*
Offline Offline

Activity: 1176
Merit: 1132


View Profile WWW
February 28, 2016, 08: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

http://www.digitalcatallaxy.com/report2015.html
100+ page annual report for SuperNET
CIYAM
Legendary
*
Offline Offline

Activity: 1890
Merit: 1075


Ian Knowles - CIYAM Lead Developer


View Profile WWW
February 28, 2016, 08: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).

With CIYAM anyone can create 100% generated C++ web applications in literally minutes.

GPG Public Key | 1ciyam3htJit1feGa26p2wQ4aw6KFTejU
charlton (OP)
Newbie
*
Offline Offline

Activity: 24
Merit: 3


View Profile
February 28, 2016, 05: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?

CIYAM
Legendary
*
Offline Offline

Activity: 1890
Merit: 1075


Ian Knowles - CIYAM Lead Developer


View Profile WWW
February 28, 2016, 05: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).

With CIYAM anyone can create 100% generated C++ web applications in literally minutes.

GPG Public Key | 1ciyam3htJit1feGa26p2wQ4aw6KFTejU
CIYAM
Legendary
*
Offline Offline

Activity: 1890
Merit: 1075


Ian Knowles - CIYAM Lead Developer


View Profile WWW
February 28, 2016, 05: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)

With CIYAM anyone can create 100% generated C++ web applications in literally minutes.

GPG Public Key | 1ciyam3htJit1feGa26p2wQ4aw6KFTejU
charlton (OP)
Newbie
*
Offline Offline

Activity: 24
Merit: 3


View Profile
February 28, 2016, 05:55:10 PM
 #9

(hope you are still with me this far)

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

CIYAM
Legendary
*
Offline Offline

Activity: 1890
Merit: 1075


Ian Knowles - CIYAM Lead Developer


View Profile WWW
February 28, 2016, 05: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.

With CIYAM anyone can create 100% generated C++ web applications in literally minutes.

GPG Public Key | 1ciyam3htJit1feGa26p2wQ4aw6KFTejU
charlton (OP)
Newbie
*
Offline Offline

Activity: 24
Merit: 3


View Profile
February 28, 2016, 06: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.

CIYAM
Legendary
*
Offline Offline

Activity: 1890
Merit: 1075


Ian Knowles - CIYAM Lead Developer


View Profile WWW
February 28, 2016, 06: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).

With CIYAM anyone can create 100% generated C++ web applications in literally minutes.

GPG Public Key | 1ciyam3htJit1feGa26p2wQ4aw6KFTejU
charlton (OP)
Newbie
*
Offline Offline

Activity: 24
Merit: 3


View Profile
February 28, 2016, 06: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....

CIYAM
Legendary
*
Offline Offline

Activity: 1890
Merit: 1075


Ian Knowles - CIYAM Lead Developer


View Profile WWW
February 28, 2016, 06: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

With CIYAM anyone can create 100% generated C++ web applications in literally minutes.

GPG Public Key | 1ciyam3htJit1feGa26p2wQ4aw6KFTejU
charlton (OP)
Newbie
*
Offline Offline

Activity: 24
Merit: 3


View Profile
February 28, 2016, 06: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.

CIYAM
Legendary
*
Offline Offline

Activity: 1890
Merit: 1075


Ian Knowles - CIYAM Lead Developer


View Profile WWW
February 28, 2016, 06: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?).


With CIYAM anyone can create 100% generated C++ web applications in literally minutes.

GPG Public Key | 1ciyam3htJit1feGa26p2wQ4aw6KFTejU
charlton (OP)
Newbie
*
Offline Offline

Activity: 24
Merit: 3


View Profile
February 28, 2016, 06: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.

CIYAM
Legendary
*
Offline Offline

Activity: 1890
Merit: 1075


Ian Knowles - CIYAM Lead Developer


View Profile WWW
February 28, 2016, 06: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).

With CIYAM anyone can create 100% generated C++ web applications in literally minutes.

GPG Public Key | 1ciyam3htJit1feGa26p2wQ4aw6KFTejU
charlton (OP)
Newbie
*
Offline Offline

Activity: 24
Merit: 3


View Profile
February 28, 2016, 09: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.

cyberguy
Jr. Member
*
Offline Offline

Activity: 34
Merit: 4


View Profile WWW
May 12, 2016, 01:39:19 PM
 #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.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!