""" Commands to manage SKALE nodes """ import json import os import click from skale import Skale from skale.utils.web3_utils import wait_receipt, check_receipt from skale.utils.helper import ip_from_bytes, init_default_logger from skale.utils.constants import LONG_LINE from utils import init_wallet, generate_random_node_data from config import ENDPOINT, ABI_FILEPATH init_default_logger() def create_node(skale): ip, public_ip, port, name = generate_random_node_data() port = 10000 res = skale.manager.create_node(ip, port, name, public_ip) receipt = wait_receipt(skale.web3, res['tx']) return receipt @click.group() @click.option('--endpoint', default=ENDPOINT, help='Skale manager endpoint') @click.option('--abi-filepath', default=ABI_FILEPATH, type=click.Path(),
import os import skale.utils.helper as Helper from skale.utils.helper import ip_from_bytes from skale import Skale from skale.wallets import RPCWallet from config import ENDPOINT, ABI_FILEPATH Helper.init_default_logger() TM_URL = os.environ['TM_URL'] wallet = RPCWallet(TM_URL) skale = Skale(ENDPOINT, ABI_FILEPATH, wallet) for _ in range(0, 1000000): nodes_ips = skale.nodes_data.get_active_node_ips() ips = [] for ip in nodes_ips: ips.append(ip_from_bytes(ip)) print('====') print('IPS', ips) print('====')