Bitcoin full node and query server

Aug 26, 2020

View in context in the libbitcoin Slack #general mirror.

F
Federico21:09
Hello there, I'd like to ask for a clarification for a project I'm working on which make use of libbitcoin-system v3. I need to sign a coinjoin tx, which can spend utxos of types p2pkh, p2sh-p2wpkh, bech32(native-p2wpkh). As per my understanding, if I don't want to use the SIGHASH_ANYONECANPAY every input has to be signed "togheter with his siblings". To do this I need to create a input::list and then call tx.set_inputs(that_list) and then sign them one by one using script::create_endorsement. I saw that what create_endorsement do in the generate_signature_hash step is basically creating a copy of the tx stripping away the scriptSig from the others inputs and replacing the scriptSig of the input that has to be signed with the prev_out.scriptPubKey, which is perfectly fine. Now that I have the endorsement... how can I safely set the "real" input (the one in the tx.inputs_) scriptSig? The transaction header file says that using a reference to the tx.inputs_ is deprecated and unsafe (https://github.com/libbitcoin/libbitcoin-system/blob/version3/include/bitcoin/bitcoin/chain/transaction.hpp line 130). My question is: how can I sign multiple inputs with SIGHASH_ALL (without making use of SIGHASH_ANYONECANPAY) using safe endpoints only? I feel like I'm missing something, but can't guess what. Sorry for my terrible english and maybe a bit confused explanation.