Type Method
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).
Mentioned In
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.