---
title: Testing Applications
description: "Bitcoin Core provides testing tools designed to let developers test their applications with reduced risks and limitations. ## [Testnet](https://bitcoindevelopers.org/encyclopedia/testnet/)[https://developer.bitcoin.org/examples/testing.html#testnet](https://developer.bitcoin.org/examples/testing.html#testnet) When run with no arguments, all Bitcoin Core programs default to Bitcoin’s main [network](https://developer.bitcoin.org/devguide/p2p_network.html) ([mainnet](https://developer.bitcoin.org/glossary.html#term-Mainnet)). However, for development, it’s safer and cheaper to…"
url: "https://bitcoindevelopers.org/docs/examples/testing-applications/"
updated: "2025-05-13"
category: Examples
---

# Testing Applications

Bitcoin Core provides testing tools designed to let developers test their applications with reduced risks and limitations.

## [Testnet](https://bitcoindevelopers.org/encyclopedia/testnet/)[https://developer.bitcoin.org/examples/testing.html#testnet](https://developer.bitcoin.org/examples/testing.html#testnet)

When run with no arguments, all Bitcoin Core programs default to Bitcoin’s main [network](https://developer.bitcoin.org/devguide/p2p_network.html) ([mainnet](https://developer.bitcoin.org/glossary.html#term-Mainnet)). However, for development, it’s safer and cheaper to use Bitcoin’s test [network](https://developer.bitcoin.org/devguide/p2p_network.html) ([Testnet](https://bitcoindevelopers.org/encyclopedia/testnet/)) where the [Satoshis](https://bitcoindevelopers.org/encyclopedia/satoshis/) spent have no real-world value. [Testnet](https://bitcoindevelopers.org/encyclopedia/testnet/) also relaxes some restrictions (such as [Standard Transaction](https://bitcoindevelopers.org/encyclopedia/standard-transaction/) checks) so you can test functions which might currently be disabled by default on [Mainnet](https://bitcoindevelopers.org/encyclopedia/mainnet/).

To use [Testnet](https://bitcoindevelopers.org/encyclopedia/testnet/), use the argument `-Testnet` with `bitcoin-cli`, `bitcoind` or `bitcoin-qt` or add `Testnet=1` to your `bitcoin.conf` file as [described earlier](https://developer.bitcoin.org/examples/index.html). To get free [Satoshis](https://bitcoindevelopers.org/encyclopedia/satoshis/) for testing, use [Piotr Piasecki’s testnet faucet](https://tpfaucet.appspot.com/). [Testnet](https://bitcoindevelopers.org/encyclopedia/testnet/) is a public resource provided for free by members of the community, so please don’t abuse it.

## [Regtest](https://bitcoindevelopers.org/encyclopedia/regtest/) Mode[https://developer.bitcoin.org/examples/testing.html#regtest-mode](https://developer.bitcoin.org/examples/testing.html#regtest-mode)

For situations where interaction with random peers and blocks is unnecessary or unwanted, Bitcoin Core’s [Regression test mode](https://bitcoindevelopers.org/encyclopedia/regression-test-mode/) ([Regtest](https://bitcoindevelopers.org/encyclopedia/regtest/) mode) lets you instantly create a brand-new private [Block](https://bitcoindevelopers.org/encyclopedia/block/) chain with the same basic rules as [Testnet](https://bitcoindevelopers.org/encyclopedia/testnet/)—but one major difference: you choose when to create new blocks, so you have complete control over the environment.

Many developers consider [Regtest](https://bitcoindevelopers.org/encyclopedia/regtest/) mode the preferred way to develop new applications. The following example will let you create a [Regtest](https://bitcoindevelopers.org/encyclopedia/regtest/) environment after you first [configure bitcoind](https://developer.bitcoin.org/examples/index.html).

```
> bitcoind -Regtest -daemon
Bitcoin server starting
```

Start `bitcoind` in [Regtest](https://bitcoindevelopers.org/encyclopedia/regtest/) mode to create a private [Block](https://bitcoindevelopers.org/encyclopedia/block/) chain.

```
## Bitcoin Core 0.10.1 and earlier
bitcoin-cli -Regtest setgenerate true 101

## Bitcoin Core 17.1 and earlier
bitcoin-cli -Regtest generate 101

## Bitcoin Core 18.0 and later
bitcoin-cli -Regtest generatetoaddress 101 $(bitcoin-cli -Regtest getnewaddress)
```

Generate 101 blocks using a special [RPC](https://developer.bitcoin.org/reference/rpc/index.html) which is only available in [Regtest](https://bitcoindevelopers.org/encyclopedia/regtest/) mode. This takes less than a second on a generic PC. Because this is a new [Block](https://bitcoindevelopers.org/encyclopedia/block/) chain using Bitcoin’s default rules, the first blocks pay a [Block reward](https://bitcoindevelopers.org/encyclopedia/block-reward/) of 50 [Bitcoins](https://bitcoindevelopers.org/encyclopedia/bitcoins/). Unlike [Mainnet](https://bitcoindevelopers.org/encyclopedia/mainnet/), in [Regtest](https://bitcoindevelopers.org/encyclopedia/regtest/) mode only the first 150 blocks pay a reward of 50 [Bitcoins](https://bitcoindevelopers.org/encyclopedia/bitcoins/). However, a [Block](https://bitcoindevelopers.org/encyclopedia/block/) must have 100 [Confirmations](https://bitcoindevelopers.org/encyclopedia/confirmations/) before that reward can be spent, so we generate 101 blocks to get access to the [Coinbase](https://bitcoindevelopers.org/encyclopedia/coinbase/) transaction from [Block](https://bitcoindevelopers.org/encyclopedia/block/) #1.

```
bitcoin-cli -Regtest getbalance
50.00000000
```

Verify that we now have 50 [Bitcoins](https://bitcoindevelopers.org/encyclopedia/bitcoins/) available to spend.

You can now use Bitcoin Core [RPCs](https://developer.bitcoin.org/reference/rpc/index.html) prefixed with `bitcoin-cli -Regtest`.

[Regtest](https://bitcoindevelopers.org/encyclopedia/regtest/) wallets and [Block](https://bitcoindevelopers.org/encyclopedia/block/) chain state (chainstate) are saved in the `Regtest` subdirectory of the Bitcoin Core configuration directory. You can safely delete the `Regtest` subdirectory and restart Bitcoin Core to start a new [Regtest](https://bitcoindevelopers.org/encyclopedia/regtest/). (See the [Developer Examples Introduction](https://developer.bitcoin.org/examples/index.html) for default configuration directory locations on various operating systems. Always back up [Mainnet](https://bitcoindevelopers.org/encyclopedia/mainnet/) wallets before performing dangerous operations such as deleting.)
