-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update documents and remove unused files
- Loading branch information
1 parent
ae08a2a
commit d1ff895
Showing
17 changed files
with
203 additions
and
370 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
## NLoop Regtest guide (c-lightning) | ||
|
||
You can try running `nloopd` as a plugin for c-lightning in the | ||
similar [way we did with lnd](./lnd_regtest.md) | ||
|
||
But since c-lightning does not work well with docker as lnd does, we run | ||
`lightningd` on the host machine. | ||
|
||
* First, download [c-lightning binary](https://github.com/ElementsProject/lightning/releases), or [compile by yourself](https://github.com/ElementsProject/lightning/blob/master/doc/INSTALL.md). | ||
* Next, download [`nloopd` binary](https://github.com/bitbankinc/NLoop/releases/tag/v1.2.0.0-beta) or [compile by yourself](./compile.md) | ||
* run all other dependencies as we did in lnd ... `cd tests/NLoop.Server.Tests/ && docker-compose up -d` | ||
* Run `./scripts/start_cln_with_local_docker.sh` in project root, this will launch `lightningd` in regtest mode with using nloopd binary in your PATH as a plugin. | ||
* It uses appropriate startup option for talking to dependent services. | ||
* You can check all plugin startup options by | ||
`lightningd --plugin=/path/to/nloopd -help` | ||
* Now you can talk to lightningd as usual | ||
* all RPC methods for nloop has a prefix `nloop-`, run `lightning-cli --lightning-dir=./tests/NLoop.Server.Tests/data/lightning_user --network=regtest help` to see those RPCs. | ||
* (For convenience, you can instead just run `./scripts/lightning-cli.sh help`) | ||
* It must be the same with those of [the rest api](https://bitbankinc.github.io/NLoop/) | ||
|
||
|
||
Now check `lightningd` is running correctly with nloopd as a plugin with | ||
`./scripts/lightning-cli.sh --network=regtest nloop_getinfo` | ||
|
||
You can use utility scripts under `tests/NLoop.Server.Tests/cliutils` in the same way we did for lnd. | ||
|
||
```sh | ||
cd tests/NLoop.Server.Tests | ||
./cliutils/prepare_funds.sh | ||
./cliutils/prepare_tx_for_fee.sh | ||
./cliutils/open_from_user_to_server.sh | ||
``` | ||
|
||
And also to reset the state | ||
```sh | ||
cd tests/NLoop.Server.Tests | ||
docker-compose down | ||
rm -rf data | ||
git checkout -- data | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
### How to compile nloopd. | ||
|
||
It is faily simple to compile nloopd by yourself. | ||
All you need is to install latest dotnet sdk (>= 6) | ||
and run | ||
|
||
``` | ||
dotnet publish NLoop.Server \ | ||
-p:PublishReadyToRun=true \ | ||
-p:PublishSingleFile=true \ | ||
-p:PublishTrimmed=false \ | ||
-p:RuntimeIdentifier=linux-x64 \ | ||
-p:IncludeNativeLibrariesForSelfExtract=true \ | ||
--self-contained true | ||
``` | ||
|
||
`RuntimeIdentifier` must be modified according to the machine you want to run. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
## NLoop Regtest guide (lnd) | ||
|
||
This guide walks through the steps to test `nloop` in regtest mode with lnd. | ||
|
||
### Service dependencies graph. | ||
|
||
 | ||
|
||
### How-to | ||
|
||
Note that this requires .NET SDK with compatible version installed. | ||
|
||
You also have to enable [docker buildkit](https://docs.docker.com/develop/develop-images/build_enhancements/), by setting | ||
|
||
```bash | ||
DOCKER_BUILDKIT=1 | ||
COMPOSE_DOCKER_CLI_BUILD=1 | ||
``` | ||
|
||
```sh | ||
# --- prepare dependent services --- | ||
cd tests/NLoop.Server.Tests | ||
|
||
docker-compose up -d # Start dependencies such as bitcoind and lnd | ||
|
||
# prepare dummy funds for all clients. | ||
./cliutils/prepare_funds.sh | ||
|
||
# regtest blockchain is too empty that clients fails to estimate the fee. | ||
# So fill in some dummy tx's and funds by this command, it may take a while to complete. | ||
# This is necessary only for performing an actual swap and not for running the server itself. | ||
./cliutils/prepare_tx_for_fee.sh | ||
|
||
./cliutils/open_from_user_to_server.sh | ||
|
||
# you can also use these scripts for invoking RPC methods for bitcoind, lnd. | ||
./docker-bitcoin-cli.sh getblockchaininfo | ||
./docker-litecoin-cli.sh getblockchaininfo | ||
./docker-lncli-user.sh getinfo | ||
./docker-lncli-server_ltc.sh getinfo | ||
# Some interactive operation (e.g. lnd's `payinvoice`) may require you to execute it with the pseudo-tty. | ||
# in that case do not use these scripts and run `docker-compose exec` without `-T` option | ||
|
||
cd ../.. | ||
# --- --- | ||
|
||
# --- start running nloopd --- | ||
|
||
# You must run this as a same user with a `docker-compose`. | ||
# Since it reads files in `tests/NLoop.Server.Tests/data` generated by the docker-compose command above. | ||
./scripts/start_with_local_docker.sh | ||
|
||
# --- --- | ||
|
||
# Get general information about NLoop. | ||
curl http://localhost:5000/v1/info | ||
``` | ||
|
||
Now you can play with [nloop rest api described here](https://bitbankinc.github.io/NLoop/) | ||
|
||
You can access http://localhost:2113 for EventStoreDB admin ui to check the current state of the db. | ||
|
||
To reset the state, you can just run the following commands after stopping the docker-compose. | ||
|
||
```sh | ||
cd tests/NLoop.Server.Tests | ||
docker-compose down | ||
rm -rf data | ||
git checkout -- data | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -eu | ||
|
||
cln_datadir=`pwd`/tests/NLoop.Server.Tests/data/lightning_user | ||
|
||
lightning-cli \ | ||
--lightning-dir=$cln_datadir \ | ||
--network=regtest \ | ||
$@ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.