-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fee bumping Package #114
base: main
Are you sure you want to change the base?
Fee bumping Package #114
Commits on Jun 23, 2024
-
feat: Initialize @caravan/feebumping package
Create a new package for fee bumping functionality in Caravan. This package provides modular and reusable utilities for implementing RBF (Replace-By-Fee) and CPFP (Child-Pays-For-Parent) fee bumping strategies. Key additions: - Basic package structure and configuration files - Core modules for RBF and CPFP implementations - Fee estimation utilities - Type definitions for fee bumping operations - Constants and utility functions This package aims to enhance Caravan's transaction management capabilities by providing a flexible and extensible fee bumping solution that can be easily integrated into the Caravan coordinator wallet and other Bitcoin projects.
Configuration menu - View commit details
-
Copy full SHA for 5c233db - Browse repository at this point
Copy the full SHA 5c233dbView commit details -
Configuration menu - View commit details
-
Copy full SHA for 592a875 - Browse repository at this point
Copy the full SHA 592a875View commit details
Commits on Jul 19, 2024
-
Add comprehensive fee bumping package for Caravan
This commit introduces a new @caravan/fee-bumping package that provides robust functionality for handling Replace-By-Fee (RBF) and Child-Pays-For-Parent (CPFP) fee bumping strategies in Bitcoin transactions. The package is designed to work seamlessly with other Caravan packages and offers a flexible, modular approach to fee bumping. Key features: - Implement RBFHandler for Replace-By-Fee transactions - Implement CPFPHandler for Child-Pays-For-Parent transactions - Create FeeEstimator for dynamic fee rate calculations - Provide utility functions for transaction analysis and manipulation - Define comprehensive types for improved type safety and developer experience - Implement constants for fee-related thresholds and limits The package structure includes: - src/index.ts: Main entry point and FeeBumping class - src/types.ts: TypeScript interfaces and types - src/estimator.ts: FeeEstimator class for fee calculations - src/rbf.ts: RBFHandler class for RBF operations - src/cpfp.ts: CPFPHandler class for CPFP operations - src/utils.ts: Utility functions for transaction handling - src/constants.ts: Constant values used throughout the package This package provides a solid foundation for implementing fee bumping strategies in Caravan-based applications. It offers: 1. Flexible fee estimation based on network conditions 2. Configurable options for both RBF and CPFP operations 3. Built-in safeguards against excessive fees 4. Utility functions for transaction analysis and modification The implementation is designed with extensibility in mind, allowing for easy updates and additions to fee bumping strategies in the future. Next steps: - Implement comprehensive unit tests for all components - Integrate the package with the main Caravan UI - Create documentation and usage examples - Perform thorough testing with various transaction scenarios This addition significantly enhances Caravan's capabilities in handling dynamic fee environments, improving overall user experience and transaction reliability.
Configuration menu - View commit details
-
Copy full SHA for 4f0755c - Browse repository at this point
Copy the full SHA 4f0755cView commit details
Commits on Jul 22, 2024
-
Implement fee bumping types and estimation functions
- Add new types for UTXO, TransactionOutput, TransactionAnalysis, FeeRate, FeeEstimate, TransactionDetails, BlockchainClientInterface, RBFOptions, and CPFPOptions in types.ts - Create getFeeEstimates function to fetch fee estimates from blockchain client - Implement calculateFee function to compute transaction fee based on vsize and fee rate - Use BigNumber for precise calculations - Import necessary constants and interfaces This commit lays the groundwork for RBF and CPFP implementations by defining essential types and providing core fee estimation functionality.
Configuration menu - View commit details
-
Copy full SHA for b00eaae - Browse repository at this point
Copy the full SHA b00eaaeView commit details -
Add transaction analysis functionality for fee bumping
- Create new file analyzer.ts with analyzeTransaction function - Implement logic to determine if a transaction can use RBF or CPFP - Calculate current fee rate of the transaction - Provide a recommended fee bumping method based on transaction properties - Utilize utility functions isRBFSignaled and calculateEffectiveFeeRate - Return a TransactionAnalysis object with fee bumping options This commit adds crucial functionality for analyzing transactions to determine the best fee bumping strategy, supporting the implementation of RBF and CPFP features in the Caravan wallet.
Configuration menu - View commit details
-
Copy full SHA for 9b0c967 - Browse repository at this point
Copy the full SHA 9b0c967View commit details -
Refactor fee bumping package for improved functionality and integration
This commit significantly refactors the fee bumping package to improve its functionality, integration with bitcoinjs-lib, and overall code structure. Key changes include: RBF (Replace-By-Fee): - Updated to work with bitcoinjs-lib Transaction objects - Implemented dynamic input and output handling - Added support for transaction cancellation and fee subtraction from outputs CPFP (Child-Pays-For-Parent): - Refactored to handle multiple parent outputs - Implemented dynamic input and output calculation - Added support for additional outputs in child transactions - Improved fee calculation accuracy Utils: - Added deriveAddress function for working with bitcoinjs-lib Output objects - Updated isRBFSignaled and calculateEffectiveFeeRate functions - Removed estimateVirtualSize in favor of using Transaction.virtualSize() Transaction Analysis: - Implemented analyzeTransaction function for recommending fee bumping strategies - Added logic to compare current fee rate with network fee rate Removed: - Eliminated estimator.ts file, integrating necessary functionality into other modules Tests: - Added comprehensive test suite for analyzeTransaction function - Updated existing tests to reflect new implementations of RBF and CPFP functions Types: - Updated and expanded type definitions to better integrate with bitcoinjs-lib - Added new interfaces for RBFOptions, CPFPOptions, and TransactionAnalysis
Configuration menu - View commit details
-
Copy full SHA for b7b2fa5 - Browse repository at this point
Copy the full SHA b7b2fa5View commit details
Commits on Jul 26, 2024
-
Changes to the RBF functionality in the fees package and added RBF si…
…gnalling functionality to PSBTV2 Key changes: 1. rbf.ts: - Introduced RbfTransaction class to encapsulate RBF logic - Implemented methods for preparing accelerated and canceled transactions - Added helper methods for fee calculations and PSBT manipulations - Created public functions prepareRbfTransaction and prepareCancelTransaction as entry points for RBF operations 2. psbtv2.ts: - Added isRbfSignaled method to check if a transaction is RBF-enabled
Configuration menu - View commit details
-
Copy full SHA for 63c129c - Browse repository at this point
Copy the full SHA 63c129cView commit details
Commits on Aug 1, 2024
-
Implement CPFP and RBF classes with tests
This commit introduces new classes for Child-Pays-for-Parent (CPFP) and refactors majority of Replace-By-Fee (RBF) transaction creation, along with comprehensive tests. Key changes: - Add CPFPTransaction class for creating child transactions - Refactored RbfTransaction class for preparing replacement transactions - Create tests for CPFP, RBF - Update existing transaction utilities to support new classes The new classes support both PSBTv2 and PSBTv0 formats, handle various edge cases, and provide methods for fee calculation and transaction preparation.
Configuration menu - View commit details
-
Copy full SHA for 4fce4fe - Browse repository at this point
Copy the full SHA 4fce4feView commit details
Commits on Aug 3, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 77f0cbe - Browse repository at this point
Copy the full SHA 77f0cbeView commit details
Commits on Aug 6, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 77f4db4 - Browse repository at this point
Copy the full SHA 77f4db4View commit details
Commits on Aug 14, 2024
-
Enhance RBF class functionality with improved state management and fe…
…e calculation - Add state management to track acceleration and cancellation status - Implement caching for fee increase and vsize calculations - Introduce incremental relay fee for accurate fee bump calculations - Refactor fee calculation logic to comply with BIP 125 rules - Optimize input selection by sorting UTXOs before addition - Improve RBF signaling by updating only one input sequence - Added more comments for better code understanding
Configuration menu - View commit details
-
Copy full SHA for 4f4f97a - Browse repository at this point
Copy the full SHA 4f4f97aView commit details -
Added methods to handle sequence numbers within PSBTs for better RBF …
…(Replace-By-Fee) support - setInputSequence(inputIndex: number, sequence: number): A method for setting the sequence number of a specific input, critical for signaling RBF and handling nLockTime. - get isRBFSignaled(): boolean: A method to check if the transaction signals RBF, as per BIP125 guidelines. - Added tests
Configuration menu - View commit details
-
Copy full SHA for 07d5a84 - Browse repository at this point
Copy the full SHA 07d5a84View commit details -
Configuration menu - View commit details
-
Copy full SHA for d71a0ec - Browse repository at this point
Copy the full SHA d71a0ecView commit details -
Configuration menu - View commit details
-
Copy full SHA for ee553e7 - Browse repository at this point
Copy the full SHA ee553e7View commit details
Commits on Aug 16, 2024
-
Refactor RBF class with improved state management and error handling
This commit introduces a significant refactoring of the RBF (Replace-By-Fee) class, enhancing its functionality, reliability, and maintainability. The changes focus on implementing a robust state management system, expanding method capabilities, and introducing a sophisticated error handling mechanism. Key Changes: 1. Transaction State Philosophy: - Implemented a state machine approach using the TransactionState enum - States include: INITIALIZED, ANALYZING, ANALYZED, MODIFYING, FINALIZING, FINALIZED, and ERROR - Each method now checks and updates the state, ensuring operations occur in the correct sequence - This approach prevents invalid operations and provides clear visibility into the transaction's current status 2. New and Enhanced Methods: - analyze(): Performs initial analysis of the transaction, including RBF eligibility checks - prepareAccelerated(): Prepares an accelerated replacement transaction - prepareCanceled(): Creates a cancellation replacement transaction - calculateFeeIncrease(): Determines the required fee increase for RBF - estimateRBFCost() and estimateCPFPCost(): Calculate costs for different fee-bumping strategies - recommendFeeBumpStrategy(): Suggests the optimal fee-bumping approach - getTransactionInfo(): Provides comprehensive transaction details 3. Error Handling System: - Introduced a custom RbfError class extending TransactionError - Defined specific error types (RbfErrorType) for various failure scenarios - Errors now include both an error type and the transaction state at the time of the error - This system allows for more precise error reporting and easier debugging 4. Improved UTXO Management: - Enhanced logic for selecting and adding additional UTXOs when necessary - Implemented checks to ensure compliance with BIP 125 rules 5. Fee Calculations: - Refined fee estimation logic, taking into account transaction size changes - Introduced methods to calculate and compare different fee scenarios 6. Caching Mechanism: - Implemented caching for frequently used calculations (e.g., transaction size estimates) - Improves performance by reducing redundant computations 7. Comprehensive Transaction Analysis: - Added methods to analyze RBF possibility (canRBF) and cancellation possibility (canCancel) - These provide quick insights into available options for the transaction 8. Helper Functions: - Introduced utility functions for common operations like UTXO selection and output adjustments
Configuration menu - View commit details
-
Copy full SHA for 9237196 - Browse repository at this point
Copy the full SHA 9237196View commit details
Commits on Aug 19, 2024
-
feat: Implement TransactionAnalyzer for raw transaction analysis
This commit introduces a new TransactionAnalyzer class designed to work with raw transaction hex data instead of PSBTs. The class provides functionality to analyze Bitcoin transactions, calculate fees, and determine fee bump strategies. Key features: - Parse raw transaction hex to extract inputs and outputs - Calculate absolute and relative fees - Estimate fees required for RBF and CPFP - Determine if a transaction is eligible for RBF or CPFP - Recommend optimal fee bump strategy The TransactionAnalyzer serves as a foundation for future RBF and CPFP implementations, providing essential information without relying on PSBTs. Added unit tests to verify the functionality of the TransactionAnalyzer class, covering various scenarios and edge cases.
Configuration menu - View commit details
-
Copy full SHA for 63969ab - Browse repository at this point
Copy the full SHA 63969abView commit details
Commits on Aug 22, 2024
-
Refactor of TransactionAnalyzer classfor Enhanced Fee Calculation and…
… Clarity Description - Refactored the TransactionAnalyzer class to address inaccuracies in CPFP (Child Pays for Parent) fee calculations. This involved refining the argument handling, optimizing properties, and improving the use of internal/private values, getters, and setters for more robust and maintainable code. - Added comprehensive documentation to all types, enhancing the overall clarity and usability of the package. - Moved tests and fixtures to seperate folder - Cleaned `utils` and `constants` files
Configuration menu - View commit details
-
Copy full SHA for 0047714 - Browse repository at this point
Copy the full SHA 0047714View commit details -
Added Bitcoin Transaction Components and Template
Description - Added BtcTxComponent as a base class for handling Bitcoin transaction inputs and outputs. - Introduced BtcTxInputTemplate and BtcTxOutputTemplate for managing individual inputs and outputs. - Created BtcTransactionTemplate to help build, validate, and manage Bitcoin transactions.
Configuration menu - View commit details
-
Copy full SHA for 28a1ae2 - Browse repository at this point
Copy the full SHA 28a1ae2View commit details -
feat: Implemented new CPFP/RBF functions
- Added `createCPFPTransaction` function to generate a CPFP transaction with enhanced fee handling. - Implemented `createCancelRbfTransaction` to allow cancellation of an original transaction using RBF. - Added `createAcceleratedRbfTransaction` for accelerating an original transaction by increasing the fee. - Integrated transaction analysis and validation within each function. - Included detailed documentation and examples for each function.
Configuration menu - View commit details
-
Copy full SHA for 8ca1b75 - Browse repository at this point
Copy the full SHA 8ca1b75View commit details
Commits on Aug 29, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 09cceac - Browse repository at this point
Copy the full SHA 09cceacView commit details -
refactor: changes in transactionAnalyzer class and it's tests
- Removed dust threshold option from the class - minor corrections in fee calculations - improvement in documentation - added new fixtures and tests
Configuration menu - View commit details
-
Copy full SHA for 47e598f - Browse repository at this point
Copy the full SHA 47e598fView commit details -
refactor : btcTransactionComponents and btcTransactionTemplate classes
- better btcTransactionComponents validation and malleability considerations - changes to keep consistent use of BN library within classes - fixes to methods : `adjustChangeOutput` - new added fixtures and tests
Configuration menu - View commit details
-
Copy full SHA for 3c9f3ff - Browse repository at this point
Copy the full SHA 3c9f3ffView commit details -
Configuration menu - View commit details
-
Copy full SHA for 93f5e39 - Browse repository at this point
Copy the full SHA 93f5e39View commit details
Commits on Sep 1, 2024
-
Configuration menu - View commit details
-
Copy full SHA for b247da4 - Browse repository at this point
Copy the full SHA b247da4View commit details -
refactor : btcComponents and btcTemplate ... toPsbt() method , remove…
…d external/change type from btcOutput and added prevTxHex , sequence fields in btcInput
Configuration menu - View commit details
-
Copy full SHA for 6662b2d - Browse repository at this point
Copy the full SHA 6662b2dView commit details -
Configuration menu - View commit details
-
Copy full SHA for f6aeea6 - Browse repository at this point
Copy the full SHA f6aeea6View commit details
Commits on Sep 2, 2024
-
refactor: Changes in btcTransactionInput , Add methods for intiatiati…
…ng class from a UTXO type and having a mapping between the two , removed unnecessary types and changes in analyzer to handle new btcInputs and UTXOs
Configuration menu - View commit details
-
Copy full SHA for 345d6fb - Browse repository at this point
Copy the full SHA 345d6fbView commit details -
Configuration menu - View commit details
-
Copy full SHA for ad3c6ee - Browse repository at this point
Copy the full SHA ad3c6eeView commit details -
refactor: RBF/CPFP functions to handle new toPSBT() method of templat…
…e and new UTXO - btcInput functionality
Configuration menu - View commit details
-
Copy full SHA for a215dea - Browse repository at this point
Copy the full SHA a215deaView commit details -
Configuration menu - View commit details
-
Copy full SHA for 4597dc9 - Browse repository at this point
Copy the full SHA 4597dc9View commit details -
Configuration menu - View commit details
-
Copy full SHA for f39e26d - Browse repository at this point
Copy the full SHA f39e26dView commit details
Commits on Sep 9, 2024
-
refactor btcTransactionComponents : Changes to inline docstring comme…
…nts and lock method
Configuration menu - View commit details
-
Copy full SHA for 372f919 - Browse repository at this point
Copy the full SHA 372f919View commit details -
Configuration menu - View commit details
-
Copy full SHA for d19fd1e - Browse repository at this point
Copy the full SHA d19fd1eView commit details -
refactor btcTransactionComponents : added methods to validate witness…
…Utxo and sequence setters , methods to enable/disable RBF in InputTemplate
Configuration menu - View commit details
-
Copy full SHA for 272d946 - Browse repository at this point
Copy the full SHA 272d946View commit details -
Configuration menu - View commit details
-
Copy full SHA for c75270a - Browse repository at this point
Copy the full SHA c75270aView commit details -
Configuration menu - View commit details
-
Copy full SHA for 09d9bc5 - Browse repository at this point
Copy the full SHA 09d9bc5View commit details -
Add ScriptType : Added a new script-type extending MULTISIG_ADDRESS_T…
…YPES from caravan-bitcoin
Configuration menu - View commit details
-
Copy full SHA for 8da4962 - Browse repository at this point
Copy the full SHA 8da4962View commit details -
Configuration menu - View commit details
-
Copy full SHA for 0acce5f - Browse repository at this point
Copy the full SHA 0acce5fView commit details
Commits on Sep 11, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 65717ec - Browse repository at this point
Copy the full SHA 65717ecView commit details
Commits on Sep 12, 2024
-
Refactor: Utils file to remove unnecessary functions, move some util …
…fn to other files & correct/extend fn like getOutputAddress
Configuration menu - View commit details
-
Copy full SHA for dc02fb5 - Browse repository at this point
Copy the full SHA dc02fb5View commit details -
refactor: Transaction Analyzer ... correct rbf-fees calculation , ret…
…urn types , add estimatedCPFPChildSize fn
Configuration menu - View commit details
-
Copy full SHA for 73dd323 - Browse repository at this point
Copy the full SHA 73dd323View commit details -
minor-refactor: Add detailed doc strings for ABSURDLY_HIGH_ABS_FEE & …
…ABSURDLY_HIGH_FEE_RATE
Configuration menu - View commit details
-
Copy full SHA for db3ae16 - Browse repository at this point
Copy the full SHA db3ae16View commit details -
Configuration menu - View commit details
-
Copy full SHA for fbd36a1 - Browse repository at this point
Copy the full SHA fbd36a1View commit details -
refactor: btcTransactionTemplate add addInputToPsbt & addOutputToPsbt…
… from utils to template class
Configuration menu - View commit details
-
Copy full SHA for 82a3c5c - Browse repository at this point
Copy the full SHA 82a3c5cView commit details -
Configuration menu - View commit details
-
Copy full SHA for f142a7f - Browse repository at this point
Copy the full SHA f142a7fView commit details
Commits on Sep 16, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 104bc75 - Browse repository at this point
Copy the full SHA 104bc75View commit details -
Configuration menu - View commit details
-
Copy full SHA for e5c98c1 - Browse repository at this point
Copy the full SHA e5c98c1View commit details -
Configuration menu - View commit details
-
Copy full SHA for 74511cf - Browse repository at this point
Copy the full SHA 74511cfView commit details -
Configuration menu - View commit details
-
Copy full SHA for 6f35442 - Browse repository at this point
Copy the full SHA 6f35442View commit details
Commits on Sep 22, 2024
-
Configuration menu - View commit details
-
Copy full SHA for dcffd5e - Browse repository at this point
Copy the full SHA dcffd5eView commit details -
Configuration menu - View commit details
-
Copy full SHA for 788ff6f - Browse repository at this point
Copy the full SHA 788ff6fView commit details -
Configuration menu - View commit details
-
Copy full SHA for c3f56c4 - Browse repository at this point
Copy the full SHA c3f56c4View commit details -
Configuration menu - View commit details
-
Copy full SHA for 74c643b - Browse repository at this point
Copy the full SHA 74c643bView commit details
Commits on Sep 24, 2024
-
correction : RBF function , ensure that the new bumped tx ,pays gte o…
…f the original fees
Configuration menu - View commit details
-
Copy full SHA for c570faf - Browse repository at this point
Copy the full SHA c570fafView commit details -
Configuration menu - View commit details
-
Copy full SHA for 539ac54 - Browse repository at this point
Copy the full SHA 539ac54View commit details -
Configuration menu - View commit details
-
Copy full SHA for bddee6e - Browse repository at this point
Copy the full SHA bddee6eView commit details -
Configuration menu - View commit details
-
Copy full SHA for ad43a38 - Browse repository at this point
Copy the full SHA ad43a38View commit details -
Configuration menu - View commit details
-
Copy full SHA for e8105cb - Browse repository at this point
Copy the full SHA e8105cbView commit details
Commits on Sep 27, 2024
-
minor changes : Transaction Analyzer - RBF FEE CALCULATION COMMENTS .…
….. REMOVED UNUSED VARIABLES
Configuration menu - View commit details
-
Copy full SHA for 7150a01 - Browse repository at this point
Copy the full SHA 7150a01View commit details -
Configuration menu - View commit details
-
Copy full SHA for a44bedc - Browse repository at this point
Copy the full SHA a44bedcView commit details -
Configuration menu - View commit details
-
Copy full SHA for 663df1e - Browse repository at this point
Copy the full SHA 663df1eView commit details -
Configuration menu - View commit details
-
Copy full SHA for 09fba1f - Browse repository at this point
Copy the full SHA 09fba1fView commit details
Commits on Oct 9, 2024
-
Configuration menu - View commit details
-
Copy full SHA for 90b3227 - Browse repository at this point
Copy the full SHA 90b3227View commit details