|
| 1 | +/** |
| 2 | + * Copyright (c) 2011-2025 libbitcoin developers (see AUTHORS) |
| 3 | + * |
| 4 | + * This file is part of libbitcoin. |
| 5 | + * |
| 6 | + * This program is free software: you can redistribute it and/or modify |
| 7 | + * it under the terms of the GNU Affero General Public License as published by |
| 8 | + * the Free Software Foundation, either version 3 of the License, or |
| 9 | + * (at your option) any later version. |
| 10 | + * |
| 11 | + * This program is distributed in the hope that it will be useful, |
| 12 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | + * GNU Affero General Public License for more details. |
| 15 | + * |
| 16 | + * You should have received a copy of the GNU Affero General Public License |
| 17 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 18 | + */ |
| 19 | +#ifndef LIBBITCOIN_NODE_INTERFACES_BITCOIND_HPP |
| 20 | +#define LIBBITCOIN_NODE_INTERFACES_BITCOIND_HPP |
| 21 | + |
| 22 | +#include <bitcoin/node/define.hpp> |
| 23 | + |
| 24 | +namespace libbitcoin { |
| 25 | +namespace node { |
| 26 | +namespace interface { |
| 27 | + |
| 28 | +struct bitcoind_methods |
| 29 | +{ |
| 30 | + static constexpr std::tuple methods |
| 31 | + { |
| 32 | + /// Blockchain methods. |
| 33 | + method<"getbestblockhash">{}, |
| 34 | + method<"getblock", string_t, optional<0_u32>>{ "blockhash", "verbosity" }, |
| 35 | + method<"getblockchaininfo">{}, |
| 36 | + method<"getblockcount">{}, |
| 37 | + method<"getblockfilter", string_t, optional<"basic"_t>>{ "blockhash", "filtertype" }, |
| 38 | + method<"getblockhash", number_t>{ "height" }, |
| 39 | + method<"getblockheader", string_t, optional<true>>{ "blockhash", "verbose" }, |
| 40 | + method<"getblockstats", string_t, optional<empty::array>>{ "hash_or_height", "stats" }, |
| 41 | + method<"getchaintxstats", optional<-1_i32>, optional<""_t>>{ "nblocks", "blockhash" }, |
| 42 | + method<"getchainwork">{}, |
| 43 | + method<"gettxout", string_t, number_t, optional<true>>{ "txid", "n", "include_mempool" }, |
| 44 | + method<"gettxoutsetinfo">{}, |
| 45 | + method<"pruneblockchain", number_t>{ "height" }, |
| 46 | + method<"savemempool">{}, |
| 47 | + method<"scantxoutset", string_t, optional<empty::array>>{ "action", "scanobjects" }, |
| 48 | + method<"verifychain", optional<4_u32>, optional<288_u32>>{ "checklevel", "nblocks" }, |
| 49 | + method<"verifytxoutset", string_t>{ "input_verify_flag" }, |
| 50 | + |
| 51 | + /// Control methods. |
| 52 | + method<"getmemoryinfo", optional<"stats"_t>>{ "mode" }, |
| 53 | + method<"getrpcinfo">{}, |
| 54 | + method<"help", optional<""_t>>{ "command" }, |
| 55 | + method<"logging", optional<"*"_t>>{ "include" }, |
| 56 | + method<"stop">{}, |
| 57 | + method<"uptime">{}, |
| 58 | + |
| 59 | + /// Mining methods. |
| 60 | + method<"getblocktemplate", optional<empty::object>>{ "template_request" }, |
| 61 | + method<"getmininginfo">{}, |
| 62 | + method<"getnetworkhashps", optional<120_u32>, optional<-1_i32>>{ "nblocks", "height" }, |
| 63 | + method<"prioritisetransaction", string_t, number_t, number_t>{ "txid", "dummy", "priority_delta" }, |
| 64 | + method<"submitblock", string_t, optional<""_t>>{ "block", "parameters" }, |
| 65 | + |
| 66 | + /// Network methods. |
| 67 | + method<"addnode", string_t, string_t>{ "node", "command" }, |
| 68 | + method<"clearbanned">{}, |
| 69 | + method<"disconnectnode", string_t, optional<-1_i32>>{ "address", "nodeid" }, |
| 70 | + method<"getaddednodeinfo", optional<false>, optional<true>, optional<""_t>>{ "include_chain_info", "dns", "addnode" }, |
| 71 | + method<"getconnectioncount">{}, |
| 72 | + method<"getnetworkinfo">{}, |
| 73 | + method<"getpeerinfo">{}, |
| 74 | + method<"listbanned">{}, |
| 75 | + method<"ping">{}, |
| 76 | + method<"setban", string_t, string_t, optional<86400_u32>, optional<false>, optional<""_t>>{ "addr", "command", "bantime", "absolute", "reason" }, |
| 77 | + method<"setnetworkactive", boolean_t>{ "state" }, |
| 78 | + |
| 79 | + /// Rawtransactions methods. |
| 80 | + method<"combinerawtransaction", array_t>{ "txs" }, |
| 81 | + method<"createrawtransaction", array_t, object_t, optional<0_u32>, optional<false>>{ "inputs", "outputs", "locktime", "replaceable" }, |
| 82 | + method<"decoderawtransaction", string_t>{ "hexstring" }, |
| 83 | + method<"fundrawtransaction", string_t, optional<empty::object>>{ "rawtx", "options" }, |
| 84 | + method<"getrawtransaction", string_t, optional<0_u32>, optional<""_t>>{ "txid", "verbose", "blockhash" }, |
| 85 | + method<"sendrawtransaction", string_t, optional<0_u32>>{ "hexstring", "maxfeerate" }, |
| 86 | + method<"signrawtransactionwithkey", string_t, optional<empty::array>, optional<empty::array>, optional<"ALL|FORKID"_t>>{ "hexstring", "privkeys", "prevtxs", "sighashtype" }, |
| 87 | + method<"testmempoolaccept", array_t, optional<0_u32>>{ "rawtxs", "maxfeerate" }, |
| 88 | + method<"testrawtransaction", string_t>{ "rawtx" }, |
| 89 | + |
| 90 | + /// Util methods (node-related). |
| 91 | + method<"createmultisig", number_t, array_t>{ "nrequired", "keys" }, |
| 92 | + method<"decodepsbt", string_t>{ "psbt" }, |
| 93 | + method<"decodescript", string_t>{ "hex" }, |
| 94 | + method<"estimaterawfee", number_t, optional<"unset"_t>>{ "conf_target", "estimate_mode" }, |
| 95 | + method<"getdescriptorinfo", string_t>{ "descriptor" }, |
| 96 | + method<"validateaddress", string_t>{ "address" }, |
| 97 | + |
| 98 | + /// Wallet methods (unsupported). |
| 99 | + method<"abandontransaction", string_t>{ "txid" }, |
| 100 | + method<"addmultisigaddress", number_t, array_t, optional<""_t>, optional<"legacy"_t>>{ "nrequired", "keys", "label", "address_type" }, |
| 101 | + method<"backupwallet", string_t>{ "destination" }, |
| 102 | + method<"bumpfee", string_t, optional<empty::object>>{ "txid", "options" }, |
| 103 | + method<"createwallet", string_t, optional<false>, optional<false>, optional<false>, optional<""_t>, optional<false>, optional<false>, optional<false>, optional<"set"_t>>{ "wallet_name", "disable_private_keys", "blank", "passphrase", "avoid_reuse", "descriptors", "load_on_startup", "external_signer", "change_type" }, |
| 104 | + method<"dumpprivkey", string_t>{ "address" }, |
| 105 | + method<"dumpwallet", string_t>{ "filename" }, |
| 106 | + method<"encryptwallet", string_t>{ "passphrase" }, |
| 107 | + method<"getaddressinfo", string_t>{ "address" }, |
| 108 | + method<"getbalances">{}, |
| 109 | + method<"getnewaddress", optional<""_t>, optional<"legacy"_t>>{ "label", "address_type" }, |
| 110 | + method<"getreceivedbyaddress", string_t, optional<0>>{ "address", "minconf" }, |
| 111 | + method<"getreceivedbylabel", string_t, optional<0>>{ "label", "minconf" }, |
| 112 | + method<"gettransaction", string_t, optional<false>, optional<false>>{ "txid", "include_watchonly", "verbose" }, |
| 113 | + method<"getunconfirmedbalance">{}, |
| 114 | + method<"getwalletinfo">{}, |
| 115 | + method<"importaddress", string_t, optional<""_t>, optional<false>, optional<true>>{ "address", "label", "rescan", "p2sh" }, |
| 116 | + method<"importmulti", array_t, optional<empty::object>>{ "requests", "options" }, |
| 117 | + method<"importprivkey", string_t, optional<""_t>, optional<false>>{ "privkey", "label", "rescan" }, |
| 118 | + method<"importprunedfunds", string_t, string_t>{ "rawtransaction", "txoutproof" }, |
| 119 | + method<"importpubkey", string_t, optional<""_t>, optional<false>>{ "pubkey", "label", "rescan" }, |
| 120 | + method<"importwallet", string_t>{ "filename" }, |
| 121 | + method<"keypoolrefill", optional<100>>{ "newsize" }, |
| 122 | + method<"listaddressgroupings", optional<1>, optional<false>>{ "minconf", "include_watchonly" }, |
| 123 | + method<"listlabels", optional<"receive"_t>>{ "purpose" }, |
| 124 | + method<"listlockunspent">{}, |
| 125 | + method<"listreceivedbyaddress", optional<1>, optional<false>, optional<false>, optional<""_t>>{ "minconf", "include_empty", "include_watchonly", "address_filter" }, |
| 126 | + method<"listreceivedbylabel", optional<1>, optional<false>, optional<false>>{ "minconf", "include_empty", "include_watchonly" }, |
| 127 | + method<"listtransactions", optional<""_t>, optional<10>, optional<0>, optional<false>>{ "label", "count", "skip", "include_watchonly" }, |
| 128 | + method<"listunspent", optional<1>, optional<empty::array>, optional<true>, optional<false>>{ "minconf", "addresses", "include_unsafe", "query_options" }, |
| 129 | + method<"loadwallet", string_t, optional<false>>{ "filename", "load_on_startup" }, |
| 130 | + method<"lockunspent", boolean_t, optional<empty::array>>{ "unlock", "transactions" }, |
| 131 | + method<"removeprunedfunds", string_t>{ "txid" }, |
| 132 | + method<"rescanblockchain", optional<0>>{ "start_height" }, |
| 133 | + method<"send", object_t, optional<empty::object>>{ "outputs", "options" }, |
| 134 | + method<"sendmany", string_t, object_t, optional<1>, optional<""_t>, optional<""_t>, optional<false>, optional<false>, optional<25>, optional<"unset"_t>, optional<false>, optional<0>>{ "dummy", "outputs", "minconf", "comment", "comment_to", "subtractfeefrom", "replaceable", "conf_target", "estimate_mode", "avoid_reuse", "fee_rate" }, |
| 135 | + method<"sendtoaddress", string_t, number_t, optional<""_t>, optional<""_t>, optional<false>, optional<25>, optional<"unset"_t>, optional<false>, optional<0>, optional<false>>{ "address", "amount", "comment", "comment_to", "subtractfeefromamount", "conf_target", "estimate_mode", "avoid_reuse", "fee_rate", "verbose" }, |
| 136 | + method<"setlabel", string_t, string_t>{ "address", "label" }, |
| 137 | + method<"settxfee", number_t>{ "amount" }, |
| 138 | + method<"signmessage", string_t, string_t>{ "address", "message" }, |
| 139 | + method<"signmessagewithprivkey", string_t, string_t>{ "privkey", "message" }, |
| 140 | + method<"syncwithvalidationinterfacequeue">{}, |
| 141 | + method<"unloadwallet", optional<""_t>, optional<false>>{ "wallet_name", "load_on_startup" }, |
| 142 | + method<"walletcreatefundedpsbt", optional<empty::array>, optional<empty::object>, optional<0>, optional<empty::object>>{ "inputs", "outputs", "locktime", "options" }, |
| 143 | + method<"walletlock">{}, |
| 144 | + method<"walletpassphrase", string_t, number_t>{ "passphrase", "timeout" }, |
| 145 | + method<"walletprocesspsbt", string_t, optional<false>, optional<false>, optional<false>>{ "psbt", "sign", "bip32derivs", "complete" } |
| 146 | + }; |
| 147 | + |
| 148 | + template <typename... Args> |
| 149 | + using subscriber = network::unsubscriber<Args...>; |
| 150 | + |
| 151 | + template <size_t Index> |
| 152 | + using at = method_at<methods, Index>; |
| 153 | + |
| 154 | + // Derive this from above in c++26 using reflection. |
| 155 | + using getbestblockhash = at<0>; |
| 156 | + using getblock = at<1>; |
| 157 | + using getblockchaininfo = at<2>; |
| 158 | + using getblockcount = at<3>; |
| 159 | + using getblockfilter = at<4>; |
| 160 | + using getblockhash = at<5>; |
| 161 | + using getblockheader = at<6>; |
| 162 | + using getblockstats = at<7>; |
| 163 | + using getchaintxstats = at<8>; |
| 164 | + using getchainwork = at<9>; |
| 165 | + using gettxout = at<10>; |
| 166 | + using gettxoutsetinfo = at<11>; |
| 167 | + using pruneblockchain = at<12>; |
| 168 | + using savemempool = at<13>; |
| 169 | + using scantxoutset = at<14>; |
| 170 | + using verifychain = at<15>; |
| 171 | + using verifytxoutset = at<16>; |
| 172 | + using getmemoryinfo = at<17>; |
| 173 | + using getrpcinfo = at<18>; |
| 174 | + using help = at<19>; |
| 175 | + using logging = at<20>; |
| 176 | + using stop = at<21>; |
| 177 | + using uptime = at<22>; |
| 178 | + using getblocktemplate = at<23>; |
| 179 | + using getmininginfo = at<24>; |
| 180 | + using getnetworkhashps = at<25>; |
| 181 | + using prioritisetransaction = at<26>; |
| 182 | + using submitblock = at<27>; |
| 183 | + using addnode = at<28>; |
| 184 | + using clearbanned = at<29>; |
| 185 | + using disconnectnode = at<30>; |
| 186 | + using getaddednodeinfo = at<31>; |
| 187 | + using getconnectioncount = at<32>; |
| 188 | + using getnetworkinfo = at<33>; |
| 189 | + using getpeerinfo = at<34>; |
| 190 | + using listbanned = at<35>; |
| 191 | + using ping = at<36>; |
| 192 | + using setban = at<37>; |
| 193 | + using setnetworkactive = at<38>; |
| 194 | + using combinerawtransaction = at<39>; |
| 195 | + using createrawtransaction = at<40>; |
| 196 | + using decoderawtransaction = at<41>; |
| 197 | + using fundrawtransaction = at<42>; |
| 198 | + using getrawtransaction = at<43>; |
| 199 | + using sendrawtransaction = at<44>; |
| 200 | + using signrawtransactionwithkey = at<45>; |
| 201 | + using testmempoolaccept = at<46>; |
| 202 | + using testrawtransaction = at<47>; |
| 203 | + using createmultisig = at<48>; |
| 204 | + using decodepsbt = at<49>; |
| 205 | + using decodescript = at<50>; |
| 206 | + using estimaterawfee = at<51>; |
| 207 | + using getdescriptorinfo = at<52>; |
| 208 | + using validateaddress = at<53>; |
| 209 | + using abandontransaction = at<54>; |
| 210 | + using addmultisigaddress = at<55>; |
| 211 | + using backupwallet = at<56>; |
| 212 | + using bumpfee = at<57>; |
| 213 | + using createwallet = at<58>; |
| 214 | + using dumpprivkey = at<59>; |
| 215 | + using dumpwallet = at<60>; |
| 216 | + using encryptwallet = at<61>; |
| 217 | + using getaddressinfo = at<62>; |
| 218 | + using getbalances = at<63>; |
| 219 | + using getnewaddress = at<64>; |
| 220 | + using getreceivedbyaddress = at<65>; |
| 221 | + using getreceivedbylabel = at<66>; |
| 222 | + using gettransaction = at<67>; |
| 223 | + using getunconfirmedbalance = at<68>; |
| 224 | + using getwalletinfo = at<69>; |
| 225 | + using importaddress = at<70>; |
| 226 | + using importmulti = at<71>; |
| 227 | + using importprivkey = at<72>; |
| 228 | + using importprunedfunds = at<73>; |
| 229 | + using importpubkey = at<74>; |
| 230 | + using importwallet = at<75>; |
| 231 | + using keypoolrefill = at<76>; |
| 232 | + using listaddressgroupings = at<77>; |
| 233 | + using listlabels = at<78>; |
| 234 | + using listlockunspent = at<79>; |
| 235 | + using listreceivedbyaddress = at<80>; |
| 236 | + using listreceivedbylabel = at<81>; |
| 237 | + using listtransactions = at<82>; |
| 238 | + using listunspent = at<83>; |
| 239 | + using loadwallet = at<84>; |
| 240 | + using lockunspent = at<85>; |
| 241 | + using removeprunedfunds = at<86>; |
| 242 | + using rescanblockchain = at<87>; |
| 243 | + using send = at<88>; |
| 244 | + using sendmany = at<89>; |
| 245 | + using sendtoaddress = at<90>; |
| 246 | + using setlabel = at<91>; |
| 247 | + using settxfee = at<92>; |
| 248 | + using signmessage = at<93>; |
| 249 | + using signmessagewithprivkey = at<94>; |
| 250 | + using syncwithvalidationinterfacequeue = at<95>; |
| 251 | + using unloadwallet = at<96>; |
| 252 | + using walletcreatefundedpsbt = at<97>; |
| 253 | + using walletlock = at<98>; |
| 254 | + using walletpassphrase = at<99>; |
| 255 | + using walletprocesspsbt = at<100>; |
| 256 | +}; |
| 257 | + |
| 258 | +} // namespace interface |
| 259 | +} // namespace node |
| 260 | +} // namespace libbitcoin |
| 261 | + |
| 262 | +#endif |
0 commit comments