-
Notifications
You must be signed in to change notification settings - Fork 267
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for Peerswap atomic swap based local liquidity management protocol #2342
Closed
Closed
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
fd714ea
Fix timeouts caused by a slow machine
remyers 7678204
Add serialization for PeerSwap messages
remyers ef88c3e
Add on-chain transactions for peerswap
remyers 584ef48
Add shared peerswap helper functions and data structures
remyers ed0b0f8
Add new SwapKeyManager for peerswap swaps
remyers 559a2da
Add SwapInSender peerswap workflow actor
remyers 2e17561
Add SwapInReceiver peerswap workflow actor
remyers d7e6c5b
Add SwapRegister to forward peerswap messages to swap actors
remyers 522fd3a
Update Peer actor to forward peerswap messages from peers to the Swap…
remyers a3dae29
Update Channel actor to forward peerswap messages to Peer
remyers df69b97
Add SwapInSend/Receive integration test
remyers dc6ad3c
add cli/api for peerswap swapin, status and cancel
remyers 1ef5a99
Fix errors found during integration testing
remyers d8c41d2
Add swap-out support and basic tests
remyers c07b552
Change Register to use simple swapId String for key
remyers 00032d6
Rename actors to SwapMaker and SwapTaker
remyers 1270c07
Add swaps db and update swap actors to use it
remyers 32c2a96
Modify to work with PeerSwap as a plugin
remyers eb91acb
Move Peerswap functionality into a plugin
remyers d3118f4
Create random seed file if seed file not found
remyers c34a722
Clean up handling/responses for 'listswaps' and 'cancelswap'
remyers 4da5074
Add some TODOs to discuss later
remyers 805e602
Cleanup register and prevent multiple swaps per channel
remyers File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
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
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,28 @@ | ||
# Peerswap plugin | ||
|
||
This plugin allows implements the PeerSwap protocol: https://github.com/ElementsProject/peerswap-spec/blob/main/peer-protocol.md | ||
|
||
## Build | ||
|
||
To build this plugin, run the following command in this directory: | ||
|
||
```sh | ||
mvn package | ||
``` | ||
|
||
## Run | ||
|
||
To run eclair with this plugin, start eclair with the following command: | ||
|
||
```sh | ||
eclair-node-<version>/bin/eclair-node.sh <path-to-plugin-jar>/peerswap-plugin-<version>.jar | ||
``` | ||
|
||
## Commands | ||
|
||
```sh | ||
eclair-cli swapin --shortChannelId=<short-channel-id>> --amountSat=<amount> | ||
eclair-cli swapout --shortChannelId=<short-channel-id>> --amountSat=<amount> | ||
eclair-cli listswaps | ||
eclair-cli cancelswap --swapId=<swap-id> | ||
``` |
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,163 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
~ Copyright 2022 ACINQ SAS | ||
~ | ||
~ Licensed under the Apache License, Version 2.0 (the "License"); | ||
~ you may not use this file except in compliance with the License. | ||
~ You may obtain a copy of the License at | ||
~ | ||
~ http://www.apache.org/licenses/LICENSE-2.0 | ||
~ | ||
~ Unless required by applicable law or agreed to in writing, software | ||
~ distributed under the License is distributed on an "AS IS" BASIS, | ||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
~ See the License for the specific language governing permissions and | ||
~ limitations under the License. | ||
--> | ||
|
||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>fr.acinq.eclair</groupId> | ||
<artifactId>eclair_2.13</artifactId> | ||
<version>0.7.1-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>peerswap-plugin_2.13</artifactId> | ||
<packaging>jar</packaging> | ||
<name>peerswap-plugin</name> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>com.googlecode.maven-download-plugin</groupId> | ||
<artifactId>download-maven-plugin</artifactId> | ||
<version>1.3.0</version> | ||
<executions> | ||
<execution> | ||
<id>download-bitcoind</id> | ||
<phase>generate-test-resources</phase> | ||
<goals> | ||
<goal>wget</goal> | ||
</goals> | ||
<configuration> | ||
<skip>${maven.test.skip}</skip> | ||
<url>${bitcoind.url}</url> | ||
<unpack>true</unpack> | ||
<outputDirectory>${project.build.directory}</outputDirectory> | ||
<md5>${bitcoind.md5}</md5> | ||
<sha1>${bitcoind.sha1}</sha1> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-shade-plugin</artifactId> | ||
<version>3.2.1</version> | ||
<configuration> | ||
<transformers> | ||
<!-- Add a manifest entry for Main-Class with the FQDN of the implementation. --> | ||
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"> | ||
<manifestEntries> | ||
<Main-Class>fr.acinq.eclair.plugins.peerswap.PeerSwapPlugin</Main-Class> | ||
</manifestEntries> | ||
</transformer> | ||
</transformers> | ||
</configuration> | ||
<executions> | ||
<execution> | ||
<phase>package</phase> | ||
<goals> | ||
<goal>shade</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
<profiles> | ||
<profile> | ||
<id>default</id> | ||
<activation> | ||
<activeByDefault>true</activeByDefault> | ||
</activation> | ||
<properties> | ||
<bitcoind.url>https://bitcoincore.org/bin/bitcoin-core-0.21.1/bitcoin-0.21.1-x86_64-linux-gnu.tar.gz</bitcoind.url> | ||
<bitcoind.md5>e283a98b5e9f0b58e625e1dde661201d</bitcoind.md5> | ||
<bitcoind.sha1>5101e29b39c33cc8e40d5f3b46dda37991b037a0</bitcoind.sha1> | ||
</properties> | ||
</profile> | ||
<profile> | ||
<id>Mac</id> | ||
<activation> | ||
<os> | ||
<family>mac</family> | ||
</os> | ||
</activation> | ||
<properties> | ||
<bitcoind.url>https://bitcoincore.org/bin/bitcoin-core-0.21.1/bitcoin-0.21.1-osx64.tar.gz</bitcoind.url> | ||
<bitcoind.md5>dfd1f323678eede14ae2cf6afb26ff6a</bitcoind.md5> | ||
<bitcoind.sha1>4273696f90a2648f90142438221f5d1ade16afa2</bitcoind.sha1> | ||
</properties> | ||
</profile> | ||
<profile> | ||
<id>Windows</id> | ||
<activation> | ||
<os> | ||
<family>Windows</family> | ||
</os> | ||
</activation> | ||
<properties> | ||
<bitcoind.url>https://bitcoincore.org/bin/bitcoin-core-0.21.1/bitcoin-0.21.1-win64.zip</bitcoind.url> | ||
<bitcoind.md5>1c6f5081ea68dcec7eddb9e6cdfc508d</bitcoind.md5> | ||
<bitcoind.sha1>a782cd413fc736f05fad3831d6a9f59dde779520</bitcoind.sha1> | ||
</properties> | ||
</profile> | ||
</profiles> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.scala-lang</groupId> | ||
<artifactId>scala-library</artifactId> | ||
<version>${scala.version}</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>fr.acinq.eclair</groupId> | ||
<artifactId>eclair-core_${scala.version.short}</artifactId> | ||
<version>${project.version}</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>fr.acinq.eclair</groupId> | ||
<artifactId>eclair-node_${scala.version.short}</artifactId> | ||
<version>${project.version}</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
<!-- TESTS --> | ||
<dependency> | ||
<groupId>com.typesafe.akka</groupId> | ||
<artifactId>akka-testkit_${scala.version.short}</artifactId> | ||
<version>${akka.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.typesafe.akka</groupId> | ||
<artifactId>akka-actor-testkit-typed_${scala.version.short}</artifactId> | ||
<version>${akka.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>fr.acinq.eclair</groupId> | ||
<artifactId>eclair-core_${scala.version.short}</artifactId> | ||
<version>${project.version}</version> | ||
<classifier>tests</classifier> | ||
<type>test-jar</type> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
</project> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this method does not seem to be used anywhere yet ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.