pybitcash / bitcash

BitCash: Python Bitcoin Cash Library (fork of ofek's Bit)
https://bitcash.dev
MIT License
97 stars 39 forks source link

How can you sign multiple inputs originating from various addresses? #131

Closed dinno-invis1ble closed 10 months ago

dinno-invis1ble commented 10 months ago

Hello,

Is there a method to sign multiple inputs that come from different addresses? I couldn't locate this information in the documentation.

Thank you in advance.

merc1er commented 10 months ago

If you build a transaction, that should give you a signed transaction with multiple unspents.

from bitcash import Key

key = Key("...")

outputs = [("bitcoincash:qq2j4wmn285l38jem8ftfxnrv4ea5ljzrg6j37gmuj", 2000, "satoshi")]

unspents = key.get_unspents()
key.create_transaction(outputs, unspents=unspents)
# Returns: 0100000002bef932533cxxx0000

Does that answer the question?

dinno-invis1ble commented 10 months ago

What I'm trying to understand is how to consolidate funds from #address1 and #address2 in a single transaction. I've prepared the unspents, but how do I sign the transaction using both private keys?

merc1er commented 10 months ago

Sadly BitCash does not support HD wallets. So you can only send funds from a single address.

dinno-invis1ble commented 10 months ago

Thank you for assistance! 😄