Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -144,3 +144,4 @@ nbproject/

#Local Development Environment - Visual Studio Code
.vscode
.ccache
3 changes: 3 additions & 0 deletions cmake/modules/NSIS.template.in
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ Section -post SEC0001
CreateShortcut "$SMPROGRAMS\$StartMenuGroup\@CPACK_NSIS_DISPLAY_NAME@ (testnet4).lnk" "$INSTDIR\${BITCOIN_GUI_NAME}" "-testnet4" "$INSTDIR\${BITCOIN_GUI_NAME}" 1
CreateShortcut "$SMPROGRAMS\$StartMenuGroup\@CPACK_NSIS_DISPLAY_NAME@ (scalenet).lnk" "$INSTDIR\${BITCOIN_GUI_NAME}" "-scalenet" "$INSTDIR\${BITCOIN_GUI_NAME}" 1
CreateShortcut "$SMPROGRAMS\$StartMenuGroup\@CPACK_NSIS_DISPLAY_NAME@ (chipnet).lnk" "$INSTDIR\${BITCOIN_GUI_NAME}" "-chipnet" "$INSTDIR\${BITCOIN_GUI_NAME}" 1
CreateShortcut "$SMPROGRAMS\$StartMenuGroup\@CPACK_NSIS_DISPLAY_NAME@ (tempnet).lnk" "$INSTDIR\${BITCOIN_GUI_NAME}" "-tempnet" "$INSTDIR\${BITCOIN_GUI_NAME}" 1
CreateShortcut "$SMPROGRAMS\$StartMenuGroup\Uninstall $(^Name).lnk" $INSTDIR\uninstall.exe
!insertmacro MUI_STARTMENU_WRITE_END
WriteRegStr HKCU "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)" DisplayName "$(^Name)"
Expand Down Expand Up @@ -146,11 +147,13 @@ Section -un.post UNSEC0001
Delete /REBOOTOK "$SMPROGRAMS\$StartMenuGroup\@CPACK_NSIS_DISPLAY_NAME@ (testnet4).lnk"
Delete /REBOOTOK "$SMPROGRAMS\$StartMenuGroup\@CPACK_NSIS_DISPLAY_NAME@ (scalenet).lnk"
Delete /REBOOTOK "$SMPROGRAMS\$StartMenuGroup\@CPACK_NSIS_DISPLAY_NAME@ (chipnet).lnk"
Delete /REBOOTOK "$SMPROGRAMS\$StartMenuGroup\@CPACK_NSIS_DISPLAY_NAME@ (tempnet).lnk"
Delete /REBOOTOK "$SMSTARTUP\Bitcoin Cash Node.lnk"
Delete /REBOOTOK "$SMSTARTUP\Bitcoin Cash Node (testnet).lnk"
Delete /REBOOTOK "$SMSTARTUP\Bitcoin Cash Node (testnet4).lnk"
Delete /REBOOTOK "$SMSTARTUP\Bitcoin Cash Node (scalenet).lnk"
Delete /REBOOTOK "$SMSTARTUP\Bitcoin Cash Node (chipnet).lnk"
Delete /REBOOTOK "$SMSTARTUP\Bitcoin Cash Node (tempnet).lnk"
Delete /REBOOTOK "$SMSTARTUP\Bitcoin Cash Node (regtest).lnk"
Delete /REBOOTOK "$INSTDIR\uninstall.exe"
Delete /REBOOTOK "$INSTDIR\debug.log"
Expand Down
5 changes: 4 additions & 1 deletion contrib/devtools/chainparams/make_chainparams.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class Chain(Enum):
TestNet4 = "TESTNET4"
ScaleNet = "SCALENET"
ChipNet = "CHIPNET"
TempNet = "TEMPNET"


def get_chainparams(rpc_caller, block):
Expand All @@ -38,6 +39,8 @@ def get_chainparams(rpc_caller, block):
"edit this script to comment-out this line of code.")
elif chaininfo['chain'] == 'chip':
chain = Chain.ChipNet
elif chaininfo['chain'] == 'temp':
chain = Chain.TempNet
else:
raise NotImplementedError

Expand Down Expand Up @@ -86,7 +89,7 @@ def main(args):
formatter_class=argparse.RawTextHelpFormatter)
parser.add_argument('--address', '-a', default="127.0.0.1:8332",
help="Node address for making RPC calls.\n"
"The chain (MainNet, TestNet, TestNet4, ScaleNet) will be automatically detected.\n"
"The chain (MainNet, TestNet, TestNet4, ScaleNet, ChipNet, TempNet) will be automatically detected.\n"
"Default: '127.0.0.1:8332'")
parser.add_argument('--block', '-b',
help="The block hash or height to use for fetching chainparams.\n"
Expand Down
5 changes: 4 additions & 1 deletion contrib/devtools/gen-bitcoin-conf.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ ${BITCOIND} --help \
cat >> "${EXAMPLE_CONF_FILE}" << 'EOF'

# [Sections]
# Most options apply to mainnet, testnet, testnet4, scalenet, chipnet, and regtest.
# Most options apply to mainnet, testnet, testnet4, scalenet, chipnet, tempnet, and regtest.
# If you want to confine an option to just one network, you should add it in the
# relevant section below.
# EXCEPTIONS: The options addnode, connect, port, bind, rpcport, rpcbind and wallet
Expand All @@ -85,6 +85,9 @@ cat >> "${EXAMPLE_CONF_FILE}" << 'EOF'
# Options only for chipnet
[chip]

# Options only for tempnet
[temp]

# Options only for regtest
[regtest]
EOF
30 changes: 22 additions & 8 deletions doc/test-networks.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,18 @@ Test Networks
This document describes the Bitcoin Cash test networks supported by the
BCHN software.

There are currently three test networks that you can access with BCHN:
There are currently five test networks that you can access with BCHN:

- testnet3 (historical testnet)
- testnet4
- scalenet
- chipnet
- tempnet

These test network are maintained and supported by the wider community
of protocol developers. They can be accessed by running the software
(daemon, GUI and CLI) with `-testnet`, `-testnet4`, `-scalenet` and
`-chipnet` arguments, respectively.
(daemon, GUI and CLI) with `-testnet`, `-testnet4`, `-scalenet`,
`-chipnet`, and `-tempnet` arguments, respectively.

Other software clients may have additional test network definitions compiled
into them but these are not currently supported by BCHN and could not be
Expand Down Expand Up @@ -89,16 +90,29 @@ Chipnet is intended as a place to test against upcoming Cash Improvement
Proposals (CHIPs) which are intended to be activated in the next main network
consensus upgrade.

It therefore deploys these CHIPs (and updates to them) as much in advance as
possible (optimally 6 months ahead of the main network upgrades).
Chipnet deploys CHIPs 6 months ahead of the main network upgrades.

After the upgrade to Adaptive Blocksize Limit Algorithm for Bitcoin Cash
on this network in November 2023, the maximum blocksize of this network will
vary dynamically with a floor capacity of 2MB.
The maximum blocksize of Chipnet varies dynamically with a floor of 2MB.

Tempnet
-------

A tempnet is any temporary fork of Chipnet that tests and previews a potential
Chipnet upgrade. In the months before CHIPs are locked-in for a particular
cycle, possible CHIPs for that cycle should be integrated and tested together
via one or more coordinated public tempnets.

Tempnet and Chipnet nodes pre-queue a predefined activation transaction for
broadcast at the activation MTP. You can inspect and manage the broadcast
queue via RPC:

Overview Table for BCHN-supported Test Networks
-----------------------------------------------

This table summarizes parameters for testnet3, testnet4, scalenet, and chipnet.
Tempnet parameters match chipnet (with the exception of the latest upgrade
activation MTP/height), so it is not listed separately.

| Attribute/Network | testnet3 | testnet4 | scalenet | chipnet |
|------------------------------|-------------|--------------|-------------|-------------|
| Default p2p port | 18333 | 28333 | 38333 | 48333 |
Expand Down
1 change: 1 addition & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -581,6 +581,7 @@ add_library(server
net_processing.cpp
node/blockstorage.cpp
node/transaction.cpp
node/txbroadcastqueue.cpp
noui.cpp
outputtype.cpp
policy/fees.cpp
Expand Down
4 changes: 3 additions & 1 deletion src/bitcoin-cli.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ static void SetupCliArgs() {
const auto testnet4BaseParams = CreateBaseChainParams(CBaseChainParams::TESTNET4);
const auto scalenetBaseParams = CreateBaseChainParams(CBaseChainParams::SCALENET);
const auto chipnetBaseParams = CreateBaseChainParams(CBaseChainParams::CHIPNET);
const auto tempnetBaseParams = CreateBaseChainParams(CBaseChainParams::TEMPNET);
const auto regtestBaseParams = CreateBaseChainParams(CBaseChainParams::REGTEST);

gArgs.AddArg("-version", "Print version and exit", ArgsManager::ALLOW_ANY,
Expand Down Expand Up @@ -77,12 +78,13 @@ static void SetupCliArgs() {
ArgsManager::ALLOW_ANY, OptionsCategory::OPTIONS);
gArgs.AddArg("-rpcport=<port>",
strprintf("Connect to JSON-RPC on <port> (default: %u, "
"testnet: %u, testnet4: %u, scalenet: %u, chipnet: %u, regtest: %u)",
"testnet: %u, testnet4: %u, scalenet: %u, chipnet: %u, tempnet: %u, regtest: %u)",
defaultBaseParams->RPCPort(),
testnetBaseParams->RPCPort(),
testnet4BaseParams->RPCPort(),
scalenetBaseParams->RPCPort(),
chipnetBaseParams->RPCPort(),
tempnetBaseParams->RPCPort(),
regtestBaseParams->RPCPort()),
ArgsManager::ALLOW_ANY | ArgsManager::NETWORK_ONLY, OptionsCategory::OPTIONS);
gArgs.AddArg("-rpcwait", "Wait for RPC server to start", ArgsManager::ALLOW_ANY,
Expand Down
54 changes: 44 additions & 10 deletions src/chainparams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,11 @@
#include <chainparamsconstants.h>
#include <chainparamsseeds.h>
#include <consensus/consensus.h>
#include <consensus/upgrade_times.h>
#include <consensus/merkle.h>
#include <netbase.h>
#include <primitives/transaction.h>
#include <streams.h>
#include <tinyformat.h>
#include <util/strencodings.h>
#include <util/system.h>
Expand Down Expand Up @@ -149,8 +152,8 @@ class CMainParams : public CChainParams {
// May 15, 2025 12:00:00 UTC protocol upgrade (this is one less than the first block mined under new rules)
consensus.upgrade11Height = 898373;

// May 15, 2026 12:00:00 UTC tentative protocol upgrade
consensus.upgrade12ActivationTime = 1778846400;
consensus.upgrade12ActivationTime = Consensus::UpgradeTimes::MAY_2026;
consensus.softwareExpiryTime = Consensus::UpgradeTimes::MAY_2027;

// Default limit for block size (in bytes)
consensus.nDefaultConsensusBlockSize = DEFAULT_CONSENSUS_BLOCK_SIZE;
Expand Down Expand Up @@ -403,8 +406,8 @@ class CTestNetParams : public CChainParams {
// May 15, 2025 12:00:00 UTC protocol upgrade (this is one less than the first block mined under new rules)
consensus.upgrade11Height = 1658049;

// May 15, 2026 12:00:00 UTC tentative protocol upgrade
consensus.upgrade12ActivationTime = 1778846400;
consensus.upgrade12ActivationTime = Consensus::UpgradeTimes::MAY_2026;
consensus.softwareExpiryTime = Consensus::UpgradeTimes::MAY_2027;

// Default limit for block size (in bytes)
consensus.nDefaultConsensusBlockSize = DEFAULT_CONSENSUS_BLOCK_SIZE;
Expand Down Expand Up @@ -620,8 +623,8 @@ class CTestNet4Params : public CChainParams {
// May 15, 2025 12:00:00 UTC protocol upgrade (this is one less than the first block mined under new rules)
consensus.upgrade11Height = 253318;

// May 15, 2026 12:00:00 UTC tentative protocol upgrade
consensus.upgrade12ActivationTime = 1778846400;
consensus.upgrade12ActivationTime = Consensus::UpgradeTimes::MAY_2026;
consensus.softwareExpiryTime = Consensus::UpgradeTimes::MAY_2027;

// Default limit for block size (in bytes) (testnet4 is smaller at 2MB)
consensus.nDefaultConsensusBlockSize = 2 * ONE_MEGABYTE;
Expand Down Expand Up @@ -807,8 +810,8 @@ class CScaleNetParams : public CChainParams {
// May 15, 2025 12:00:00 UTC protocol upgrade
consensus.upgrade11Height = 10'006;

// May 15, 2026 12:00:00 UTC tentative protocol upgrade
consensus.upgrade12ActivationTime = 1778846400;
consensus.upgrade12ActivationTime = Consensus::UpgradeTimes::MAY_2026;
consensus.softwareExpiryTime = Consensus::UpgradeTimes::MAY_2027;

// Default limit for block size (in bytes)
consensus.nDefaultConsensusBlockSize = 256 * ONE_MEGABYTE;
Expand Down Expand Up @@ -967,8 +970,19 @@ class CChipNetParams : public CChainParams {
// November 15, 2024 12:00:00 UTC; protocol upgrade activates 6 months early
consensus.upgrade11Height = 227228; // (one less than upgrade block)

// November 15, 2025 12:00:00 UTC; tentative protocol upgrade activates 6 months early
consensus.upgrade12ActivationTime = 1763208000;
consensus.upgrade12ActivationTime = Consensus::UpgradeTimes::NOV_2025;
consensus.softwareExpiryTime = Consensus::UpgradeTimes::NOV_2026;

// Require and pre-queue a predefined activation transaction on chipnet.
static const char *const CHIPNET_ACTIVATION_TX_HEX =
"020000000130d1c3a524c4b208e6c1b558b110749f4ae1d431373b10a963f3ff9d873db75700000000040279015d00000000010000000000000000a9ef30d1c3a524c4b208e6c1b558b110749f4ae1d431373b10a963f3ff9d873db757608000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006a043230323600000000";
consensus.upgrade12ActivationTx = ParseHex(CHIPNET_ACTIVATION_TX_HEX);
{
CDataStream ss(consensus.upgrade12ActivationTx, SER_NETWORK, PROTOCOL_VERSION);
CMutableTransaction mtx;
ss >> mtx;
consensus.upgrade12ActivationTxid = CTransaction(mtx).GetId();
}

// Default limit for block size (in bytes) (chipnet is like testnet4 in that it is smaller at 2MB)
consensus.nDefaultConsensusBlockSize = 2 * ONE_MEGABYTE;
Expand Down Expand Up @@ -1071,6 +1085,22 @@ class CChipNetParams : public CChainParams {
}
};

class CTempNetParams : public CChipNetParams {
public:
CTempNetParams() {
strNetworkID = CBaseChainParams::TEMPNET;
// Tempnets activate the next consensus changes ahead of chipnet.
consensus.upgrade12ActivationTime = 1757937600; // Sep 15 2025 12:00:00 UTC
// Tempnets expire when the real chipnet activates the upgrade:
consensus.softwareExpiryTime = Consensus::UpgradeTimes::NOV_2025;
vSeeds.clear();
vFixedSeeds.clear();
vSeeds.emplace_back("tempnet.bitjson.com");
vSeeds.emplace_back("chipnet.bitjson.com");
vFixedSeeds.assign(std::begin(pnSeed6_tempnet), std::end(pnSeed6_tempnet));
}
};

/**
* Regression test
*/
Expand Down Expand Up @@ -1242,6 +1272,10 @@ std::unique_ptr<CChainParams> CreateChainParams(const std::string &chain) {
return std::make_unique<CChipNetParams>();
}

if (chain == CBaseChainParams::TEMPNET) {
return std::make_unique<CTempNetParams>();
}

throw std::runtime_error(
strprintf("%s: Unknown chain %s.", __func__, chain));
}
Expand Down
7 changes: 7 additions & 0 deletions src/chainparamsbase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const std::string CBaseChainParams::TESTNET = "test";
const std::string CBaseChainParams::TESTNET4 = "test4";
const std::string CBaseChainParams::SCALENET = "scale";
const std::string CBaseChainParams::CHIPNET = "chip";
const std::string CBaseChainParams::TEMPNET = "temp";
const std::string CBaseChainParams::REGTEST = "regtest";

void SetupChainParamsBaseOptions() {
Expand All @@ -33,6 +34,8 @@ void SetupChainParamsBaseOptions() {
OptionsCategory::CHAINPARAMS);
gArgs.AddArg("-chipnet", "Use the upcoming upgrade activation chain", ArgsManager::ALLOW_ANY,
OptionsCategory::CHAINPARAMS);
gArgs.AddArg("-tempnet", "Use the temporary test chain for upcoming chipnet rules", ArgsManager::ALLOW_ANY,
OptionsCategory::CHAINPARAMS);
}

static std::unique_ptr<CBaseChainParams> globalChainBaseParams;
Expand Down Expand Up @@ -67,6 +70,10 @@ std::unique_ptr<CBaseChainParams> CreateBaseChainParams(const std::string &chain
return std::make_unique<CBaseChainParams>("chipnet", 48332, 48334);
}

if (chain == CBaseChainParams::TEMPNET) {
return std::make_unique<CBaseChainParams>("tempnet", 48332, 48334);
}

if (chain == CBaseChainParams::REGTEST) {
return std::make_unique<CBaseChainParams>("regtest", 18443, 18445);
}
Expand Down
1 change: 1 addition & 0 deletions src/chainparamsbase.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class CBaseChainParams {
static const std::string TESTNET4;
static const std::string SCALENET;
static const std::string CHIPNET;
static const std::string TEMPNET;
static const std::string REGTEST;

const std::string &DataDir() const { return strDataDir; }
Expand Down
11 changes: 11 additions & 0 deletions src/chainparamsseeds.h
Original file line number Diff line number Diff line change
Expand Up @@ -205,3 +205,14 @@ static const SeedSpec6 pnSeed6_chipnet[] = {
{ "72.66.71.69:48333" },
{ "208.88.16.38:48333" }
};

static const SeedSpec6 pnSeed6_tempnet[] = {
{ "192.241.252.19:48333" },
{ "165.232.108.105:48333" },
{ "188.166.38.228:48333" },
{ "142.93.105.115:48333" },
{ "146.190.48.81:48333" },
{ "159.89.170.220:48333" },
{ "165.22.53.37:48333" },
{ "134.199.159.4:48333" }
};
15 changes: 5 additions & 10 deletions src/consensus/activation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ int32_t GetUpgrade9ActivationHeight(const Consensus::Params &params) {
}

bool IsUpgrade9EnabledForHeightPrev(const Consensus::Params &params, const int32_t nHeightPrev) {
return nHeightPrev >= GetUpgrade9ActivationHeight(params);
return nHeightPrev >= g_Upgrade9HeightOverride.value_or(params.upgrade9Height);
}

bool IsUpgrade9Enabled(const Consensus::Params &params, const CBlockIndex *pindexPrev) {
Expand All @@ -125,16 +125,13 @@ int32_t GetUpgrade10ActivationHeight(const Consensus::Params &params) {
return g_Upgrade10HeightOverride.value_or(params.upgrade10Height);
}

static bool IsUpgrade10EnabledForHeightPrev(const Consensus::Params &params, const int32_t nHeightPrev) {
return nHeightPrev >= GetUpgrade10ActivationHeight(params);
}

bool IsUpgrade10Enabled(const Consensus::Params &params, const CBlockIndex *pindexPrev) {
if (pindexPrev == nullptr) {
return false;
}

return IsUpgrade10EnabledForHeightPrev(params, pindexPrev->nHeight);
return pindexPrev->nHeight >= g_Upgrade10HeightOverride.value_or(params.upgrade10Height);
}

// Upgrade 11
Expand All @@ -145,7 +142,7 @@ int32_t GetUpgrade11ActivationHeight(const Consensus::Params &params) {
}

static bool IsUpgrade11EnabledForHeightPrev(const Consensus::Params &params, const int32_t nHeightPrev) {
return nHeightPrev >= GetUpgrade11ActivationHeight(params);
return nHeightPrev >= g_Upgrade11HeightOverride.value_or(params.upgrade11Height);
}

bool IsUpgrade11Enabled(const Consensus::Params &params, const CBlockIndex *pindexPrev) {
Expand All @@ -157,14 +154,12 @@ bool IsUpgrade11Enabled(const Consensus::Params &params, const CBlockIndex *pind
}

// Upgrade 12
static bool IsUpgrade12Enabled(const Consensus::Params &params, const int64_t nMedianTimePast) {
return nMedianTimePast >= gArgs.GetArg("-upgrade12activationtime", params.upgrade12ActivationTime);
}

bool IsUpgrade12Enabled(const Consensus::Params &params, const CBlockIndex *pindexPrev) {
if (pindexPrev == nullptr) {
return false;
}

return IsUpgrade12Enabled(params, pindexPrev->GetMedianTimePast());
return pindexPrev->GetMedianTimePast() >=
gArgs.GetArg("-upgrade12activationtime", params.upgrade12ActivationTime);
}
8 changes: 8 additions & 0 deletions src/consensus/params.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

#include <limits>
#include <optional>
#include <vector>

namespace Consensus {

Expand Down Expand Up @@ -57,6 +58,13 @@ struct Params {
int upgrade11Height;
/** Unix time used for tentative MTP activation of 15 May 2026 12:00:00 UTC upgrade */
int64_t upgrade12ActivationTime;
/** Default time for software_outdated warnings (non-consensus). <=0 disables. */
int64_t softwareExpiryTime = 0;

/** Raw tx required in the first block after tempnet activates (tempnet-only). */
std::vector<unsigned char> upgrade12ActivationTx;
/** Precomputed txid of the activation tx. */
uint256 upgrade12ActivationTxid;

/** Default blocksize limit -- can be overridden with the -excessiveblocksize= command-line switch.
After activation of upgrade 10, this is the minimum max block size, since the ABLA algorithm allows for
Expand Down
Loading