Handling Custom Redeem Scripts in P2SH

19 replies 205 views
Posts: 20 · Reputation: 30
#1Mar 16, 2026, 01:30 PM
Creating custom scriptSig and scriptPubkey is a breeze. You can calculate a P2SH address and spend from it with some manual steps. Like, here's an example: scriptSig: 080123456789abcdef scriptPubkey: a82055c53f5d490297900cefa825d0c8e8e9532ee8a118abe7d8570762cd38be981887. Combine them and you get a redeem script, just pad it with a length byte "2c".
3 Reply Quote Share
hash_lordNewbie
Posts: 18 · Reputation: 2
#2Mar 16, 2026, 06:33 PM
What about trying Coinb.in? They have a raw transaction tool that may accept redeem scripts. I haven't tried it with custom ones like yours though, but it’s definitely worth a shot.
2 Reply Quote Share
mr_apeNewbie
Posts: 401 · Reputation: 35
#3Mar 18, 2026, 11:52 PM
I doubt any wallet will support that. No one really needs these non-standard scripts anyway, and the risks they come with can ruin the user experience. That’s why it’s all manual work. Only those who get how it works take that risk.
2 Reply Quote Share
0xChadNewbie
Posts: 513 · Reputation: 3
#4Mar 19, 2026, 12:57 AM
You can import your redeem script into Bitcoin Core using a specific command. That "true" at the end signifies it’s a P2SH script. It’ll generate the same address back: 33CGouuJW2G66mDaQ13pMBDuztW9eLKiKw. But don’t expect to spend from it through the interface.
3 Reply Quote Share
Posts: 20 · Reputation: 30
#5Mar 19, 2026, 05:30 AM
Ugh, this is so annoying! The Bitcoin Core manual claims you can import a scriptSig with a redeem script, yet all I can do is add it as a watch-only address. I need to crack this!
4 Reply Quote Share
Posts: 20 · Reputation: 30
#6Mar 21, 2026, 04:04 PM
I confirm this. Using importaddress will just give you a watch-only address. But importmulti is supposed to let you use redeem scripts, right? Still confused about how to make it work...
3 Reply Quote Share
matrix2021Full Member
Posts: 92 · Reputation: 612
#7Mar 21, 2026, 05:36 PM
Nope. Bitcoin Core has specific accepted script formats. Your redeem script isn’t one of them, so it just warns you. It adds the script and address, but can’t create valid inputs for anything outside standard formats.
2 Reply Quote Share
Posts: 20 · Reputation: 30
#8Mar 21, 2026, 05:41 PM
Can you give an example of a standard P2SH address along with its redeem script? I can't seem to find any working examples despite the manual saying it’s possible.
4 Reply Quote Share
matrix2021Full Member
Posts: 92 · Reputation: 612
#9Mar 22, 2026, 08:51 PM
Both import formats do the same thing. The different notation changes how it reads the address but it boils down to the same outcome.
1 Reply Quote Share
Posts: 20 · Reputation: 30
#10Mar 22, 2026, 11:00 PM
Seriously! If importmulti with scriptPubKey and redeem script can only make watch-only addresses, what’s the point of it? You can already get that with a public address.
3 Reply Quote Share
matrix2021Full Member
Posts: 92 · Reputation: 612
#11Mar 23, 2026, 01:23 AM
Importmulti can import private keys too, but it’s meant for scenarios where you have existing private keys. Plus, it is handy for using partial transactions.
0 Reply Quote Share
Posts: 20 · Reputation: 30
#12Mar 23, 2026, 05:43 AM
Got it! It’s wild that you can build a transaction here then broadcast it in Bitcoin Core without a hitch, but you can’t do the whole thing directly in the client.
2 Reply Quote Share
matrix2021Full Member
Posts: 92 · Reputation: 612
#13Mar 23, 2026, 07:09 AM
The node's IsStandard check isn’t as strict as what the wallet enforces. The node doesn’t rely on standard templates like the wallet does, so it’s a bit more flexible.
3 Reply Quote Share
Posts: 20 · Reputation: 30
#14Mar 25, 2026, 02:23 AM
I get it, but it’s still tricky. Sure, Bitcoin scripts can be complex, but in the end, you just need it to result in "TRUE". That’s not rocket science.
3 Reply Quote Share
matrix2021Full Member
Posts: 92 · Reputation: 612
#15Mar 25, 2026, 06:35 AM
The problem is automating scriptSig creation for random scripts isn’t feasible. Bitcoin Core needs to know how to construct those scripts to process transactions.
4 Reply Quote Share
Posts: 6 · Reputation: 138
#16Mar 25, 2026, 10:49 AM
Interesting, but I doubt that was a real "puzzle" transaction. They were just messing around with P2SH scripts. It would have been cool to see a detailed step-by-step instead of just the result.
5 Reply Quote Share
hash_lordNewbie
Posts: 18 · Reputation: 2
#17Mar 25, 2026, 01:31 PM
That site looks sketchy. They've done articles like this before to attract views. Seems like they're cashing in on the hype around this stuff.
3 Reply Quote Share
mr_apeNewbie
Posts: 401 · Reputation: 35
#18Mar 25, 2026, 04:45 PM
These addresses were actually tested way back in 2014. The OP_2 to OP_9 scripts work too since they resolve as true in the stack. Crazy to see old tricks resurfacing.
3 Reply Quote Share
hawk42Full Member
Posts: 6 · Reputation: 346
#19Mar 25, 2026, 05:13 PM
I found another cool example. I call it a "nothing P2SH address" because the script is EMPTY. Interestingly, it’s been highly active and used for large transactions recently.
3 Reply Quote Share
Posts: 20 · Reputation: 30
#20Mar 25, 2026, 06:58 PM
To spend from it, just use a simple command as the unlocking script. But too bad no one can directly control it through Bitcoin Core.
3 Reply Quote Share

Related topics