Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
Already on GitHub? Sign in to your account
Add Developer Examples Page / New Example Transactions #442
Conversation
harding
and others
added some commits
May 30, 2014
|
Note: the preview site has been updated with the changes @saivann made through to ca7b38d. (Thanks Saïvann!) |
|
@harding I'm still slowly testing each part of the examples page and so far everything seems good! However I'd like to suggest the "Simple Raw Transaction" example to use two outputs (one for the payment, one for the change). Although your warning text after the example is crystal clear, I think the vast majority of transactions have to spend part of the UTXO in change outputs, so handling change outputs where it's not automagically done by the API seems like a prudent approach to me given the risk involved. |
|
@saivann the example immediately following, "Complex Raw Transaction", has two outputs (and two inputs). More importantly, it seems important to me to have a baseline simple-as-possible transaction before moving on to more complex examples. I explicitly make comparisons in several later parts of the text:
If you think it's necessary, we can add a Simple Two-Output Raw Tx subsection immediately between the Simple and Complex Raw Txes. Let me know. Thanks!, -Dave |
|
@harding Yes I saw that you tried to make this as simple as possible. Yet, my first impression is that we should accustom people with "Any |
|
@saivann I'm not a big fan of that. I personally almost always use createrawtransaction (CRT) without change outputs. For example, I often use CRT to fully respend one or more outputs so I can add a locktime or move multisig outputs to my P2PKH cold wallet. Although I'm not a fan of relying on it, it should be noted that sendrawtransaction will (by default) throw an error if you attempt to broadcast a transaction with what it considers an excessive fee. (That's in our RPC docs for sendrawtransaction.) I also still think keeping the examples simple is the most important reason not to add additional outputs to the simplest example. If users ignore our warning about using raw txes on mainnet, and ignore our advice to only use spendtoaddress, and ignore our warning about CRT not creating change outputs---then making our examples more complicated is unlikely to dissuade them anyway. Sorry to be stubborn about this. -Dave |
|
@saivann do you think a reasonable compromise would be to add a short one-line warning to each use of CRT about change outputs? For example a shell comment above each call:
|
Didn't know that, that's great! @harding OK I think it's fine, let's not make this a blocking issue. I didn't think my suggestion was making the example too complicate, but it is true that we have clear warning text about it (I will open a pull req to further increase visibility to these warning texts, maybe just this icon, but after this pull req is merged) |
harding
added some commits
Jun 8, 2014
saivann
added some commits
Jun 9, 2014
saivann
commented on an outdated diff
Jun 9, 2014
| +* An optional memo Charlie can send to Bob. (There's no guarantee that | ||
| + Bob will read it.) | ||
| + | ||
| +* A refund address (output script) which Bob can pay if he needs to | ||
| + return some or all of Charlie's satoshis. | ||
| + | ||
| +Bob's server receives the Payment message, verifies the transaction pays | ||
| +the requested amount to the address provided, and then broadcasts the | ||
| +transaction to the network. It also replies to the HTTP POSTed Payment | ||
| +message with a PaymentACK message, which includes an optional memo | ||
| +from Bob's server thanking Charlie for his patronage and providing other | ||
| +information about the order, such as the expected arrival date. | ||
| + | ||
| +Charlie's wallet sees the PaymentACK and tells Charlie that the payment | ||
| +has been sent. The PaymentACK doesn't mean that Charlie has actually | ||
| +paid Bob---see the Verifying Payment subsection below---but it does mean |
saivann
Contributor
|
|
@harding Just sent you a couple of additional pull requests. I noted that the ...And I didn't test links, did you test them, per chance? Otherwise, I've tested the whole Transaction examples subsection and this all LGTM. Really amazing work, which I'm sure will prove useful. Thanks!! |
harding
added some commits
Jun 9, 2014
|
@saivann updated with your patches and a version of the clarification you suggested. I also fixed the merge problem and used the makefile (which, whoops, never got PR'd) to check all the links. I think this addresses all known feedback, so if no critical feedback is received, I'll merge this around 18:00 UTC Tuesday. Edit: Preview updated: http://dg0.dtrt.org/en/developer-examples |
|
@harding Great! LGTM. Did you see my suggestion about the |
|
@saivann yes, I saw it. I'm not sure how I feel about that. I deleted them because I thought they basically repeat what BIP70 itself says---and because I think we could probably just expand the example we have to cover Payment and PaymentACK. In fact, I'll add that to the todo right now. |
harding commentedJun 7, 2014
As discussed on the docs mailing list, the developer docs are intended to have three main pages: the Developer Guide, the Developer Reference, and another page we provisionally called the Developer Cookbook (because it would be similar to the O'Reilly "[Programming Language] Cookbook"-style books.
I've added this page using the name Developer Examples. The new page features a newly-written set of example transactions with detailed explanations, which is something that's been TODO'd for a couple months now. It also features the extended BIP70 example from the Guide. A preview is available here:
http://dg0.dtrt.org/en/developer-examples
The extended BIP70 example from the Guide has been removed and replaced with an overview-level description of the Payment Protocol.
Now that we have three pages, I also gave each of the full pages their own icon on the portal page.
A new CSS class, multicode, has been added to allow multiple syntax highlighted examples to be included in a single code block. This lets us use bash highlighting for bash commands and json highlighting for JSON output, or any other combination. It can be seen in use in many of the example transactions.
Two one-line were made to the autocrossref plugin. The first change makes autocrossref ignore code blocks; the second change makes it remove HTML comments from autocrossref text so we can easily check to ensure it doesn't create broken links (see 61f0931 for details).
This is a large change, so I will not merge it until I receive at least one ACK.