<!--
{
  "availability" : [

  ],
  "documentType" : "symbol",
  "framework" : "Bitcoin",
  "identifier" : "/documentation/Bitcoin/Daemon",
  "metadataVersion" : "0.1.0",
  "role" : "Enumeration",
  "symbol" : {
    "kind" : "Enumeration",
    "modules" : [
      "Bitcoin"
    ],
    "preciseIdentifier" : "s:7Bitcoin6DaemonO"
  },
  "title" : "Daemon"
}
-->

# Daemon

Controls the lifecycle of an embedded Bitcoin Core daemon process.

```
enum Daemon
```

## Overview

Provides static methods to start, bootstrap, and wait for the `bitcoind` process.
The daemon runs on a dedicated thread and communicates via JSON-RPC.

## Typical Usage

```swift
// Start the daemon
Daemon.start(["-regtest", "-server"])

// Bootstrap the direct RPC bridge (cookie auth — credential-free)
let cookieFile = dataDir.appending(path: ".cookie")
try await Daemon.bootstrap(cookieFile: cookieFile, port: 18443)

// Or bootstrap with explicit credentials
try await Daemon.bootstrap(
    url: URL(string: "http://127.0.0.1:8332")!,
    username: "user",
    password: "pass"
)

// Now AutoTransport routes non-wallet RPCs through the direct bridge.
```