diff --git a/README.md b/README.md new file mode 100644 index 00000000..7f70615b --- /dev/null +++ b/README.md @@ -0,0 +1,22 @@ +ElectrumSV SDK +============== + + Licence: The Open BSV License + Maintainers: Roger Taylor, AustEcon + Project Lead: Roger Taylor + Language: Python (>=3.7) + Homepage: https://electrumsv.io/ + +[![PyPI version](https://badge.fury.io/py/electrumsv-sdk.svg)](https://badge.fury.io/py/electrumsv-sdk) +[![Build Status](https://dev.azure.com/electrumsv/ElectrumSV/_apis/build/status/electrumsv.electrumsv-sdk?branchName=master)](https://dev.azure.com/electrumsv/ElectrumSV/_apis/build/status/electrumsv.electrumsv-sdk?branchName=master) +[![Platforms](https://img.shields.io/badge/platforms-linux%20%7C%20windows%20%7C%20macos-blue)](https://img.shields.io/badge/platforms-linux%20%7C%20windows%20%7C%20macos-blue) +[![Platforms](https://img.shields.io/pypi/pyversions/electrumsv-sdk.svg?style=flat-square)](https://pypi.org/project/electrumsv-sdk) + + +Overview +======== + +The ElectrumSV SDK provides the command-line tool ``electrumsv-sdk`` to manage a local Bitcoin +development environment. As long as your Python installation places it's scripts on your path, +after you have installed the `ElectrumSV SDK `_ +Python package, it should be available for you to use. diff --git a/README.rst b/README.rst deleted file mode 100644 index b6ac4c56..00000000 --- a/README.rst +++ /dev/null @@ -1,24 +0,0 @@ -ElectrumSV SDK -============== - -:: - - Licence: The Open BSV License - Maintainers: Roger Taylor, AustEcon - Project Lead: Roger Taylor - Language: Python (>=3.7) - Homepage: https://electrumsv.io/ - -|pypi_badge| - -.. |pypi_badge| image:: https://badge.fury.io/py/electrumsv-sdk.svg - :target: https://badge.fury.io/py/electrumsv-sdk - -Overview -======== - -The ElectrumSV SDK provides the command-line tool ``electrumsv-sdk`` to manage a local Bitcoin -development environment. As long as your Python installation places it's scripts on your path, -after you have installed the `ElectrumSV SDK `_ -Python package, it should be available for you to use. - diff --git a/electrumsv-sdk/README.md b/electrumsv-sdk/README.md new file mode 100644 index 00000000..d3c88979 --- /dev/null +++ b/electrumsv-sdk/README.md @@ -0,0 +1,100 @@ +ElectrumSV Software Development Kit +=================================== + +This project provides a consolidated set of resources that together can allow a developer, whether +working on ElectrumSV directly or on an application based on ElectrumSV, to develop, run and test +while offline (and is especially aimed at facilitating rigourous CI/CD functional testing). + + Licence: The Open BSV License + Maintainers: Roger Taylor, AustEcon + Project Lead: Roger Taylor + Language: Python (>=3.7) + Homepage: https://electrumsv.io/ + +[![PyPI version](https://badge.fury.io/py/electrumsv-sdk.svg)](https://badge.fury.io/py/electrumsv-sdk) +[![Build Status](https://dev.azure.com/electrumsv/ElectrumSV/_apis/build/status/electrumsv.electrumsv-sdk?branchName=master)](https://dev.azure.com/electrumsv/ElectrumSV/_apis/build/status/electrumsv.electrumsv-sdk?branchName=master) +[![Platforms](https://img.shields.io/badge/platforms-linux%20%7C%20windows%20%7C%20macos-blue)](https://img.shields.io/badge/platforms-linux%20%7C%20windows%20%7C%20macos-blue) +[![Platforms](https://img.shields.io/pypi/pyversions/electrumsv-sdk.svg?style=flat-square)](https://pypi.org/project/electrumsv-sdk) + +Instructions +============ +Official hosted documentation webpage coming soon... + +To install from [pypi](https://pypi.org/project/electrumsv-sdk/) run (for general users): + + > pip install --upgrade electrumsv-sdk + +Now you have global access to a script called 'electrumsv-sdk.exe' from +any console window. + +For help: + + > electrumsv-sdk --help + +If you want help for one of the subcommands (e.g. 'start') do: + + > electrumsv-sdk start --help + +Which will show: + + usage: electrumsv-sdk start [-h] [--new] [--gui] [--background] [--inline] [--new-terminal] [--id ID] [--repo REPO] [--branch BRANCH] {electrumsv,electrumx,merchant_api,node,status_monitor,whatsonchain,whatsonchain_api} ... + + positional arguments: + {electrumsv,electrumx,merchant_api,node,status_monitor,whatsonchain,whatsonchain_api} + subcommand + electrumsv start electrumsv + electrumx start electrumx + merchant_api start merchant_api + node start node + status_monitor start status_monitor + whatsonchain start whatsonchain + whatsonchain_api start whatsonchain_api + + optional arguments: + -h, --help show this help message and exit + --new run a new instance with unique 'id' + --gui run in gui mode (electrumsv only) + --background spawn in background + --inline spawn in current shell + --new-terminal spawn in a new terminal window + --id ID human-readable identifier for component (e.g. 'worker1_esv') + --repo REPO git repo as either an https://github.com url or a local git repo path e.g. G:/electrumsv (optional) + --branch BRANCH git repo branch (optional) + +NOTE1: The sdk tool only handles a single ``component_type`` at a time (i.e. for the ``start``, +``stop`` and ``reset`` commands). + +NOTE2: The "optional arguments" above come **before** specifying the ``component_type`` e.g.: + + > electrumsv-sdk start --new --id=myspecialnode node + + +Plugins +------- + +The plugin model has three layers + +- `builtin_components/` (located in site-packages/electrumsv_sdk/builtin_components +- `user_components/` (located in AppData/local/ElectrumSV-SDK/user_components +- `electrumsv_sdk_components` (local working directory) + +Each layer overrides the one above it if there are any namespace clashes for a given ``component_type`` + +The rationale for using a plugin model is aimed at maintainability and extensibility. + +To get a feel for the patterns and how to create your own plugin you can look at the ``'builtin_components/'`` +as a template. + +Disclaimer: Creating plugins is more the domain of software developers who are expected to have a +certain competency level and are willing to work through some technical challenges to get it working. + +Most users of this SDK would be expected to merely make use of existing (built-in) plugins for the +ease of spinning up 1 or more RegTest instances of the offered component types and manipulating the +state of the RegTest environment via the provided tools (which may or may not make use of the +electrumsv wallet - which runs by default as a daemon process with a REST API (but can also be +run in the more familiar GUI mode). + +Whatsonchain blockexplorer (localhost) +-------------------------------------- +Please go to [whatsonchain setup guide](https://github.com/electrumsv/electrumsv-sdk/tree/master/electrumsv-sdk/contrib/whatsonchain/README.md) Whatsonchain setup guide + diff --git a/electrumsv-sdk/README.rst b/electrumsv-sdk/README.rst deleted file mode 100644 index e12c4ef1..00000000 --- a/electrumsv-sdk/README.rst +++ /dev/null @@ -1,170 +0,0 @@ -ElectrumSV Software Development Kit -=================================== - -.. code-block:: - - Licence: The Open BSV License - Maintainers: Roger Taylor, AustEcon - Project Lead: Roger Taylor - Language: Python (>=3.7) - Homepage: https://electrumsv.io/ - -Overview -======== - -This project provides a consolidated set of resources that together can allow a developer, whether -working on ElectrumSV directly or on an application based on ElectrumSV, to develop, run and test -while offline (and is especially aimed at facilitating rigourous CI/CD functional testing). - -Instructions -============ -To install from pypi_ run (for general users):: - - > pip install --upgrade electrumsv-sdk - -.. _pypi: https://pypi.org/project/electrumsv-sdk/ - -For development of this SDK on master branch, ``cd`` to the top-level directory of this repository and do:: - - > pip install -e . - -(the '-e' flag is for installing in development 'editable' mode). - -Now you have global access to a script called 'electrumsv-sdk.exe' from -any console window. - -For help:: - - > electrumsv-sdk --help - -Which (on 19/10/2020) will show:: - - """ - top-level - ========= - electrumsv-sdk has four top-level namespaces (and works similarly to systemctl): - - "start" - - "stop" - - "reset" - - "node" - - "status" - - The "start" command is the most feature-rich and launches servers as background - processes (see next): - - start - ===== - examples: - run node + electrumx + electrumsv - > electrumsv-sdk start node - > electrumsv-sdk start electrumx - > electrumsv-sdk start electrumsv - - run new instances: - > electrumsv-sdk start --new node - - run new instances with user-defined --id - > electrumsv-sdk start --new --id=myspecialnode node - - dependencies are installed on-demand at run-time - - specify --repo as a local path or remote git url for each component type. - > electrumsv-sdk start --repo=G:\electrumsv electrumsv - specify --branch as either "master" or "features/my-feature-branch" - > electrumsv-sdk start --branch=master electrumsv - - all arguments are optional - - stop - ==== - stops all running servers/spawned processes - - reset - ===== - resets server state. e.g. - - bitcoin node state is reset back to genesis - - electrumx state is reset back to genesis - - electrumsv RegTest wallet history is erased to match blockchain state e.g. - > electrumsv-sdk reset - - node - ==== - direct access to the standard bitcoin JSON-RPC interface e.g. - > electrumsv-sdk node help - > electrumsv-sdk node generate 10 - - status - ====== - returns a status report of applications previously started by the SDK - - """ - -if you want help for one of the subcommands do:: - - > electrumsv-sdk start --help - -Which on 19/10/2020 will show:: - - usage: electrumsv-sdk start [-h] [--new] [--gui] [--background] [--id ID] - [--repo REPO] [--branch BRANCH] - {electrumsv,electrumx,status_monitor,node,indexer,whatsonchain} - ... - - positional arguments: - {electrumsv,electrumx,status_monitor,node,indexer,whatsonchain} - subcommand - electrumsv start electrumsv - electrumx start electrumx - status_monitor start status monitor - node start node - indexer start indexer - whatsonchain start whatsonchain explorer - - optional arguments: - -h, --help show this help message and exit - --new - --gui - --background - --id ID human-readable identifier for component (e.g. - 'worker1_esv') - --repo REPO git repo as either an https://github.com url or a - local git repo path e.g. G:/electrumsv (optional) - --branch BRANCH git repo branch (optional) - -NOTE1: The sdk tool only handles a single ``component_type`` at a time (i.e. for the ``start``, ``stop``, ``reset`` -commands). - -NOTE2: The "optional arguments" above actually come **before** specifying the ``component_type`` e.g.:: - - > electrumsv-sdk start --new --id=myspecialnode node - -This reserves the capability for arguments to the right hand side of the ``component_type`` to be fed to the component's underlying -commandline interface (if one exists) - this is currently only supported for the electrumsv builtin component. - -Plugins -~~~~~~~ -As of version 0.0.19 the SDK follows a plugin model whereby there are three layers: - -- ``'builtin_components/'`` (located in site-packages/electrumsv_sdk/builtin_components -- ``'user_components/'`` (located in AppData/local/ElectrumSV-SDK/user_components -- ``'electrumsv_sdk_components'`` (local working directory) - -Each layer overrides the one above it if there are any namespace clashes for a given ``component_type`` - -The rationale for using a plugin model is aimed at maintainability and extensibility. - -To get a feel for the patterns and how to create your own plugin you can look at the ``'builtin_components/'`` -as a template. - -Disclaimer: Creating plugins is more the domain of software developers who are expected to have a -certain competency level and are willing to work through some technical challenges to get it working. - -Most users of this SDK would be expected to merely make use of it for the ease of spinning up 1 or more RegTest -instances of bitcoin node(s) +/- manipulating the state of the RegTest environment via the various tooling (which -may or may not make use of the electrumsv wallet GUI or daemon/REST API) - -Whatsonchain blockexplorer (localhost) -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Please go to `Whatsonchain setup guide`_. - -.. _Whatsonchain setup guide: https://github.com/electrumsv/electrumsv-sdk/tree/master/electrumsv-sdk/contrib/whatsonchain/README.md diff --git a/electrumsv-sdk/contrib/whatsonchain/README.md b/electrumsv-sdk/contrib/whatsonchain/README.md index 084ea0f2..18e78e97 100644 --- a/electrumsv-sdk/contrib/whatsonchain/README.md +++ b/electrumsv-sdk/contrib/whatsonchain/README.md @@ -18,25 +18,17 @@ open a terminal window and type: > npm config set python /path/to/executable/python -# Step 3 (install the whatsonchain explorer package) +# Step 3 (use the sdk to install and run) Clone this repository and install package: - > git clone https://github.com/AustEcon/woc-explorer.git - > cd woc-explorer - > npm install - > npm build - -NOTE: I would like to continue using the main repository -at https://github.com/waqas64/woc-explorer at a later date. But this is -a short-term way to have everything pre-configured for our RegTest needs -(removes the step of editing configuration files is all). - -Now you can start the explorer with: - - > npm start + > electrumsv-sdk install whatsonchain + > electrumsv-sdk start node + > electrumsv-sdk start electrumx + > electrumsv-sdk start whatsonchain Webpage is viewable at http://127.0.0.1:3002/ -**You need to be running the node and ideally electrumx to have anything to look at.** +**You need to be running the node and ideally electrumx to have anything to look at. +Hence why the node and electrumx are also started here.** The docker build for this explorer doesn't work for me at the moment. YMMV. diff --git a/electrumsv-sdk/electrumsv_sdk/__init__.py b/electrumsv-sdk/electrumsv_sdk/__init__.py index 57d4bebe..c4d4fdcf 100644 --- a/electrumsv-sdk/electrumsv_sdk/__init__.py +++ b/electrumsv-sdk/electrumsv_sdk/__init__.py @@ -1 +1 @@ -__version__ = '0.0.29' +__version__ = '0.0.30' diff --git a/electrumsv-sdk/electrumsv_sdk/argparsing.py b/electrumsv-sdk/electrumsv_sdk/argparsing.py index 6ca6c1c5..3d37ea48 100644 --- a/electrumsv-sdk/electrumsv_sdk/argparsing.py +++ b/electrumsv-sdk/electrumsv_sdk/argparsing.py @@ -253,11 +253,14 @@ def add_install_argparser(self, namespaces): def add_start_argparser(self, namespaces): start_parser = namespaces.add_parser("start", help="specify which servers to run") - start_parser.add_argument("--new", action="store_true", help="") - start_parser.add_argument("--gui", action="store_true", help="") - start_parser.add_argument("--background", action="store_true", help="") - start_parser.add_argument("--inline", action="store_true", help="") - start_parser.add_argument("--new-terminal", action="store_true", help="") + start_parser.add_argument("--new", action="store_true", + help="run a new instance with unique 'id'") + start_parser.add_argument("--gui", action="store_true", + help="run in gui mode (electrumsv only)") + start_parser.add_argument("--background", action="store_true", help="spawn in background") + start_parser.add_argument("--inline", action="store_true", help="spawn in current shell") + start_parser.add_argument("--new-terminal", action="store_true", + help="spawn in a new terminal window") start_parser.add_argument("--id", type=str, default="", help="human-readable identifier " "for component (e.g. 'worker1_esv')") start_parser.add_argument("--repo", type=str, default="", help="git repo as either an " diff --git a/electrumsv-sdk/setup.py b/electrumsv-sdk/setup.py index 20bc3584..5f12ed98 100644 --- a/electrumsv-sdk/setup.py +++ b/electrumsv-sdk/setup.py @@ -50,7 +50,7 @@ def _locate_requirements(): version=version, install_requires=_locate_requirements(), description='ElectrumSV SDK', - long_description=open('README.rst', 'r').read(), + long_description=open('README.md', 'r').read(), long_description_content_type='text/markdown', author='Roger Taylor', author_email="roger.taylor.email@gmail.com", @@ -82,6 +82,7 @@ def _locate_requirements(): 'Operating System :: Microsoft :: Windows :: Windows 10', 'Programming Language :: Python :: 3.7', 'Programming Language :: Python :: 3.8', + 'Programming Language :: Python :: 3.9', 'Programming Language :: Python :: Implementation :: CPython', ], include_package_data=True,