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.
251consensus.BIP65Height = 581885; // 00000000007f6655f22f98e72ed80d8b06dc761d5da09df0fa1dc4be4f861eb6252consensus.BIP66Height = 330776; // 000000002104c8c45e99a8853285a3b592602a3ccde2b832481da85e9e4ba182253consensus.CSVHeight = 770112; // 00000000025e930139bac5c6c31a403776da130831ab85be56578f3fa75369bb254consensus.SegwitHeight = 834624; // 00000000002b980fcd729daaa248fd9316a5200e9b367f4ff2c42453e84201ca255consensus.MinBIP9WarningHeight = 2013984; // taproot activation height + miner confirmation window256consensus.powLimit = uint256{"00000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffff"};257consensus.nPowTargetTimespan = 14 * 24 * 60 * 60; // two weeks258consensus.nPowTargetSpacing = 10 * 60;259consensus.fPowAllowMinDifficultyBlocks = true;260consensus.enforce_BIP94 = false;261consensus.fPowNoRetargeting = false;262consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].bit = 28;263consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nStartTime = Consensus::BIP9Deployment::NEVER_ACTIVE;264consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT;265consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].min_activation_height = 0; // No activation delay266consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].threshold = 1512; // 75%267consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].period = 2016;269ApplyDeploymentOptions(opts.dep_opts);271consensus.nMinimumChainWork = uint256{"0000000000000000000000000000000000000000000017f49f702147f10c0eb6"};272consensus.defaultAssumeValid = uint256{"00000000b318a3703d14a844c55ef507f4c2fc8f8766e24271fd43c180c51637"}; // 5128859274pchMessageStart[0] = 0x0b;275pchMessageStart[1] = 0x11;276pchMessageStart[2] = 0x09;277pchMessageStart[3] = 0x07;278nDefaultPort = 18333;279nPruneAfterHeight = 1000;280m_assumed_blockchain_size = 245;281m_assumed_chain_state_size = 19;283genesis = CreateGenesisBlock(1296688602, 414098458, 0x1d00ffff, 1, 50 * COIN);284consensus.hashGenesisBlock = genesis.GetHash();285assert(consensus.hashGenesisBlock == uint256{"000000000933ea01ad0ee984209779baaec3ced90fa3f408719526f8d77f4943"});286assert(genesis.hashMerkleRoot == uint256{"4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b"});288vFixedSeeds.clear();289vSeeds.clear();290// nodes with support for servicebits filtering should be at the top291vSeeds.emplace_back("testnet-seed.bitcoin.jonasschnelli.ch.");292vSeeds.emplace_back("seed.tbtc.petertodd.net.");293vSeeds.emplace_back("testnet-seed.bluematt.me."); // Just a static list of stable node(s), only supports x9294vSeeds.emplace_back("seed.testnet.achownodes.xyz."); // Ava Chow, only supports x1, x5, x9, x49, x809, x849, xd, x400, x404, x408, x448, xc08, xc48, x40c296base58Prefixes[PUBKEY_ADDRESS] = std::vector<unsigned char>(1,111);297base58Prefixes[SCRIPT_ADDRESS] = std::vector<unsigned char>(1,196);298base58Prefixes[SECRET_KEY] = std::vector<unsigned char>(1,239);299base58Prefixes[EXT_PUBLIC_KEY] = {0x04, 0x35, 0x87, 0xCF};300base58Prefixes[EXT_SECRET_KEY] = {0x04, 0x35, 0x83, 0x94};302bech32_hrp = "tb";304vFixedSeeds = std::vector<uint8_t>(std::begin(chainparams_seed_test), std::end(chainparams_seed_test));306fDefaultConsistencyChecks = false;307m_is_mockable_chain = false;309m_assumeutxo_data = {310{311.height = 2'500'000,312.hash_serialized = AssumeutxoHash{uint256{"f841584909f68e47897952345234e37fcd9128cd818f41ee6c3ca68db8071be7"}},313.m_chain_tx_count = 66484552,314.blockhash = uint256{"0000000000000093bcb68c03a9a168ae252572d348a2eaeba2cdf9231d73206f"},315},316{317.height = 4'840'000,318.hash_serialized = AssumeutxoHash{uint256{"ce6bb677bb2ee9789c4a1c9d73e6683c53fc20e8fdbedbdaaf468982a0c8db2a"}},319.m_chain_tx_count = 536078574,320.blockhash = uint256{"00000000000000f4971a7fb37fbdff89315b69a2e1920c467654a382f0d64786"},321},322{323.height = 5'125'000,324.hash_serialized = AssumeutxoHash{uint256{"d05430f34c9b7dd7eb98c0718cdf03782bcce8273847557d68ac2efc1365d4b8"}},325.m_chain_tx_count = 536708663,326.blockhash = uint256{"00000000000009ad1946e21cb4f1a6323ee99c89017b59d5166472672b868133"},327}328};330chainTxData = ChainTxData{331// Data from RPC: getchaintxstats 4096 00000000b318a3703d14a844c55ef507f4c2fc8f8766e24271fd43c180c51637332.nTime = 1788932318,333.tx_count = 536748780,334.dTxRate = 0.02306697351149596,335};337// Generated by headerssync-params.py on 2026-09-08.338m_headers_sync_params = HeadersSyncParams{339.commitment_period = 682,340.redownload_buffer_size = 14613, // 14613/682 = ~21.4 commitments341};342}343};345/**346* Testnet (v4): public test network which is reset from time to time.347*/348class CTestNet4Params : public CChainParams {349public:350CTestNet4Params(const TestNetOptions& opts) {351m_chain_type = ChainType::TESTNET4;352consensus.signet_blocks = false;353consensus.signet_challenge.clear();354consensus.nSubsidyHalvingInterval = 210000;355consensus.BIP34Height = 1;356consensus.BIP34Hash = uint256{};357consensus.BIP65Height = 1;358consensus.BIP66Height = 1;359consensus.CSVHeight = 1;360consensus.SegwitHeight = 1;361consensus.MinBIP9WarningHeight = 0;362consensus.powLimit = uint256{"00000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffff"};363consensus.nPowTargetTimespan = 14 * 24 * 60 * 60; // two weeks364consensus.nPowTargetSpacing = 10 * 60;365consensus.fPowAllowMinDifficultyBlocks = true;366consensus.enforce_BIP94 = true;367consensus.fPowNoRetargeting = false;369consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].bit = 28;370consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nStartTime = Consensus::BIP9Deployment::NEVER_ACTIVE;371consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].nTimeout = Consensus::BIP9Deployment::NO_TIMEOUT;372consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].min_activation_height = 0; // No activation delay373consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].threshold = 1512; // 75%374consensus.vDeployments[Consensus::DEPLOYMENT_TESTDUMMY].period = 2016;376ApplyDeploymentOptions(opts.dep_opts);378consensus.nMinimumChainWork = uint256{"000000000000000000000000000000000000000000000e346a558455ade8eca9"};379consensus.defaultAssumeValid = uint256{"0000000021df65b91665a342e26ceb05e54826ad7d8fcd40316230058fa3b865"}; // 151604381pchMessageStart[0] = 0x1c;382pchMessageStart[1] = 0x16;383pchMessageStart[2] = 0x3f;384pchMessageStart[3] = 0x28;385nDefaultPort = 48333;386nPruneAfterHeight = 1000;387m_assumed_blockchain_size = 31;388m_assumed_chain_state_size = 2;390const char* testnet4_genesis_msg = "03/May/2024 000000000000000000001ebd58c244970b3aa9d783bb001011fbe8ea8e98e00e";391const CScript testnet4_genesis_script = CScript() << "000000000000000000000000000000000000000000000000000000000000000000"_hex << OP_CHECKSIG;392genesis = CreateGenesisBlock(testnet4_genesis_msg,393testnet4_genesis_script,3941714777860,395393743547,3960x1d00ffff,3971,39850 * COIN);399consensus.hashGenesisBlock = genesis.GetHash();400assert(consensus.hashGenesisBlock == uint256{"00000000da84f2bafbbc53dee25a72ae507ff4914b867c565be350b0da8bf043"});401assert(genesis.hashMerkleRoot == uint256{"7aa0a7ae1e223414cb807e40cd57e667b718e42aaf9306db9102fe28912b7b4e"});403vFixedSeeds.clear();404vSeeds.clear();405// nodes with support for servicebits filtering should be at the top406vSeeds.emplace_back("seed.testnet4.bitcoin.sprovoost.nl."); // Sjors Provoost407vSeeds.emplace_back("seed.testnet4.wiz.biz."); // Jason Maurice409base58Prefixes[PUBKEY_ADDRESS] = std::vector<unsigned char>(1,111);410base58Prefixes[SCRIPT_ADDRESS] = std::vector<unsigned char>(1,196);411base58Prefixes[SECRET_KEY] = std::vector<unsigned char>(1,239);412base58Prefixes[EXT_PUBLIC_KEY] = {0x04, 0x35, 0x87, 0xCF};413base58Prefixes[EXT_SECRET_KEY] = {0x04, 0x35, 0x83, 0x94};415bech32_hrp = "tb";417vFixedSeeds = std::vector<uint8_t>(std::begin(chainparams_seed_testnet4), std::end(chainparams_seed_testnet4));419fDefaultConsistencyChecks = false;420m_is_mockable_chain = false;422m_assumeutxo_data = {423{424.height = 90'000,425.hash_serialized = AssumeutxoHash{uint256{"784fb5e98241de66fdd429f4392155c9e7db5c017148e66e8fdbc95746f8b9b5"}},426.m_chain_tx_count = 11347043,427.blockhash = uint256{"0000000002ebe8bcda020e0dd6ccfbdfac531d2f6a81457191b99fc2df2dbe3b"},428},429{430.height = 120'000,431.hash_serialized = AssumeutxoHash{uint256{"10b05d05ad468d0971162e1b222a4aa66caca89da2bb2a93f8f37fb29c4794b0"}},432.m_chain_tx_count = 14141057,433.blockhash = uint256{"000000000bd2317e51b3c5794981c35ba894ce27d3e772d5c39ecd9cbce01dc8"},434},435{436.height = 150'000,437.hash_serialized = AssumeutxoHash{uint256{"ca068cae50679d7c947454bbe4f0e6aeec1fbe2c6c2735a08bb988623649f950"}},438.m_chain_tx_count = 14810011,439.blockhash = uint256{"0000000000d9877342754dea8ec1eb24631517d38e3443c370465ee53a8b7434"},440}441};443chainTxData = ChainTxData{444// Data from RPC: getchaintxstats 4096 0000000021df65b91665a342e26ceb05e54826ad7d8fcd40316230058fa3b865445.nTime = 1788932739,446.tx_count = 14825119,447.dTxRate = 0.1148250171344748,448};450// Generated by headerssync-params.py on 2026-09-08.451m_headers_sync_params = HeadersSyncParams{452.commitment_period = 616,453.redownload_buffer_size = 16199, // 16199/616 = ~26.3 commitments454};455}456};458/**459* Signet: test network with an additional consensus parameter (see BIP325).460*/461class SigNetParams : public CChainParams {462public:463explicit SigNetParams(const SigNetOptions& options)464{465std::vector<uint8_t> bin;466vFixedSeeds.clear();467vSeeds.clear();469if (!options.challenge) {470bin = "512103ad5e0edad18cb1f0fc0d28a3d4f1f3e445640337489abb10404f2d1e086be430210359ef5021964fe22d6f8e05b2463c9540ce96883fe3b278760f048f5189f2e6c452ae"_hex_v_u8;471vFixedSeeds = std::vector<uint8_t>(std::begin(chainparams_seed_signet), std::end(chainparams_seed_signet));472vSeeds.emplace_back("seed.signet.bitcoin.sprovoost.nl.");473vSeeds.emplace_back("seed.signet.achownodes.xyz."); // Ava Chow, only supports x1, x5, x9, x49, x809, x849, xd, x400, x404, x408, x448, xc08, xc48, x40c475consensus.nMinimumChainWork = uint256{"00000000000000000000000000000000000000000000000000001090e9dc1520"};476consensus.defaultAssumeValid = uint256{"00000002a5e0ba0498f1e9f4591af0b66b63c654665efe65206fd0ae7bbaf923"}; // 321295477m_assumed_blockchain_size = 25;478m_assumed_chain_state_size = 5;479chainTxData = ChainTxData{480// Data from RPC: getchaintxstats 4096 00000002a5e0ba0498f1e9f4591af0b66b63c654665efe65206fd0ae7bbaf923481.nTime = 1788925860,482.tx_count = 32273793,483.dTxRate = 0.3977566114505673,484};485} else {486bin = *options.challenge;487consensus.nMinimumChainWork = uint256{};488consensus.defaultAssumeValid = uint256{};489m_assumed_blockchain_size = 0;490m_assumed_chain_state_size = 0;491chainTxData = ChainTxData{4920,4930,4940,495};496LogInfo("Signet with challenge %s", HexStr(bin));497}499if (options.seeds) {500vSeeds = *options.seeds;