decred.org/dcrdex@v1.0.5/dex/testing/firo/README_ELECTRUM_HARNESSES.md (about)

     1  
     2  # Electrum-Firo Harness Support
     3  
     4  Harnesses to run Electrum-Firo wallet on regtest.
     5  
     6  ## 1. Firo Chain Server Test Harness
     7  
     8  The **harness.sh** chain server harness is a collection of tmux scripts that
     9  collectively create a sandboxed environment for testing dex swap transactions.
    10  See Also: README_HARNESS.md
    11  
    12  ## 2. ElectrumX-Firo Test Harness
    13  
    14  The harness is a script named **electrumx.sh** which downloads a git repo
    15  containing a specific commit of ElectrumX-Firo server. No external releases.
    16  
    17  It requires **harness.sh** Firo chain server harness running.
    18  
    19  ## 3. Electrum-Firo Test Harness
    20  
    21  The harness is a script named **electrum.sh** which downloads a git repo containing
    22  a release version of Electrum-Firo wallet client.
    23  
    24  It requires **electrumx.sh** Firo ElectrumX-Firo server harness running.
    25  
    26  Which in turn requires **harness.sh** Firo chain server harness running.
    27  
    28  ## Dependencies
    29  
    30  The **harness.sh** script depends on [firod] and [firo-cli] to run.
    31  Go to <https://github.com/firoorg/firo/releases> for binaries or source.
    32  
    33  The **electrumx.sh** script depends on [python3], [python3 pip] and [git] to run.
    34  Python3 v3.6 is coded but this script was tested using python3.10. Some testing
    35  (minimal) was done with 3.7. Git should be latest. Pip will be downloaded and it's version upgraded by the script into a virtual environment each time.
    36  
    37  The **electrum.sh** script depends on [python3], [python3 pip] and [git] to run.
    38  Python3 v3.6 is coded but this script was tested using python3.10. Some testing
    39  (minimal) was done with 3.7. Python 3.8, 3.9 would be expected to work although
    40  untested. However using Python 3.11 there are dependencies which will not build
    41  and are unsupported by their respective maintainers on PyPI. Git should be latest.
    42  Pip will be re-downloaded and it's version upgraded by the script into a virtual environment each time.
    43  
    44  ### Architecture
    45  
    46  - ELECTRUM WALLET CLIENT
    47  - ELECTRUMX SERVER
    48  - FIRO CHAIN HARNESS
    49  
    50  All three scripts store data in **~/dextest/...** directory tree.
    51  
    52  ## Using
    53  
    54  You must have `firod` and `firo-cli` in `PATH` to use the chain server harness. Use 3 tty's
    55  and run each line below in a **separate** tty:
    56  
    57  ```bash
    58  $  ./harness.sh
    59  $  ./electrumx.sh
    60  $  ./electrum.sh
    61  ```
    62  
    63  The Electrum-Firo wallet client will have a prepared, empty but encrypted
    64  regtest wallet.
    65  
    66  Password is "abc".
    67  
    68  ## Development
    69  
    70  ### Firo Chain Server
    71  
    72  For the Firo chain server see the README_HARNESS.md in this directory.
    73  
    74  ### Server
    75  
    76  The **electrumx.sh** script first cleans part of the **~/dextest/electrum/firo/server...**
    77  directory tree.
    78  
    79  The script then downloads a specific commit from:
    80  <https://github.com/firoorg/electrumx-firo.git> to the .../server/electrumx-repo directory.
    81  
    82  It then creates a python virtual environment (venv) sandbox and installs the
    83  requesting python3 interpreter, latest version of pip and all required modules
    84  in `setup.py` into the sandbox.
    85  If any need building from C source it will be done at this point.
    86  
    87  Server certificates are created. Then all the required environment variables to
    88  configure the server exported; and the electrumX daemon started
    89  
    90  The electrumX daemon will connect to the firo chain harness node **alpha**
    91  
    92  ### Client
    93  
    94  The **electrum.sh** script first cleans part of the **~/dextest/electrum/firo/client...**
    95  directory tree.
    96  
    97  The script then downloads a specific commit from:
    98   <https://github.com/firoorg/electrum-firo.git> to the ../client/electrum-repo directory.
    99  
   100  It then creates a python virtual environment (venv) sandbox and installs the
   101  requesting python3 interpreter, latest version of pip and all required modules
   102  from files in `contrib/requirements` directory into the sandbox. If any need building from C source it will be done at
   103  this point.
   104  
   105  A prepared, empty but encrypted electrum wallet is copied to the electrum data
   106  directory at **~/dextest/electrum/firo/client/wallet/regtest/wallets**.
   107  
   108  The script starts the Electrum-Firo wallet client in CLI mode with debug level
   109  logging to stderr. Change STARTUP= in the script to "GUI" to start the Gui or
   110  "DAEMON" to start as a daemon. Stop the daemon with the `stop-daemon` script.
   111  
   112  The electrum client wallet will connect to the firo electrumX server.
   113  
   114  ### Simnet Trade Testing
   115  
   116  In seperate tty's start up:
   117  
   118     - btc harness
   119     - dcr harness
   120     - firo harness
   121     - electrumx.sh Electrum-Firo regtest server
   122     - electrum.sh Electrum-Firo regtest wallet
   123     - dcrdex harness
   124  
   125  Ensure dcrctl, firod and firo-cli are in PATH for simnet-trade-tests exec process
   126  mining.
   127  
   128  ```bash
   129  $  ./run dcrfiroelectrum --runonce --all
   130  ```
   131  
   132  Best results by nuking everything after each run of the simnet-trade-test test suite.