-
Notifications
You must be signed in to change notification settings - Fork 127
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adds transaction example #937
Conversation
Each hex digit is a nibble (4 bits), so 2 bytes takes 4 hex digits. The version is indeed Along the same lines, regarding the |
So how is the verision =
I believe this was my reasoning/rationalization for my guesswork. |
That's the transaction version. The script version is a different version. |
A couple of things:
|
Added variable to table:
I found that confusing as well, have removed. Was just following the convention in the block header example. Do we want to get rid of the commas there too? |
@davecgh with the changes made per above comment, I think we're close to a workable example. However, wondering if more can/should be documented here. Personally, I'd like to understand Decred's transactions at a lower level. E.g. how the variable length integers are parsed. I think this could be valuable to other developers as well. But I'm wondering what questions we're getting from developers specifically, and what are they trying to do generally. Presumably they need to be able to a) parse transactions and b) construct transactions. But what types of transactions? At what level of abstraction? Do we need to document stakebase and other types of transactions? What is Decred-specific, and what is already covered by the Bitcoin dev docs transaction guide? Also, do we want to do a diagram, like this one from the Bitcoin dev guide (which is an open source SVG if we want to start with this)? |
Commas are acceptable between each byte (2 hex digits), but there was something strange about how they were formatted such that is was non-standard and confusing. |
An SVG diagram would be helpful I think. As far as the other questions, all transactions follow the format specified here. Votes, Ticket Purchases, etc, are merely specific incantations of them. |
I believe this (public domain) diagram from the Bitcoin wiki could be easily modified for our purposes, I am wondering if this text from the diagram is true for Decred as well?
Also, this may be totally enough for this page. However, when I pretend to be a developer looking at this, I still have questions. What are the rules for encoding different types of transactions? What is the byte map for specific types of scripts? Are they the same as Bitcoin, or are they different? Can I just use Bitcoin documentation for this? What types of scripts are supported? What is the byte map for Decred-specific transactions (e.g. transactions for buying, voting, and revoking tickets)? Do they follow some rules? Do I just need to look to the source code for answers to these questions? |
The bit about script and DER encoding using big-endian values is correct. Regarding the rest, that is way too much to put into a general transaction specification imo. What you're discussing is separate sections which discuss the various types of standard transactions and scripts. |
Tried and failed to come up with a simple way to word this. Realized that this is already painstakingly documented for Bitcoin transactions, and that if we're not doing anything different (at this level of abstraction anyway), it's probably not worth re-documenting here.
For this page, you're probably right. I do still think it's useful to provide more documentation/explanation of Decred-specific transactions (e.g. stakebase transactions). But that doesn't need to be this page. Perhaps for this PR, we should just stop here and do a final round of review on what we have so far?
|
I agree that it would be useful to document each one for sure, but I just don't think it belongs in the general transaction specification. They are strictly subsets of generalized transactions. |
In terms of review, the section at the bottom doesn't appear formatted correctly. |
Agreed, we probably don't want to put any more detail in the general transaction specification. Have proposed documenting Decred-specific transactions further in an Issue to gather feedback on the idea. Table formatting is fixed. Markdown formatting is limited (e.g. no merged cells) so had to convert to html to get something more readable. |
Already discussed on matrix, but the table formatting is still not correct on some browsers such as Firefox. |
Ok fixed table formatting for Firefox. Turns out this is a common problem, which gets into some thorny CSS issues. I ended up just hard-coding the text wrapping for cells with long strings; the other, more elegant solutions from SO weren't working. Is this hacky CSS OK? Have tested on Brave, Chrome, Firefox and Safari and rendering fine on all now. |
Still looks broken to me in FF 66.0.5. |
@davecgh have implemented all your suggested changes, as well as tweaked the formatting to accommodate some of the new long strings (working on FF as well). My only outstanding question is on the Signature Script description (in comment on suggestion). |
I still see several unaddressed review items. They are collapsed. |
Are there wrongly resolved comments? Have addressed the outstanding comments I can see. |
Reviewed updates, resolved relevant comments, and answered questions. If you look, there is a "7 hidden conversations" in the middle where the review comments are hidden until you click the "Load more...". Those are the unaddressed items I was referring to. |
Found the "7 hidden conversations" in the middle, but when I click on them it just expands to show already resolved changes :/ Do you see any unresolved changes still on your end? I hate this UI feature. |
I resolved them because you addressed them in the latest commit. I approved the PR already. |
Cool. Thx for the thorough review/patience on this one 👍 |
Adds an example transaction to the Transaction Details page ( Closes #765 ).
Note: the transaction fields were broken down according to the example tx provided in #765 by @davecgh, and when parsing the data I ended up moving a couple bytes around. E.g.
script version
in the example was0000
, but the docs say this is a two byte field, so have used00
and moved the subsequent00
into the next field (script length
). There are also a couple fields that need double checking, such aspublic key signature length
(hex evaluating to 25, though looks like the script has 50 bytes?) andsignature script length
.Also, the markdown table is a bit wonky, due to the fact that markdown doesn't support spanning cells. Can tweak the formatting with inline html, but wanted to get a first pass review on the current table first. We could also just use text formatting like we do for the block header example.
Also, do we want to paste a link to the full decoded tx JSON?
https://explorer.dcrdata.org/api/tx/decoded/a58389bd42520a9b9ecbae5432e27b91fde74d2f8e74ac6f8c22cda57b8ae348?indent=true