Skip to content
Merged
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
29 changes: 20 additions & 9 deletions src/chainparams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,26 @@ class CCustomParams : public CChainParams {
fRequireStandard = GetBoolArg("-frequirestandard", false);
fMineBlocksOnDemand = GetBoolArg("-fmineblocksondemand", true);
anyonecanspend_aremine = GetBoolArg("-anyonecanspendaremine", true);

base58Prefixes[PUBKEY_ADDRESS] = std::vector<unsigned char>(1, GetArg("-pubkeyprefix", 235));
base58Prefixes[SCRIPT_ADDRESS] = std::vector<unsigned char>(1, GetArg("-scriptprefix", 75));
base58Prefixes[BLINDED_ADDRESS]= std::vector<unsigned char>(1, GetArg("-blindedprefix", 4));
base58Prefixes[SECRET_KEY] = std::vector<unsigned char>(1, GetArg("-secretprefix", 239));

std::string extpubprefix = GetArg("-extpubkeyprefix", "043587CF");
if (!IsHex(extpubprefix) || extpubprefix.size() != 8) {
assert("-extpubkeyprefix must be hex string of length 8" && false);
}
base58Prefixes[EXT_PUBLIC_KEY] = ParseHex(extpubprefix);

std::string extprvprefix = GetArg("-extprvkeyprefix", "04358394");
if (!IsHex(extprvprefix) || extprvprefix.size() != 8) {
assert("-extprvkeyprefix must be hex string of length 8" && false);
}
base58Prefixes[EXT_SECRET_KEY] = ParseHex(extprvprefix);
base58Prefixes[PARENT_PUBKEY_ADDRESS] = std::vector<unsigned char>(1, GetArg("-parentpubkeyprefix", 111));
base58Prefixes[PARENT_SCRIPT_ADDRESS] = std::vector<unsigned char>(1, GetArg("-parentscriptprefix", 196));

}

public:
Expand Down Expand Up @@ -199,15 +219,6 @@ class CCustomParams : public CChainParams {
0,
0
};
base58Prefixes[PUBKEY_ADDRESS] = std::vector<unsigned char>(1,235);
base58Prefixes[SCRIPT_ADDRESS] = std::vector<unsigned char>(1,75);
base58Prefixes[BLINDED_ADDRESS]= std::vector<unsigned char>(1,4);
base58Prefixes[SECRET_KEY] = std::vector<unsigned char>(1,239);
base58Prefixes[EXT_PUBLIC_KEY] = boost::assign::list_of(0x04)(0x35)(0x87)(0xCF).convert_to_container<std::vector<unsigned char> >();
base58Prefixes[EXT_SECRET_KEY] = boost::assign::list_of(0x04)(0x35)(0x83)(0x94).convert_to_container<std::vector<unsigned char> >();

base58Prefixes[PARENT_PUBKEY_ADDRESS] = std::vector<unsigned char>(1, GetArg("-parentpubkeyprefix", 111));
base58Prefixes[PARENT_SCRIPT_ADDRESS] = std::vector<unsigned char>(1, GetArg("-parentscriptprefix", 196));
}
};

Expand Down
7 changes: 7 additions & 0 deletions src/chainparamsbase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@ void AppendParamsHelpMessages(std::string& strUsage, bool debugHelp)
strUsage += HelpMessageOpt("-chain=<chain>", strprintf(_("Use the chain <chain> (default: %s). Anything except main is allowed"), CHAINPARAMS_REGTEST));
if (debugHelp) {
strUsage += HelpMessageOpt("-regtest", strprintf(_("Equivalent to -chain=%s"), CHAINPARAMS_REGTEST));
strUsage += HelpMessageOpt("-pubkeyprefix", strprintf(_("The byte prefix, in decimal, of the chain's base58 pubkey address. (default: %d)"), 235));
strUsage += HelpMessageOpt("-scriptprefix", strprintf(_("The byte prefix, in decimal, of the chain's base58 script address. (default: %d)"), 75));
strUsage += HelpMessageOpt("-secretprefix", strprintf(_("The byte prefix, in decimal, of the chain's base58 secret key encoding. (default: %d)"), 239));
strUsage += HelpMessageOpt("-extpubkeyprefix", strprintf(_("The 4-byte prefix, in hex, of the chain's base58 extended public key encoding. (default: %s)"), "043587CF"));
strUsage += HelpMessageOpt("-extprvkeyprefix", strprintf(_("The 4-byte prefix, in hex, of the chain's base58 extended private key encoding. (default: %s)"), "04358394"));
strUsage += HelpMessageOpt("-blindedprefix", strprintf(_("The byte prefix, in decimal, of the chain's base58 script address. (default: %d)"), 4));

}
}

Expand Down