-
Notifications
You must be signed in to change notification settings - Fork 219
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
feat: add atomic swap htlc sending and claiming #3552
feat: add atomic swap htlc sending and claiming #3552
Conversation
e0a5b50
to
94ee0b5
Compare
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.
Looking really good, a couple minor comments.
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.
LGTM from a code review and logic perspective - really nice.
Changes look good, just needs a rebase. Quite a few conflicts. |
bcbb904
to
db44ca8
Compare
db44ca8
to
80ac4f6
Compare
* development: (32 commits) feat: add atomic swap refund transaction handling (tari-project#3573) feat: improve wallet connectivity status for console wallet (tari-project#3577) v0.21.1 feat: add error codes to LibWallet for CipherSeed errors (tari-project#3578) ci: split cucumber job into two (tari-project#3583) feat(wallet): import utxo’s as EncumberedToBeReceived rather than Unspent (tari-project#3575) docs: rfc 0250_Covenants (tari-project#3574) feat: get fee for transactions for stratum transcoder (tari-project#3571) test: make monerod stagenet usage resilient (tari-project#3572) feat: add atomic swap htlc sending and claiming (tari-project#3552) feat: implement prometheus metrics for base node (tari-project#3563) feat: implement multiple read single write for sqlite (tari-project#3568) feat: trigger time lock balance update when block received (tari-project#3567) test: reduce cucumber ci to critical only (tari-project#3566) test: fix cucumber console wallet startup (tari-project#3564) chore: add node id/public key to log mdc (tari-project#3559) fix: avoid implicit using of the time crate (tari-project#3562) feat: one-click installer - cli edition (tari-project#3534) ci: add workflow dispatch to libwallet build action (tari-project#3556) fix: stop leak of value of recovered output (tari-project#3558) ...
Description
This Pr adds in the ability to send and claim HTLC transactions.
This is added to the console wallet UI and GRPC commands.
UI:
tari_console_wallet --command "init-sha-atomic-swap <Amount> <Bob pubkey> <Message>"
This is used to initialize an atomic swap for the XTR side
tari_console_wallet --command "finalise-sha-atomic-swap <Output hash> <pre_image hex>"
This is used to finalize and claim an HTLC transaction for the XTR side.
GRPC:
rpc SendShaAtomicSwapTransaction(SendShaAtomicSwapRequest) returns (SendShaAtomicSwapResponse);
This is used to initialize an atomic swap for the XTR side
rpc ClaimShaAtomicSwapTransaction(ClaimShaAtomicSwapRequest) returns (ClaimShaAtomicSwapResponse);
This is used to finalize and claim an HTLC transaction for the XTR side.
Motivation and Context
This is the first step in allowing Atomic swaps for Tari and coins that have SHA256 as a pre_image.
Currently, the available commands in this PR and tools available we can do the happy path of an atomic swap for:
Bitcoin
Bitcoin Cash (Bitcoin ABC, Bitcoin Unlimited, Bitcoin XT)
Decred
Litecoin
Monacoin
Particl
Qtum
Vertcoin
Viacoin
Zcoin
How Has This Been Tested?
Added unit and cucumber tests for the Tari side.
Did a manual XTR BTC atomic swap
XTR UTXO hash:
186a95239d16ebf800cb3b7991521585b569253255002b009b16f11faab8d115
BTC tx_ids:
1f770ce82aeb1f6c0d0345a6a88f1b3eb2e226595063491c93ad442625f678ae
2b6e2e2566577e8e52da685e2abb4252b98fc4a60dc9a1b09a56e6b003900bc9