[0/4] A Bitcoin Scripting Proposal BIP Quartet

Posted by Rusty Russell

Sep 27, 2025/11:27 UTC

The recent proposal outlined in the Bitcoin Improvement Proposal (BIP) introduces a "varops budget" for Bitcoin scripting, aiming to extend beyond the limitations of the current "sigops budget" established by Segwit. This novel framework seeks to address constraints on non-signature operations within Bitcoin's scripting mechanism, providing a more flexible and comprehensive approach to evaluating script operations through a systematic cost framework based on stack data interactions.

Historically, Bitcoin's scripting capabilities were restricted following version 0.3.1 to mitigate vulnerabilities that could lead to excessive computational time and memory usage, protecting against denial-of-service attacks and ensuring network reliability. However, as Bitcoin usage has evolved to become more sophisticated, these restrictions have increasingly come into conflict with new proposals, necessitating explicit performance evaluations and limitations to prevent potential issues. The varops budget aims to offer a clear, simple method for assessing script operation costs, using worst-case behavior as a basis for determining feasibility within predefined limits.

The cost model proposed considers the size of stack operands rather than their values, with significant assumptions made about the operational context - such as negligible memory allocation/deallocation overhead and the use of linear arrays for stack data, to simplify and standardize cost analysis across various implementations. This model establishes upper limits on script sizes and stack object sizes to facilitate testing and ensure efficiency even under extreme conditions.

A key element of this BIP is the determination of a transaction-wide varops budget, calculated by multiplying the total transaction weight by a fixed factor. This budgeting approach enables cross-input introspection and ensures that transactions adhere to set limits, failing validation if they exceed their allocated budget. The cost of opcodes was derived from benchmarking across multiple platforms, setting a foundation for the categorization of operations based on their execution time and resource consumption.

The document further details specific opcode examples, illustrating how the varops budget applies to various script operations, including stack manipulation and comparison operators. Each example provides insight into the rationale behind cost assignments, highlighting the importance of considering operand length and operation complexity in determining script validity under the new budgeting model.

For more detailed information and ongoing development updates on this BIP, interested parties are encouraged to visit the reference implementation hosted on GitHub.

This initiative represents a collaborative effort among contributors who have diligently explored the intricacies of Bitcoin scripting to enhance its functionality and adaptability. The support and contributions from the community underscore the collective endeavor to progress Bitcoin development while maintaining its foundational principles of security and decentralization.

Link to Raw Post
Bitcoin Logo

TLDR

Join Our Newsletter

We’ll email you summaries of the latest discussions from high signal bitcoin sources, like bitcoin-dev, lightning-dev, and Delving Bitcoin.

Explore all Products

ChatBTC imageBitcoin searchBitcoin TranscriptsSaving SatoshiDecoding BitcoinWarnet
Built with 🧡 by the Bitcoin Dev Project
View our public visitor count

We'd love to hear your feedback on this project.

Give Feedback