@@ -1213,53 +1213,363 @@ impl std::default::Default for Config {
1213
1213
1214
1214
#[ derive( Clone , Debug , Default , Deserialize , PartialEq ) ]
1215
1215
pub struct BurnchainConfig {
1216
+ /// The underlying blockchain used for Proof-of-Transfer.
1217
+ /// Currently, only `"bitcoin"` is supported.
1218
+ ///
1219
+ /// Default: `"bitcoin"`
1216
1220
pub chain : String ,
1221
+ /// The operational mode or network profile for the Stacks node.
1222
+ /// This setting determines network parameters (like chain ID, peer version),
1223
+ /// default configurations, genesis block definitions, and overall node behavior.
1224
+ ///
1225
+ /// Supported values:
1226
+ /// ```text
1227
+ /// | Mode | Network Type |
1228
+ /// |-----------------|--------------|
1229
+ /// | "mainnet" | mainnet |
1230
+ /// | "xenon" | testnet |
1231
+ /// | "mocknet" | regtest |
1232
+ /// | "helium" | regtest |
1233
+ /// | "neon" | regtest |
1234
+ /// | "argon" | regtest |
1235
+ /// | "krypton" | regtest |
1236
+ /// | "nakamoto-neon" | regtest |
1237
+ /// ```
1238
+ ///
1239
+ /// Default: `"mocknet"`
1217
1240
pub mode : String ,
1241
+ /// The network-specific identifier used in P2P communication and database initialization.
1242
+ /// Derived from `mode` during config load, unless explicitly overridden (for test purposes).
1243
+ ///
1244
+ /// **Warning:** Do not modify this unless you really know what you're doing.
1245
+ /// This is intended strictly for testing purposes.
1246
+ ///
1247
+ /// Default: Derived from [`BurnchainConfig::mode`] ([`CHAIN_ID_MAINNET`] for `mainnet`, [`CHAIN_ID_TESTNET`] otherwise).
1218
1248
pub chain_id : u32 ,
1249
+ /// The peer protocol version number used in P2P communication.
1250
+ /// This parameter cannot be set via the configuration file.
1251
+ ///
1252
+ /// **Warning:** Do not modify this unless you really know what you're doing.
1253
+ ///
1254
+ /// Default: Derived from [`BurnchainConfig::mode`] ([`PEER_VERSION_MAINNET`] for `mainnet`, [`PEER_VERSION_TESTNET`] otherwise).
1219
1255
pub peer_version : u32 ,
1256
+ /// Specifies a mandatory wait period (in milliseconds) after receiving a burnchain tip
1257
+ /// before the node attempts to build the anchored block for the new tenure.
1258
+ /// This duration effectively schedules the start of the block-building
1259
+ /// process relative to the tip's arrival time.
1260
+ ///
1261
+ /// This is intended strictly for testing purposes.
1262
+ ///
1263
+ /// Default: `5000` milliseconds.
1264
+ /// `10000` milliseconds when launched with the `helium` or `mocknet` subcommands.
1220
1265
pub commit_anchor_block_within : u64 ,
1266
+ /// The maximum amount (in sats) of "burn commitment" to broadcast for the next block's leader election.
1267
+ /// Acts as a safety cap to limit the maximum amount spent on mining.
1268
+ /// It serves as both the target fee and a fallback if dynamic fee calculations fail or cannot be performed.
1269
+ ///
1270
+ /// This setting can be hot-reloaded from the config file, allowing adjustment without restarting.
1271
+ ///
1272
+ /// Only relevant if [`NodeConfig::miner`] is `true`.
1273
+ ///
1274
+ /// Default: `20000` satoshis
1221
1275
pub burn_fee_cap : u64 ,
1276
+ /// The hostname or IP address of the bitcoin node peer.
1277
+ ///
1278
+ /// This field is required for all node configurations as it specifies where to find the underlying
1279
+ /// bitcoin node to interact with for PoX operations, block validation, and mining.
1280
+ ///
1281
+ /// Default: `"0.0.0.0"`
1222
1282
pub peer_host : String ,
1283
+ /// The P2P network port of the bitcoin node specified by [`BurnchainConfig::peer_host`].
1284
+ ///
1285
+ /// Default: `8333`
1223
1286
pub peer_port : u16 ,
1287
+ /// The RPC port of the bitcoin node specified by [`BurnchainConfig::peer_host`].
1288
+ ///
1289
+ /// Default: `8332`
1224
1290
pub rpc_port : u16 ,
1291
+ /// Flag indicating whether to use SSL/TLS when connecting to the bitcoin node's RPC interface.
1292
+ ///
1293
+ /// Default: `false`
1225
1294
pub rpc_ssl : bool ,
1295
+ /// The username for authenticating with the bitcoin node's RPC interface.
1296
+ /// Required if the bitcoin node requires RPC authentication.
1297
+ ///
1298
+ /// Only relevant if [`NodeConfig::miner`] is `true`.
1299
+ ///
1300
+ /// Default: `None`
1226
1301
pub username : Option < String > ,
1302
+ /// The password for authenticating with the bitcoin node's RPC interface.
1303
+ /// Required if the bitcoin node requires RPC authentication.
1304
+ ///
1305
+ /// Only relevant if [`NodeConfig::miner`] is `true`.
1306
+ ///
1307
+ /// Default: `None`
1227
1308
pub password : Option < String > ,
1228
- /// Timeout, in seconds, for communication with bitcoind
1309
+ /// Timeout duration, in seconds, for RPC calls made to the bitcoin node.
1310
+ /// Configures the timeout on the underlying HTTP client.
1311
+ ///
1312
+ /// Default: `60` seconds
1229
1313
pub timeout : u32 ,
1314
+ /// The network "magic bytes" used to identify packets for the specific bitcoin network instance
1315
+ /// (e.g., mainnet, testnet, regtest). Must match the magic bytes of the connected bitcoin node.
1316
+ ///
1317
+ /// These two-byte identifiers help ensure that nodes only connect to peers on the same network type.
1318
+ /// Common values include:
1319
+ /// - "X2" for mainnet
1320
+ /// - "T2" for testnet (xenon)
1321
+ /// - Other values for specific test networks
1322
+ ///
1323
+ /// Configured as a 2-character ASCII string (e.g., "X2" for mainnet).
1324
+ ///
1325
+ /// Default: [`BLOCKSTACK_MAGIC_MAINNET`] (corresponds to "X2") unless overridden by [`BurnchainConfig::mode`] (e.g., "T2" for testnet (xenon)).
1230
1326
pub magic_bytes : MagicBytes ,
1327
+ /// The public key associated with the local mining address for the underlying Bitcoin regtest node.
1328
+ /// Provided as a hex string representing an uncompressed public key.
1329
+ ///
1330
+ /// It is primarily used in modes that rely on a controlled Bitcoin regtest backend
1331
+ /// (e.g., "helium", "mocknet", "neon") where the Stacks node itself needs to
1332
+ /// instruct the Bitcoin node to generate blocks.
1333
+ ///
1334
+ /// The key is used to derive the Bitcoin address that receives the coinbase rewards
1335
+ /// when generating blocks on the regtest network.
1336
+ ///
1337
+ /// Mandatory if [`BurnchainConfig::mode`] is "helium".
1338
+ /// This is intended strictly for testing purposes.
1339
+ ///
1340
+ /// Default: `None`
1231
1341
pub local_mining_public_key : Option < String > ,
1342
+ /// Optional bitcoin block height at which the Stacks node process should gracefully exit.
1343
+ /// When bitcoin reaches this height, the node logs a message and initiates a graceful shutdown.
1344
+ ///
1345
+ /// Applied only if [`BurnchainConfig::mode`] is not "mainnet".
1346
+ /// This is intended strictly for testing purposes.
1347
+ ///
1348
+ /// Default: `None`
1232
1349
pub process_exit_at_block_height : Option < u64 > ,
1350
+ /// The interval, in seconds, at which the node polls the bitcoin node for new blocks and state updates.
1351
+ ///
1352
+ /// The default value of 10 seconds is mainly intended for testing purposes.
1353
+ /// It's suggested to set this to a higher value for mainnet, e.g., 300 seconds (5 minutes).
1354
+ ///
1355
+ /// Default: `10` seconds
1233
1356
pub poll_time_secs : u64 ,
1357
+ /// The default fee rate in satoshis per virtual byte (sats/vB) to use when estimating fees for miners
1358
+ /// to submit bitcoin transactions (like block commits or leader key registrations).
1359
+ ///
1360
+ /// Only relevant if [`NodeConfig::miner`] is `true`.
1361
+ ///
1362
+ /// Default: [`DEFAULT_SATS_PER_VB`] (currently 50 satoshis per virtual byte)
1234
1363
pub satoshis_per_byte : u64 ,
1235
- /// Maximum percentage of `satoshis_per_byte` that a Bitcoin fee rate may
1236
- /// be increased to when RBFing a transaction
1364
+ /// Maximum fee rate multiplier allowed when using Replace-By-Fee (RBF) for bitcoin transactions.
1365
+ /// Expressed as a percentage of the original [`BurnchainConfig::satoshis_per_byte`] rate (e.g.,
1366
+ /// 150 means the fee rate can be increased up to 1.5x). Used in mining logic for RBF decisions
1367
+ /// to cap the replacement fee rate.
1368
+ ///
1369
+ /// Only relevant if [`NodeConfig::miner`] is `true`.
1370
+ ///
1371
+ /// Default: [`DEFAULT_MAX_RBF_RATE`] (currently 150, i.e., 1.5x)
1237
1372
pub max_rbf : u64 ,
1373
+ /// Estimated size (in virtual bytes) of a leader key registration transaction on bitcoin.
1374
+ /// Used for fee calculation in mining logic by multiplying with the fee rate [`BurnchainConfig::satoshis_per_byte`].
1375
+ ///
1376
+ /// Only relevant if [`NodeConfig::miner`] is `true`.
1377
+ ///
1378
+ /// Default: [`OP_TX_LEADER_KEY_ESTIM_SIZE`] (currently 290)
1238
1379
pub leader_key_tx_estimated_size : u64 ,
1380
+ /// Estimated size (in virtual bytes) of a block commit transaction on bitcoin.
1381
+ /// Used for fee calculation in mining logic by multiplying with the fee rate [`BurnchainConfig::satoshis_per_byte`].
1382
+ ///
1383
+ /// Only relevant if [`NodeConfig::miner`] is `true`.
1384
+ ///
1385
+ /// Default: [`OP_TX_BLOCK_COMMIT_ESTIM_SIZE`] (currently 380)
1239
1386
pub block_commit_tx_estimated_size : u64 ,
1240
- /// Amount to increment the fee by, in Sats/vByte, when RBFing a Bitcoin
1241
- /// transaction
1387
+ /// The incremental amount (in Sats/vByte) to add to the previous transaction's
1388
+ /// fee rate for RBF bitcoin transactions.
1389
+ ///
1390
+ /// Only relevant if [`NodeConfig::miner`] is `true`.
1391
+ ///
1392
+ /// Default: [`DEFAULT_RBF_FEE_RATE_INCREMENT`] (currently 5 satoshis per virtual byte)
1242
1393
pub rbf_fee_increment : u64 ,
1394
+ /// Overrides the default starting bitcoin block height for the node.
1395
+ /// Allows starting synchronization from a specific historical point in test environments.
1396
+ /// Should be used together with [`BurnchainConfig::first_burn_block_timestamp`] and [`BurnchainConfig::first_burn_block_hash`] for proper operation.
1397
+ ///
1398
+ /// Applied only if [`BurnchainConfig::mode`] is not "mainnet".
1399
+ /// This is intended strictly for testing purposes.
1400
+ ///
1401
+ /// Default: `None` (uses the burnchain's default starting height for the mode).
1243
1402
pub first_burn_block_height : Option < u64 > ,
1403
+ /// Overrides the default starting block timestamp of the burnchain.
1404
+ /// Should be used together with [`BurnchainConfig::first_burn_block_height`] and [`BurnchainConfig::first_burn_block_hash`] for proper operation.
1405
+ ///
1406
+ /// Applied only if [`BurnchainConfig::mode`] is not "mainnet".
1407
+ /// This is intended strictly for testing purposes.
1408
+ ///
1409
+ /// Default: `None` (uses the burnchain's default starting timestamp).
1244
1410
pub first_burn_block_timestamp : Option < u32 > ,
1411
+ /// Overrides the default starting block hash of the burnchain.
1412
+ /// Should be used together with [`BurnchainConfig::first_burn_block_timestamp`] and [`BurnchainConfig::first_burn_block_height`] for proper operation.
1413
+ ///
1414
+ /// Applied only if [`BurnchainConfig::mode`] is not "mainnet".
1415
+ /// This is intended strictly for testing purposes.
1416
+ ///
1417
+ /// Default: `None` (uses the burnchain's default starting block hash).
1245
1418
pub first_burn_block_hash : Option < String > ,
1246
- /// Custom override for the definitions of the epochs. This will only be applied for testnet and
1247
- /// regtest nodes.
1419
+ /// Custom override for the definitions of Stacks epochs (start/end burnchain heights, consensus rules).
1420
+ /// This setting allows testing specific epoch transitions or custom consensus rules by defining exactly
1421
+ /// when each epoch starts on bitcoin.
1422
+ ///
1423
+ /// **Configuration:**
1424
+ /// Configured as a list `[[burnchain.epochs]]` in TOML, each with:
1425
+ /// - `epoch_name`: A string identifying the epoch (e.g., `"1.0"`, `"2.05"`, `"3.1"`).
1426
+ /// - `start_height`: The Bitcoin block height at which this epoch becomes active.
1427
+ ///
1428
+ /// Example TOML entry:
1429
+ /// ```toml
1430
+ /// [[burnchain.epochs]]
1431
+ /// epoch_name = "2.1"
1432
+ /// start_height = 150
1433
+ /// ```
1434
+ ///
1435
+ /// **Details:**
1436
+ /// Epochs define distinct protocol rule sets (consensus rules, execution costs, capabilities).
1437
+ /// When configured, the list must include all epochs sequentially from "1.0" up to the
1438
+ /// highest desired epoch, without skipping any intermediate ones.
1439
+ /// Valid `epoch_name` values currently include:
1440
+ /// `"1.0"`, `"2.0"`, `"2.05"`, `"2.1"`, `"2.2"`, `"2.3"`, `"2.4"`, `"2.5"`, `"3.0"`, `"3.1"`.
1441
+ ///
1442
+ /// **Validation Rules:**
1443
+ /// - Epochs must be provided in strict chronological order (`1.0`, `2.0`, `2.05`...).
1444
+ /// - `start_height` values must be non-decreasing across the list.
1445
+ /// - Epoch `"1.0"` must have `start_height = 0`.
1446
+ /// - The number of defined epochs cannot exceed the maximum supported by the node software.
1447
+ ///
1448
+ /// Applied only if [`BurnchainConfig::mode`] is not "mainnet".
1449
+ /// This is intended strictly for testing purposes.
1450
+ ///
1451
+ /// Default: `None` (uses the standard epoch definitions for the selected `mode`).
1248
1452
pub epochs : Option < EpochList < ExecutionCost > > ,
1453
+ /// Sets a custom burnchain height for PoX-2 activation (for testing).
1454
+ ///
1455
+ /// This affects two key transitions:
1456
+ /// 1. The block height at which PoX v1 lockups are automatically unlocked.
1457
+ /// 2. The block height from which PoX reward set calculations switch to PoX v2 rules.
1458
+ ///
1459
+ /// **Behavior:**
1460
+ /// - This value directly sets the auto unlock height for PoX v1 lockups before transition to PoX v2. This
1461
+ /// also defines the burn height at which PoX reward sets are calculated using PoX v2 rather than v1.
1462
+ /// - If custom [`BurnchainConfig::epochs`] are provided:
1463
+ /// - This value is used to validate that Epoch 2.1's start height is ≤ this value.
1464
+ /// - However, the height specified in `epochs` for Epoch 2.1 takes precedence.
1465
+ ///
1466
+ /// Applied only if [`BurnchainConfig::mode`] is not "mainnet".
1467
+ /// This is intended strictly for testing purposes.
1468
+ ///
1469
+ /// Default: `None`.
1249
1470
pub pox_2_activation : Option < u32 > ,
1471
+ /// Overrides the length (in bitcoin blocks) of the PoX reward cycle.
1472
+ ///
1473
+ /// Applied only if [`BurnchainConfig::mode`] is not "mainnet".
1474
+ /// This is intended strictly for testing purposes.
1475
+ ///
1476
+ /// Default: `None` (uses the standard reward cycle length for the mode).
1250
1477
pub pox_reward_length : Option < u32 > ,
1478
+ /// Overrides the length (in bitcoin blocks) of the PoX prepare phase.
1479
+ ///
1480
+ /// Applied only if [`BurnchainConfig::mode`] is not "mainnet".
1481
+ /// This is intended strictly for testing purposes.
1482
+ ///
1483
+ /// Default: `None` (uses the standard prepare phase length for the mode).
1251
1484
pub pox_prepare_length : Option < u32 > ,
1485
+ /// Overrides the bitcoin height at which the PoX sunset period begins in epochs before 2.1.
1486
+ /// The sunset period represents a planned phase-out of the PoX mechanism. During this period,
1487
+ /// stacking rewards gradually decrease, eventually ceasing entirely. This parameter allows
1488
+ /// testing the PoX sunset transition by explicitly setting its start height.
1489
+ ///
1490
+ /// Applied only if [`BurnchainConfig::mode`] is not "mainnet".
1491
+ /// This is intended strictly for testing purposes.
1492
+ ///
1493
+ /// Default: `None` (uses the standard sunset start height for the mode).
1494
+ /// Deprecated: The sunset phase was removed in Epoch 2.1. This parameter can still be used for testing purposes for epochs before 2.1.
1252
1495
pub sunset_start : Option < u32 > ,
1496
+ ///
1497
+ /// Overrides the bitcoin height, non-inclusive, at which the PoX sunset period ends in epochs before 2.1.
1498
+ /// After this height, Stacking rewards are disabled completely. This parameter works together
1499
+ /// with `sunset_start` to define the full sunset transition period for PoX.
1500
+ ///
1501
+ /// Applied only if [`BurnchainConfig::mode`] is not "mainnet".
1502
+ /// This is intended strictly for testing purposes.
1503
+ ///
1504
+ /// Default: `None` (uses the standard sunset end height for the mode).
1505
+ /// Deprecated: The sunset phase was removed in Epoch 2.1. This parameter can still be used for testing purposes for epochs before 2.1.
1253
1506
pub sunset_end : Option < u32 > ,
1507
+ /// Specifies the name of the Bitcoin wallet to use within the connected bitcoin node.
1508
+ /// Used to interact with a specific named wallet if the bitcoin node manages multiple wallets.
1509
+ ///
1510
+ /// If the specified wallet doesn't exist, the node will attempt to create it via the createwallet RPC call.
1511
+ /// This is particularly useful for miners who need to manage separate wallets.
1512
+ ///
1513
+ /// Primarily relevant for miners interacting with multi-wallet Bitcoin nodes.
1514
+ ///
1515
+ /// Default: `""` (empty string, implying the default wallet or no specific wallet needed).
1254
1516
pub wallet_name : String ,
1517
+ /// Override for the burnchain height activating stricter AST size checks pre-epoch 3.0 for testing purposes.
1518
+ ///
1519
+ /// Used pre-epoch 3.0 to control activation before it became standard (at burn height `752000`).
1520
+ /// Ignored in standard production builds as the underlying mechanism is disabled unless the `testing` feature is active.
1521
+ ///
1522
+ /// Default: `None`.
1523
+ /// Deprecated: This setting is ignored in Epoch 3.0+.
1255
1524
pub ast_precheck_size_height : Option < u64 > ,
1525
+ /// Overrides for the burnchain block affirmation map for specific reward cycles.
1526
+ /// Allows manually setting the miner affirmation ('p'resent/'n'ot-present/'a'bsent) map for a
1527
+ /// given cycle, bypassing the map normally derived from sortition results.
1528
+ ///
1529
+ /// **Configuration:**
1530
+ /// Configured as a list `[[burnchain.affirmation_overrides]]` in TOML, each with:
1531
+ /// - `reward_cycle`: The cycle number to override.
1532
+ /// - `affirmation`: The 'p'/'n'/'a' sequence representing the map. Must have length `reward_cycle - 1`.
1533
+ ///
1534
+ /// Example TOML:
1535
+ /// ```toml
1536
+ /// [[burnchain.affirmation_overrides]]
1537
+ /// reward_cycle = 413
1538
+ /// affirmation = "pna..." # Must be 412 chars long
1539
+ /// ```
1540
+ ///
1541
+ /// **Details:**
1542
+ /// Special defaults are added when [`BurnchainConfig::mode`] is "xenon" or the node
1543
+ /// is launched with the `testnet` subcommand, but config entries take precedence.
1544
+ /// At startup, these overrides are written to the `BurnchainDB` (`overrides` table).
1545
+ /// Primarily used for testing or recovering from network issues.
1546
+ ///
1547
+ /// Default: Empty `HashMap`.
1548
+ /// Deprecated: This setting is ignored in Epoch 3.0+. Only used in the neon chain mode.
1256
1549
pub affirmation_overrides : HashMap < u64 , AffirmationMap > ,
1257
- /// fault injection to simulate a slow burnchain peer.
1258
- /// Delay burnchain block downloads by the given number of millseconds
1550
+ /// Fault injection setting for testing. Introduces an artificial delay (in milliseconds)
1551
+ /// before processing each burnchain block download. Simulates a slow burnchain connection.
1552
+ ///
1553
+ /// This is intended strictly for testing purposes.
1554
+ ///
1555
+ /// Default: `0` (no delay).
1259
1556
pub fault_injection_burnchain_block_delay : u64 ,
1260
- /// The maximum number of unspent UTXOs to request from the bitcoin node.
1261
- /// This value is passed as the `maximumCount` query option to the
1262
- /// `listunspent` RPC call.
1557
+ /// The maximum number of unspent transaction outputs (UTXOs) to request from the bitcoin node.
1558
+ ///
1559
+ /// This value is passed as the `maximumCount` parameter to the bitcoin node. It helps manage
1560
+ /// response size and processing load, particularly relevant for miners querying for available
1561
+ /// UTXOs to fund operations like block commits or leader key registrations.
1562
+ ///
1563
+ /// Setting this limit too high might lead to performance issues or timeouts when querying
1564
+ /// nodes with a very large number of UTXOs. Conversely, setting it too low might prevent
1565
+ /// the miner from finding enough UTXOs in a single query to meet the required funding amount
1566
+ /// for a transaction, even if sufficient funds exist across more UTXOs not returned by the limited query.
1567
+ ///
1568
+ /// This value must be `<= 1024`.
1569
+ ///
1570
+ /// Only relevant if [`NodeConfig::miner`] is `true`.
1571
+ ///
1572
+ /// Default: `Some(1024)`
1263
1573
pub max_unspent_utxos : Option < u64 > ,
1264
1574
}
1265
1575
0 commit comments