oleganza / CoreBitcoin

Awesome Bitcoin toolkit for ObjC and Swift
Do What The F*ck You Want To Public License
719 stars 255 forks source link

How to sig a P2SH script? #118

Open AlleniCode opened 6 years ago

AlleniCode commented 6 years ago

Here is a unspent out tx:

<BTCTransactionOutput:0x0x6040002aff60 6d2b7d3ce940854abb68767a7e5572a6f4ac492e4f1fbbf232e2a03372da80be:0 0.00000001 BTC 'OP_HASH160 a2eb5e481b2092ad4ee15a542649aaa1a3e02d58 OP_EQUAL'>

I call this func to sig, but failed!

- (NSData*) signatureHashForScript:(BTCScript*)subscript inputIndex:(uint32_t)inputIndex hashType:(BTCSignatureHashType)hashType error:(NSError**)errorOut;

"script_type": "pay-to-script-hash"

How to sig a P2SH script? Thx!