I could not find anywhere on the web about it. I was hopeless until I noticed that I could, without modifying the library.
First choose a similar class in Bitcore-lib.
- multisigscripthash (<== suggested) or publickeyhash for P2SH outputs
- multisig or publickey for bare script outputs (don’t use these, these are nonstandard)
Then copy it to a new file in your project such as this one**. Do not use typescript classes even if your project is of kind Typescript.
require paths. Also require
inherit from NPM. As in the boilerplates above, we need to inherit from
A function such as “buildP2SHPushIn” in the example should produce the redeemscript. Remember, the last element of P2SH redeem scripts is a push of the P2SH script.
And finally use
addInput instead of the higher-level function
from to add inputs as shown here**
**The examples are for Bitcoin Cash, but they can be used the same way in Bitcoin. Do not copy from them, however!