Skip to content

Commit

Permalink
3 launch project configurations for different coins (dgarage#189)
Browse files Browse the repository at this point in the history
* Added new launch configs

Added 3 launch configs to the NBXplorer:
"NBXplorer - BTC on Mainnet" -> run NBXplorer with the default arguments
"NBXplorer - BTC+LTC on Regtest" -> run NBXplorer with the BTC+LTC config as in README.md
"NBXplorer - DASH on Testnet" -> run NBXplorer with default DASH Testnet settings

* Changed the startup URLs

Changed the startup URLs to the status page of BTC, LTC and DASH

* Added default RPC usernames and passwords

* Removed the iisSettings from the configuration

* Removed rpcuser and rpcpassword from the BTC and LTC settings

* Removed the RPC username and password from the Dash config as well

* Added a few notes and sample parameters to the command line section

* Fixed the "run from source" command and the btcnodeendpoint parameter.

* Removed the rescan demonstration.

* Changed the "Run from source" and "Run using built DLL" sections

* Removed the double "compiled" word

* Added details about the --noauth parameter in the Postman section
  • Loading branch information
andrasfuchs authored and NicolasDorier committed Sep 4, 2019
1 parent bbc358d commit c97f807
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 10 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ dlldata.c
project.lock.json
project.fragment.lock.json
artifacts/
**/Properties/launchSettings.json

*_i.c
*_p.c
Expand Down
36 changes: 36 additions & 0 deletions NBXplorer/Properties/launchSettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"profiles": {
"NBXplorer - BTC on Mainnet": {
"commandName": "Project",
"commandLineArgs": "",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "http://localhost:4774",
"launchUrl": "v1/cryptos/btc/status"
},

"NBXplorer - BTC+LTC on Regtest": {
"commandName": "Project",
"commandLineArgs": "--chains=btc,ltc --network=regtest",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "http://localhost:4774",
"launchUrl": "v1/cryptos/ltc/status"
},

"NBXplorer - DASH on Testnet": {
"commandName": "Project",
"commandLineArgs": "--chains=dash --network=testnet",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
},
"applicationUrl": "http://localhost:4774",
"launchUrl": "v1/cryptos/dash/status"
}
}
}
38 changes: 29 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ Example, if you have ltc node and btc node on regtest (default configuration), a

## How to use the API?

Check [the documentation](docs/API.md), you can then use any client library:
Check [the API documentation](docs/API.md), you can then use any client library:
* [NBXplorer.NodeJS](https://github.com/junderw/NBXplorer.NodeJS) for NodeJS clients.
* [NBXplorer.Client](https://www.nuget.org/packages/NBxplorer.Client) for .NET clients.

Expand Down Expand Up @@ -129,13 +129,25 @@ The default configuration assumes `mainnet` with only `btc` chain supported, and
You can change the location of the configuration file with the `--conf=pathToConf` command line argument.

### Command line parameters
Please note that NBXplorer uses cookie authentication by default. If you run your Bitcoin/Litecoin/Dash nodes using their daemon (like `bitcoind`, `litecoind` or `dashd`), they generate a new cookie every time you start them, and that should work without any extra configuration.
If you run the node(s) using the GUI versions, like Bitcoin\Litecoin\Dash Core Qt with the `-server` parameter while you set the rpcusername and rpcpassword in their `.conf` files, you must set those values for every crypto you are planning to support.
See samples below.

#### From Source (.NET Core SDK required)
The same settings as above, e.g.
```dotnet run NBXplorer.dll --port=20300 --network=mainnet --nodeendpoint=127.0.0.1:32939```
#### Run from source (requires .NET Core SDK)
You should use `run.ps1` (Windows) or `run.sh` (Linux) to execute NBXplorer, but you can also execute it manually with the following command:
```dotnet run --no-launch-profile -p .\NBXplorer\NBXplorer.csproj -- <parameters>```

#### Run using built DLL (requires .NET Core Runtime only)
If you already have a compiled DLL, you can run the executable with the following command:
```dotnet NBXplorer.dll <parameters>```

#### Sample parameters
Running NBXplorer HTTP server on port 20300, connecting to the BTC mainnet node locally.
```--port=20300 --network=mainnet --btcnodeendpoint=127.0.0.1:32939```

Running NBXplorer on testnet, supporting Bitcoin, Litecoin and Dash, using cookie authentication for BTC and LTC, and RPC username and password for Dash, connecting to all of them locally.
```--chains=btc,ltc,dash --network=testnet --dashrpcuser=myuser --dashrpcpassword=mypassword```

#### From Built DLL (.NET Core Runtime required)
```dotnet NBXplorer.dll --port=20300 --network=mainnet --nodeendpoint=127.0.0.1:32939```

### Environment variables

Expand Down Expand Up @@ -167,16 +179,24 @@ If you need to see old payments, you need to configure `startheight` to a specif
### Using Postman
[Postman](https://www.getpostman.com) is a useful tool for testing and experimenting with REST API's.

You can test the NBXplorer API quickly and easily using Postman as follows :
* Assumption: you are using the default Cookie Auth , you are running NBXplorer on the same machine as your BTC (or other supported crypto) node or NBXplorer can access the blockchain data files.
* Run NBXplorer and locate you cookie file - note NBXplorer will generate a new Cookie file each time it runs
You can test the [NBXplorer API](docs/API.md) quickly and easily using Postman.

If you use cookie authentication (enabled by default) in your locally run NBXplorer, you need to set that up in Postman:
* Run NBXplorer and locate you cookie file (NBXplorer will generate a new Cookie file each time it runs in [its default data folder](docs/API.md#authentication))
* In Postman create a new GET API test
* In Authorization select *Basic Auth*, you should see 2 input boxes for username and password
* Open your cookie file with a text editor e.g. Notepad on windows . You should see a cookie string e.g. `__cookie__:0ff9cd83a5ac7c19a6b56a3d1e7a5c96e113d42dba7720a1f72a3a5e8c4b6c66`
* Back in Postman paste the `__cookie__` part of your cookie file into username (whatever comes before the :)
* Paste the Hex string (after the : ) into the password box
* Click the Update Request button in Postman - this will force Postman to generate the correct HTTP headers based on your cookie details
* You should now see a new entry in the Headers section with a Key of *Authorization* and Value of *Basic xxxxxxxxx* where the string after `Basic` will be your Base64 encoded username and password.
* Enter the API URL you are going to test

You can also disable authentication in NBXplorer for testing with the `--noauth` parameter. This makes testing quicker:
* Run NBXplorer with the `--noauth` parameter
* In Postman create a new GET API test
* In Authorization select *No Auth*
* Enter the API URL you are going to test

You are now ready to test the API - it is easiest to start with something simple such as the fees endpoint e.g.

Expand Down

0 comments on commit c97f807

Please sign in to comment.