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

Composer V2 #2873

Merged
merged 67 commits into from
Jan 3, 2025
Merged

Composer V2 #2873

merged 67 commits into from
Jan 3, 2025

Conversation

ouziel-slama
Copy link
Contributor

@ouziel-slama ouziel-slama commented Dec 19, 2024

  • Replacement of transaction.py and transaction_helper/* with composer.py
  • No more dependency on Addrindexrs, prioritizing the use of Bitcoin Core to retrieve UTXOs or search for a public key, and then with Electr if it is configured.
  • Use of the bitcoin-utils library to generate transactions
  • API backward compatible with the old composer
  • Addition of the following parameters:
    • change_address: allows defining the change address
    • more_outputs: allows adding an arbitrary number of outputs in the form <value>:<address> or <value>:<script_pubkey>
    • use_all_inputs_set: forces the use of all UTXOs provided with inputs_set
    • sat_per_vbyte: allows defining transaction fees
    • max_fee: defines the maximum fees to be paid
    • verbose: includes transaction details, notably data and psbt
    • multisig_pubkey: public key allowing the redemption of multisig data outputs
  • The following parameters are deprecated but still work: fee_per_kb, fee_provided, dust_return_pubkey, return_psbt, regular_dust_size, multisig_dust_size, extended_tx_info, old_style_api, p2sh_pretx_txid, segwit, unspent_tx_hash
  • Composed transactions no longer contain the script_pubkey (lock script) where the script_sig (unlock script) should be.
  • With verbose=true, the composer also returns a lock_scripts field that contains the script_pubkey of the UTXOs used by the transaction.
  • Composed transactions use a version byte 2 instead of version 1
  • Error messages for UTXOs now contain the reason for the error in parentheses: invalid UTXOs: <utxo(s)> (<reason>)

  • Double-check the spelling and grammar of all strings, code comments, etc.
  • Double-check that all code is deterministic that needs to be
  • Add tests to cover any new or revised logic
  • Ensure that the test suite passes
  • Update the project release notes
  • Update the project documentation, as appropriate, with a corresponding Pull Request in the Documentation repository

@ouziel-slama ouziel-slama marked this pull request as draft December 19, 2024 18:39
utxos = inputs_set.split(",")
utxos = [utxo.split(":")[0] for utxo in utxos]
for tx_hash in utxos:
def search_pubkey_in_transactions(pubkeyhash, tx_hashes):

Check warning

Code scanning / pylint

Too many branches (16/12). Warning

Too many branches (16/12).
utxos = [utxo.split(":")[0] for utxo in utxos]
for tx_hash in utxos:
def search_pubkey_in_transactions(pubkeyhash, tx_hashes):
for tx_hash in tx_hashes:

Check warning

Code scanning / pylint

Too many nested blocks (6/5). Warning

Too many nested blocks (6/5).
utxos = [utxo.split(":")[0] for utxo in utxos]
for tx_hash in utxos:
def search_pubkey_in_transactions(pubkeyhash, tx_hashes):
for tx_hash in tx_hashes:

Check warning

Code scanning / pylint

Too many nested blocks (6/5). Warning

Too many nested blocks (6/5).
@@ -58,3 +60,45 @@
unspent["address"] = address
unspents += address_unspents
return unspents


def pubkey_from_tx(tx, pubkeyhash):

Check warning

Code scanning / pylint

Too many branches (15/12). Warning

Too many branches (15/12).
@ouziel-slama ouziel-slama marked this pull request as ready for review January 3, 2025 15:59
Copy link
Member

@adamkrellenstein adamkrellenstein left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

beautiful! super clean!

@@ -0,0 +1,179 @@
"""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I think we're going to be removing P2SH encoding soon-ish (once we add support for encoding in witness data). In the meantime, we can re-enable this? Will reduce fees for some users.

@ouziel-slama ouziel-slama merged commit 7d48ba5 into develop Jan 3, 2025
19 checks passed
@ouziel-slama ouziel-slama deleted the composer2 branch January 3, 2025 20:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants