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 python32# Copyright (c) 2018-present The Bitcoin Core developers3# Distributed under the MIT software license, see the accompanying4# file COPYING or http://www.opensource.org/licenses/mit-license.php.6import os7import sys8import argparse9import json11def perform_pre_checks():12mock_result_path = os.path.join(os.getcwd(), "mock_result")13if os.path.isfile(mock_result_path):14with open(mock_result_path, "r") as f:15mock_result = f.read()16if mock_result[0]:17sys.stdout.write(mock_result[2:])18sys.exit(int(mock_result[0]))20def enumerate(args):21sys.stdout.write(json.dumps([{"fingerprint": "b3c19bfc", "type": "trezor", "model": "trezor_t"}]))23def getdescriptors(args):24xpub_pkh = "xpub6CRhJvXV8x2AKWvqi1ZSMFU6cbxzQiYrv3dxSUXCawjMJ1JzpqVsveH4way1yCmJm29KzH1zrVZmVwes4Qo6oXVE1HFn4fdiKrYJngqFFc6"25xpub_sh = "xpub6CoNoq3Tg4tGSpom2BSwL42gy864KHo3TXkHxLxBbhvCkgmdVXADQmiHbLZhX3Me1cYhRx7s25Lpm4LnT5zu395ANHsXB2QvT9tqJDAibTN"26xpub_wpkh = "xpub6DUcLgY1DfgDy2RV6q4djwwsLitaoZDumbribqrR8mP78fEtgZa1XEsqT5MWQ7gwLwKsTQPT28XLoVE5A97rDNTwMXjmzPaNijoCApCbWvp"28sys.stdout.write(json.dumps({29"receive": [30"pkh([b3c19bfc/44'/1'/" + args.account + "']" + xpub_pkh + "/0/*)#h26nxtl9",31"sh(wpkh([b3c19bfc/49'/1'/" + args.account + "']" + xpub_sh + "/0/*))#32ry02yp",32"wpkh([b3c19bfc/84'/1'/" + args.account + "']" + xpub_wpkh + "/0/*)#jftn8ppv"33],34"internal": [35"pkh([b3c19bfc/44'/1'/" + args.account + "']" + xpub_pkh + "/1/*)#x7ljm70a",36"sh(wpkh([b3c19bfc/49'/1'/" + args.account + "']" + xpub_sh + "/1/*))#ytdjh437",37"wpkh([b3c19bfc/84'/1'/" + args.account + "']" + xpub_wpkh + "/1/*)#rawj6535"38]39}))41parser = argparse.ArgumentParser(prog='./invalid_signer.py', description='External invalid signer mock')42parser.add_argument('--fingerprint')43parser.add_argument('--chain', default='main')44parser.add_argument('--stdin', action='store_true')46subparsers = parser.add_subparsers(description='Commands', dest='command')47subparsers.required = True49parser_enumerate = subparsers.add_parser('enumerate', help='list available signers')50parser_enumerate.set_defaults(func=enumerate)52parser_getdescriptors = subparsers.add_parser('getdescriptors')53parser_getdescriptors.set_defaults(func=getdescriptors)54parser_getdescriptors.add_argument('--account', metavar='account')56if not sys.stdin.isatty():57buffer = sys.stdin.read()58if buffer and buffer.rstrip() != "":59sys.argv.extend(buffer.rstrip().split(" "))61args = parser.parse_args()63perform_pre_checks()65args.func(args)
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.