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
5 changes: 4 additions & 1 deletion hathor/cli/run_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ def create_parser(cls) -> ArgumentParser:
netargs = parser.add_mutually_exclusive_group()
netargs.add_argument('--nano-testnet', action='store_true', help='Connect to Hathor nano-testnet')
netargs.add_argument('--testnet', action='store_true', help='Connect to Hathor testnet')
netargs.add_argument('--localnet', action='store_true', help='Create a localnet with default configuration.')

parser.add_argument('--test-mode-tx-weight', action='store_true',
help='Reduces tx weight to 1 for testing purposes')
Expand Down Expand Up @@ -487,7 +488,7 @@ def check_python_version(self) -> None:
]))

def __init__(self, *, argv=None):
from hathor.conf import NANO_TESTNET_SETTINGS_FILEPATH, TESTNET_SETTINGS_FILEPATH
from hathor.conf import LOCALNET_SETTINGS_FILEPATH, NANO_TESTNET_SETTINGS_FILEPATH, TESTNET_SETTINGS_FILEPATH
from hathor.conf.get_settings import get_global_settings
self.log = logger.new()

Expand All @@ -506,6 +507,8 @@ def __init__(self, *, argv=None):
os.environ['HATHOR_CONFIG_YAML'] = TESTNET_SETTINGS_FILEPATH
elif self._args.nano_testnet:
os.environ['HATHOR_CONFIG_YAML'] = NANO_TESTNET_SETTINGS_FILEPATH
elif self._args.localnet:
os.environ['HATHOR_CONFIG_YAML'] = LOCALNET_SETTINGS_FILEPATH

try:
get_global_settings()
Expand Down
1 change: 1 addition & 0 deletions hathor/cli/run_node_args.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,4 @@ class RunNodeArgs(BaseModel, extra=Extra.allow):
disable_ws_history_streaming: bool
x_enable_ipv6: bool
x_disable_ipv4: bool
localnet: bool
2 changes: 2 additions & 0 deletions hathor/conf/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,14 @@
MAINNET_SETTINGS_FILEPATH = str(parent_dir / 'mainnet.yml')
TESTNET_SETTINGS_FILEPATH = str(parent_dir / 'testnet.yml')
NANO_TESTNET_SETTINGS_FILEPATH = str(parent_dir / 'nano_testnet.yml')
LOCALNET_SETTINGS_FILEPATH = str(parent_dir / 'localnet.yml')
UNITTESTS_SETTINGS_FILEPATH = str(parent_dir / 'unittests.yml')

__all__ = [
'MAINNET_SETTINGS_FILEPATH',
'TESTNET_SETTINGS_FILEPATH',
'NANO_TESTNET_SETTINGS_FILEPATH',
'LOCALNET_SETTINGS_FILEPATH',
'UNITTESTS_SETTINGS_FILEPATH',
'HathorSettings',
]
27 changes: 27 additions & 0 deletions hathor/conf/localnet.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
P2PKH_VERSION_BYTE: x49
MULTISIG_VERSION_BYTE: x87
NETWORK_NAME: local-privatenet
BOOTSTRAP_DNS: []

# Ledger genesis
GENESIS_OUTPUT_SCRIPT: 76a91466665b27f7dbc4c8c089d2f686c170c74d66f0b588ac
GENESIS_BLOCK_TIMESTAMP: 1643902665
GENESIS_BLOCK_NONCE: 4784939
GENESIS_BLOCK_HASH: 00000334a21fbb58b4db8d7ff282d018e03e2977abd3004cf378fb1d677c3967
GENESIS_TX1_NONCE: 0
GENESIS_TX1_HASH: 54165cef1fd4cf2240d702b8383c307c822c16ca407f78014bdefa189a7571c2
GENESIS_TX2_NONCE: 0
GENESIS_TX2_HASH: 039906854ce6309b3180945f2a23deb9edff369753f7082e19053f5ac11bfbae

# Genesis wallet:
# avocado spot town typical traffic vault danger century property shallow divorce festival
# spend attack anchor afford rotate green audit adjust fade wagon depart level

MIN_TX_WEIGHT_K: 0
MIN_TX_WEIGHT_COEFFICIENT: 0
MIN_TX_WEIGHT: 1
REWARD_SPEND_MIN_BLOCKS: 1

CHECKPOINTS: []

extends: testnet.yml