This project contains a swap server. In a nutshell a user requests a swap, pays to the swap address and requests payout from the server. The server will then pay the user over lightning, obtaining the preimage. Only with that preimage can the server redeem the utxo onchain. If the payment is not made, the user can refund the utxo to itself once the locktime has expired.
In order to install swapd
you have to compile from source.
- Rust installation
protoc
installation
Run make release
in the root folder of this repository. The binaries will be
target/release/swapd
and target/release/swap-cli
.
In order to run swapd
the following need to be installed.
- Core lightning >= v24.08, accessible over grpc
- bitcoind, accessible with rpc
- postgres
See swapd --help
for configuration parameters.
To run all tests call make test
, or PYTEST_PAR=10 make test -j12
.
To run only the unit tests call make utest
.
In order to run the integration tests you need
- python >= 3.8, < 4.0
virtualenv
(python -m pip install --user virtualenv
)lightningd
accessible through yourPATH
bitcoind
andbitcoin-cli
accessible through yourPATH
Call make itest
to only run the integration tests. To run a single test, use
PYTEST_OPTS="-k name_of_test" make itest
. To run tests in parallel, use
PYTEST_PAR=10 make itest
.
Contributions are welcome!
Make sure to run make check
before committing, or
PYTEST_PAR=10 make check -j12
if you like to be fast.