Altcoins Talks - Cryptocurrency Forum

Cryptocurrency Ecosystem => Bitcoin Forum => Topic started by: NotATether on April 25, 2024, 03:20:36 PM

Title: OP_CAT and Bitcoin
Post by: NotATether on April 25, 2024, 03:20:36 PM
I know most people don't understand anything about Bitcoin Script, so I will try to explain this as best as I can.

When you create a transaction, the outputs of the transactions have scripts attached to them, which contain instructions that an input must replicate in order to unlock those inputs for signing.

Mostly the script looks something like OP_DUP OP_HASH160 OP_PUSH <some hash> OP_EQUALVERIFY OP_CHECKSIG or maybe OP_DUP OP_PUSH <some hash> OP_EQUAL.

Scripts can take inputs, which are stored on a stack, similar to a programming language, which is created when a Bitcoin Core node verifies a transaction and is destroyed when verification is completed.

Ever since the introduction of Taproot, people have been finding rather creative uses for these opcodes. One of these led to the creation of Ordinals.

However, having opcodes that can do complex operations will save fees on the bitcoin network and will allow more transactions to be mined in the same block at once (due to something called "sigops"). OP_CAT is one such opcode: It combines the two highest values on the stack.

For example, if the stack looks like this:

NotA
Tether

then OP_CAT will delete these two values and put "NotATether" on the stack.

Or if the stack is

Not
A
Tetether

and you do two OP_CATs, then it will also create NotATether. (first NotA, Tether and then the complete string NotATether).

The good news is, OP_CAT finally has a BIP number, BIP 347, and that means that the BIP is under serious consideration.

It might even be added into the Bitcoin protocol again. It was first disabled by Satoshi Nakamoto himself very early on in Bitcoin's life.

https://www.coindesk.com/tech/2024/04/24/op-cat-proposal-to-bring-smart-contracts-to-bitcoin-finally-gets-a-bip-number/
Title: Re: OP_CAT and Bitcoin
Post by: SamReomo on April 25, 2024, 08:24:16 PM
Very comprehensive post about Bitcoin scripts. I have not heard much about Bitcoin scripts, only once or twice I have skimmed it but after reading this post, I gained some good information about those scripts.

I have heard about that OP_CAT and the proposal of adding smart contracts to Bitcoin network. I don't know what impact that will have on Bitcoin network, but if it creates more transactions then we may see network congestion.
Title: Re: OP_CAT and Bitcoin
Post by: Agbe on April 25, 2024, 10:19:17 PM
If I wish I can give more than one karma. This is educative and this the first time I am hearing of bitcoin script. Thanks for your comprehensive breaking down of the script. I can also see the formation of your username. Since this is the first time of hearing it. It is somehow difficult for me to understand so I will still make some research to add up so that the understanding will be good so I can also contribute to knowledge. And I think for one to understand this bitcoin script, the person has to do some practical works to do transaction to know the input and output of the process. And for one to understand bitcoin this would have been the first topic to know. Because it concerns about all the transactions processes of bitcoin.

I just got this (https://academy.bit2me.com/en/que-es-bitcoin-script/#:~:text=Bitcoin%20Script%20is%20the%20language,that%20we%20will%20know%20next.) too to add up to the knowledge and I am getting more understanding on bitcoin script. Thanks for the information.
Title: Re: OP_CAT and Bitcoin
Post by: Dr.Bitcoin_Strange on April 25, 2024, 10:56:02 PM
Inasmuch as the OP_CAT has lots of potential benefits to Bitcoin, let's not also forget that it could have disadvantages too, such as causing an increase in the network congestion. We know that one of the main benefits of the OP_CAT is to allow more complex scripts, when this happens, it could potentially lead to higher transaction sizes and also decreasing over all throughput, which will definitely increase the congestion in the network.
Title: Re: OP_CAT and Bitcoin
Post by: Ambatman on April 26, 2024, 09:53:35 PM
Any idea why it was disabled by Satoshi? I have been meaning to learn about various script. Seeing and reading people using it in their thread always get me lost, so started doing research and I recently finished learning something's about OP Return, How to change its format to text or hexagonal and the reason it was introduced.
So there's OP CAT and it can enable the creation of smart Contracts
Wouldn't something like this increase congestion?  Or is it a better alternative to runes and ordinals. Thanks.
Title: Re: OP_CAT and Bitcoin
Post by: bitmover on April 26, 2024, 11:27:58 PM
Mostly the script looks something like OP_DUP OP_HASH160 OP_PUSH <some hash> OP_EQUALVERIFY OP_CHECKSIG or maybe OP_DUP OP_PUSH <some hash> OP_EQUAL.

I am impressed you didn't mention OP_RETURN, the most "famous" one


Any idea why it was disabled by Satoshi? I have been meaning to learn about various script. Seeing and reading people using it in their thread always get me lost, so started doing research and I recently finished learning something's about OP Return, How to change its format to text or hexagonal and the reason it was introduced.

OP_RETURN is an easy way to write messages in a transaction

There is a tutorial here:
https://armantheparman.com/op_return/



Interesting curiosity:
Genesis block message was written using OP_PUSHBYTES
https://mempool.space/tx/4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b
Title: Re: OP_CAT and Bitcoin
Post by: Stompix on April 27, 2024, 09:37:01 PM
Any idea why it was disabled by Satoshi?

Usage and possible vulnerabilities in spending at that time.
There have been ideas to revive it but I don't really see it happening, most devs were against it back in the days, there was no interest in them,as OP_CAT is not alone:
https://en.bitcoin.it/wiki/Script

There is also OP_MOD that is disabled, mainly because of no functionality and that would have some use cases and less animosity.

I am impressed you didn't mention OP_RETURN, the most "famous" one

The one whose name should not be uttered  :-X