1

I am hoping there is someone out there that can help me with probably a simple bit coin scripting question...but maybe there is something more to it. I am trying to fully test a custom script on a regtest bitcoind node network. I have worked through some online tutorials and I can create the custom locking script, transform it into a P2SH, and send coin to it. The issue is when I try to unlock the script. I am trying to write the unlocking transaction by hand since this is a basic puzzle transaction...with no luck. Here is the detailed info:

  1. Bitcoin Version: 16.0
  2. Network: RegTest
  3. Locking Script Hex: 0x93016387 (OP_ADD 99 OP_EQUAL)

Here is the base transaction serialized, please note this does reference a previous transaction that sends 1.0 coin to that wallet's address. 0200000001f5bbd0f99f94380cdff45f3eb689e62437df6e6519554a99ae4042b6499afee0000000006b483045022100e2382837f540c03bde1d3aafea0706c358db61b65d85aef9ea29350ecfb7c8dd02204244642b7166529085238527771ead376e1fa69d20dd23b49762014543d407ea0121036397e0c5c226797a1244f5c0736d7874b756cbc11fe39866c2c380403ca5bcdaffffffff0180c6ef050000000017a9143f58b4f7b14847a9083694b9b3b52a4cea2569ed8700000000
If you decode this, you will see a vout to the p2sh address:
2My2ApqGcoNXYceZC4d7fipBu4GodkbefHD
The next transaction I generated is:
02000000014192c46838cfe8296c9189b7d7e51a57aad2ee31f931d5b9721908f13f87594b0000000000ffffffff0140b9ec05000000001976a914351ef68a632b634cdb63d0e2b58b7f795ba1233f88ac00000000
Which references the previous transaction but does not have a signature and it decodes properly. Then I try to insert the solution to the locking script, by adding: 3e5101620493016387a9143f58b4f7b14847a9083694b9b3b52a4cea2569ed87 in the correct spot...which it might not be makes this transaction: 02000000014192c46838cfe8296c9189b7d7e51a57aad2ee31f931d5b9721908f13f87594b00000000003e5101620493016387a9143f58b4f7b14847a9083694b9b3b52a4cea2569ed87ffffffff0140b9ec05000000001976a914351ef68a632b634cdb63d0e2b58b7f795ba1233f88ac00000000

And that is where it breaks, I try to decode it...doesn't work...I try to send it...doesn't work...I believe the hex is correct and I believe it is in the right spot...but any ideas or help you can provide will be helpful.

3
  • 1
    What transaction have you created that fails?
    – Andrew Chow
    Jun 1, 2018 at 0:08
  • It is not clear, what you have done so far, and how you tried to create your transaction. From a high level perspective I answered a similar question here: bitcoin.stackexchange.com/questions/74753/… - you’d just need to replace „my“ sha256/ripemd160 against your simple expertise. If you can show what you have done, we might be able to provide better help... Jun 1, 2018 at 20:42
  • Thank you, I will definitely share what I have done shortly. I was walking through the top part and partially uncovered an issue. I want to make sure that I don't send you guys down the wrong path. I appreciate the help, and will follow up shortly with the missing pieces.
    – Dave
    Jun 4, 2018 at 13:19

1 Answer 1

1

So I have resolved the issue, first a huge thanks to pebwindkraft for the direction and link to look at. Based on his breakdown of a transaction I was able to figure out where I was going wrong. I was missing the correct hex to unlock the previous transaction, once that was entered in the correct spot of the serialized transaction, it was broadcasted successfully. The breakdown of the transaction there, plus the bitcoin reference pages were huge helps in figuring this out.

Thanks again,

Dave

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.