jgarzik
commented at 7:51 PM on November 4, 2014:
contributor
No objection to outputting the hash somewhere. The norm is providing the txid and hex-encoded TX in JSON output.
Providing the hash as a key=value line separate from the hex-encoded output is a bit odd.
mruddy
commented at 8:33 PM on November 4, 2014:
contributor
Thanks for the feedback.
I agree, it's a little awkward. My main reason for the key-value pair was to make sure that users did not think that the hex-encoded hash was part of the hex-encoded transaction. I can bring it all onto one line since it's a new flag that won't break anybody yet.
Three options that come to mind:
Like Jeff said: {"txid":"hex tx hash", "tx":"hex tx"}
hex tx,hex tx hash
tx=hex tx,txid=hex tx hash
Option 1 is clean and makes sense to look at.
Option 2 is easier to command line script (e.g.- use "cut" instead of going to python, ruby, etc...).
Option 3 is a mix.
I kind of like option 2 for scripting ease, but it's not a strong preference.
I'll update to use Jeff's idea (option 1) if I don't get any conflicting feedback within a few hours.
jgarzik
commented at 8:57 PM on November 4, 2014:
contributor
Another option is "-hash" command line option, which only outputs the hash. That turns some operations into a two-step process, but is clean and util-friendly. No 'cut' or 'awk' required.
mruddy
commented at 10:15 PM on November 4, 2014:
contributor
Good idea Jeff! I've incorporated both of your inputs. Now, there is a "-hash" that outputs only the computed transaction hash. There is also a new "-hexhash" that creates the JSON formatted output containing both the hex-encoded transaction and the hex-encoded transaction id. I like this updated commit much more than my original submission.
jgarzik
commented at 10:21 PM on November 4, 2014:
contributor
For the latter, I would recommend simply modifying the "-json" output to include the txid and hex-encoded tx.
That then mirrors what bitcoind produces in some of its output, such as 'getrawtransaction' when 'verbose' flag is true.
mruddy
commented at 11:11 PM on November 4, 2014:
contributor
Ah, cool, I wasn't aware of that, even better.
I looked at getrawtransaction and this latest commit changes course a bit in order to be consistent with that.
Now, there are -txid and -verbose options instead of -hash and -hexhash.
The -txid is the case where we only show the hex-encoded transaction id/hash.
The -verbose option now simply adds the "hex" member to the JSON output. This also makes the "-verbose" flag available for expansion later.
jgarzik
commented at 11:13 PM on November 4, 2014:
contributor
I think we are pretty close. Consider that bitcoind interprets "verbose" as implying the entire JSON output. i.e. "not verbose" is the hex-encoded binary form.
Therefore, (1) -txid as you have it and (2) added "hex" to JSON output should be sufficient. No need for an additional -verbose.
mruddy
commented at 11:29 PM on November 4, 2014:
contributor
OK, what I hear you saying is that requesting JSON output is synonymous with requesting verbose output in this context. Sounds fine, commit updated.
jgarzik
commented at 11:34 PM on November 4, 2014:
contributor
Looks good to me. Wait a bit for others' comments (if any), rebase into a single commit, and we're done.
bitcoin-tx: Add the "-txid" option. Also add the hex-encoded transaction to the JSON output as the "hex" property.84877904c0
mruddy force-pushed on Nov 5, 2014
mruddy renamed this: bitcoin-tx: Add option to include computed transaction hash in output bitcoin-tx: Add the "-txid" option and add hex-encoded transaction to JSON on Nov 5, 2014
mruddy
commented at 3:31 AM on November 5, 2014:
contributor
Cool, re-based, should be good to go. Thanks for the help and feedback!
jgarzik
commented at 3:34 AM on November 5, 2014:
contributor
ut ACK -- looks good to me
mruddy
commented at 4:01 PM on November 7, 2014:
contributor
Anything else I need to do to get this request merged in? Thanks!
jgarzik
commented at 4:10 PM on November 7, 2014:
contributor
@mruddy Nothing on your side, besides waiting. We need another dev to ACK it, as we require multiple reviews before merging non-trivial patches.
gmaxwell
commented at 7:13 PM on November 8, 2014:
contributor
ACK
sipa
commented at 4:17 PM on November 17, 2014:
member
utACK
laanwj added the label Improvement on Dec 5, 2014
laanwj merged this on Dec 5, 2014
laanwj closed this on Dec 5, 2014
laanwj referenced this in commit 7d42644dda on Dec 5, 2014
This is a metadata mirror of the GitHub repository
bitcoin/bitcoin.
This site is not affiliated with GitHub.
Content is generated from a GitHub metadata backup.
generated: 2026-04-22 06:15 UTC
This site is hosted by @0xB10C More mirrored repositories can be found on mirror.b10c.me