6

I recently posted this Testnet TX (TxID 2d0daa01da8294a54178f8111eb2a02010c425fd15957d8baee8717edcfbe105) which successfully spends an output (TxID 8d897ca91774a7fafa086a3275e679248d6bffee015d3b2efefd5dab00df152d) of form:

OP_DUP OP_HASH160 ##HASH160_KEY1## OP_EQUALVERIFY OP_CHECKSIGVERIFY OP_IF OP_DUP OP_HASH160 ##HASH160_KEY1## OP_EQUALVERIFY OP_CHECKSIG OP_ELSE OP_HASH256 ##HASH256_OF_SECRET## OP_EQUAL OP_ENDIF

Where ##HASH256_OF_SECRET## is sha256(sha256(3ceb50edd0282cd99dc59351f513dcdf)) and ##HASH160_KEYx## is the ripemd160(sha256(public key n)).

I have been trying for days using Python (pybitcointools library, Pycoin library, raw tx construction) and Bitcoincore, however I consistently cannot duplicate the Tx myself.


EDIT: added keys, code

Here's a duplicated Tx on Testnet: ed99a9d3c8da943c5140790349d000450209367c7cf24d1627df6b43ece8b9d4:1

Keys (from pycoin):

input                        : 98a6776b00481d69147af4f19982816d24b21f1e45bd6b9b6612969a805dff5d
network                      : Bitcoin testnet3
netcode                      : XTN
secret exponent              : 69045673789968930636498185430340997034503775217197653543201755869784347377501
 hex                         : 98a6776b00481d69147af4f19982816d24b21f1e45bd6b9b6612969a805dff5d
wif                          : cShS7YocDNMfpxHPd1iWbXX6eTFPQoNTJSw6W4sQY5BVimvvw6FY
 uncompressed                : 92k9QgqAnrFCWtwvA4neyJnngkZG3g43ne9BJuzBmeeirPHXtu3
public pair x                : 66609190448066768097937392847179714582119540337817974512409209527265330917500
public pair y                : 13690920648454078566739109880631240403596673427366917192400893160542072726114
 x as hex                    : 9343773d05d5a07f103914d5294ca742db124babd2c2cac5f84e6114f192f07c
 y as hex                    : 1e44c956c737a60369fbf4f5e6324dc005ba38d156f61232f9251fec8ee3e262
y parity                     : even
key pair as sec              : 029343773d05d5a07f103914d5294ca742db124babd2c2cac5f84e6114f192f07c
 uncompressed                : 049343773d05d5a07f103914d5294ca742db124babd2c2cac5f84e6114f192f07c\
                                 1e44c956c737a60369fbf4f5e6324dc005ba38d156f61232f9251fec8ee3e262
hash160                      : fd00f9fd452fee2214e8b0f9acf4c53496bd5636
 uncompressed                : 23dfc9ad6d857c92ad2b99004354067492cf464c
Bitcoin address              : n4aiRSJEm2gT9QrZTFJ7DJy3KPGnDHxybf
Bitcoin address uncompressed : mine2pMKAyoA6CBimPd1ZdFVi5kvhTM7TT

script = 76a914dd6cce9f255a8cc17bda8ba0373df8e861cb866e88ad6376a914e900510876cb689f1db6fa982376c301362b740c88ac67aa20644d79d87e0907833e888e272e5d7b925deb261a8499a65cbc0bf26797a15e8e8768

[118, 169, '23dfc9ad6d857c92ad2b99004354067492cf464c', 136, 173, 99, 118, 169, 'fd00f9fd452fee2214e8b0f9acf4c53496bd5636', 136, 172, 103, 170, '0757152190e14e5889b1270309d7c8e40219d45e04096fcb97d1b4c5a99064e1', 135, 104]

*mysecret* = '12345678'.decode('hex')
sha256(sha256(*mysecret*)) == 0757152190e14e5889b1270309d7c8e40219d45e04096fcb97d1b4c5a99064e1

I'm looking for a working guide on constructing a Testnet & P2SH Tx which utilises Boolean scripting. Specifically:

  1. A working testnet example of the question posed above (detailed further here) (I'll offer a bounty for this)
  2. Constructing a multisig Tx of form: (1 KEY1 KEY2 2 CHECKMULTISIG) OR MASTERKEY
Ava Chow
  • 70,382
  • 5
  • 81
  • 161
Wizard Of Ozzie
  • 5,298
  • 4
  • 31
  • 63
  • 2
    Just a quick question: are you checking the output number in the transaction you are spending? It seems strange you can reproduce the transaction only at times.Your successful transaction in "prev_out": has "n": 1 but the output number in the previous transaction is likely to be different each time. How do you create the transaction? With bitcoin-cli createrawtransaction? – halftimepad Jun 23 '15 at 22:57
  • 1
    @halftimepad both pybitcointools and Bitcoin core – Wizard Of Ozzie Jun 24 '15 at 01:13
  • Do you have at hand the hex raw transaction for one case where you could reproduce the transaction and for one where you couldn't? With that I can tell you if it is a problem with the output number. – halftimepad Jun 24 '15 at 07:45
  • @halftimepad sounds good, I'll check my iPython logs – Wizard Of Ozzie Jun 25 '15 at 01:41
  • @wizard-of-ozzie its been a while since you asked, do you still need help with the issue? – sr_gi Mar 16 '17 at 12:20

1 Answers1

1

FWIW, Output is redeemed in 61ba3a8b40706931b72929628cf1a07d604f158c8350055725c664d544d00030:0

Midstate for sighash :

02000000
01
  D4B9E8EC436BDF27164DF27C7C3609024500D049037940513C94DAC8D3A999ED
  01000000
  58
    76 A9 14 23DFC9AD6D857C92AD2B99004354067492CF464C 88 AD
    63
      76 A9 14 FD00F9FD452FEE2214E8B0F9ACF4C53496BD5636 88 AC
    67
      AA 20 0757152190E14E5889B1270309D7C8E40219D45E04096FCB97D1B4C5A99064E1 87
    68
  FDFFFFFF
01
  006EBE0000000000
  19
  76 A9 14 4F2465FEC27AD88917C9FCB72B09ADE39B8911ED 88 AC
6C3C1300
01000000

Redeemed by scriptsig :

04 12345678
00
47
  30
  44
    02
    20 71B0D6894AE2252BD67F8D9882C814A2A59E1C7AE8B8F1117DB17A484538833A
    02
    20 680F44F3150B652C49B6523EFF5E750D460F3306ED669835DB7C3095596211BF
  01
41
  049343773D05D5A07F103914D5294CA742DB124BABD2C2CAC5F84E6114F192F07C1E44C956C737A60369FBF4F5E6324DC005BA38D156F61232F9251FEC8EE3E262
arubi
  • 1,864
  • 8
  • 21