-
Notifications
You must be signed in to change notification settings - Fork 143
Tools: add crude calculator for transaction size #322
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
Tools: add crude calculator for transaction size #322
Conversation
|
I think it's fine to add this. I also agree that we shouldn't link to it until it's a bit more polished. One thing that I'd like to see added is documentation on how the values are calculated. |
I don't understand this. Is this more code documentation (I thought that was ok), more description about what fields are included in a transaction in the HTML output, or something else? |
More description in the html about how the values are calculated. |
bitschmidty
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tACK
Cool tool! Left a couple suggestion.
2ea75d6 to
9567b7b
Compare
|
Forced push, hopefully addressing all comments (including providing more information about how the values are calculated). Thanks for the reviews, @jnewbery and @bitschmidty! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@harding I think the legend is really informational. Im also using the table calcs in a presentation right now!
Resolved previous comments and added a few new ones.
0xB10C
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this.
en/tools/calc-size.md
Outdated
|
|
||
| <br> | ||
| Number of inputs: <input type="number" id="inputs" value="1" onchange="calculateTotal()"/><br> | ||
| Number of outputs: <input type="number" id="outputs" value="2" onchange="calculateTotal()"/> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| // TODO: maybe allow the input type to be different from the output | ||
| // type, or multiple inputs of different types (or multiple | ||
| // outputs of different types) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That would be cool! I might do a follow up PR that adds this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That'd be great! Also having someone work on this who actually knows JS would probably be very beneficial. :-)
e8ba382 to
0bbfd33
Compare
|
Force pushed some edits:
|
Oh, perhaps worth a dorky note, I think that if |
0bbfd33 to
6d0712c
Compare
|
tACK 6d0712c (Chrome, Safari, Firefox on macOS) |
0xB10C
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tAck 6d0712c
- tested in Firefox, Chrome and Chromium
- looked over the size definitions
- checked for dead links (automatically)
6d0712c to
d5d75cd
Compare
|
Pushed a single line edit to make the P2WSH 2-of-3 witness example more accurate and less confusing. |
d5d75cd to
a4b46e9
Compare
|
Looks great. Thanks Dave! |

This adds a crude Javascript-based transaction size calculator to
/en/tools/calc-size/. No links are added to the tool from other parts of the site and I'm not sure we should add any unless the tool is improved.However, I've found it good enough for my own use and I think it might help y'all when you're burdened with verifying my transaction size math in newsletter and workbook content. Future improvements can let it deal with a wider range of multisig variations, differing types of input and output scripts, non-keypath P2TR, uncompressed pubkeys, low-R signatures, LN onchain scripts, and other common transaction types.
That said, if you don't think this is a good fit for the Optech website, let me know and I can easily host it somewhere else.