> ## Documentation Index
> Fetch the complete documentation index at: https://www.bitnob.dev/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Bitnob API requests authenticate with an `X-Auth-Client` API key header against https://api.bitnob.com.
> Always use the sandbox environment for testing. Never put live API keys in sample code.
> Money amounts are integers in the smallest unit of the currency (satoshis for BTC, cents for fiat). Never use floats.
> Every state-changing request takes a client-supplied `reference` and must be treated as idempotent on retry.
> Quotes expire. Re-quote rather than reusing a stale quote id.

# Capstone project: Bitcoin Core CLI automation

> A capstone CLI tool that runs a node, manages wallets and UTXOs, and broadcasts signed transactions end to end.

## Goal

This project tests your ability to:

* Operate and script around a Bitcoin Core node
* Manage wallets and UTXOs
* Create, sign, and broadcast raw transactions
* Work entirely from the command line or via a scripting language

## Project specification

Your tool (Bash, Python, or any CLI language) should do the following:

## Start a Bitcoin node in regtest mode

Check if bitcoind is already running. If not, start it with:

```bash theme={null}
bitcoind -regtest -daemon
```

## Generate 101 blocks

Create a wallet and a miner address:

```bash theme={null}
bitcoin-cli -regtest createwallet "capstone"

MINER_ADDR=$(bitcoin-cli -regtest getnewaddress)
```

Mine 101 blocks to unlock coinbase outputs:

```bash theme={null}
bitcoin-cli -regtest generatetoaddress 101 $MINER_ADDR
```

## Send bitcoin to 2 new addresses

Generate two new recipient addresses:

```bash theme={null}
ADDR1=$(bitcoin-cli -regtest getnewaddress "recipient1")

ADDR2=$(bitcoin-cli -regtest getnewaddress "recipient2")
```

Send 0.25 BTC to each. This needs `fallbackfee=0.0001` in `bitcoin.conf`:

```bash theme={null}
TXID=$(bitcoin-cli -regtest sendmany "" "{\"$ADDR1\":0.25,\"$ADDR2\":0.25}")
```

## Confirm the transaction

Mine 1 block:

```bash theme={null}
bitcoin-cli -regtest generatetoaddress 1 $MINER_ADDR
```

## Output full raw transaction

Retrieve and decode the transaction:

```bash theme={null}
RAWTX=$(bitcoin-cli -regtest gettransaction $TXID | jq -r .hex)

bitcoin-cli -regtest decoderawtransaction $RAWTX
```

## Success criteria

Your tool must:

* Be runnable from a single command or script
* Wallet balance before and after TX
* The full transaction hex
* The decoded transaction JSON
* Handle errors gracefully (e.g. wallet already exists)
* Bonus

Add logging and cleanup:

* Create a log file with all steps and timestamps
* Allow user to reset the regtest chain (stop, clear, restart)
* Example

Capstone Start: Initializing Regtest Node...

Node running

Wallet 'capstone' created

Mined 101 blocks

Sending 0.25 BTC to two new addresses

TXID: a6c1f...89

Mined confirmation block

🔍 Raw Transaction:

```bash theme={null}
02000000...
```

🔍 Decoded Transaction:

```json theme={null}
{
  "txid": "...",
  "vout": [...],
  ...
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.