I have a segwit address (starts with bc...) and its private key, that holds some BTC value.
Using node.js
I would like to transfer all my funds to another address.
This should be pretty straight forward - create a transaction and broadcast to the network.
I've found a few libraries that does it but for some reason was not able to successfully execute.
2 questions:
- Must I have a running Bitcoin node for that or is there some "public" node which I can work with?
- Is there a working code reference for this simple transaction? Suppose that my wallet has 0.001 (unspent) BTC, how do I transfer this amount to another address? How does the fee calculation come to place?