Example #1
0
from remme.tp.account import AccountHandler
from remme.shared.logging import setup_logging
from remme.settings.default import load_toml_with_defaults

TP_HANDLERS = [AccountHandler, PubKeyHandler, AtomicSwapHandler]

if __name__ == '__main__':
    config = load_toml_with_defaults(
        '/config/remme-client-config.toml')['remme']['client']
    parser = argparse.ArgumentParser(description='Transaction processor.')
    parser.add_argument('-v', '--verbosity', type=int, default=2)
    parser.add_argument('--account', action='store_true')
    parser.add_argument('--atomic-swap', action='store_true')
    parser.add_argument('--pubkey', action='store_true')
    args = parser.parse_args()
    setup_logging('remme', args.verbosity)

    processor = TransactionProcessor(
        url=f'tcp://{ config["validator_ip"] }:{ config["validator_port"] }')

    if args.account:
        processor.add_handler(AccountHandler)
    if args.atomic_swap:
        processor.add_handler(AtomicSwapHandler)
    if args.pubkey:
        processor.add_handler(PubKeyHandler)

    try:
        processor.start()
    except KeyboardInterrupt:
        pass
Example #2
0
from remme.rest_api.validator import proxy
from remme.shared.logging import setup_logging
from remme.shared.stream import Stream
from remme.ws import WsApplicationHandler
from remme.settings.default import load_toml_with_defaults


logger = logging.getLogger(__name__)


if __name__ == '__main__':
    cfg_rest = load_toml_with_defaults('/config/remme-rest-api.toml')['remme']['rest_api']
    cfg_ws = load_toml_with_defaults('/config/remme-client-config.toml')['remme']['client']
    zmq_url = f'tcp://{ cfg_ws["validator_ip"] }:{ cfg_ws["validator_port"] }'

    setup_logging('rest-api')

    parser = argparse.ArgumentParser()

    parser.add_argument('--port', type=int, default=cfg_rest["port"])
    parser.add_argument('--bind', default=cfg_rest["bind"])
    arguments = parser.parse_args()

    loop = ZMQEventLoop()
    asyncio.set_event_loop(loop)

    app = connexion.AioHttpApp(__name__, specification_dir='.',
                               swagger_ui=cfg_rest['swagger']['enable_ui'],
                               swagger_json=cfg_rest['swagger']['enable_json'])
    cors_config = cfg_rest["cors"]
    # enable CORS
Example #3
0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ------------------------------------------------------------------------

import argparse
from sawtooth_sdk.processor.core import TransactionProcessor
from remme.certificate.certificate_handler import CertificateHandler
from remme.token.token_handler import TokenHandler
from remme.shared.logging import setup_logging

TP_HANDLERS = [TokenHandler, CertificateHandler]

if __name__ == '__main__':
    parser = argparse.ArgumentParser(description='Transaction processor.')
    parser.add_argument('endpoint')
    parser.add_argument('-v', '--verbosity', type=int, default=2)
    args = parser.parse_args()
    setup_logging('REMME', args.verbosity)
    processor = TransactionProcessor(url=args.endpoint)
    for handler in TP_HANDLERS:
        processor.add_handler(handler)
    try:
        processor.start()
    except KeyboardInterrupt:
        pass
    finally:
        processor.stop()
Example #4
0
# Copyright 2018 REMME
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ------------------------------------------------------------------------

import sys
import os
import unittest

from remme.shared.logging import setup_logging
from .test_token import *

if __name__ == '__main__':
    setup_logging('remme', 2)
    unittest.main()
Example #5
0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ------------------------------------------------------------------------

import argparse
import asyncio
from aiohttp import web
from zmq.asyncio import ZMQEventLoop
from sawtooth_sdk.messaging.stream import Stream
from remme.settings import ZMQ_URL
from remme.shared.logging import setup_logging
from .ws import WsApplicationHandler

if __name__ == '__main__':
    setup_logging('remme.ws')
    parser = argparse.ArgumentParser()
    parser.add_argument('--port', type=int, default=8080)
    parser.add_argument('--bind', default='0.0.0.0')
    arguments = parser.parse_args()
    loop = ZMQEventLoop()
    asyncio.set_event_loop(loop)
    app = web.Application(loop=loop)
    stream = Stream(ZMQ_URL)
    ws_handler = WsApplicationHandler(stream, loop=loop)
    app.router.add_route('GET', '/ws', ws_handler.subscriptions)
    web.run_app(app, host=arguments.bind, port=arguments.port)