Live Markets, Charts & Financial News

Bitcoin Covenants: CHECKSIGFROMSTACK (BIP 348)

1

This is the second article in a series Deep diving in the individual era proposals that have reached a point of maturity that deserves an in -depth collapse.

Checksgfromstack (CSFS), which was presented by Black and Jeremy Robin with BIP 348, is not a covenant. As I said in the preliminary article for this series, some of the proposals that I will cover are not a covenant, but rather a synergy or interconnected with them in some way. CSFS is the first example of it.

CSFS is a very simple Opcode icon, but before we go through how it works, let's look at the basics of how the Bitcoin text already works.

The text program is a language based on stack. This means that the data is “stacked” together on top of each other on the stack, and it is operated by removing an element from the top of the stack to the work based on what the OPCode code does, either return the data or as a result of the upper part of the stack.

There are two parts of the text program when it is finally implemented and verified, and the “witness” provided to cancel the insurance of the text program, and the text program included in the directing that is spent. Added the witness/open text program to the left side of the locking program, then each element is added to (or works on) the stack one by one to the right. See this example (“”|It represents the border between the witness and the scenario):

1 2 | ON_ADD 3 on_Equal

The text program adds this value “1” to the stack, then the value “2” is above it. OP_ADD takes the first elements of the stack and adds them together, which restores the result to the stack (now all that is on the stack is “3”). Then another “3” is added to the stack. The last element, OP_EQUAL, takes the upper component of the stack and returns “1” to the stack (it can represent 1 and 0 correct or wrong numbers as well as numbers).

The text program must end with the last element in the upper part of the stack, otherwise the text program (and the implementation of the transaction) fails and is considered an invalid consensus.

This is an essential example of the text of payment (P2PKH), that is, old addresses that start with “1”:

| DUP Hash160 Qualeverify Checksig

First, the signature and the public key are added to the stack. Then the DUP, which takes the upper stack element and repeats it, and returns it to the top of the stack. Hash160 takes the upper stack (repetition of the public key), retain it, then return it to the top of the stack. The public key fragmentation of the text program is placed on top of the stack. It works equally on an equal footing, it holds two elements of the top of the stack and restores 1 or 0 based on the result. The only difference is that the equal is also operated after equality, which fails to treat if the upper stack element is not 1, and also removes the upper stack element. Finally, Checksig, which holds the elements of two stacks, is operating on the assumption that it is a sign and pubkey, and it is achieved implicit signature against the retail that is verified. If it is valid, it puts 1 at the top of the stack.

How works csfs

Checksig is one of the most OPCodes used in Bitcoin. Each transaction, with almost no exceptions, is used, OPCODE is used at some point in a text software. Checking for signature is a basic component of bitcoin protocol. The problem is that there is almost no flexibility regarding the message you are examining from the signature. Checksig will only check the signing for the verified treatment. There is some flexibility, i.e. you can decide with freedom what parts of the transaction on the signature apply, but that's all.

CSFS aims to change this by allowing to verify a signature against any arbitrary message that is pushed directly to the stack, instead of being limited to verifying signatures against the same treatment. The code follows OPCODE, a very basic operating structure:

| Csfs

The signature and the message are dropped above the stack, then the public key above it, and finally CSFS hold the three most important elements of the stack on the assumption that the public key and the message and the signature from top to bottom, and checking the signature against the message. If the signature is valid, 1 is placed on the stack.

That's it. The simple alternative from Checksig allows users to determine arbitrary messages instead of just treating spending.

What is CSFS is useful for

So what is exactly this is good? What is the use of verification of a signing against an arbitrary message on the stack rather than treating spending?

First, in conjunction with CTV, it can provide a reward for something that lightning developers wanted from the beginning, floating signatures that can be attached to various transactions. This was originally suggested as a new flag for release of signatures (the field that dictates parts of the transaction on which the signature applies). This was required because the treatment signing covers the treatment ID of the treatment that created the output that is spent. This means that the signature is only valid to spend the transaction exactly Directing.

This is a desirable behavior of lightning because it will allow us to get rid of the channel’s penalties. Each previous Lightning case needs a key to a penalty and a treatment in order to ensure that your opposite party is never used any of them to try to claim the money they do not have. If they try, you can claim all their money. The superior functions will be something that allows you to simply “attach” the treatment of the current situation with any previous one to stop the theft attempt by properly distributing the funds instead of its confiscation.

This can be achieved using a basic text program that takes the CTV fragmentation and signing it is examined using CSFS. This would allow any fragmentation signed with the CSFS key to spend any outputs created using this text program.

Another useful feature is the UTXO control. In the same way that any CTV segmentation can be spent by CSFS correctly to spend UTXO with a text program designed for that, other variables can be passed to the script to be verified, such as a new public key. A text program that allows the CSFS key can be created to sign it any The public key, which can be verified then using CSFS and using it to verify the authenticity of the normal examination. This would allow you to delegate the ability to spend UTXO to anyone else without the need to move it on the chain.

Finally, in conjunction with CAT, CSFS can be used to create more sophisticated meditation functions. As we will see later in this series, CSFS is not actually required to simulate any of this most advanced behavior, as CAT alone is able to do this.

Final ideas

CSFS is a very essential OPCOode icon in addition to providing simple useful functions in itself, and it consists very well even with the most simple Ashudd in the creation of very useful functions. While the above example with regard to floating signatures particularly refers to the lightning network, floating signatures are generally useful that apply to any bitcoin -based protocol using pre -signed transactions.

In addition to the floating signatures, the mandate of the rudimentary programs is very useful that exceeds the Utxo control to a new public key. The same basic ability to “side load” after the truth can apply to the flow of the validity of the text program to anything, not only public keys. Timelock values ​​can now be added, hashlock, etc. These values ​​can now be added dynamically after the truth.

Moreover, CSFS is a very mature suggestion. Contains implementation broadcast on the network and liquid items (liquid uses at the base of the code) Since 2016. In addition, Bitcoin Cash had Release From him since 2018.

CSFS is a very mature suggestion that is almost conceptual as long as you are in this field, with multiple mature applications, and very clear use can be applied.

Comments are closed, but trackbacks and pingbacks are open.