bitcoin-dev

BIP for OP_CHECKSIGFROMSTACK

BIP for OP_CHECKSIGFROMSTACK

Original Postby Brandon Black

Posted on: April 25, 2024 05:12 UTC

The discussion focuses on the introduction of two new opcodes, OP_CHECKSIGFROMSTACK and OP_CHECKSIGFROMSTACKVERIFY, aimed at enhancing bitcoin scripts by enabling cryptographic signature checks against data other than bitcoin transactions.

This initiative marks a departure from existing methods by proposing a bitcoin-specific design that diverges from previous suggestions, notably by repurposing NOP (specifically NOP5) for OP_CHECKSIGFROMSTACKVERIFY to extend data signature verification capabilities across all script types, with an emphasis on tapscript. The proposal underscores a strategic approach towards integrating these opcodes into bitcoin's scripting language without disrupting the current ecosystem, suggesting a soft-fork deployment.

The technical specifications of these opcodes are outlined, emphasizing their operational parameters such as stack element requirements, public key size limitations, and signature validation processes. Notably, the proposal adheres strictly to BIP 340 standards for Schnorr signatures, with specific conditions applied to public key sizes and signature validation outcomes. The semantics of OP_CHECKSIGFROMSTACK and OP_CHECKSIGFROMSTACKVERIFY closely mirror those of their counterparts, OP_CHECKSIG and OP_CHECKSIGVERIFY, albeit with nuanced differences tailored to their unique functionalities within the script execution context.

Design considerations reveal a thoughtful analysis of potential implications and applications, including message hashing practices and the decision against hashing prior to BIP 340 verification. The choice of a NOP upgrade path for OP_CHECKSIGFROMSTACKVERIFY reflects a strategic compromise to facilitate legacy and segwitv0 script compatibility. Additionally, the document addresses the integration of these opcodes with Tapscript, multisig semantics, and future enhancements like split signatures and Taproot internal keys, outlining a forward-looking perspective that balances innovation with backward compatibility.

The motivation behind introducing these opcodes is further clarified through practical applications, such as enhancing Lightning Network Symmetry and enabling script-based delegation mechanisms. These examples illustrate the proposed opcodes' potential to contribute significantly to bitcoin's flexibility and utility in complex transaction scenarios.

A reference implementation, hosted on GitHub (bitcoin/bitcoin#29270), provides a concrete foundation for evaluating the proposal's feasibility and operational integrity. This inclusion of a working model underscores the proposal's readiness for further scrutiny and potential adoption within the bitcoin development community.

In summary, the proposed introduction of OP_CHECKSIGFROMSTACK and OP_CHECKSIGFROMSTACKVERIFY represents a significant evolution in bitcoin script functionality. By carefully delineating the operational parameters, design considerations, and practical applications of these new opcodes, the document offers a comprehensive blueprint for enhancing bitcoin's scripting capabilities in a manner that is both innovative and respectful of the cryptocurrency's foundational principles.