Inside Bitcoin
Opening the selected file…
Opening the selected file…
The code behind the network, with room to understand it.
Release published 2026-10-28 · Snapshot fetched 2026-11-01. Latest stable release at fetch time; development branches and Git history are excluded. Only the selected code window and visible folders load here.
1// Copyright (c) 2018-present The Bitcoin Core developers2// Distributed under the MIT software license, see the accompanying3// file COPYING or http://www.opensource.org/licenses/mit-license.php.5#include <zmq/zmqrpc.h>7#include <rpc/server.h>8#include <rpc/util.h>9#include <univalue.h>10#include <zmq/zmqabstractnotifier.h>11#include <zmq/zmqnotificationinterface.h>13#include <list>14#include <memory>15#include <string>16#include <utility>17#include <vector>19class JSONRPCRequest;21namespace {23static RPCMethod getzmqnotifications()24{25return RPCMethod{26"getzmqnotifications",27"Returns information about the active ZeroMQ notifications.\n",28{},29RPCResult{30RPCResult::Type::ARR, "", "",31{32{RPCResult::Type::OBJ, "", "",33{34{RPCResult::Type::STR, "type", "Type of notification"},35{RPCResult::Type::STR, "address", "Address of the publisher"},36{RPCResult::Type::NUM, "hwm", "Outbound message high water mark"},37}},38}39},40RPCExamples{41HelpExampleCli("getzmqnotifications", "")42+ HelpExampleRpc("getzmqnotifications", "")43},44[](const RPCMethod& self, const JSONRPCRequest& request) -> UniValue45{46UniValue result(UniValue::VARR);47if (g_zmq_notification_interface != nullptr) {48for (const auto* n : g_zmq_notification_interface->GetActiveNotifiers()) {49UniValue obj(UniValue::VOBJ);50obj.pushKV("type", n->GetType());51obj.pushKV("address", n->GetAddress());52obj.pushKV("hwm", n->GetOutboundMessageHighWaterMark());53result.push_back(std::move(obj));54}55}57return result;58},59};60}62const CRPCCommand commands[]{63{"zmq", &getzmqnotifications},64};66} // anonymous namespace68void RegisterZMQRPCCommands(CRPCTable& t)69{70for (const auto& c : commands) {71t.appendCommand(c.name, &c);72}73}
Independent explanations by MyBitcoinExplorer. Not affiliated with or endorsed by Bitcoin Core. Guides are educational and do not replace the source or its tests.
Bitcoin Core source © its contributors, distributed under the MIT license. Original notices and bundled third-party licenses are retained in the source tree.