BIP-325: Signet [consensus] #18267 #34
Replies: 1 comment
-
SummaryPR #18267 added Signet Support to Bitcoin Core. Signet is a special type of test network on Bitcoin. Signet was developed to address certain problems of existing testnet.
Signet solved these problems by adding an additional signature requirement and the usual POW for block validation. This makes Signet mining centralized, which is intentional. Signet also allows anybody to deploy their own Signet testing network with different consensus parameters. The Mutiny Wallet team created their own custom signet with 30 seconds blocks. Mutiny Blog: https://www.nobsbitcoin.com/mutinynet/ Signet Block validation rules are described in BIP325. One interesting bit on Signet block validation is the process involves creating two "virtual transactions" with A The net effect of this is if We talked in-depth about this in the review club. More on summary and further reading links in the IRC review club. QuestionsWhy do we need test networks and what problems (if any) do we have with the current testnet?Testnets are needed to perform before-deployment testing for developers. Developers can test their code in Testnets before deployment to the mainnet. testnet bitcoin doesn't have value and can be freely obtained. A Signet faucet for Signet sats: https://signetfaucet.com/ Current Testnets are problematic due to the reasons described above. Signet has become the de facto testing ground for developers. Signet block generation is more reliable and Simulates the Mainchain network situation more closely than regular Testnets. Testnets cannot be customized to have your own rules. Signet can be customized. What are some of the parameters that distinguish mainnet, testnet and signet? Which of these do the different networks have in common? What makes signet special?Different Networks are identified by chain parameters by the node. Chain parameters for MAINNET, TESTNET, SIGNET, and REGTEST are defined in
Each network parameter is an inherited class of In /**
* CChainParams defines various tweakable parameters of a given instance of the
* Bitcoin system.
*/
class CChainParams
{
public:
enum Base58Type {
PUBKEY_ADDRESS,
....
protected:
CChainParams() {}
Consensus::Params consensus;
CMessageHeader::MessageStartChars pchMessageStart;
uint16_t nDefaultPort;
uint64_t nPruneAfterHeight;
uint64_t m_assumed_blockchain_size;
uint64_t m_assumed_chain_state_size;
std::vector<std::string> vSeeds;
std::vector<unsigned char> base58Prefixes[MAX_BASE58_TYPES];
std::string bech32_hrp;
ChainType m_chain_type;
CBlock genesis;
std::vector<uint8_t> vFixedSeeds;
bool fDefaultConsistencyChecks;
bool fRequireStandard;
bool m_is_test_chain;
bool m_is_mockable_chain;
CCheckpointData checkpointData;
MapAssumeutxo m_assumeutxo_data;
ChainTxData chainTxData;
};
How is Signet Different.Unlike other networks, the Signet parameter definition starts with initializing two variables that are customizable by the user in the case of Signet.
If not provided by the user, they are set to some default values. Then it sets two extra params in These two parameters are not set for other networks. The first parameter flags that blocks are of Signet type, so block validation should
How many signets are there? Could we start our own just for review club, and if so, how?Currently, there are two Signets running publicly. The default Signet is maintained by Bitcoin Core developers and Mutiny Signet is maintained by mutiny devs. Anybody can create their own custom signet. They need to run their own Signet block production script and mine their blocks. Others can join their Signet by setting the following configs in [signet]
signetchallenge=<custom signet challenge>
addnode=<custom signet node's public IP>
dnsseed=0 What parts of this PR affect consensus-critical code for nodes running on mainnet?The PR changes many parts around certain consensus critical code. Certain modules like Care should be taken while modifying these parts of the code base. The PR contains a few changes around these codes, but no serious problems What new configuration options have been added?Three new configuration options are added to This PR added three new to the existing variants of base chain parameters, which are required for Signet. The current In void SetupChainParamsBaseOptions(ArgsManager& argsman)
{
argsman.AddArg("-chain=<chain>", "Use the chain <chain> (default: main). Allowed values: main, test, signet, regtest", ArgsManager::ALLOW_ANY, OptionsCategory::CHAINPARAMS);
argsman.AddArg("-regtest", "Enter regression test mode, which uses a special chain in which blocks can be solved instantly. "
"This is intended for regression testing tools and app development. Equivalent to -chain=regtest.", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::CHAINPARAMS);
argsman.AddArg("-testactivationheight=name@height.", "Set the activation height of 'name' (segwit, bip34, dersig, cltv, csv). (regtest-only)", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::DEBUG_TEST);
argsman.AddArg("-testnet", "Use the test chain. Equivalent to -chain=test.", ArgsManager::ALLOW_ANY, OptionsCategory::CHAINPARAMS);
argsman.AddArg("-vbparams=deployment:start:end[:min_activation_height]", "Use given start/end times and min_activation_height for specified version bits deployment (regtest-only)", ArgsManager::ALLOW_ANY | ArgsManager::DEBUG_ONLY, OptionsCategory::CHAINPARAMS);
argsman.AddArg("-signet", "Use the signet chain. Equivalent to -chain=signet. Note that the network is defined by the -signetchallenge parameter", ArgsManager::ALLOW_ANY, OptionsCategory::CHAINPARAMS);
argsman.AddArg("-signetchallenge", "Blocks must satisfy the given script to be considered valid (only for signet networks; defaults to the global default signet test network challenge)", ArgsManager::ALLOW_ANY | ArgsManager::DISALLOW_NEGATION, OptionsCategory::CHAINPARAMS);
argsman.AddArg("-signetseednode", "Specify a seed node for the signet network, in the hostname[:port] format, e.g. sig.net:1234 (may be used multiple times to specify multiple seed nodes; defaults to the global default signet test network seed node(s))", ArgsManager::ALLOW_ANY | ArgsManager::DISALLOW_NEGATION, OptionsCategory::CHAINPARAMS);
} What are CMutableTransaction tx_to_spend and CMutableTransaction tx_spending? (Defined in src/signet.cpp) Who broadcasts these transactions?These transactions are the "virtual transactions" defined by BIP325. These two transactions are defined in In /**
* Generate the signet tx corresponding to the given block
*
* The signet tx commits to everything in the block except:
* 1. It hashes a modified merkle root with the signet signature removed.
* 2. It skips the nonce.
*/
class SignetTxs {
template<class T1, class T2>
SignetTxs(const T1& to_spend, const T2& to_sign) : m_to_spend{to_spend}, m_to_sign{to_sign} { }
public:
static std::optional<SignetTxs> Create(const CBlock& block, const CScript& challenge);
const CTransaction m_to_spend;
const CTransaction m_to_sign;
}; They are never broadcasted and only created internally at the time of validation by the node. Look into Why was GetWitnessCommitmentIndex() moved? Was anything altered?Answer requested from the community. (bonus) Did you build the GUI? How does it look different from mainnet?Answer requested from the community. (double bonus) Why is the signet commitment concatenated to the witness commitment and not in its own OP_RETURN?Answer requested from the community. |
Beta Was this translation helpful? Give feedback.
-
Session Details
[Consensus]
[python]
Learning
Summary
This PR is an old one, and added the support for Signet BIP325 into core. While the PR is quite a big changeset, the core of the change is not that big. This PR gives a glimpse of how different networks (mainnet, signet, regtest, testnet) are identified by the node, how they are different, how they are tested in the functional testing environment, and how we can configure the local node for different networks.
Notes and Questions: https://bitcoincore.reviews/18267
Beta Was this translation helpful? Give feedback.
All reactions