bitcoin-rbf-cpfp
Replace-by-Fee (BIP125, full-RBF) and Child-Pays-For-Parent fee bumping. Mempool ancestor/descendant rules, package CPFP (BIP331), TRUC v3 (BIP431). Wallet-level fee bump strategies. USE WHEN: implementing fee bumping, debugging "stuck transaction", designing wallet UX for fee acceleration.
What this skill does
# RBF + CPFP
> See also [../../protocol/transactions/quick-ref/rbf-cpfp.md](../../protocol/transactions/quick-ref/rbf-cpfp.md)
> for protocol-level details. This SKILL.md focuses on **wallet
> implementation**.
## Wallet-level RBF flow
```
1. Build initial tx with sequence < 0xfffffffe on at least one input
(signals opt-in RBF). Default to 0xfffffffd.
2. Sign and broadcast.
3. After N blocks of non-confirmation OR explicit user request:
a. Estimate new fee rate.
b. Build replacement: same outputs, possibly different change
amount (smaller, since more goes to fee).
c. Verify BIP125 rules: replacement adds no new unconfirmed
inputs; pays > old fee + incremental_relay × vsize.
d. Sign and broadcast.
4. Old tx is dropped from mempool; new tx awaits confirmation.
```
## BIP125 replacement rules (simplified)
For replacement `R` of original `O`:
1. R has higher absolute fee than O.
2. R has higher fee rate than O.
3. R does not add new unconfirmed inputs.
4. R replaces ≤ 100 conflicting txs (and their descendants).
5. R pays at least `incrementalrelayfee × R.vsize` extra per added
vbyte beyond O.
Bitcoin Core 28.0 made **full-RBF** the default — even txs without
opt-in signal (sequence ≥ 0xfffffffe) can be replaced.
## Wallet UX for RBF
User-facing controls:
- Slider: target confirmation time (10 min, 1 hour, next day).
- "Bump fee" button on pending txs.
- Display fee bump cost: extra fee + new total.
- Warning: "Replacing this transaction will invalidate the previous
one. Recipient may not see it."
## Wallet-level CPFP flow
When sender's tx is stuck and CPFP is the only option (e.g., tx is
non-RBF or is from someone else):
```
1. Identify a UTXO from the stuck tx that you control (your change
output, or a received output).
2. Build a child tx spending that UTXO.
3. Compute child fee such that:
package_fee_rate = (parent_fee + child_fee) / (parent_vsize + child_vsize)
≥ target_rate
4. Broadcast child via sendrawtransaction (Core ≤ 28) or
submitpackage (BIP331).
```
## Receiver-side CPFP
If you're the **receiver** of an unconfirmed payment that's stuck:
- Option A: spend the received output to yourself with high fee.
Now both txs in mempool; package CPFP includes parent.
- Option B: wait. Sender may RBF on their side.
## Package CPFP (BIP331)
`submitpackage` RPC accepts `[parent, child]` array atomically.
Pre-BIP331, child alone was rejected if parent below mempool min.
Now: package effective rate is computed.
```bash
bitcoin-cli submitpackage '["<parent_hex>","<child_hex>"]'
```
## TRUC v3 (BIP431)
Strict version=3 transactions for Lightning-style use:
- ≤ 1 unconfirmed ancestor / descendant.
- ≤ 10 kvB tx size.
- Sibling eviction: a v3 child can replace a sibling without paying
for the sibling's bandwidth.
Combined with **ephemeral anchors** (value=0 anchor outputs that must
be spent in the same package), gives non-pinnable Lightning fee
bumping.
## Lightning-specific fee bumping
- **Anchor commitment** (BOLT-3 update): small value (330 sats)
output spendable by either party for CPFP.
- **TRUC v3 + ephemeral anchor**: zero-value anchor, must be spent
in same package. Mitigates pinning.
LSP and self-custodial Lightning wallets implement these via:
- LND: `chantools transient-fee-bumper` (legacy) or built-in fee
bumping for anchor channels.
- CLN: `feebumper` plugin or core support.
- LDK: `OnchainTxHandler` orchestrates child txs.
## Common bugs
- Reusing the same input in both old and new tx but for different
outputs → not a valid replacement (input set must overlap to
conflict).
- RBF replacement that adds new unconfirmed input from someone else's
tx → rejected (rule 3).
- Building child that spends a parent output that's already fully
spent in another descendant → rejected as conflict.
- Computing fee rate against `size` instead of `vsize` → underpays
for SegWit txs.
## See also
- [fee-estimation/SKILL.md](../fee-estimation/SKILL.md)
- [../../protocol/package-relay/SKILL.md](../../protocol/package-relay/SKILL.md)
- [../../protocol/transactions/quick-ref/v3-truc.md](../../protocol/transactions/quick-ref/v3-truc.md)
Related in Design
contribute
IncludedLocal-only OSS contribution command center. Auto-refreshes the user's in-flight PR and issue state on invoke so conversations start with full context — no need to brief Claude on what's in flight. Helps the user find issues to contribute to on GitHub, builds per-repo dossiers of what each upstream expects (CLA, DCO, branch convention, AI policy, draft-first, review bots, issue templates), runs deterministic gates before any external action so AI-assisted contributions don't reach maintainers as slop. State is markdown-only: candidate files at ~/.contribute-system/candidates/, repo dossiers at ~/.contribute-system/research/, append-only event log at ~/.contribute-system/log.jsonl. No database, no cloud calls. Use when the user asks about their PRs / issues / contributions, wants to find new work to take on, claim an issue, build/refresh a repo's dossier, or draft a Design Issue or PR. Trigger with "/contribute", "what's my PR status", "find a contribution", "claim issue X", "draft a Design Issue for Y", "refresh dossier for Z".
architectural-analysis
IncludedUser-triggered deep architectural analysis of a codebase or scoped subtree across eight modes — information architecture, data flow, integration points, UI surfaces, interaction patterns, data model, control flow, and failure modes. This skill should be used when the user asks to "diagram this codebase," "map the architecture," "show the data flow," "give me an ERD," "trace control flow," "find the integration points," "verify the layout pattern," "audit the UX architecture," or any similar request whose primary deliverable is mermaid diagrams plus cited reports under docs/architecture/. Dispatches haiku/sonnet sub-agents in parallel for per-mode exploration, then verifies every citation mechanically before any node lands in a diagram. Not for one-off prose explanations of code (use code-explanation) or for high-level system design from scratch (use system-design).
mcp
IncludedModel Context Protocol (MCP) server development and tool management. Languages: Python, TypeScript. Capabilities: build MCP servers, integrate external APIs, discover/execute MCP tools, manage multi-server configs, design agent-centric tools. Actions: create, build, integrate, discover, execute, configure MCP servers/tools. Keywords: MCP, Model Context Protocol, MCP server, MCP tool, stdio transport, SSE transport, tool discovery, resource provider, prompt template, external API integration, Gemini CLI MCP, Claude MCP, agent tools, tool execution, server config. Use when: building MCP servers, integrating external APIs as MCP tools, discovering available MCP tools, executing MCP capabilities, configuring multi-server setups, designing tools for AI agents.
react-native-skia
IncludedDesign, build, debug, and optimise high-polish animated graphics in React Native or Expo using @shopify/react-native-skia, Reanimated, and Gesture Handler. Use when the user wants canvas-driven UI, shaders, paths, rich text, image filters, sprite fields, Skottie, video frames, snapshots, web CanvasKit setup, or performance tuning for custom motion-heavy elements such as loaders, hero art, cards, charts, progress indicators, particle systems, or gesture-driven surfaces. Also use when the user asks for fluid, glow, glass, blob, parallax, 60fps/120fps, or GPU-friendly animated effects in React Native, even if they do not explicitly say "Skia". Do not use for ordinary form/layout work with standard views.
plaid
IncludedProduct Led AI Development — guides founders from idea to launched product. Six capabilities: Idea (discover a product idea), Validate (pressure-test the idea against fatal flaws, problem reality, competition, and 2-week MVP feasibility), Plan (vision intake + document generation), Design (translate image references into a design.md spec), Launch (go-to-market strategy), and Build (roadmap execution). Use when someone says "PLAID", "plaid idea", "help me find an idea", "product idea", "idea from my business", "idea from my expertise", "plaid validate", "validate my idea", "pressure-test", "is this idea good", "find fatal flaws", "validate the problem", "plan a product", "define my vision", "generate a PRD", "product strategy", "plaid design", "design from image", "translate image to design", "create design.md", "extract design tokens", "plaid launch", "go-to-market", "launch plan", "GTM strategy", "launch playbook", "plaid build", "build the app", "start building", or "execute the roadmap".
nextjs-framer-motion-animations
IncludedAdds production-safe Motion for React or Framer Motion animations to Next.js apps, including reveal, hover and tap micro-interactions, whileInView, stagger, AnimatePresence, layout and layoutId transitions, reorder, scroll-linked UI, and lightweight route-content transitions. Use when the user asks to add, refactor, or debug Motion or Framer Motion in App Router or Pages Router codebases, especially around server/client boundaries, reduced motion, LazyMotion, bundle size, hydration, or route transitions. Avoid for GSAP-style timelines, WebGL or 3D scenes, heavy scroll storytelling, or CSS-only effects unless Motion is explicitly requested.