bitcoinjs-lib icon indicating copy to clipboard operation
bitcoinjs-lib copied to clipboard

Basic example fo taproot send to many?

Open tunnckoCore opened this issue 2 years ago • 1 comments
trafficstars

Heya there. Looked over the tests, but can't figure it out. Too much types of bitcoin addresses.

My need is very basic. Lets say I have a taproot address, and want others to send certain amount to it. This certain amount should be split into a x% to my taproot address, and other x% to another taproot address.

I'm open sourcer for a decade. So, some basic workin example would be enough.

Kind of understand UTXOs but it's still tricky for my mind.

-- edit

Could be a bit more privacy preserving. I understand the process, but can't combine all the things.

    1. Create a keypair (taproot)
    1. Pass the address to the payer, and listen on UTXOs
    1. get the UTXO
    1. create Ptsbt with that UTXO as input
    1. add 2 outputs
    • one to my other taproot address (slice X% from utxo.value);
    • and the other output (the rest of utxo.value) to another taproot address (which i get from someone else or API)
    1. sign and send the tx

Right?

tunnckoCore avatar Apr 24 '23 10:04 tunnckoCore

https://github.com/bitcoinjs/bitcoinjs-lib/blob/v6.1.0/test/integration/taproot.spec.ts#L20-L85

There are plenty of examples.

junderw avatar Apr 24 '23 21:04 junderw