-
Notifications
You must be signed in to change notification settings - Fork 3
Add submitpackage method to docs #1
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -537,6 +537,92 @@ Protocol version 1.0 returning an error as the result: | |
|
|
||
| "258: txn-mempool-conflict" | ||
|
|
||
| blockchain.transaction.broadcast_package | ||
| ======================================== | ||
|
|
||
| Broadcast a package of transactions to the network (submitpackage). The package must consist of a child with its parents, | ||
| and none of the parents may depend on one another. The package must be topologically sorted, | ||
| with the child being the last element in the array. | ||
|
|
||
| **Signature** | ||
|
|
||
| .. function:: blockchain.transaction.broadcast_package(raw_txs, verbose=false) | ||
|
|
||
| *raw_txs* | ||
|
|
||
| An array of raw transactions, each as a hexadecimal string. | ||
|
|
||
| *verbose* | ||
|
|
||
| Whether the verbose bitcoind response is required. | ||
|
|
||
| **Result** | ||
|
|
||
| If *verbose* is :const:`false`: | ||
|
|
||
| A dictionary with the following keys: | ||
|
|
||
| * `success` | ||
| * Type: bool | ||
| * Value: Indicating the result of the package submission | ||
| * `errors` | ||
| * Type: Optional[List[Dict]] | ||
| * Value: Error message and txid (NOT wtxid) of transactions that were not accepted | ||
|
|
||
| If *verbose* is :const:`true`: | ||
|
|
||
| The Bitcoin Core daemon result according to its RPC API documentation. | ||
| Note that the exact structure and semantics can depend on the bitcoind version, | ||
| and hence the electrum protocol can make no guarantees about it. | ||
|
Comment on lines
+572
to
+576
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I expect most clients to want the default, simple, verbose=false option. However, AFAICT it does not cost a server implementation ~anything to offer the rich bitcoind response. The server has to call the Having access to the full bitcoind result can be useful e.g. if you trust the server, or for quick scripts. And maybe also for some unforeseen use-cases where the So I think we can also add this There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fair enough! |
||
|
|
||
| **Result Example** | ||
|
|
||
| When *verbose* is :const:`false`:: | ||
|
|
||
| { | ||
| "success": true | ||
| } | ||
|
|
||
| With errors: | ||
|
|
||
| { | ||
| "success": false, | ||
| "errors": | ||
| [ | ||
| { | ||
| "txid": "ec6f295cd4b1b91f59cabb0ab8fdc7c76580db08be6426e465f75a69d82b9659", | ||
| "error": "bad-txns-inputs-missingorspent" | ||
| } | ||
| ] | ||
| } | ||
|
|
||
| When *verbose* is :const:`true`:: | ||
|
|
||
| { (json object) | ||
| "package_msg" : "str", (string) The transaction package result message. "success" indicates all transactions were accepted into or are already in the mempool. | ||
| "tx-results" : { (json object) transaction results keyed by wtxid | ||
| "wtxid" : { (json object) transaction wtxid | ||
| "txid" : "hex", (string) The transaction hash in hex | ||
| "other-wtxid" : "hex", (string, optional) The wtxid of a different transaction with the same txid but different witness found in the mempool. This means the submitted transaction was ignored. | ||
| "vsize" : n, (numeric, optional) Sigops-adjusted virtual transaction size. | ||
| "fees" : { (json object, optional) Transaction fees | ||
| "base" : n, (numeric) transaction fee in BTC | ||
| "effective-feerate" : n, (numeric, optional) if the transaction was not already in the mempool, the effective feerate in BTC per KvB. For example, the package feerate and/or feerate with modified fees from prioritisetransaction. | ||
| "effective-includes" : [ (json array, optional) if effective-feerate is provided, the wtxids of the transactions whose fees and vsizes are included in effective-feerate. | ||
| "hex", (string) transaction wtxid in hex | ||
| ... | ||
| ] | ||
| }, | ||
| "error" : "str" (string, optional) The transaction error string, if it was rejected by the mempool | ||
| }, | ||
| ... | ||
| }, | ||
| "replaced-transactions" : [ (json array, optional) List of txids of replaced transactions | ||
| "hex", (string) The transaction id | ||
| ... | ||
| ] | ||
| } | ||
|
|
||
| blockchain.transaction.get | ||
| ========================== | ||
|
|
||
|
|
||
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.
note: the bitcoind response lists both txid and wtxid - although it keys results based on wtxid. In this use case either one is sufficient. There can be no collision of txids within a package.
The electrum protocol uses txids generally, I think we can keep to that and do the same here.
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 sounds good, I don't see any issue with using
txideither.