decred.org/dcrdex@v1.0.5/docs/wiki/Testnet-Testing.md (about)

     1  # Testnet Testing
     2  
     3  - [Prepare RPC Wallets](#prepare-rpc-wallets)
     4    - [Run Bitcoin Daemon](#run-bitcoin-daemon)
     5    - [Create the Bitcoin Testnet Wallet](#create-the-bitcoin-testnet-wallet)
     6    - [Create a Bitcoin Exchange Wallet Configuration File](#create-a-bitcoin-exchange-wallet-configuration-file)
     7    - [Run Decred Daemon and Wallet Software](#run-decred-daemon-and-wallet-software)
     8    - [Create a Decred Exchange Wallet Configuration File](#create-a-decred-exchange-wallet-configuration-file)
     9  - [Get the Testnet Server TLS Certificate](#get-the-testnet-server-tls-certificate)
    10  - [Start the Client](#start-the-client)
    11  - [Add RPC Wallet](#add-rpc-wallet)
    12  - [Acquire Testnet Funds](#acquire-testnet-funds)
    13  
    14  To get started, you must have followed all of the required steps in [Client
    15  Installation and
    16  Configuration](https://github.com/decred/dcrdex/wiki/Client-Installation-and-Configuration).
    17  If you have and do not wish to use the testnet RPC wallets, you can proceed to
    18  [acquiring Testnet funds](#acquire-testnet-funds).
    19  
    20  However, if you wish to use testnet RPC wallets, follow the guide below to set
    21  up RPC wallet for BTC and DCR.
    22  
    23  ## Prepare RPC Wallets
    24  
    25  ### Run Bitcoin Daemon
    26  
    27  To run a full Bitcoin node, Bitcoin Core (`bitcoind` or `bitcoin-qt`) is
    28  recommended. Pruning is okay for testnet testing, because you won't be running
    29  the server, but **if you ever plan to test the server**, you will need to run
    30  without pruning and with the transaction index built, `-txindex`.
    31  
    32  Be sure to set the `rpcuser` and `rpcpassword` in your `bitcoind` configuration
    33  file (recommended, shown), or as a command line argument (adjust commands below
    34  as needed). You can set `rpcuser` and `rpcpassword` to any value you'd like.
    35  
    36  ```sh
    37  > bitcoind -testnet -server -debug=rpc
    38  ```
    39  
    40  #### Create the Bitcoin Testnet Wallet
    41  
    42  To create a dedicated "dex" wallet, run
    43  
    44  ```sh
    45  > bitcoin-cli -testnet createwallet dex
    46  ```
    47  
    48  Encrypt the wallet with a password of your choosing.
    49  
    50  ```sh
    51  > bitcoin-cli -testnet -rpcwallet=dex encryptwallet mypassword
    52  ```
    53  
    54  Note: Normally prefixing the above command with a space will keep it out of your command line history.
    55  
    56  Bitcoin Core will not load the wallet on startup, so I recommend you create
    57  a testnet section in your configuration file instructing the wallet to be
    58  loaded.
    59  
    60  Add to **bitcoin.conf**
    61  
    62  ```ini
    63  [test]
    64  
    65  wallet=
    66  wallet=dex
    67  ```
    68  
    69  If you do not amend **bitcoin.conf**, you will need to `bitcoin-cli -testnet loadwallet dex`
    70  every time you start `bitcoind`.
    71  
    72  #### Create a Bitcoin Exchange Wallet Configuration File
    73  
    74  Create a DEX wallet configuration file with your credentials.
    75  
    76  Add to **btc_testnet.conf**
    77  
    78  ```ini
    79  walletname=dex
    80  rpcuser=abc
    81  rpcpassword=def
    82  rpcport=18332
    83  ```
    84  
    85  Port `18332` is the default testnet port. If you've specified a different port
    86  in your configuration file, you'll need to specify that port instead.
    87  
    88  ### Run Decred Daemon and Wallet Software
    89  
    90  Get the dcrd/dcrwallet/dcrctl command line suite from [the latest release binaries](https://github.com/decred/decred-release/releases/tag/v1.5.1) or building from master ([`dcrd`](https://github.com/decred/dcrd#build-from-source-all-platforms), [`dcrwallet`](https://github.com/decred/dcrwallet#build-from-source-all-platforms), [`dcrctl`](https://github.com/decred/dcrctl#build-and-installation) or alternatively [this dcrbuild.sh script](https://gist.github.com/chappjc/6cfc52a5b700a43c03d533172f91aa57) on Linux/Mac), which is fairly simple.
    91  
    92  Sync the Decred blockchain. Set the `username` and `password` in the `dcrd`
    93  configuration file (recommended, shown), or as a command line argument (adjust
    94  commands below as needed). You can set `username` and `password` to any value
    95  you'd like.
    96  
    97  ```sh
    98  > dcrd --testnet
    99  ```
   100  
   101  Once Decred is synchronized, start `dcrwallet`.
   102  
   103  ```sh
   104  > dcrwallet --testnet
   105  ```
   106  
   107  If this is your first time running **dcrwallet** on testnet, you'll be prompted
   108  to run with `--create` to set your password and create the wallet. You'll need
   109  the wallet password later.
   110  
   111  At this point, you may choose to specify a new account just for trading. For
   112  the remainder of these instructions, is it assumed this step is complete.
   113  
   114  ```sh
   115  > dcrctl --testnet --wallet createnewaccount dex
   116  ```
   117  
   118  #### Create a Decred Exchange Wallet Configuration File
   119  
   120  Create a DEX wallet configuration file with your credentials.
   121  
   122  Add to **dcr_testnet.conf**
   123  
   124  ```ini
   125  account=dex
   126  username=abc
   127  password=def
   128  rpccert=/path/to/.dcrwallet/rpc.cert
   129  rpclisten=127.0.0.1:19110
   130  ```
   131  
   132  The `rpclisten` shown is the default for testnet. If you have specified a
   133  different port in your **dcrwallet** configuration, you'll need to use that.
   134  Make sure to enter the correct path for your TLS certificate (`rpccert`). If not
   135  specified, the certificate is typically located at `~/.dcrwallet/rpc.cert`.
   136  
   137  ## Get the Testnet Server TLS Certificate
   138  
   139  There is a Decred testnet server at bison.exchange:17232. You do not need to
   140  provide a certificate.
   141  
   142  ## Start the Client
   143  
   144  Clear any existing client DB files from previous setups:
   145  
   146  ```sh
   147  rm ~/.dexc/testnet/dexc.db ~/.dexc/testnet/backup/dexc.db
   148  ```
   149  
   150  Start `bisonw` with the web UI and RPC server in testnet mode and trace level logging:
   151  
   152  ```sh
   153  ./bisonw --testnet --rpc --log=trace
   154  ```
   155  
   156  ## Add RPC Wallet
   157  
   158  If you already created an SPV wallet, you can change to an RPC wallet from the
   159  wallet settings view.
   160  
   161  If not, visit the wallets page and click on the "Create a {asset name} wallet"
   162  button. Click on the "External" tab, input the RPC wallet config info and submit
   163  the form. If everything went well your RPC wallet will be added to dcrdex.
   164  
   165  ### Acquire Testnet Funds
   166  
   167  You can generate a deposit address for any of the available wallets through the
   168  wallets view in the client app.
   169  
   170  #### DCR
   171  
   172  Take the address to the testnet faucet at <https://faucet.decred.org/> and get
   173  some DCR or reach out to us on matrix.
   174  
   175  #### BTC
   176  
   177  Testnet BTC is hard to come by. If you can't get your hands on any, place an
   178  order on testnet DEX to sell some DCR for BTC.