# Class BSV::Wallet::Config <a id="class-BSV-Wallet-Config"></a>

**Inherits:** `Object`

End-user wallet configuration surface.

Centralises every end-user-facing knob the wallet exposes —database URL, WIF,
limp mode threshold, daemon pool size, EF cache size, hint socket, fee model.
Dev/test fixtures (named-wallet WIFs, `BSV_WALLET_POSTGRES` base,
+DATABASE_URL_<NAME>+ overrides) are out of scope here; see #292.

Defaults read ENV at instantiation, preserving today's shell-env-driven
behaviour. The configure block in a user's +~/.bsv-wallet/config.rb+ (or
wherever `BSV_WALLET_CONFIG` points) can override any of these.

Three usage modes for an end user:

    1. Do nothing — Config defaults read shell ENV. Set
       +LIMP_THRESHOLD=100000+ in your shell and it just works.

    2. Pin values in +~/.bsv-wallet/config.rb+:
         c.limp_threshold = 100_000
       ignoring the ENV var entirely.

    3. Read alternate ENV vars or compute values:
         c.limp_threshold = Integer(ENV.fetch('MY_LIMP', '50000'))

- **@see** `BSV::Wallet.configure`
- **@see** `BSV::Wallet.load_config_file!`

## Attributes
### `daemon_pool_size` [RW] <a id="attribute-i-daemon_pool_size"></a> <a id="daemon_pool_size-instance_method"></a>
Sequel connection pool size for walletd.

### `database_url` [RW] <a id="attribute-i-database_url"></a> <a id="database_url-instance_method"></a>
Database URL for end-user single-wallet boot (sqlite:// or postgres://).

### `fee_model` [RW] <a id="attribute-i-fee_model"></a> <a id="fee_model-instance_method"></a>
Fee model the wallet charges and estimates against. The single source the
TxBuilder (build_change) and estimate_sweep_fee both read, so the two can
never drift (#342). Default 100 sats/kb; rate overridable via
`BSV_WALLET_FEE_RATE_SATS_PER_KB`, or set a whole model in
+~/.bsv-wallet/config.rb+ (+c.fee_model = ...+).

### `hints_socket` [RW] <a id="attribute-i-hints_socket"></a> <a id="hints_socket-instance_method"></a>
Optional cross-process EF hint socket path. `nil` = feature off.

### `limp_threshold` [RW] <a id="attribute-i-limp_threshold"></a> <a id="limp_threshold-instance_method"></a>
Limp mode threshold (sats). Below this, outbound is blocked.

### `network` [RW] <a id="attribute-i-network"></a> <a id="network-instance_method"></a>
<code>:mainnet</code> or <code>:testnet</code>.

### `reap_threshold` [RW] <a id="attribute-i-reap_threshold"></a> <a id="reap_threshold-instance_method"></a>
Reaper staleness threshold (seconds). An action with locked inputs but no
terminal state older than this is reclaimed by the daemon's reaper loop
(#325/#326). Must exceed the delayed_broadcast lifecycle window so live
in-flight actions are never reaped. Default 1 hour.

### `spv_checkpoint` [RW] <a id="attribute-i-spv_checkpoint"></a> <a id="spv_checkpoint-instance_method"></a>
Optional `spv_headers` checkpoint override: +{ height:, header: }+ (a
{BSV::Network::BlockHeader} or raw 80 bytes). `nil` (default) uses the
gem-baked {BSV::Network::Checkpoints} anchor for the network. Minimal seam for
tests / operators pinning their own anchor; end users never need it.

### `trust_model` [RW] <a id="attribute-i-trust_model"></a> <a id="trust_model-instance_method"></a>
Chain-validity trust model (HLR #335). <code>:trusted_service</code> (default)
trusts a chain-query Service's merkle-root answer outright;
<code>:spv_headers</code> opts in to a locally-validated, PoW-checked header
chain anchored at a baked-in checkpoint. Selected at <code>CLI.boot</code> to
pick the chain tracker; an unset/blank `BSV_WALLET_TRUST_MODEL` leaves today's
trusted-service behaviour unchanged.

### `tx_cache_size` [RW] <a id="attribute-i-tx_cache_size"></a> <a id="tx_cache_size-instance_method"></a>
Shared hydration cache capacity (entries). The wtxid-keyed substrate both the
EF broadcast path and the Hydrator's deep BEEF walk read; default sized for
multi-hop cascade working sets (#296 Phase D).

### `wif` [RW] <a id="attribute-i-wif"></a> <a id="wif-instance_method"></a>
Wallet private key, WIF format. End-user single-wallet boot.

## Public Class Methods
### `parse_network(value)` <a id="method-c-parse_network"></a> <a id="parse_network-class_method"></a>
Normalise a network string to a Symbol. Blank, whitespace-only, or nil input →
<code>:mainnet</code> (the wallet's default). Shared between
+Config#initialize+ (env-driven) and <code>bin/walletd</code> (positional arg)
so both reject the +"".to_sym → :""+ trap.
- **@param** `value` [String, Symbol, nil]
- **@return** [Symbol]

### `parse_trust_model(value)` <a id="method-c-parse_trust_model"></a> <a id="parse_trust_model-class_method"></a>
Normalise a trust-model string to a Symbol. Blank, whitespace-only, or nil
input → <code>:trusted_service</code> (today's behaviour — opt-in is the
exception, not the default). Mirrors {.parse_network}, dodging the +"".to_sym
→ :""+ trap so an +export BSV_WALLET_TRUST_MODEL=+ in a shell does not select
an empty-symbol model.
- **@param** `value` [String, Symbol, nil]
- **@return** [Symbol]

## Public Instance Methods
### `initialize()` <a id="method-i-initialize"></a> <a id="initialize-instance_method"></a>
- **@return** [Config] a new instance of Config
