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#!/usr/bin/env bpftrace3BEGIN4{5printf("Logging opened, closed, misbehaving, and evicted P2P connections\n")6}8usdt:./build/bin/bitcoind:net:inbound_connection9{10$id = (int64) arg0;11$addr = str(arg1);12$conn_type = str(arg2);13$network = (int32) arg3;14$existing = (uint64) arg4;15printf("INBOUND conn from %s: id=%ld, type=%s, network=%d, total=%d\n", $addr, $id, $conn_type, $network, $existing);16}18usdt:./build/bin/bitcoind:net:outbound_connection19{20$id = (int64) arg0;21$addr = str(arg1);22$conn_type = str(arg2);23$network = (int32) arg3;24$existing = (uint64) arg4;25printf("OUTBOUND conn to %s: id=%ld, type=%s, network=%d, total=%d\n", $addr, $id, $conn_type, $network, $existing);26}28usdt:./build/bin/bitcoind:net:closed_connection29{30$id = (int64) arg0;31$addr = str(arg1);32$conn_type = str(arg2);33$network = (int32) arg3;34printf("CLOSED conn to %s: id=%ld, type=%s, network=%d, established=%ld\n", $addr, $id, $conn_type, $network, arg4);35}37usdt:./build/bin/bitcoind:net:evicted_inbound_connection38{39$id = (int64) arg0;40$addr = str(arg1);41$conn_type = str(arg2);42$network = (int32) arg3;43printf("EVICTED conn to %s: id=%ld, type=%s, network=%d, established=%ld\n", $addr, $id, $conn_type, $network, arg4);44}46usdt:./build/bin/bitcoind:net:misbehaving_connection47{48$id = (int64) arg0;49$message = str(arg1);50printf("MISBEHAVING conn id=%ld, message='%s'\n", $id, $message);51}
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.