I am creating an atomic swap interface between Bitcoin and EVM using hashed timelock contracts as the underlying swapping mechanism. The idea is to support atomic swaps via the browser, using browser-based wallets.

To do this I need my web interface to be able to create Bitcoin scripts programmatically and create transactions to which those scripts are attached - all via the web interface. Metamask uses Web3.js for the EVM side of this transaction, but I am not sure which browser-based Bitcoin wallet has similar functionality.

I need to support a bitcoin wallet that can invoke new bitcoin scripts via javascript and create transactions based on those scripts. Does such a browser-based wallet exist for Bitcoin?

I have looked at Xverse and Trust wallet, but no such support seems to exist.


Is there a browser-based bitcoin wallet that can support the programmatic creation of transactions that include custom Bitcoin scripts?

  • 2
    Wallet reviews are off-topic for this site. That said it's a good question. If this helps, i think browser-based wallets are much more common in Ethereum land than in Bitcoin land. In Bitcoin the only ones you'd come across would likely be "pocket money" wallets (i'm thinking of the Joule extension, Mutiny, or even Cashu) which aren't used for onchain txs. In addition there is still a limited number of wallets with support for custom scripts, which makes it very unlikely any of the browser-based wallet does support them. Jan 15 at 14:02
  • Thanks. If there are no browser-based options, are there any desktop-based options other than Bitcoin-QT/Bitcoind? I'm hoping one that doesn't require the user to run a full-node. Jan 15 at 14:11
  • You only need HTLCs? Are your scripts Miniscript-compatible? They should be, or it should be easy to make them so. (Side-note: given the upvotes i think we can make an exception for this question, i'll write up an answer once this conversation in the comments is over.) Jan 15 at 14:32
  • I haven't created the HTLC scripts yet - I was looking for a wallet solution first then I am happy to write them in whatever format is necessary. The main goal here is to enable the entire flow via the browser. So I am agnostic as to the implementation details of the HTLC script itself Jan 15 at 14:39

1 Answer 1


Product and services reviews are generally off-topic for this site. That said, i think the way the question is formulated allows to give some general guidance for how to go about looking for a Bitcoin wallet which fits your needs, without getting in an opinionated analysis of each of them.

From the question and the comments, i infer you are more familiar with Ethereum. I believe web wallets are much more common in the Ethereum world than they are in the Bitcoin world. I think if you look around for web-based Bitcoin wallets you'd mostly come across "pocket money" wallets which put forward Lightning or Chaumian Mint based payments rather than onchain transactions.

Since you don't have specific requirements for the format of the script, you could either:

  1. Look for wallets which support Miniscript. They aren't yet very common yet, but are now getting more traction and more are being developed. That said, i would expect most Miniscript-aware wallet to not support any Miniscript. Rather i'd expect they would simply leverage Miniscript for the usecase they are focused on addressing.
  2. Look if you could integrate with Lightning. After all, payments on Lightning are just HTLC's. Except they are kept off-chain most of the time. If you choose this route, i'd advise to design your protocol such as to keep Lightning payments almost instant. It's sometimes tempting to just hold onto an HTLC (thereby blocking liquidity along the whole path), but it won't be free forever.

Your Answer

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

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