Looking for wallet software that supports custom P2SH redeem scripts?

19 replies 395 views
bull2011Member
Posts: 62 · Reputation: 206
#1Jun 13, 2026, 07:33 PM
Creating valid custom scriptSig/scriptPubkey combos is pretty straightforward. You can easily calculate a P2SH address, send coins there, and then spend from it with a bit of manual work. For instance: scriptSig Result (as part of a raw transaction): 080123456789abcdef scriptPubkey Result (as part of a raw transaction): a82055c53f5d490297900cefa825d0c8e8e9532ee8a118abe7d8570762cd38be981887 To make the redeem script, you just combine those two, adding a length byte "2c" at the start to make it valid. You can easily compute the P2SH address using Python, and you’ll get a public P2SH address like 33CGouuJW2G66mDaQ13pMBDuztW9eLKiKw. To spend from it, all you need is the redeem script. There’s an online service for spending from it, but it’s a bit of a hassle. I've found it works almost fine, but it sometimes adds an annoying OP_PUSHDATA1 which you need to delete and adjust the length size byte before you can submit the unsigned transaction via a web service or your wallet. Using broadcast('xxx') in Electrum has worked really well for me in these situations. In short, I've managed to get everything to function smoothly, though it involves a bit of manual effort. Just a heads up, don't use this example in real life. The first time you spend from it, your scriptSig will be visible on the blockchain. Plus, since there aren’t any real signatures, anyone could spend from that address using the same scriptSig over and over. So my question is: Is there any wallet software (and not some web service) that can take a scriptSig and a scriptPubkey, or just "import redeem script"?
5 Reply Quote Share
nova_2019Senior Member
Posts: 229 · Reputation: 1027
#2Jun 14, 2026, 12:23 AM
Have you looked at Coinb.in? It's raw transaction creation tool will accept a redeem script (also address or WIF Key)... However, I've not tested it with "custom" redeem scripts like your example, but it is worth testing out to see if it is able to handle it.
3 Reply Quote Share
im_apeHero Member
Posts: 629 · Reputation: 3824
#3Jun 14, 2026, 06:54 PM
no wallet has this type of options and i don't think any of them would add it since there is no reason for a user to create this type of non-standard scripts. not to mention the risks that these bring up which will affect the user experience. this is why the process is hard and you have to do it manually and "other tools", it is meant to be used by someone who understands how things work and accepts the risks on their own.
2 Reply Quote Share
gr3g.0rbitHero Member
Posts: 1025 · Reputation: 2646
#4Jun 15, 2026, 12:49 AM
You can import this to Bitcoin core using: Where the last "true" indicates that the first value is a P2SH script. It will produce the same address: 33CGouuJW2G66mDaQ13pMBDuztW9eLKiKw. But it wont let you spend from it through the GUI though
2 Reply Quote Share
bull2011Member
Posts: 62 · Reputation: 206
#5Jun 15, 2026, 05:00 AM
Damn, this is frustrating! The manual for Bitcoin Core says you can do it (import sigscript together with redeem script): https://bitcoincore.org/en/doc/0.20.0/rpc/wallet/importmulti/ But the closest I get is this command (run in the console): which adds 33CGouuJW2G66mDaQ13pMBDuztW9eLKiKw as a watch-only address; specifically it responds with We have to crack this! Edit: It doesn't matter what I write in the redeemscript string, it won't accept any of it. It does complain if one character is not hexadecimal, so at least we know the program is reading it, but... then nope. Feels like a stupid JSON formatting thing; please help!
1 Reply Quote Share
bull2011Member
Posts: 62 · Reputation: 206
#6Jun 16, 2026, 07:24 PM
I can replicate and confirm this, thank you. importaddress is for watch-only addresses though, according to the specs: https://bitcoincore.org/en/doc/0.20.0/rpc/wallet/importaddress/ However, importmulti specifically says you can have redeem scripts instead of private keys https://bitcoincore.org/en/doc/0.20.0/rpc/wallet/importmulti/ But I don't understand how to get it to work... Edit: there may be some leads here https://0bin.net/paste/nfnSf0HcBqBUGDto#7zJMRUhGEBkyh-eASQPEwKfNHgQ4D5KrUJRsk8MTPSa - have to dig deeper into how to properly format JSON-strings with redeemscript - try it you too!
1 Reply Quote Share
ryan_nodeSenior Member
Posts: 202 · Reputation: 852
#7Jun 17, 2026, 01:42 AM
It isn't. Bitcoin Core only accepts a fix set of standard script formats. Your redeemScript is not one of those, so it gives a warning about it. Note that this is just a warning and the script and address are still added to your wallet. However because Bitcoin Core does not recognize the type of script, it is unable to produce a valid input for that script. It can only produce inputs for the standard scripts.
0 Reply Quote Share
bull2011Member
Posts: 62 · Reputation: 206
#8Jun 18, 2026, 02:31 AM
Very interesting, thanks. Could you please give me an example with a what would be considered a standard P2SH address and its redeem script and a JSON-string that will be accepted by importmulti in Bitcoin Core? The manual explicitly says it can be done, but I haven't found one single working example; I find it strange that there is a documented function but zero (at least that I am able to find) published examples.
2 Reply Quote Share
ryan_nodeSenior Member
Posts: 202 · Reputation: 852
#9Jun 18, 2026, 08:23 AM
Both import the same  thing. The second one just uses the notation to give an address instead of a raw scriptPubKey.
3 Reply Quote Share
bull2011Member
Posts: 62 · Reputation: 206
#10Jun 18, 2026, 10:10 AM
Thanks! If it really is the case that importmulti for P2SH with scriptPubKey and redeemscript can only produce watchonly-addresses in Bitcoin Core, I don't understand why the function exists in the first place since the public address alone is, of course, enough for watchonly. Edit: I tried your first example. It works. But so does this, without redeemscript, with the identical outcome: So..... why can you insert a value that doesn't add any functionality, I don't get it.
5 Reply Quote Share
ryan_nodeSenior Member
Posts: 202 · Reputation: 852
#11Jun 18, 2026, 01:40 PM
importmulti can be used to import private keys and import scripts for which you already have the private keys for (e.g. adding a multisig to the wallet where you have one of the keys). importmulti is also useful for adding scripts and keys to your wallet so that you can use PSBT with those things.
1 Reply Quote Share
bull2011Member
Posts: 62 · Reputation: 206
#12Jun 18, 2026, 04:18 PM
Gotcha. Thanks for taking the time to explain. I find it a little funny you can easily create a transaction here, and then later broadcast it in Bitcoin Core without a problem at all, but not create it within the client. These transactions thus pass "isStandard", but you have to rely on third-party tools (web services or simply Notepad++ - it's not THAT difficult) to assemble them.
4 Reply Quote Share
ryan_nodeSenior Member
Posts: 202 · Reputation: 852
#13Jun 18, 2026, 07:33 PM
The node IsStandard check is a little looser than the wallet's check for standard scripts. It isn't looking for standard script templates because it doesn't need to. But how do you have a piece of software know how to make the scriptSig/scriptWitness? You have to hard code it, or make something that's smart enough to figure it out own its own. Hardcoding means that the developers have to think of literally every possible script and write scenarios for them. That's basically impossible because there is basically an infinite number of possible scripts. And something smart enough to cover all scripts is also not really possible. Miniscript is something that does the "smart enough to figure it out own its own" but within a very limited subset of script that can be reasoned about.
2 Reply Quote Share
bull2011Member
Posts: 62 · Reputation: 206
#14Jun 18, 2026, 11:11 PM
I'm not really sure what you mean. Yes, Bitcoin scripts can be infinitely complex, but hashes are only hashes (the "H" in P2SH), there are only so many opcodes, and the "only" thing your code needs to make sure is that when everything is combined and executed, the end result is "TRUE" (i.e. a single 01 in the stack top element, and no other stack elements). Pretty trivial. These two pages accomplish just this, fast and easy relying only on relatively easy-to-understand javascript: https://bitcoin-script-debugger.visvirial.com/ https://bip32jp.github.io/english/createp2sh.html I have coded my own quick and dirty Python script that creates valid raw transactions from self-made sigscript and redeemscript (as in the OP), the output can indeed be broadcast with Bitcoin Core without a problem. In other words, they must be considered standard (if we by standard mean "doesn't get caught in Bitcoin Core's 'isStandad' function"), and they propagate normally through the network (i.e. the other standard nodes have problems with them) and are confirmed, mined and included in blocks, as expected. I still find it fascinating that no wallet software does this natively, as I think this is the most simple form of a Bitcoin transaction - they don't even have signatures! Take Peter Todd's (in)famous SHA1 transaction puzzle for example; the solution could not have been created in Bitcoin Core, but very well broadcast with it. What's I'm gonna do next to automate the process further is to make an Electrum plugin. Which will yield the end-result I was looking for all along. A simple GUI-solution. I do think it's a little sad I can't do it in Bitcoin Core (without forking it, which at this point is not desirable).
6 Reply Quote Share
ryan_nodeSenior Member
Posts: 202 · Reputation: 852
#15Jun 18, 2026, 11:59 PM
What I meant was having Bitcoin Core automatically create the scriptSig for you for an arbitrary script is not feasible. As in it isn't possible to have sendtoaddress automatically construct, sign,  and send the transaction if it has arbitrary scripts because Core doesn't know how to make the scriptSigs for those arbitrary scripts. Those sites are for you to create the scriptSig manually, which I guess is what you are asking: to be able  to provide the scriptSig manually.
4 Reply Quote Share
markstakeMember
Posts: 4 · Reputation: 62
#16Jun 20, 2026, 11:27 PM
Looks like these guys solved a puzzle transaction using methods from this post - it is referenced! They too had to do it manually and could use Bitcoin Core to construct the transaction. I'm gonna look at their raw transaction and try to figure out how they did it. Cool topic. https://btcleak.com/2020/07/19/we-solved-a-p2sh-transaction-puzzle-and-redeemed-bitcoin/
2 Reply Quote Share
nova_2019Senior Member
Posts: 229 · Reputation: 1027
#17Jun 21, 2026, 01:14 AM
I would not say that it was a "puzzle" as such, in that it wasn't publicly listed as a challenge or anything like that... it seems they were just experimenting with P2SH scripts and discovered someone had been sending dust to the address generated from the "1=1" script address... It might have been useful for readers if they had actually shown the step by step guide to how they constructed the transaction, rather than "here is the finished transaction, feel free to decode it yourself" Still, it's nice to see theory being used in practice
0 Reply Quote Share
im_apeHero Member
Posts: 629 · Reputation: 3824
#18Jun 21, 2026, 04:33 AM
that whole website is shady. they have been making this type of articles 2 other times before too with the titles such as "hack bitcoin". i believe that it was mainly created to get traffic from those searching for this type of nonsense that seems to becoming popular again these days.
3 Reply Quote Share
Posts: 16 · Reputation: 153
#19Jun 21, 2026, 06:56 AM
These addresses have been funded as an experiment on October first 2014: In case you wonder why OP_2 to OP_9 work as well since they are not equal to 1 (TRUE) as the final value on stack after all commands are evaluated, well that's because the top element of the stock should be a non-zero value to resolve as valid. But anyway, the article is from 2020 and presented like it's a new thing while this was done already six years ago.
6 Reply Quote Share
bull2011Member
Posts: 62 · Reputation: 206
#20Jun 21, 2026, 10:29 AM
Found another interesting example. I call it "the nothing P2SH address". Because the script is NOTHING (code below). Here is how to calculate the address (Python command line): What's fascinating is its high activity, relatively large transactions and very recent use: https://www.blockchain.com/btc/address/3J98t1WpEZ73CNmQviecrnyiWrnqRhWNLy To spend from it, simply will do as the unlocking script, judging from looking at the blockchain (example transaction: 6f033ffb5eb1be1527f7d03b6dfe195ced3575965ac619d6c2ca67e37ca5d0d9). And it's a pity no one can control it automatically from Bitcoin Core or Electrum, or any standard wallet software, in my humble opinion.
2 Reply Quote Share
?Reply
Sign in to reply to this topic

Related topics