Skip to content
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

chore: cleanup wally #17

Merged
merged 1 commit into from
Nov 26, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions boltz_client/onchain_wally.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""
https://github.com/jgriffiths/wally_swap_test/blob/master/main.py
https://wally.readthedocs.io/en/release_0.8.9/psbt/
https://wally.readthedocs.io/en/release_1.0.0/psbt/
https://github.com/BlockchainCommons/Learning-Bitcoin-from-the-Command-Line/blob/master/07_1_Creating_a_Partially_Signed_Bitcoin_Transaction.md
special thanks to @jgriffiths for helping debugging this!
"""
Expand Down Expand Up @@ -176,12 +176,12 @@ def create_liquid_tx(
wally.map_add_integer(assets, idx, unblinded_asset)
wally.map_add_integer(abfs, idx, abf)

# ephemeral_keys
# returns ephemeral_keys
_ = wally.psbt_blind(psbt, values, vbfs, assets, abfs, entropy, output_idx, 0)

# SIGN PSBT
# wally can identify the input to sign because we gave the keypath above
wally.psbt_sign(psbt, private_key, wally.EC_FLAG_ECDSA)
wally.psbt_sign(psbt, private_key, wally.EC_FLAG_GRIND_R)
# Fetch the signature from the PSBT input for finalization
sig_pos = wally.psbt_find_input_signature(psbt, idx, signing_pubkey)
assert sig_pos != 0, "signature not found"
Expand All @@ -208,7 +208,6 @@ def create_liquid_tx(
wally.psbt_from_base64(base64, wally.WALLY_PSBT_PARSE_FLAG_STRICT)
# Dump the psbt. To extract the finalized tx, use e.g:
# elements-cli-sim finalizepsbt $(python psbt_wally.py) true
# print(base64)

# Extract the completed tx from the now-finalized psbt
tx = wally.psbt_extract(psbt, 0) # 0 == must be finalized
Expand Down