Bitcoin Forum
July 08, 2024, 07:18:26 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: How to spend coins to a non-standard p2sh address  (Read 332 times)
ryanc (OP)
Member
**
Offline Offline

Activity: 105
Merit: 59


View Profile WWW
May 23, 2017, 04:14:55 PM
Last edit: May 23, 2017, 06:53:59 PM by ryanc
 #1

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
SopaXT
Full Member
***
Offline Offline

Activity: 158
Merit: 113


View Profile
May 24, 2017, 03:06:46 PM
 #2

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.

Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!