Inside Bitcoin
Opening the selected file…
Inside Bitcoin
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) 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@0xcc316e3f71a040fb;7using Cxx = import "/capnp/c++.capnp";8$Cxx.namespace("mp");10annotation include(file): Text;11annotation includeTypes(file): Text;12# Extra include paths to add to generated files.14annotation wrap(interface, struct): Text;15# Wrap capnp interface generating ProxyClient / ProxyServer C++ classes that16# forward calls to a C++ interface with same methods and parameters. Text17# string should be the name of the C++ interface.18# If applied to struct rather than an interface, this will generate a ProxyType19# struct with get methods for introspection and copying fields between C++ and20# capnp structs.22annotation count(param, struct, interface): Int32;23# Indicate how many C++ method parameters there are corresponding to one capnp24# parameter (default is 1). If not 1, multiple C++ method arguments will be25# condensed into a single capnp parameter by the client and then expanded by26# the server by CustomReadField/CustomBuildField overloads which need to be27# provided separately. An example would be a capnp Text parameter initialized28# from C++ char* and size arguments. Can be 0 to fill an implicit capnp29# parameter from client or server side context. If annotation is applied to an30# interface or struct type it will apply to all parameters of that type.32annotation exception(param): Text;33# Indicate that a result parameter corresponds to a C++ exception. Text string34# should be the name of a C++ exception type that the generated server class35# will catch and the client class will rethrow.37annotation name(field, method): Text;38# Name of the C++ method or field corresponding to a capnp method or field.40annotation skip(field): Void;41# Synonym for count(0).43interface ThreadMap $count(0) {44# Interface letting clients control which thread a method call should45# execute on. Clients create and name threads and pass the thread handle as46# a call parameter.47makeThread @0 (name :Text) -> (result :Thread);48# Pre-allocate a pool of server threads for implicit dispatch. When a49# request arrives with no context.thread set, the server dispatches it50# through this pool via a shared work queue.51makePool @1 (count :UInt32) -> ();52}54interface Thread {55# Thread handle returned by makeThread corresponding to one server thread.57getName @0 () -> (result: Text);58}60struct Context $count(0) {61# Execution context passed as a parameter from the client class to the server class.63thread @0 : Thread;64# Handle of the server thread the current method call should execute on.66callbackThread @1 : Thread;67# Handle of the client thread that is calling the current method, and that68# any callbacks made by the server thread should be made on.69}
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.