MCPcopy Create free account
hub / github.com/ElementsProject/elements / scantxoutset

Function scantxoutset

src/rpc/blockchain.cpp:2662–2865  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2660};
2661
2662static RPCHelpMan scantxoutset()
2663{
2664 // scriptPubKey corresponding to mainnet address 12cbQLTFMXRnSzktFkuoG3eHoMeFtpTu3S
2665 const std::string EXAMPLE_DESCRIPTOR_RAW = "raw(76a91411b366edfc0a8b66feebae5c2e25a7b6a5d1cf3188ac)#fm24fxxy";
2666
2667 return RPCHelpMan{"scantxoutset",
2668 "\nScans the unspent transaction output set for entries that match certain output descriptors.\n"
2669 "Examples of output descriptors are:\n"
2670 " addr(<address>) Outputs whose scriptPubKey corresponds to the specified address (does not include P2PK)\n"
2671 " raw(<hex script>) Outputs whose scriptPubKey equals the specified hex scripts\n"
2672 " combo(<pubkey>) P2PK, P2PKH, P2WPKH, and P2SH-P2WPKH outputs for the given pubkey\n"
2673 " pkh(<pubkey>) P2PKH outputs for the given pubkey\n"
2674 " sh(multi(<n>,<pubkey>,<pubkey>,...)) P2SH-multisig outputs for the given threshold and pubkeys\n"
2675 "\nIn the above, <pubkey> either refers to a fixed public key in hexadecimal notation, or to an xpub/xprv optionally followed by one\n"
2676 "or more path elements separated by \"/\", and optionally ending in \"/*\" (unhardened), or \"/*'\" or \"/*h\" (hardened) to specify all\n"
2677 "unhardened or hardened child keys.\n"
2678 "In the latter case, a range needs to be specified by below if different from 1000.\n"
2679 "For more information on output descriptors, see the documentation in the doc/descriptors.md file.\n",
2680 {
2681 {"action", RPCArg::Type::STR, RPCArg::Optional::NO, "The action to execute\n"
2682 "\"start\" for starting a scan\n"
2683 "\"abort\" for aborting the current scan (returns true when abort was successful)\n"
2684 "\"status\" for progress report (in %) of the current scan"},
2685 {"scanobjects", RPCArg::Type::ARR, RPCArg::Optional::OMITTED, "Array of scan objects. Required for \"start\" action\n"
2686 "Every scan object is either a string descriptor or an object:",
2687 {
2688 {"descriptor", RPCArg::Type::STR, RPCArg::Optional::OMITTED, "An output descriptor"},
2689 {"", RPCArg::Type::OBJ, RPCArg::Optional::OMITTED, "An object with output descriptor and metadata",
2690 {
2691 {"desc", RPCArg::Type::STR, RPCArg::Optional::NO, "An output descriptor"},
2692 {"range", RPCArg::Type::RANGE, RPCArg::Default{1000}, "The range of HD chain indexes to explore (either end or [begin,end])"},
2693 }},
2694 },
2695 "[scanobjects,...]"},
2696 },
2697 {
2698 RPCResult{"When action=='abort'", RPCResult::Type::BOOL, "", ""},
2699 RPCResult{"When action=='status' and no scan is in progress", RPCResult::Type::NONE, "", ""},
2700 RPCResult{"When action=='status' and scan is in progress", RPCResult::Type::OBJ, "", "",
2701 {
2702 {RPCResult::Type::NUM, "progress", "The scan progress"},
2703 }},
2704 RPCResult{"When action=='start'", RPCResult::Type::OBJ, "", "", {
2705 {RPCResult::Type::BOOL, "success", "Whether the scan was completed"},
2706 {RPCResult::Type::NUM, "txouts", "The number of unspent transaction outputs scanned"},
2707 {RPCResult::Type::NUM, "height", "The current block height (index)"},
2708 {RPCResult::Type::STR_HEX, "bestblock", "The hash of the block at the tip of the chain"},
2709 {RPCResult::Type::ARR, "unspents", "",
2710 {
2711 {RPCResult::Type::OBJ, "", "",
2712 {
2713 {RPCResult::Type::STR_HEX, "txid", "The transaction id"},
2714 {RPCResult::Type::NUM, "vout", "The vout value"},
2715 {RPCResult::Type::STR_HEX, "scriptPubKey", "The script key"},
2716 {RPCResult::Type::STR, "desc", "A specialized descriptor for the matched scriptPubKey"},
2717 {RPCResult::Type::STR_AMOUNT, "amount", "The total amount in " + CURRENCY_UNIT + " of the unspent output"},
2718 {RPCResult::Type::STR_HEX, "asset", "The asset ID"},
2719 {RPCResult::Type::NUM, "height", "Height of the unspent transaction output"},

Callers

nothing calls this directly

Calls 15

HelpExampleCliFunction · 0.85
HelpExampleRpcFunction · 0.85
RPCTypeCheckFunction · 0.85
JSONRPCErrorFunction · 0.85
InferDescriptorFunction · 0.85
FindScriptPubKeyFunction · 0.85
ValueFromAmountFunction · 0.85
ForceFlushStateToDiskMethod · 0.80
GetAmountMethod · 0.80
IsExplicitMethod · 0.80
GetAssetMethod · 0.80

Tested by

no test coverage detected