Back to Resources

Setting Up Your Development Environment

Version 1.1 - Last Updated: April 2025

Prerequisites

Before you begin, ensure you have the following installed on your system:

  • Node.js (v16 or later)
  • npm (v7 or later) or yarn
  • Git
  • A code editor (VS Code recommended)

Installing the BTCv2 Development Kit

The BTCv2 Development Kit (BDK) provides all the tools you need to build applications on the Bitcoin Mobile platform.

1. Install the BDK CLI

npm install -g @btcmobile/bdk-cli

2. Initialize a new BTCv2 project

bdk init my-btcv2-app

3. Navigate to your project directory

cd my-btcv2-app

4. Install dependencies

npm install

Configuring Your Environment

1. Create a .env file

Create a .env file in your project root with the following content:

# API Configuration BTCV2_API_KEY=your_api_key_here BTCV2_NETWORK=testnet # or mainnet # Mining Configuration MINING_PRESET=balanced MAX_TEMPERATURE=40 # Celsius # Bridge Configuration BRIDGE_ENABLED=true BRIDGE_FEE=0.001 # 0.1%

2. Get your API key

To get your API key, visit the API Management section in the Resources page.

3. Configure your network

For development, we recommend using the testnet. You can get testnet tokens from the Testnet Faucet.

Running Your Development Environment

1. Start the local development server

npm run dev

2. Run the BTCv2 local node

bdk node start

Your local BTCv2 node will be running at http://localhost:8723.

Troubleshooting

Connection Issues

If you're having trouble connecting to the testnet, ensure your API key is correct and that you have an active internet connection.

Mining Simulation Errors

If the mining simulator is not working, try running bdk mining reset to reset the mining environment.

Dependency Issues

If you encounter dependency issues, try deleting the node_modules folder and running npm install again.

Next Steps

Now that your development environment is set up, you can: