Skip to content

Commit 5f81db6

Browse files
committed
Move all network interfaces except peer and http (base) to node.
1 parent 66be672 commit 5f81db6

File tree

12 files changed

+825
-6
lines changed

12 files changed

+825
-6
lines changed

Makefile.am

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,15 @@ include_bitcoin_node_impl_chasersdir = ${includedir}/bitcoin/node/impl/chasers
199199
include_bitcoin_node_impl_chasers_HEADERS = \
200200
include/bitcoin/node/impl/chasers/chaser_organize.ipp
201201

202+
include_bitcoin_node_interfacesdir = ${includedir}/bitcoin/node/interfaces
203+
include_bitcoin_node_interfaces_HEADERS = \
204+
include/bitcoin/node/interfaces/bitcoind.hpp \
205+
include/bitcoin/node/interfaces/electrum.hpp \
206+
include/bitcoin/node/interfaces/explore.hpp \
207+
include/bitcoin/node/interfaces/interfaces.hpp \
208+
include/bitcoin/node/interfaces/stratum_v1.hpp \
209+
include/bitcoin/node/interfaces/stratum_v2.hpp
210+
202211
include_bitcoin_node_parsedir = ${includedir}/bitcoin/node/parse
203212
include_bitcoin_node_parse_HEADERS = \
204213
include/bitcoin/node/parse/parse.hpp \

builds/msvc/vs2022/libbitcoin-node/libbitcoin-node.vcxproj

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,12 @@
191191
<ClInclude Include="..\..\..\..\include\bitcoin\node\error.hpp" />
192192
<ClInclude Include="..\..\..\..\include\bitcoin\node\events.hpp" />
193193
<ClInclude Include="..\..\..\..\include\bitcoin\node\full_node.hpp" />
194+
<ClInclude Include="..\..\..\..\include\bitcoin\node\interfaces\bitcoind.hpp" />
195+
<ClInclude Include="..\..\..\..\include\bitcoin\node\interfaces\electrum.hpp" />
196+
<ClInclude Include="..\..\..\..\include\bitcoin\node\interfaces\explore.hpp" />
197+
<ClInclude Include="..\..\..\..\include\bitcoin\node\interfaces\interfaces.hpp" />
198+
<ClInclude Include="..\..\..\..\include\bitcoin\node\interfaces\stratum_v1.hpp" />
199+
<ClInclude Include="..\..\..\..\include\bitcoin\node\interfaces\stratum_v2.hpp" />
194200
<ClInclude Include="..\..\..\..\include\bitcoin\node\parse\parse.hpp" />
195201
<ClInclude Include="..\..\..\..\include\bitcoin\node\parse\query.hpp" />
196202
<ClInclude Include="..\..\..\..\include\bitcoin\node\parse\target.hpp" />

builds/msvc/vs2022/libbitcoin-node/libbitcoin-node.vcxproj.filters

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,22 @@
2626
<UniqueIdentifier>{5FFB5F52-0772-4404-0000-00000000000B}</UniqueIdentifier>
2727
</Filter>
2828
<Filter Include="include\bitcoin\node\impl\chasers">
29-
<UniqueIdentifier>{5FFB5F52-0772-4404-0000-00000000000F}</UniqueIdentifier>
29+
<UniqueIdentifier>{5FFB5F52-0772-4404-0000-000000000001}</UniqueIdentifier>
3030
</Filter>
31-
<Filter Include="include\bitcoin\node\parse">
31+
<Filter Include="include\bitcoin\node\interfaces">
3232
<UniqueIdentifier>{5FFB5F52-0772-4404-0000-00000000000C}</UniqueIdentifier>
3333
</Filter>
34-
<Filter Include="include\bitcoin\node\protocols">
34+
<Filter Include="include\bitcoin\node\parse">
3535
<UniqueIdentifier>{5FFB5F52-0772-4404-0000-00000000000D}</UniqueIdentifier>
3636
</Filter>
37-
<Filter Include="include\bitcoin\node\sessions">
37+
<Filter Include="include\bitcoin\node\protocols">
3838
<UniqueIdentifier>{5FFB5F52-0772-4404-0000-00000000000E}</UniqueIdentifier>
3939
</Filter>
40+
<Filter Include="include\bitcoin\node\sessions">
41+
<UniqueIdentifier>{5FFB5F52-0772-4404-0000-00000000000F}</UniqueIdentifier>
42+
</Filter>
4043
<Filter Include="resource">
41-
<UniqueIdentifier>{5FFB5F52-0772-4404-0000-000000000001}</UniqueIdentifier>
44+
<UniqueIdentifier>{5FFB5F52-0772-4404-0000-000000000002}</UniqueIdentifier>
4245
</Filter>
4346
<Filter Include="src">
4447
<UniqueIdentifier>{5FFB5F52-0772-4404-0000-000000000000}</UniqueIdentifier>
@@ -266,6 +269,24 @@
266269
<ClInclude Include="..\..\..\..\include\bitcoin\node\full_node.hpp">
267270
<Filter>include\bitcoin\node</Filter>
268271
</ClInclude>
272+
<ClInclude Include="..\..\..\..\include\bitcoin\node\interfaces\bitcoind.hpp">
273+
<Filter>include\bitcoin\node\interfaces</Filter>
274+
</ClInclude>
275+
<ClInclude Include="..\..\..\..\include\bitcoin\node\interfaces\electrum.hpp">
276+
<Filter>include\bitcoin\node\interfaces</Filter>
277+
</ClInclude>
278+
<ClInclude Include="..\..\..\..\include\bitcoin\node\interfaces\explore.hpp">
279+
<Filter>include\bitcoin\node\interfaces</Filter>
280+
</ClInclude>
281+
<ClInclude Include="..\..\..\..\include\bitcoin\node\interfaces\interfaces.hpp">
282+
<Filter>include\bitcoin\node\interfaces</Filter>
283+
</ClInclude>
284+
<ClInclude Include="..\..\..\..\include\bitcoin\node\interfaces\stratum_v1.hpp">
285+
<Filter>include\bitcoin\node\interfaces</Filter>
286+
</ClInclude>
287+
<ClInclude Include="..\..\..\..\include\bitcoin\node\interfaces\stratum_v2.hpp">
288+
<Filter>include\bitcoin\node\interfaces</Filter>
289+
</ClInclude>
269290
<ClInclude Include="..\..\..\..\include\bitcoin\node\parse\parse.hpp">
270291
<Filter>include\bitcoin\node\parse</Filter>
271292
</ClInclude>

include/bitcoin/node.hpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,12 @@
4545
#include <bitcoin/node/chasers/chaser_transaction.hpp>
4646
#include <bitcoin/node/chasers/chaser_validate.hpp>
4747
#include <bitcoin/node/chasers/chasers.hpp>
48+
#include <bitcoin/node/interfaces/bitcoind.hpp>
49+
#include <bitcoin/node/interfaces/electrum.hpp>
50+
#include <bitcoin/node/interfaces/explore.hpp>
51+
#include <bitcoin/node/interfaces/interfaces.hpp>
52+
#include <bitcoin/node/interfaces/stratum_v1.hpp>
53+
#include <bitcoin/node/interfaces/stratum_v2.hpp>
4854
#include <bitcoin/node/parse/parse.hpp>
4955
#include <bitcoin/node/parse/query.hpp>
5056
#include <bitcoin/node/parse/target.hpp>

include/bitcoin/node/channels/channel_tcp.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ namespace libbitcoin {
2828
namespace node {
2929

3030
/// Abstract base TCP channel state for the node.
31+
/// This is a placeholder for electrum, bitcoind, and stratum v1/v2 channels.
3132
class BCN_API channel_tcp
3233
: public node::channel,
3334
public network::channel
Lines changed: 262 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,262 @@
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

Comments
 (0)