<p>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.</p>

<p>Thanks again,</p>

<p>Dave</p>

CC BY-SA 4.0
2018-06-05T21:08:21.520Z
2018-06-05T21:08:21.520Z
Dave
<p>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:</p>

<ol>
<li>Bitcoin Version: 16.0</li>
<li>Network: RegTest</li>
<li>Locking Script Hex: 0x93016387 (OP_ADD 99 OP_EQUAL)</li>
</ol>

<p>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<br>
If you decode this, you will see a vout to the p2sh address:<br>
 2My2ApqGcoNXYceZC4d7fipBu4GodkbefHD<br>
The next transaction I generated is:<br>
02000000014192c46838cfe8296c9189b7d7e51a57aad2ee31f931d5b9721908f13f87594b0000000000ffffffff0140b9ec05000000001976a914351ef68a632b634cdb63d0e2b58b7f795ba1233f88ac00000000<br>
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</p>

<p>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.</p>

CC BY-SA 4.0
2018-06-01T00:08:36.483Z
What transaction have you created that fails?
Ava Chow
CC BY-SA 4.0
2018-06-01T20:42:30.170Z
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: https://bitcoin.stackexchange.com/questions/74753/htlc-hash-time-lock-contract-using-bitcoin-qt/74953#74953 - 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...
pebwindkraft
CC BY-SA 4.0
2018-06-04T13:19:22.003Z
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
<input-script>
Can you help me with a puzzle transaction?
Dave
# Can you help me with a puzzle transaction?

(Asked by: username_0 on 2018-05-31)

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.

**Tags:** input-script

> **Comments:**
> **username_1**: What transaction have you created that fails?  
> **username_2**: 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: https://bitcoin.stackexchange.com/questions/74753/htlc-hash-time-lock-contract-using-bitcoin-qt/74953#74953 - 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...  
> **username_0**: 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.  

---

## 1 answers

### Answer by username_0 on 2018-06-05. Score: 1

So I have resolved the issue, first a huge thanks to username_2 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,

username_0


---

