Can you help me with a puzzle transaction? 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:


Bitcoin Version: 16.0
Network: RegTest
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.
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