So I’m utilizing this NPM package deal ( https://www.npmjs.com/package deal/bitcore-lib )
to create and signal a Bitcoin legacy transaction regionally and it was working positive for legacy.
However once I tried to do the identical for segwit addresses I began getting this error when i submit that uncooked into sendrawtransasction node methodology.
mandatory-script-verify-flag-failed (Witness requires empty scriptSig)
So I feel the difficulty is with this package deal because the construction of this cost shouldn’t be what’s required for a SegWit transaction.
So my essential query is is there any package deal in javascript I can use to create and signal a transaction? the principle payload I’ve is
receipentAddress, senderAddress, quantity ( in satoshis ), and privateKey in WIF.
any assist or clue is extremely appreciated.
//edit:
rawhex:
02000000017d155e9418b60ee26fe189d4381a1fcd5aac1d8eed5216c210e6f6e7a6d86b37010000006a47304402204d6b08238b2eafbf18b7b940a4bbb59c1cc610a1d5e05d2ed72f78f9a6035b890220513a33b2461f12f711776063a54d62913adef76eb40f62ad0eac3f16577c572e01210312bc181f50c9dff7d5ebe77d4df32a9ae2e5b0530b5a4a9c4b8b88647911a883ffffffff029065000000000000160014dc804b4f932f37f77ff9a4f843c845dc3cc3d30164f20300000000001600149518ea8b88e82e82d9003fa3f7518e15180cc58500000000