Close Menu
    Trending
    • BlackRock’s Bitcoin ETF sheds $430 million, its largest single-day outflow
    • What risks and opportunities does Sui’s $12 billion in unlocked tokens present?
    • Tron (TRX) Future Retail Activity Indicate More Gains Ahead
    • Is ETH Dumping to $2K Next as Momentum Fades?
    • What explains the UK surpassing China in crypto ownership despite stricter regulations?
    • Cronos Defies Crypto Market Downtick on Friday As Asset Manager Canary Capital Files for CRO ETF
    • XRP Set For Price Relief, But Only If Bulls Defend Key $2.13 Price Level
    • OFAC Sanctions Funnull as Experts Find Ties to Huione Pay, Triad Nexus
    Simon Crypto
    • Home
    • Crypto Market Trends
    • Bitcoin News
    • Crypto Mining
    • Cryptocurrency
    • Blockchain
    • More
      • Altcoins
      • Ethereum
    Simon Crypto
    Home»Bitcoin News»Bitcoin Covenants: CHECKSIGFROMSTACK (BIP 348)
    Bitcoin News

    Bitcoin Covenants: CHECKSIGFROMSTACK (BIP 348)

    Team_SimonCryptoBy Team_SimonCryptoApril 4, 2025No Comments8 Mins Read
    Share
    Facebook Twitter LinkedIn Pinterest Email


    That is the second article in a series deep diving into particular person covenant proposals which have reached a degree of maturity meriting an in-depth breakdown. 

    CHECKSIGFROMSTACK (CSFS), put ahead by Brandon Black and Jeremy Rubin with BIP 348, isn’t a covenant. As I stated within the introductory article to this sequence, among the proposals I’d be overlaying usually are not covenants, however synergize or interrelate with them ultimately. CSFS is the primary instance of that. 

    CSFS is a quite simple opcode, however earlier than we undergo the way it works let’s take a look at the fundamentals of how a Bitcoin script truly works. 

    Script is a stack based mostly language. That implies that knowledge is “stacked” collectively on prime of one another on the stack, and operated on by eradicating an merchandise from the highest of the stack to function on based mostly on what an opcode does, both returning the information or a consequence from it to the highest of the stack. 

    There are two elements of a script when it’s finally executed and verified, the “witness” supplied to unlock the script, and the script included within the output being spent. The witness/unlocking script is “added” to the left aspect of the locking script, after which every aspect is added to (or operates on) the stack one after the other left to proper. Take a look at this instance (the “|” marks the boundary between the witness and script):

    1 2 | OP_ADD 3 OP_EQUAL

    This instance script provides the worth “1” to the stack, then the worth “2” on prime of that. OP_ADD takes the highest two components of the stack and provides them collectively, placing the consequence again on to the stack (so now all that’s on the stack is “3”). One other “3” is then added to the stack. The final merchandise, OP_EQUAL, takes the highest two objects of the stack and returns a “1” to the stack (1 and 0 can symbolize True or False in addition to numbers).

    A script should finish with the final merchandise on the highest of the stack being True, in any other case the script (and transaction executing it) fails and is taken into account consensus invalid. 

    It is a primary instance of a pay-to-pubkey-hash (P2PKH) script, i.e. the legacy addresses that begin with a “1”:

    | DUP HASH160 EQUALVERIFY CHECKSIG

    First the signature and the general public key are added to the stack. Then DUP known as, which takes the highest stack merchandise and duplicates it, returning it to the highest of the stack. HASH160 takes the highest stack merchandise (the general public key duplicate), hashes it, then returns it to the highest of the stack. The general public key hash from the script is placed on prime of the stack. EQUALVERIFY capabilities the identical as EQUAL, it grabs the 2 prime stack objects and returns a 1 or 0 based mostly on the end result. The one distinction is EQUALVERIFY additionally runs VERIFY after EQUAL, which fails the transaction if the highest stack merchandise isn’t 1, and in addition removes the highest stack merchandise. Lastly CHECKSIG is run, which grabs the highest two stack objects assuming them to be a signature and a pubkey, and verifies the signature implicitly towards the hash of the transaction being verified. Whether it is legitimate it places a 1 on prime of the stack. 

    How CSFS Works

    CHECKSIG is without doubt one of the most used opcodes in Bitcoin. Each transaction, with virtually no exceptions, makes use of this opcode in some unspecified time in the future in considered one of its scripts. Signature verification is a foundational element of the Bitcoin protocol. The issue is, there may be virtually no flexibility by way of what message you’re checking the signature towards. CHECKSIG will solely confirm a signature towards the transaction being verified. There’s some flexibility, i.e. you may determine with some extent of freedom what elements of the transaction the signature applies to, however that’s it. 

    CSFS goals to vary this by permitting a signature to be verified towards any arbitrary message that’s pushed immediately onto the stack, as a substitute of being restricted to the verification of signatures towards the transaction itself. The opcode follows a really primary operational construction:

    | CSFS

    The signature and message are dropped on prime of the stack, then the general public key on prime of them, and eventually CSFS grabs the highest three objects from the stack assuming them to be the general public key, message, and signature from prime to backside, verifying the signature towards the message. If the signature is legitimate, a 1 is positioned on the stack. 

    That’s it. A easy variant of CHECKSIG that lets customers specify arbitrary messages as a substitute of simply the spending transaction. 

    What Is CSFS Helpful For

    So what precisely is that this good for? What’s using checking a signature towards an arbitrary message on the stack as a substitute of towards the spending transaction? 

    Firstly, together with CTV it may well present a performance equal to one thing that Lightning builders have needed for the reason that very starting, floating signatures that may connect to completely different transactions. This was initially proposed as a brand new sighash flag for signatures (the sector that dictates what elements of a transaction a signature applies to). This was wanted as a result of a transaction signature covers the transaction ID of the transaction that created the output being spent. This implies a signature is barely legitimate for a transaction spending that precise output. 

    It is a desired habits for Lightning as a result of it might enable us to dispose of channel penalties. Each previous Lightning state wants a penalty key and transaction as a way to make sure that your channel counterparty by no means makes use of any of them to attempt to declare funds they don’t personal. If they struggle you may declare all their cash. A superior performance can be one thing that permits you to merely “connect” the present state transaction to any earlier one to cease the theft try by distributing funds appropriately versus confiscating them. 

    This may be completed with a primary script that takes a CTV hash and a signature over it that’s checked utilizing CSFS. This may enable any transaction hash signed by that CSFS key to spend any output that’s created with this script. 

    One other helpful function is delegation of management of a UTXO. The identical means that any CTV hash signed by a CSFS key can validly spend a UTXO with a script designed for that, different variables may be handed into the script to be checked towards, corresponding to a brand new public key. A script may very well be constructed that permits a CSFS key to log out on any public key, which then may very well be validated utilizing CSFS and used for a traditional CHECKSIG validation. This may can help you delegate the power to spend a UTXO to anybody else with out having to maneuver it on-chain. 

    Lastly, together with CAT, CSFS can be utilized to compose way more complicated introspection performance. As we are going to see later within the sequence although, CSFS isn’t truly required to emulate any of this extra superior habits, as CAT alone is ready to take action. 

    Closing Ideas

    CSFS is a really primary opcode that along with providing easy helpful performance in its personal proper composes very properly with even the most straightforward covenant opcodes to create very helpful performance. Whereas the instance above concerning floating signatures particularly references the Lightning Community, floating signatures are a typically helpful primitive which might be relevant to any protocol constructed on Bitcoin making use of pre-signed transactions. 

    Along with floating signatures, script delegation is a really helpful primitive that generalizes far past delegating management over a UTXO to a brand new public key. The identical primary capacity to “sideload” variables after the very fact right into a script validation movement can apply to something, not simply public keys. Timelock values, hashlock preimages, and so on. Any script that hardcodes a variable to confirm towards can now have these values dynamically added after the very fact. 

    On prime of that, CSFS is a really mature proposal. It has an implementation that has been dwell on the Liquid Community and Parts (the codebase Liquid makes use of) since 2016. As well as Bitcoin Money has had a version of it since 2018. 

    CSFS is a really mature proposal that goes again conceptually virtually so long as I’ve been on this house, with a number of mature implementations, and really clear use instances it may be utilized to. 



    Source link

    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email

    Related Posts

    What Is Asset Tokenization? Types, Why It Matters Now [2025]

    May 30, 2025

    Amboss Launches Rails, A Self-Custodial Bitcoin Yield Service

    May 30, 2025

    Bitcoin Builders Exist Because Of Users

    May 30, 2025

    Ark Labs Launches Arkade, A New Native Operating System Using Bitcoin

    May 30, 2025
    Add A Comment
    Leave A Reply Cancel Reply

    Categories
    • Altcoins
    • Bitcoin News
    • Blockchain
    • Crypto Market Trends
    • Crypto Mining
    • Cryptocurrency
    • Ethereum
    Archives
    • June 2025
    • May 2025
    • April 2025
    • March 2025
    • February 2025
    • January 2025
    • December 2024
    • November 2024
    Archives
    • June 2025
    • May 2025
    • April 2025
    • March 2025
    • February 2025
    • January 2025
    • December 2024
    • November 2024
    Top Posts

    El Salvador President Showcases National Portfolio as Bitcoin Tapped $100K

    December 7, 2024

    About us

    Welcome to SimonCrypto.in, your ultimate destination for everything crypto! Whether you’re a seasoned investor, a blockchain enthusiast, or just beginning your journey into the fascinating world of cryptocurrencies, we’re here to guide you every step of the way.

    At SimonCrypto.in, we are passionate about demystifying the complex world of digital currencies and blockchain technology. Our mission is to provide insightful, accurate, and up-to-date information to empower our readers to make informed decisions in the ever-evolving crypto space.

    Top Insights

    Trump-Backed Crypto Project WLFI Closes Token Sale After Raising $590 Million

    March 15, 2025

    The Gold Bug Caught Holding ‘Digital Gold’

    April 22, 2025

    Dogecoin Trading Volume Rises Over $6.5 Billion As Liquidations Cross $31 Million, What’s Going On?

    December 20, 2024
    Categories
    • Altcoins
    • Bitcoin News
    • Blockchain
    • Crypto Market Trends
    • Crypto Mining
    • Cryptocurrency
    • Ethereum
    • Privacy Policy
    • Disclaimer
    • Terms and Conditions
    • About us
    • Contact us
    Copyright © 2024 SimonCrypto All Rights Reserved.

    Type above and press Enter to search. Press Esc to cancel.