Bitcoin full node and query server

Nov 13, 2025

View in context in the libbitcoin Slack #general mirror.

evoskuil09:05
A couple days ago I wrote the rpc message dispatcher, and yesterday I generalized it to a template that can accept an interface definition. I cleaned that up and finished its testing today. This is an example of the injectable interface definition:
/// rpc interface requires methods, type, size, and mode.
struct bitcoind
{
    static constexpr std::tuple methods
    {
        method<"getbestblockhash">{},
        method<"getblock", string_t, double>{ "blockhash", "verbosity" },
        method<"getblockchaininfo">{},
        method<"getblockcount">{},
        method<"getblockfilter", string_t, string_t>{ "blockhash", "filtertype" },
        method<"getblockfrompeer", string_t, double>{ "blockhash", "peer_id" },
        method<"getblockhash", double>{ "height" },
        method<"getblockheader", string_t, bool>{ "blockhash", "verbose" },
        method<"getblockstats", string_t, array_t>{ "hash_or_height", "stats" },
        method<"getchaintips">{},
        method<"getchaintxstats", option<double, 42>, option<string_t, "42">>{ "nblocks", "blockhash" },
        method<"getdifficulty">{},
        method<"getmempoolancestors", string_t, bool>{ "txid", "verbose" },
        method<"getmempooldescendants", string_t, bool>{ "txid", "verbose" },
        method<"getmempoolentry", string_t>{ "txid" },
        method<"getmempoolinfo">{},
        method<"getrawmempool", bool, bool>{ "verbose", "mempool_sequence" },
        method<"gettxout", string_t, double, bool>{ "txid", "n", "include_mempool" },
        method<"gettxoutproof", array_t, string_t>{ "txids", "blockhash" },
        method<"gettxoutsetinfo", string_t, bool, double>{ "hash_type", "use_index", "scan_blocks" },
        method<"preciousblock", string_t>{ "blockhash" },
        method<"pruneblockchain", double>{ "height" },
        method<"savemempool">{},
        method<"scantxoutset", string_t, array_t>{ "action", "scanobjects" },
        method<"verifychain", double, double>{ "checklevel", "nblocks" },
        method<"verifytxoutproof", string_t>{ "proof" },
    };

    using type = decltype(methods);
    static constexpr auto size = std::tuple_size_v<type>;
    static constexpr group mode = group::either;
};