diff --git a/README.md b/README.md index 72fbfab..83adaf7 100644 --- a/README.md +++ b/README.md @@ -6,13 +6,12 @@ ## Install -From source: +1. From source: ```bash git clone https://github.com/cybercongress/cybertensor.git python3 -m pip install -e cybertensor/ ``` - -To test your installation, type: +2. To test your installation, type: ```bash ctcli --help ``` @@ -21,6 +20,32 @@ or using python import cybertensor ``` +## Space Pussy setup + +1. Clone: +```bash +git clone https://github.com/cybercongress/cybertensor.git +cd cybertensor +git checkout add-space-pussy-network +``` +2. [Optional] Create and activate a virtual environment: +```bash +python3 -m venv venv +. venv/bin/activate +``` +3. Install from the source +```bash +python3 -m pip install -e . +``` + +4. To test your installation, type: +```bash +ctcli --help +``` +or using python +```python +import cybertensor +``` ## Dev setup 1. Use localbostrom: @@ -64,4 +89,4 @@ tree ~/.cybertensor/contract 7. Register network: ```bash ctcli s create -``` \ No newline at end of file +``` diff --git a/cybertensor/__init__.py b/cybertensor/__init__.py index 5958626..556ca4f 100644 --- a/cybertensor/__init__.py +++ b/cybertensor/__init__.py @@ -86,14 +86,15 @@ def debug(on: bool = True): __delegates_details_url__: str = "https://raw.githubusercontent.com/cybercongress/cybertensor/main/public/delegates.json" # Bostrom network address prefix -__chain_address_prefix__ = "bostrom" +__chain_address_prefix__ = "pussy" -__networks__ = ["local", "bostrom"] +__networks__ = ["local", "space-pussy", "bostrom"] -__contracts__ = [ - "bostrom14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9sww4mxt", - "bostrom14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9sww4mxt" -] +__contracts__ = { + "space-pussy": "pussy13xxjfq8p3kht26fn4s9jg8c5407xpphhle2744gwe4rgh2y47n4q7f7x63", + "local": "bostrom14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9sww4mxt", + "bostrom": "bostrom14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9sww4mxt" +} __local_network__ = NetworkConfig( chain_id="localbostrom", @@ -106,23 +107,32 @@ def debug(on: bool = True): __bostrom_network__ = NetworkConfig( chain_id="bostrom", - url="grpc+http://localhost:9090", - fee_minimum_gas_price=0.1, + url="grpc+http://grpc.bostrom.cybernode.ai:1443", + fee_minimum_gas_price=0.01, fee_denomination="boot", staking_denomination="boot", faucet_url="", ) +__space_pussy_network__ = NetworkConfig( + chain_id="space-pussy", + url="grpc+https://grpc.space-pussy.cybernode.ai:1443", + fee_minimum_gas_price=0.01, + fee_denomination="pussy", + staking_denomination="pussy", + faucet_url="", +) + __contract_path__ = Path(__file__).home() / ".cybertensor/contract/cybernet.wasm" __contract_schema_path__ = Path(__file__).home() / ".cybertensor/contract/schema" -__token__ = "boot" +__token__ = "pussy" __default_gas__ = 1_000_000 __default_transfer_gas__ = 100_000 -__boot_symbol__: str = "BOOT" -__giga_boot_symbol__: str = "GBOOT" +__boot_symbol__: str = "PUSSY" +__giga_boot_symbol__: str = "GPUSSY" # change to emoji here # __boot_symbol__: str = chr(0x03C4) diff --git a/cybertensor/cli.py b/cybertensor/cli.py index 26ab0d3..ed7ac47 100644 --- a/cybertensor/cli.py +++ b/cybertensor/cli.py @@ -168,7 +168,7 @@ def __init__( cli.check_config(self.config) # If no_version_checking is not set or set as False in the config, version checking is done. - if not self.config.get("no_version_checking", d=True): + if self.config.get("no_version_checking", d=True): try: cybertensor.utils.version_checking() except: diff --git a/cybertensor/commands/__init__.py b/cybertensor/commands/__init__.py index 8bcae35..6266583 100644 --- a/cybertensor/commands/__init__.py +++ b/cybertensor/commands/__init__.py @@ -21,7 +21,7 @@ defaults: Munch = munchify( { "netuid": 1, - "cwtensor": {"network": "local", "_mock": False}, + "cwtensor": {"network": "space-pussy", "_mock": False}, "pow_register": { "num_processes": None, "update_interval": 50000, diff --git a/cybertensor/commands/delegates.py b/cybertensor/commands/delegates.py index 02eb358..f0d91e0 100644 --- a/cybertensor/commands/delegates.py +++ b/cybertensor/commands/delegates.py @@ -332,18 +332,16 @@ def check_config(config: "cybertensor.config"): # Get amount. if not config.get("amount") and not config.get("stake_all"): if not Confirm.ask( - "Stake all GBOOT from account: [bold]'{}'[/bold]?".format( - config.wallet.get("name", defaults.wallet.name) - ) + f"Stake all {cybertensor.__giga_boot_symbol__} " + f"from account: [bold]'{config.wallet.get('name', defaults.wallet.name)}'[/bold]?" ): - amount = Prompt.ask("Enter GBOOT amount to stake") + amount = Prompt.ask(f"Enter {cybertensor.__giga_boot_symbol__} amount to stake") try: config.amount = float(amount) except ValueError: console.print( - ":cross_mark: [red]Invalid GBOOT amount[/red] [bold white]{}[/bold white]".format( - amount - ) + f":cross_mark: [red]Invalid {cybertensor.__giga_boot_symbol__} amount[/red] " + f"[bold white]{amount}[/bold white]" ) sys.exit() else: @@ -443,9 +441,7 @@ def check_config(config: "cybertensor.config"): if len(delegates) == 0: console.print( - ":cross_mark: [red]There are no delegates on {}[/red]".format( - cwtensor.network - ) + f":cross_mark: [red]There are no delegates on {cwtensor.network}[/red]" ) sys.exit(1) @@ -453,25 +449,21 @@ def check_config(config: "cybertensor.config"): show_delegates(config, delegates, prev_delegates=prev_delegates) delegate_index = Prompt.ask("Enter delegate index") config.delegatekey = str(delegates[int(delegate_index)].hotkey) - console.print( - "Selected: [yellow]{}[/yellow]".format(config.delegatekey) - ) + console.print(f"Selected: [yellow]{config.delegatekey}[/yellow]") # Get amount. if not config.get("amount") and not config.get("unstake_all"): if not Confirm.ask( - "Unstake all GBOOT to account: [bold]'{}'[/bold]?".format( - config.wallet.get("name", defaults.wallet.name) - ) + f"Unstake all {cybertensor.__giga_boot_symbol__} " + f"to account: [bold]'{config.wallet.get('name', defaults.wallet.name)}'[/bold]?" ): - amount = Prompt.ask("Enter GBOOT amount to unstake") + amount = Prompt.ask(f"Enter {cybertensor.__giga_boot_symbol__} amount to unstake") try: config.amount = float(amount) except ValueError: console.print( - ":cross_mark: [red]Invalid GBOOT amount[/red] [bold white]{}[/bold white]".format( - amount - ) + f":cross_mark: [red]Invalid {cybertensor.__giga_boot_symbol__} amount[/red] " + f"[bold white]{amount}[/bold white]" ) sys.exit() else: @@ -826,7 +818,7 @@ def run(cli): ) cybertensor.__console__.print(table) - cybertensor.__console__.print("Total delegated GBOOT: {}".format(total_delegated)) + cybertensor.__console__.print(f"Total delegated {cybertensor.__giga_boot_symbol__}: {total_delegated}") @staticmethod def add_args(parser: argparse.ArgumentParser): diff --git a/cybertensor/commands/overview.py b/cybertensor/commands/overview.py index 8ad3b1a..6c766ab 100644 --- a/cybertensor/commands/overview.py +++ b/cybertensor/commands/overview.py @@ -544,9 +544,7 @@ def overview_sort_function(row): console.clear() - caption = "[italic][dim][white]Wallet balance: [green]GBOOT" + str( - total_balance.gboot - ) + caption = f"[italic][dim][white]Wallet balance: [green]{cybertensor.__giga_boot_symbol__}{total_balance.gboot}" grid.add_row(Align(caption, vertical="middle", align="center")) # Print the entire table/grid diff --git a/cybertensor/commands/stake.py b/cybertensor/commands/stake.py index 5e8c411..b0a176c 100644 --- a/cybertensor/commands/stake.py +++ b/cybertensor/commands/stake.py @@ -219,18 +219,16 @@ def check_config(cls, config: "cybertensor.config"): and not config.get("max_stake") ): if not Confirm.ask( - "Stake all GBOOT from account: [bold]'{}'[/bold]?".format( - config.wallet.get("name", defaults.wallet.name) - ) + f"Stake all {cybertensor.__giga_boot_symbol__} " + f"from account: [bold]'{config.wallet.get('name', defaults.wallet.name)}'[/bold]?" ): - amount = Prompt.ask("Enter GBOOT amount to stake") + amount = Prompt.ask(f"Enter {cybertensor.__giga_boot_symbol__} amount to stake") try: config.amount = float(amount) except ValueError: console.print( - ":cross_mark:[red]Invalid GBOOT amount[/red] [bold white]{}[/bold white]".format( - amount - ) + f":cross_mark:[red]Invalid {cybertensor.__giga_boot_symbol__} amount[/red] " + f"[bold white]{amount}[/bold white]" ) sys.exit() else: @@ -251,7 +249,7 @@ def add_args(cls, parser: argparse.ArgumentParser): required=False, action="store", default=None, - help="""Specify the maximum amount of GBOOT to have staked in each hotkey.""", + help=f"""Specify the maximum amount of {cybertensor.__giga_boot_symbol__} to have staked in each hotkey.""", ) stake_parser.add_argument( "--hotkeys", diff --git a/cybertensor/cwtensor.py b/cybertensor/cwtensor.py index 80a5bed..4992b2f 100644 --- a/cybertensor/cwtensor.py +++ b/cybertensor/cwtensor.py @@ -103,7 +103,7 @@ def help(cls): def add_args(cls, parser: argparse.ArgumentParser, prefix: str = None): prefix_str = "" if prefix is None else prefix + "." try: - default_network = os.getenv("CT_CYBER_NETWORK") or "local" + default_network = os.getenv("CT_CYBER_NETWORK") or "space-pussy" # default_contract_address = os.getenv("CT_CONTRACT_ADDRESS") or "bostrom1" parser.add_argument( @@ -113,6 +113,7 @@ def add_args(cls, parser: argparse.ArgumentParser, prefix: str = None): help="""The cwtensor network flag. The likely choices are: -- bostrom (main network) -- local (local running network) + -- space-pussy (space-pussy network) """, ) @@ -137,25 +138,32 @@ def determine_chain_endpoint_and_network( network (str): The network flag. The likely choices are: -- bostrom (main network) -- local (local running network) - chain_endpoint (str): The chain endpoint flag. If set, overrides the network argument. + -- space-pussy (space-pussy network) Returns: - network (str): The network flag. The likely choices are: - chain_endpoint (str): The chain endpoint flag. If set, overrides the network argument. + network (str): The network flag. + network_config (NetworkConfig): The chain network config. + contract_address (str): Cybernet contract address """ if network is None: return None, None, None - if network in ["local", "bostrom"]: + if network in ["local", "bostrom", "space-pussy"]: if network == "bostrom": return ( network, cybertensor.__bostrom_network__, - cybertensor.__contracts__[1], + cybertensor.__contracts__[network], + ) + elif network == "space-pussy": + return ( + network, + cybertensor.__space_pussy_network__, + cybertensor.__contracts__[network], ) elif network == "local": return ( network, cybertensor.__local_network__, - cybertensor.__contracts__[0], + cybertensor.__contracts__[network], ) else: return "unknown", {}, "unknown" @@ -192,7 +200,7 @@ def setup_config(network: str, config: cybertensor.config): evaluated_contract_address, ) = cwtensor.determine_chain_endpoint_and_network( # TODO set default - "local" + "space-pussy" ) return ( @@ -213,8 +221,9 @@ def __init__( cybertensor.cwtensor.config() network (default='local or ws://127.0.0.1:9946', type=str) The cwtensor network flag. The likely choices are: + -- bostrom (main network) -- local (local running network) - -- finney (main network) + -- space-pussy (space-pussy network) or cwtensor endpoint flag. If set, overrides the network argument. """ diff --git a/cybertensor/utils/__init__.py b/cybertensor/utils/__init__.py index c86be8a..0a466cb 100644 --- a/cybertensor/utils/__init__.py +++ b/cybertensor/utils/__init__.py @@ -47,10 +47,9 @@ def version_checking(timeout: int = 15): if latest_version_as_int > cybertensor.__version_as_int__: print( - "\u001b[33mCybertensor Version: Current {}/Latest {}\nPlease update to the latest version at your earliest convenience. " - "Run the following command to upgrade:\n\n\u001b[0mpython -m pip install --upgrade cybertensor".format( - cybertensor.__version__, latest_version - ) + f"\u001b[33mCybertensor Version: Current {cybertensor.__version__}/Latest {latest_version}\n" + f"Please update to the latest version at your earliest convenience. " + f"Run the following command to upgrade:\n\n\u001b[0mpython -m pip install --upgrade cybertensor" ) except requests.exceptions.Timeout: diff --git a/cybertensor/utils/networking.py b/cybertensor/utils/networking.py index 434fc83..96f0a05 100644 --- a/cybertensor/utils/networking.py +++ b/cybertensor/utils/networking.py @@ -28,6 +28,7 @@ """ Utils for handling local network with ip and ports. """ + def int_to_ip(int_val: int) -> str: r"""Maps an integer to a unique ip-string Args: