Пример #1
0
def start_mn():
    log = get_logger("MasternodeFactor")
    log.critical("\n***Starting Masternode\n")

    DB.set_context('{}_masternode'.format(DB_NAME))

    with DB(should_reset=True) as db:
        pass

    NodeFactory.run_masternode()
Пример #2
0
def run_mn():
    from cilantro.logger import get_logger
    from cilantro.nodes import NodeFactory
    import os
    log = get_logger("MASTERNODE FACTORY")

    ip = os.getenv('HOST_IP')  #Constants.Testnet.Masternodes[0]['ip']
    sk = masternodes[0]['sk']

    NodeFactory.run_masternode(ip=ip, signing_key=sk)
Пример #3
0
def run_witness(slot_num):
    from cilantro.logger import get_logger
    from cilantro.nodes import NodeFactory
    import os

    log = get_logger(__name__)

    w_info = witnesses[slot_num]
    w_info['ip'] = os.getenv('HOST_IP')

    NodeFactory.run_witness(ip=w_info['ip'], signing_key=w_info['sk'])
Пример #4
0
def run_delegate(slot_num):
    from cilantro.logger import get_logger
    from cilantro.nodes import NodeFactory
    import os

    log = get_logger("DELEGATE FACTORY")

    d_info = delegates[slot_num]
    d_info['ip'] = os.getenv('HOST_IP')

    NodeFactory.run_delegate(ip=d_info['ip'], signing_key=d_info['sk'])
Пример #5
0
def run_witness(slot_num):
    from cilantro.logger import get_logger
    from cilantro.nodes import NodeFactory
    import os

    log = get_logger("WITNESS FACTORY")

    w_info = TESTNET_WITNESSES[slot_num]
    w_info['ip'] = os.getenv('HOST_IP')

    NodeFactory.run_witness(ip=w_info['ip'], signing_key=w_info['sk'])
Пример #6
0
def run_mn():
    from cilantro.logger import get_logger, overwrite_logger_level
    from cilantro.nodes import NodeFactory
    import os
    import logging

    # overwrite_logger_level(logging.WARNING)
    overwrite_logger_level(21)

    ip = os.getenv('HOST_IP') #Constants.Testnet.Masternodes[0]['ip']
    sk = masternodes[0]['sk']
    NodeFactory.run_masternode(ip=ip, signing_key=sk)
Пример #7
0
def run_witness(slot_num):
    from cilantro.logger import get_logger
    from cilantro import Constants
    from cilantro.nodes import NodeFactory
    import os

    log = get_logger("WITNESS FACTORY")

    w_info = Constants.Testnet.Witnesses[slot_num]
    w_info['ip'] = os.getenv('HOST_IP')

    NodeFactory.run_witness(ip=w_info['ip'], signing_key=w_info['sk'])
Пример #8
0
def run_mn():
    from cilantro.logger import get_logger
    from cilantro import Constants
    from cilantro.nodes import NodeFactory
    import os
    log = get_logger("MASTERNODE FACTORY")

    ip = os.getenv('HOST_IP')  #Constants.Testnet.Masternodes[0]['ip']

    log.critical("\n\n\nMASTERNODE BOOTING WITH IP {} AND SK {}".format(
        ip, sk))
    NodeFactory.run_masternode(ip=ip, signing_key=sk)
Пример #9
0
def start_witness(i):
    log = get_logger("WitnessFactory")

    DB.set_context('{}_witness_{}'.format(DB_NAME, i))
    with DB(should_reset=True) as db:
        pass

    w_info = Constants.Testnet.Witnesses[i]
    log.critical("\n\nStarting witness on slot {} with info {}\n\n".format(
        i, w_info))
    NodeFactory.run_witness(signing_key=w_info['sk'],
                            ip=w_info['url'],
                            name="Witness_{}".format(i + 1))
Пример #10
0
def run_mn():
    from cilantro.logger import get_logger, overwrite_logger_level
    from cilantro.nodes import NodeFactory
    from cilantro.constants.testnet import TESTNET_MASTERNODES
    import os
    import logging

    # overwrite_logger_level(logging.WARNING)
    overwrite_logger_level(21)

    ip = os.getenv('HOST_IP')  #Constants.Testnet.Masternodes[0]['ip']
    sk = TESTNET_MASTERNODES[0]['sk']
    NodeFactory.run_masternode(ip=ip, signing_key=sk, reset_db=True)
Пример #11
0
def run_witness(slot_num):
    from cilantro.logger import get_logger
    from cilantro import Constants
    from cilantro.nodes import NodeFactory
    import os
    log = get_logger("WITNESS FACTORY")

    w_info = Constants.Testnet.Witnesses[slot_num]
    w_info['ip'] = os.getenv('HOST_IP')

    log.critical("Building witness on slot {} with info {}".format(
        slot_num, w_info))
    NodeFactory.run_witness(ip=w_info['ip'], signing_key=w_info['sk'])
Пример #12
0
def run_witness(slot_num):
    from cilantro.logger import get_logger
    from cilantro import Constants
    from cilantro.nodes import NodeFactory
    from cilantro.db import DB, DB_NAME
    import os

    log = get_logger(__name__)

    w_info = Constants.Testnet.Witnesses[slot_num]
    w_info['ip'] = os.getenv('HOST_IP')

    NodeFactory.run_witness(ip=w_info['ip'], signing_key=w_info['sk'])
Пример #13
0
def run_delegate(slot_num):
    from cilantro.logger import get_logger
    from cilantro import Constants
    from cilantro.nodes import NodeFactory
    import os

    log = get_logger("DELEGATE FACTORY")

    d_info = Constants.Testnet.Delegates[slot_num]
    d_info['ip'] = os.getenv('HOST_IP')

    log.critical("Building delegate on slot {} with info {}".format(slot_num, d_info))
    NodeFactory.run_delegate(ip=d_info['ip'], signing_key=d_info['sk'])
Пример #14
0
def run_delegate(slot_num):
    from cilantro.logger import get_logger, overwrite_logger_level
    from cilantro.nodes import NodeFactory
    import os
    import logging

    # overwrite_logger_level(logging.WARNING)
    overwrite_logger_level(21)

    d_info = delegates[slot_num]
    d_info['ip'] = os.getenv('HOST_IP')

    NodeFactory.run_delegate(ip=d_info['ip'], signing_key=d_info['sk'], should_reset=True)
Пример #15
0
def run_witness(slot_num):
    from cilantro.logger import get_logger, overwrite_logger_level
    from cilantro.nodes import NodeFactory
    import os
    import logging

    # overwrite_logger_level(logging.WARNING)
    overwrite_logger_level(15)

    w_info = witnesses[slot_num]
    w_info['ip'] = os.getenv('HOST_IP')

    NodeFactory.run_witness(ip=w_info['ip'], signing_key=w_info['sk'], should_reset=True)
Пример #16
0
def run_delegate(slot_num):
    from cilantro.logger import get_logger
    from cilantro import Constants
    from cilantro.nodes import NodeFactory
    from cilantro.db import DB, DB_NAME
    import os

    log = get_logger("DELEGATE FACTORY")

    d_info = Constants.Testnet.Delegates[slot_num]
    d_info['ip'] = os.getenv('HOST_IP')

    NodeFactory.run_delegate(ip=d_info['ip'], signing_key=d_info['sk'])
Пример #17
0
def run_delegate(slot_num):
    from cilantro.logger import get_logger, overwrite_logger_level
    from cilantro import Constants
    from cilantro.nodes import NodeFactory
    import os
    import logging

    overwrite_logger_level(logging.WARNING)

    d_info = Constants.Testnet.Delegates[slot_num]
    d_info['ip'] = os.getenv('HOST_IP')

    NodeFactory.run_delegate(ip=d_info['ip'], signing_key=d_info['sk'])
Пример #18
0
def run_delegate(slot_num):
    from cilantro.logger import get_logger, overwrite_logger_level
    from cilantro.nodes import NodeFactory
    from cilantro.constants.testnet import TESTNET_DELEGATES
    import os
    import logging

    # overwrite_logger_level(logging.WARNING)
    # overwrite_logger_level(21)

    d_info = TESTNET_DELEGATES[slot_num]
    d_info['ip'] = os.getenv('HOST_IP')

    NodeFactory.run_delegate(ip=d_info['ip'], signing_key=d_info['sk'], reset_db=True)
Пример #19
0
def run_mn():
    from cilantro.logger import get_logger, overwrite_logger_level
    from cilantro.constants.testnet import masternodes
    from cilantro.nodes import NodeFactory
    import os
    import logging
    from cilantro.logger.base import get_logger
    log = get_logger('M')

    # overwrite_logger_level(logging.WARNING)
    # overwrite_logger_level(21)

    ip = os.getenv('HOST_IP')  #Constants.Testnet.Masternodes[0]['ip']
    sk = masternodes[0]['sk']
    NodeFactory.run_masternode(ip=ip, signing_key=sk, should_reset=True)
Пример #20
0
def run_witness(slot_num):
    from cilantro.logger import get_logger, overwrite_logger_level
    from cilantro.nodes import NodeFactory
    from cilantro.constants.testnet import TESTNET_WITNESSES
    import os
    import logging

    # overwrite_logger_level(logging.WARNING)
    overwrite_logger_level(15)

    w_info = TESTNET_WITNESSES[slot_num]
    w_info['ip'] = os.getenv('HOST_IP')

    NodeFactory.run_witness(ip=w_info['ip'],
                            signing_key=w_info['sk'],
                            reset_db=True)
Пример #21
0
def start_delelegate(i):
    log = get_logger("DelegateFactory")
    db_name = DB_NAME + '_delegate_' + str(i)

    d_info = Constants.Testnet.Delegates[i]
    log.critical(
        "\n***Instantiating a new delegate on slot {} with db name: {}, and info {}\n"
        .format(i, db_name, d_info))

    DB.set_context(db_name)
    with DB(should_reset=True) as db:
        pass

    NodeFactory.run_delegate(ip=d_info['url'],
                             signing_key=d_info['sk'],
                             name="Delegate_{}".format(i + 1))
Пример #22
0
def run_mn():
    from cilantro.logger import get_logger
    from cilantro import Constants
    from cilantro.nodes import NodeFactory
    from cilantro.db import DB, DB_NAME
    import os
    log = get_logger("MASTERNODE FACTORY")

    with DB('{}_masternode'.format(DB_NAME), should_reset=True) as db:
        pass

    ip = os.getenv('HOST_IP')  #Constants.Testnet.Masternodes[0]['ip']
    sk = Constants.Testnet.Masternodes[0]['sk']

    log.critical("\n\n\nMASTERNODE BOOTING WITH IP {} AND SK {}".format(
        ip, sk))
    NodeFactory.run_masternode(ip=ip, signing_key=sk)
Пример #23
0
def run_delegate(slot_num):
    from cilantro.logger import get_logger, overwrite_logger_level
    from cilantro.constants.testnet import delegates
    from cilantro.nodes import NodeFactory
    import os
    import logging
    from cilantro.logger.base import get_logger
    log = get_logger('D')

    # overwrite_logger_level(logging.WARNING)
    # overwrite_logger_level(21)
    log.critical(slot_num)
    d_info = delegates[slot_num]
    d_info['ip'] = os.getenv('HOST_IP')

    NodeFactory.run_delegate(ip=d_info['ip'],
                             signing_key=d_info['sk'],
                             should_reset=True)
Пример #24
0
def run_witness(slot_num):
    from cilantro.logger import get_logger
    from cilantro import Constants
    from cilantro.nodes import NodeFactory
    from cilantro.db import DB, DB_NAME
    import os

    log = get_logger("WITNESS FACTORY")

    with DB('{}_witness_{}'.format(DB_NAME, slot_num),
            should_reset=True) as db:
        pass

    w_info = Constants.Testnet.Witnesses[slot_num]
    w_info['ip'] = os.getenv('HOST_IP')

    log.critical("Building witness on slot {} with info {}".format(
        slot_num, w_info))
    NodeFactory.run_witness(ip=w_info['ip'], signing_key=w_info['sk'])
Пример #25
0
    def build_obj(cls, sk, url, name='Masternode') -> tuple:
        loop = asyncio.new_event_loop()
        asyncio.set_event_loop(loop)

        witness = NodeFactory._build_node(loop=loop, signing_key=sk, ip=url, node_cls=Witness, name=name)
        witness.start(start_loop=False)

        tasks = witness.tasks + [witness.composer.interface._recv_messages()]

        return witness, loop, tasks
Пример #26
0
def run_delegate(slot_num):
    from cilantro.logger import get_logger
    from cilantro import Constants
    from cilantro.nodes import NodeFactory
    from cilantro.db import DB, DB_NAME
    import os

    log = get_logger("DELEGATE FACTORY")

    d_info = Constants.Testnet.Delegates[slot_num]
    d_info['ip'] = os.getenv('HOST_IP')

    # Set default database name for this instance
    with DB('{}_delegate_{}'.format(DB_NAME, slot_num),
            should_reset=True) as db:
        pass

    log.critical("Building delegate on slot {} with info {}".format(
        slot_num, d_info))
    NodeFactory.run_delegate(ip=d_info['ip'], signing_key=d_info['sk'])
Пример #27
0
def run_mn():
    from cilantro.logger import get_logger
    from cilantro.nodes import NodeFactory
    import os, time

    log = get_logger(__name__)

    m_info = masternodes[0]
    m_info['ip'] = os.getenv('HOST_IP')

    mn = NodeFactory.run_masternode(ip=m_info['ip'], signing_key=m_info['sk'])
Пример #28
0
def run_delegate(slot_num):
    from cilantro.logger import get_logger
    from cilantro import Constants
    from cilantro.nodes import NodeFactory
    from cilantro.db import DB, DB_NAME
    import os

    log = get_logger("DELEGATE FACTORY")

    d_info = Constants.Testnet.Delegates[slot_num]
    port = d_info['url'][-4:]
    d_info['url'] = 'tcp://{}:{}'.format(os.getenv('HOST_IP'), port)

    with DB('{}_delegate_{}'.format(DB_NAME, slot_num),
            should_reset=True) as db:
        pass

    log.critical("Building witness on slot {} with info {}".format(
        slot_num, d_info))
    NodeFactory.run_delegate(ip=d_info['url'], signing_key=d_info['sk'])
Пример #29
0
def run_mn():
    from cilantro.logger import get_logger
    from cilantro import Constants
    from cilantro.nodes import NodeFactory
    from cilantro.db import DB, DB_NAME
    import os, time

    log = get_logger(__name__)

    m_info = Constants.Testnet.Masternodes[0]
    m_info['ip'] = os.getenv('HOST_IP')

    mn = NodeFactory.run_masternode(ip=m_info['ip'], signing_key=m_info['sk'])
Пример #30
0
    def build_obj(cls, sk, name='Masternode') -> tuple:
        loop = asyncio.new_event_loop()
        asyncio.set_event_loop(loop)

        ip = os.getenv('HOST_IP', '127.0.0.1')

        log = get_logger("MPMasternode Builder")
        log.info("Creating Masternode with IP {}, signing key {}..., and name {}".format(ip, sk[:8], name))

        mn = NodeFactory._build_node(loop=loop, signing_key=sk, ip=ip, node_cls=Masternode, name=name)
        mn.start(start_loop=False)

        tasks = mn.tasks + [mn.composer.interface._recv_messages()]

        return mn, loop, tasks