bitcoinjs-lib
bitcoinjs-lib copied to clipboard
Basic example fo taproot send to many?
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.
-
- Create a keypair (taproot)
-
- Pass the address to the payer, and listen on UTXOs
-
- get the UTXO
-
- create Ptsbt with that UTXO as input
-
- 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)
-
- sign and send the tx
Right?
https://github.com/bitcoinjs/bitcoinjs-lib/blob/v6.1.0/test/integration/taproot.spec.ts#L20-L85
There are plenty of examples.