<!--
{
  "availability" : [

  ],
  "documentType" : "symbol",
  "framework" : "Bitcoin",
  "identifier" : "/documentation/Bitcoin/Daemon/bootstrap(cookieFile:port:timeout:)",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "Bitcoin"
    ],
    "preciseIdentifier" : "s:7Bitcoin6DaemonO9bootstrap10cookieFile4port7timeouty10Foundation3URLV_s6UInt16Vs8DurationVtYaKFZ"
  },
  "title" : "bootstrap(cookieFile:port:timeout:)"
}
-->

# bootstrap(cookieFile:port:timeout:)

Bootstrap the direct RPC bridge using cookie authentication.

```
static func bootstrap(cookieFile: URL, port: UInt16 = 8332, timeout: Duration = .seconds(30)) async throws
```

## Parameters

`cookieFile`

File URL to the `.cookie` file in the data directory.
For non-mainnet networks, include the network subdirectory
(e.g., `datadir/regtest/.cookie`).

`port`

RPC port (default 8332).

`timeout`

Maximum time to wait for the RPC server (default 30s).

## Discussion

Reads the `.cookie` file written by Bitcoin Core at startup to obtain
credentials, then calls `_bridge_init` via HTTP. This is the default,
credential-free bootstrap mechanism.

The cookie file is created during daemon startup with the format
`__cookie__:<random-hex>`. This method polls for the file to appear,
then uses it to authenticate the `_bridge_init` call.

> Throws: The last transport or file-read error if the timeout expires,
> or `CancellationError` if the task is cancelled.