A crucial aspect of any bitcoin wallet is its ability to send and receive sats. If you do that on mainnet while building a wallet from scratch there is good news and bad news:
GOOD NEWS Find bugs but BAD NEWS go broke.
GOOD NEWS Go broke slowly because BAD NEWS wait on ~10 min block times.
So how can a developer iterate quickly while building a bitcoin wallet while not going broke?
This can also be seen in the light of development generally: constantly interacting with the live API endpoint during the iterative process or in unit testing can be costly, impractical, and time-consuming. The solution is often to simulate or mock the data, thus bypassing the need for real network requests. Similarly, the journey of building a bitcoin wallet calls for a testing environment that mirrors real-world conditions without using bitcoin mainnet.
It’s possible, let’s talk test environments and bitcoin networks!
MAINNET
The main bitcoin network.
The main bitcoin network is where actual transactions take place, involving real value and real money. However, due to block times of around 10 minutes it's not the ideal place for developers to iterate on their applications efficiently.
TESTNET
A test bitcoin network.
Testnet is another option developers can use. It provides a sandbox environment where sats hold no real-world value and a lot of different applications support it, however testnet's irregular and sometimes slow block times can still hinder your development speed and acquiring testnet coins can sometimes be a hassle, unless you ask Matt for some:
REGTEST
A local bitcoin network.
Regtest is a step in the right direction for local development and there is some great getting started information, however even this has its limitations like setting up and managing your own regtest environment which can be time-consuming and resource-intensive.
Polar came on the scene in 2019 and changed the game for someone like myself by offering a one-click solution for local app development and testing using regtest. Instead of spinning up my own local regtest or testnet, Polar allowed me allowed me to have one-click Bitcoin Lightning network for local regtest app development & testing. Polar offers a controlled testing environment and also allows for mining bitcoin blocks with regularity and speed.
SIGNET
A bitcoin network like testnet but using signed blocks.
Mutinynet is a custom signet that comes with its own faucet and block explorer. It’s features include:
It’s own faucet
It’s own block explorer
SegWit and Taproot
30 second block times
Using Mutinynet also allows you to interoperate with other apps that are also using Mutinynet.
Check out the Mutiny blog post explaining everything in even greater detail.
BDK iOS
The BDK Swift Example Wallet has support for Mutinynet and used it extensively in the iteration process of the wallet, heavily using the Esplora endpoint and faucet to iterate on new and existing features.
From there its also a good idea to test those features on testnet, as well as another signet that has 10 minute block times (check out signet.bitcoindevkit.net), and of course mainnet because that’s where the rubber meets the road.
Summary
We’ve understood how to:
Develop a bitcoin wallet
Design a bitcoin wallet
Default to Taproot in a bitcoin wallet
Use Mutinynet to iterate on a bitcoin wallet
As the fine folks at Apple say (in some variation) at the end of every WWDC session: can’t wait to see what you build.