Author

Topic: How to spend coins to a non-standard p2sh address (Read 342 times)

full member
Activity: 158
Merit: 113
I know this amazing service: https://bip32jp.github.io/english/createp2sh.html, which supports custom scriptSig/scriptPubkey spending.
AFAIK, it supports both testnet and mainnet.
member
Activity: 105
Merit: 59
I've been trying to experiment with P2SH addresses and non-standard scripts. I've sent some coins on testnet to 2NGDaDjuNuXz1wzHkusqUKCEtvwGr1q3JUc, but I'm having a hard time spending the output.

The redeemScript is
Code:
$ bitcoin-cli -testnet decodescript 210251ec22f0bd150d3ffd84f627b1e65b9b17921dd1676c5e90627ab21d18158df7043133333775ac
{
  "asm": "0251ec22f0bd150d3ffd84f627b1e65b9b17921dd1676c5e90627ab21d18158df7 926102321 OP_DROP OP_CHECKSIG",
  "type": "nonstandard",
  "p2sh": "2NGDaDjuNuXz1wzHkusqUKCEtvwGr1q3JUc"
}

I was able to add it to my wallet using importmulti, but when I do listunspent it is not shown as spendable, and I haven't been able to spend via signrawtransaction. Can anyone point me to a tool that I can use to build the spending transaction?

I tried following along with this example: https://github.com/petertodd/python-bitcoinlib/blob/master/examples/spend-p2sh-txout.py

but when i call VerifyScript(txin.scriptSig, txin_scriptPubKey, tx, 0, (SCRIPT_VERIFY_P2SH,))

I get "P2SH inner scriptPubKey returned false"

Edit: Got it working, needed to use python3
Jump to: