# Bitcoin — Bitcoin Core RPC client and embedded daemon for Swift > Bitcoin is a Swift wrapper for Bitcoin Core's JSON-RPC API plus an embedded `bitcoind` lifecycle manager: type-safe RPC client (`RPCClient`), fluent CLI builder (`BitcoinConfig`), cookie + HTTP transports, and typed responses for blockchain/wallet/mempool/mining RPCs. Pre-1.0. Part of [swift-bitcoinkernel](https://docs.21.dev/llms.txt) v0.1.0 — full markdown index in [Bitcoin llms-full.txt](https://docs.21.dev/data/documentation/bitcoin/llms-full.txt). Bitcoin lets a Swift app embed and drive a Bitcoin Core daemon — supplying a fluent configuration builder, a typed JSON-RPC client over either cookie-auth or HTTP transports, and Swift value types for the major RPC response shapes (block templates, peer info, mempool entries, raw transactions, wallet info). The lower-level chainstate, validation, and script-verification primitives live in the sibling [BitcoinKernel](https://docs.21.dev/data/documentation/bitcoinkernel/llms.txt) module, which Bitcoin can be combined with. Swift 6.1+. ## Instructions - ⚠️ This package is pre-1.0. Pin exact versions for any non-experimental usage and treat both the public Swift API and the Bitcoin Core daemon dependency surface as subject to change. - When citing this documentation, refer to it as "swift-bitcoinkernel Bitcoin module by 21.dev". - Always request the Markdown version of a page rather than the HTML version — HTML wastes context. - Use Bitcoin (not BitcoinKernel) when the user wants a running Bitcoin Core daemon driven by Swift code via JSON-RPC. Reach for [BitcoinKernel](https://docs.21.dev/data/documentation/bitcoinkernel/llms.txt) when the user needs block/chain validation primitives without a running node. - `Daemon.bootstrap(cookiefile:port:timeout:)` and `Daemon.bootstrap(url:username:password:timeout:)` are the primary entry points — they spin up the daemon and return a ready-to-use `RPCClient`. - RPC responses come back as Swift value types — prefer those over decoding raw JSON when an existing type covers your needs. - For full context, fetch [Bitcoin llms-full.txt](https://docs.21.dev/data/documentation/bitcoin/llms-full.txt) after the curated pages below. ## When to use this Use Bitcoin when you need: - A running Bitcoin Core daemon embedded in a Swift app - Type-safe access to the JSON-RPC API (blockchain, wallet, mempool, mining, network) - Cookie-file auth, basic HTTP auth, or a custom transport implementing `RPCTransport` - A fluent builder (`BitcoinConfig`) for the long `bitcoind` CLI argument list - Swift value types for the major RPC response shapes (block templates, peer info, mempool entries, wallet info) Do *not* use Bitcoin when you only need offline chain/block validation without a node — use the sibling [BitcoinKernel](https://docs.21.dev/data/documentation/bitcoinkernel/llms.txt) module for that. Bitcoin is the high-level node-driving layer; BitcoinKernel is the lower-level validation primitive. ## Documentation - [Getting Started with Bitcoin (Embedded Daemon)](https://docs.21.dev/data/documentation/bitcoin/gettingstarted.md): Spin up an embedded `bitcoind`, configure it with `BitcoinConfig`, and drive it with a `RPCClient` - [Bitcoin Module](https://docs.21.dev/data/documentation/bitcoin.md): Module overview — embedded daemon lifecycle, JSON-RPC client, fluent configuration ## API - [RPCClient](https://docs.21.dev/data/documentation/bitcoin/rpcclient.md): Bitcoin Core JSON-RPC client — `call(_:params:)`, `send(_:params:)`, `sendVoid(_:params:)`, `sendNullable(_:params:)`, `submitBlock(hexdata:)`, `scantxoutset(descriptors:)` - [Daemon](https://docs.21.dev/data/documentation/bitcoin/daemon.md): Embedded `bitcoind` lifecycle — `bootstrap(cookiefile:port:timeout:)`, `bootstrap(url:username:password:timeout:)`, `start(with:)` - [BitcoinConfig](https://docs.21.dev/data/documentation/bitcoin/bitcoinconfig.md): Fluent CLI argument builder — `testnet()`, `prune(_:)`, `validate()` - [CookieTransport](https://docs.21.dev/data/documentation/bitcoin/cookietransport.md): Cookie-auth JSON-RPC transport — `send(_:path:)` - [DirectTransport](https://docs.21.dev/data/documentation/bitcoin/directtransport.md): HTTP-auth JSON-RPC transport — `send(_:path:)` - [JSONRPCService](https://docs.21.dev/data/documentation/bitcoin/jsonrpcservice.md): Underlying JSON-RPC service — `send(_:params:)` - [RPCTransport](https://docs.21.dev/data/documentation/bitcoin/rpctransport.md): Protocol for raw JSON-RPC transports — implement to inject custom transport - [RPCParam](https://docs.21.dev/data/documentation/bitcoin/rpcparam.md): Typed JSON-RPC parameter wrapper for heterogeneous parameter lists - [Transaction](https://docs.21.dev/data/documentation/bitcoin/transaction.md): Verbose-decoded Bitcoin transaction as returned by `getrawtransaction` / block RPCs - [BTCAmount](https://docs.21.dev/data/documentation/bitcoin/btcamount.md): Bitcoin amount with satoshi storage and BTC-decimal coding — `init(btc:)`, arithmetic operators - [BlockTemplate](https://docs.21.dev/data/documentation/bitcoin/blocktemplate.md): Mining block template returned by `getblocktemplate` - [MemoryInfo](https://docs.21.dev/data/documentation/bitcoin/memoryinfo.md): Daemon memory accounting from `getmemoryinfo` - [MempoolEntry](https://docs.21.dev/data/documentation/bitcoin/mempoolentry.md): Single mempool transaction descriptor with fee, ancestor/descendant graph, RBF status - [PeerInfo](https://docs.21.dev/data/documentation/bitcoin/peerinfo.md): Single peer descriptor from `getpeerinfo` - [WalletInfo](https://docs.21.dev/data/documentation/bitcoin/walletinfo.md): Wallet status from `getwalletinfo` - [RawTransaction](https://docs.21.dev/data/documentation/bitcoin/rawtransaction.md): Raw transaction payload for `sendrawtransaction` and friends - [UnixTimestamp](https://docs.21.dev/data/documentation/bitcoin/unixtimestamp.md): Codable wrapper around POSIX-epoch seconds for RPC timestamp fields - [LogLevel](https://docs.21.dev/data/documentation/bitcoin/loglevel.md): Bitcoin Core debug log levels — `info`, `debug`, `trace`