Bitcoin Forum
June 24, 2019, 04:42:25 PM *
News: Latest Bitcoin Core release: 0.18.0 [Torrent] (New!)
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: How to spend coins to a non-standard p2sh address  (Read 230 times)
ryanc
Member
**
Offline Offline

Activity: 103
Merit: 40


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
1561394545
Hero Member
*
Offline Offline

Posts: 1561394545

View Profile Personal Message (Offline)

Ignore
1561394545
Reply with quote  #2

1561394545
Report to moderator
1561394545
Hero Member
*
Offline Offline

Posts: 1561394545

View Profile Personal Message (Offline)

Ignore
1561394545
Reply with quote  #2

1561394545
Report to moderator
"With e-currency based on cryptographic proof, without the need to trust a third party middleman, money can be secure and transactions effortless." -- Satoshi
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1561394545
Hero Member
*
Offline Offline

Posts: 1561394545

View Profile Personal Message (Offline)

Ignore
1561394545
Reply with quote  #2

1561394545
Report to moderator
1561394545
Hero Member
*
Offline Offline

Posts: 1561394545

View Profile Personal Message (Offline)

Ignore
1561394545
Reply with quote  #2

1561394545
Report to moderator
SopaXT
Full Member
***
Offline Offline

Activity: 161
Merit: 109


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:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!