• bitcoinBitcoin (BTC) $ 74,769.00
  • ethereumEthereum (ETH) $ 2,840.58
  • tetherTether (USDT) $ 1.00
  • solanaSolana (SOL) $ 188.77
  • bnbBNB (BNB) $ 599.58
  • usd-coinUSDC (USDC) $ 0.999706
  • xrpXRP (XRP) $ 0.558924
  • dogecoinDogecoin (DOGE) $ 0.193684
  • staked-etherLido Staked Ether (STETH) $ 2,839.21
  • tronTRON (TRX) $ 0.161995
  • cardanoCardano (ADA) $ 0.371071
  • the-open-networkToncoin (TON) $ 4.91
  • wrapped-stethWrapped stETH (WSTETH) $ 3,376.55
  • shiba-inuShiba Inu (SHIB) $ 0.000019
  • avalanche-2Avalanche (AVAX) $ 27.20
  • wrapped-bitcoinWrapped Bitcoin (WBTC) $ 74,667.00
  • wethWETH (WETH) $ 2,843.26
  • chainlinkChainlink (LINK) $ 12.45
  • bitcoin-cashBitcoin Cash (BCH) $ 376.47
  • suiSui (SUI) $ 2.27
  • polkadotPolkadot (DOT) $ 4.14
  • leo-tokenLEO Token (LEO) $ 6.11
  • usdsUSDS (USDS) $ 1.00
  • uniswapUniswap (UNI) $ 9.08
  • litecoinLitecoin (LTC) $ 70.86
  • wrapped-eethWrapped eETH (WEETH) $ 2,991.46
  • nearNEAR Protocol (NEAR) $ 4.21
  • aptosAptos (APT) $ 9.74
  • pepePepe (PEPE) $ 0.000010
  • bittensorBittensor (TAO) $ 531.57
  • internet-computerInternet Computer (ICP) $ 7.97
  • fetch-aiArtificial Superintelligence Alliance (FET) $ 1.40
  • daiDai (DAI) $ 0.999696
  • ethereum-classicEthereum Classic (ETC) $ 20.27
  • kaspaKaspa (KAS) $ 0.120634
  • moneroMonero (XMR) $ 162.67
  • stellarStellar (XLM) $ 0.098202
  • ethena-usdeEthena USDe (USDE) $ 1.00
  • whitebitWhiteBIT Coin (WBT) $ 19.23
  • aaveAave (AAVE) $ 184.58
  • polygon-ecosystem-tokenPOL (ex-MATIC) (POL) $ 0.342099
  • blockstackStacks (STX) $ 1.70
  • okbOKB (OKB) $ 39.73
  • dogwifcoindogwifhat (WIF) $ 2.37
  • first-digital-usdFirst Digital USD (FDUSD) $ 0.997354
  • crypto-com-chainCronos (CRO) $ 0.086646
  • arbitrumArbitrum (ARB) $ 0.575629
  • filecoinFilecoin (FIL) $ 3.77
  • celestiaCelestia (TIA) $ 5.23
  • mantleMantle (MNT) $ 0.617315
  • optimismOptimism (OP) $ 1.65
  • immutable-xImmutable (IMX) $ 1.24
  • injective-protocolInjective (INJ) $ 21.11
  • render-tokenRender (RENDER) $ 5.09
  • fantomFantom (FTM) $ 0.703257
  • thorchainTHORChain (RUNE) $ 5.48
  • hedera-hashgraphHedera (HBAR) $ 0.049017
  • cosmosCosmos Hub (ATOM) $ 4.57
  • vechainVeChain (VET) $ 0.021863
  • binance-peg-wethBinance-Peg WETH (WETH) $ 2,843.71
  • sei-networkSei (SEI) $ 0.414349
  • bitget-tokenBitget Token (BGB) $ 1.19
  • bonkBonk (BONK) $ 0.000022
  • popcatPopcat (POPCAT) $ 1.56
  • rocket-pool-ethRocket Pool ETH (RETH) $ 3,181.14
  • the-graphThe Graph (GRT) $ 0.156339
  • ethenaEthena (ENA) $ 0.505446
  • jupiter-exchange-solanaJupiter (JUP) $ 1.04
  • pyth-networkPyth Network (PYTH) $ 0.383141
  • flokiFLOKI (FLOKI) $ 0.000142
  • mantle-staked-etherMantle Staked Ether (METH) $ 2,970.63
  • mantra-daoMANTRA (OM) $ 1.44
  • lido-daoLido DAO (LDO) $ 1.43
  • makerMaker (MKR) $ 1,427.56
  • worldcoin-wldWorldcoin (WLD) $ 2.01
  • theta-tokenTheta Network (THETA) $ 1.23
  • raydiumRaydium (RAY) $ 4.62
  • kucoin-sharesKuCoin (KCS) $ 9.85
  • solv-btcSolv Protocol SolvBTC (SOLVBTC) $ 74,750.00
  • gatechain-tokenGate (GT) $ 8.98
  • renzo-restaked-ethRenzo Restaked ETH (EZETH) $ 2,915.77
  • arweaveArweave (AR) $ 16.54
  • ondo-financeOndo (ONDO) $ 0.743144
  • heliumHelium (HNT) $ 6.21
  • msolMarinade Staked SOL (MSOL) $ 232.60
  • jasmycoinJasmyCoin (JASMY) $ 0.021117
  • algorandAlgorand (ALGO) $ 0.122203
  • bitcoin-svBitcoin SV (BSV) $ 51.31
  • coinbase-wrapped-btcCoinbase Wrapped BTC (CBBTC) $ 74,915.00
  • beam-2Beam (BEAM) $ 0.018541
  • fasttokenFasttoken (FTN) $ 2.90
  • aerodrome-financeAerodrome Finance (AERO) $ 1.39
  • based-brettBrett (BRETT) $ 0.094380
  • quant-networkQuant (QNT) $ 62.72
  • matic-networkPolygon (MATIC) $ 0.341659
  • mog-coinMog Coin (MOG) $ 0.000002
  • starknetStarknet (STRK) $ 0.415593
  • ether-fi-staked-ethether.fi Staked ETH (EETH) $ 2,839.37
  • pendlePendle (PENDLE) $ 5.28
  • galaGALA (GALA) $ 0.021547
  • tokenize-xchangeTokenize Xchange (TKX) $ 10.65
  • neiro-3Neiro (NEIRO) $ 0.002014
  • bittorrentBitTorrent (BTT) $ 0.00000087
  • spx6900SPX6900 (SPX) $ 0.897641
  • coredaoorgCore (CORE) $ 0.909308
  • flowFlow (FLOW) $ 0.540806
  • cat-in-a-dogs-worldcat in a dogs world (MEW) $ 0.009373
  • lombard-staked-btcLombard Staked BTC (LBTC) $ 74,726.00
  • goatseus-maximusGoatseus Maximus (GOAT) $ 0.799505
  • apecoinApeCoin (APE) $ 1.09
  • usddUSDD (USDD) $ 1.00
  • axie-infinityAxie Infinity (AXS) $ 4.92
  • ordinalsORDI (ORDI) $ 35.58
  • dydx-chaindYdX (DYDX) $ 1.12
  • solv-protocol-solvbtc-bbnSolv Protocol SolvBTC.BBN (SOLVBTC.BB) $ 74,743.00
  • kaiaKaia (KAIA) $ 0.124184
  • jupiter-staked-solJupiter Staked SOL (JUPSOL) $ 198.43
  • elrond-erd-2MultiversX (EGLD) $ 26.01
  • neoNEO (NEO) $ 10.15
  • bridged-usdc-polygon-pos-bridgeBridged USDC (Polygon PoS Bridge) (USDC.E) $ 0.999974
  • arbitrum-bridged-wbtc-arbitrum-oneArbitrum Bridged WBTC (Arbitrum One) (WBTC) $ 74,866.00
  • eosEOS (EOS) $ 0.460852
  • conflux-tokenConflux (CFX) $ 0.152962
  • ecasheCash (XEC) $ 0.000035
  • zcashZcash (ZEC) $ 45.03
  • nexoNEXO (NEXO) $ 1.06
  • notcoinNotcoin (NOT) $ 0.006595
  • flare-networksFlare (FLR) $ 0.013178
  • gigachad-2Gigachad (GIGA) $ 0.069025
  • gnosisGnosis (GNO) $ 255.15
  • wormholeWormhole (W) $ 0.242842
  • kelp-dao-restaked-ethKelp DAO Restaked ETH (RSETH) $ 2,916.88
  • tether-goldTether Gold (XAUT) $ 2,666.50
  • tezosTezos (XTZ) $ 0.648580
  • l2-standard-bridged-weth-baseL2 Standard Bridged WETH (Base) (WETH) $ 2,844.77
  • fraxFrax (FRAX) $ 0.995425
  • arkhamArkham (ARKM) $ 2.14
  • axelarAxelar (AXL) $ 0.754587
  • mina-protocolMina Protocol (MINA) $ 0.534816
  • ethereum-name-serviceEthereum Name Service (ENS) $ 18.79
  • safeSafe (SAFE) $ 1.24
  • turboTurbo (TURBO) $ 0.009039
  • the-sandboxThe Sandbox (SAND) $ 0.257746
  • superfarmSuperVerse (SUPER) $ 1.37
  • akash-networkAkash Network (AKT) $ 2.47
  • eigenlayerEigenlayer (EIGEN) $ 3.24
  • nervos-networkNervos Network (CKB) $ 0.013393
  • book-of-memeBOOK OF MEME (BOME) $ 0.008548
  • grassGrass (GRASS) $ 2.41
  • chilizChiliz (CHZ) $ 0.061965
  • decentralandDecentraland (MANA) $ 0.302813
  • coinbase-wrapped-staked-ethCoinbase Wrapped Staked ETH (CBETH) $ 3,079.40
  • paypal-usdPayPal USD (PYUSD) $ 0.999765
  • aioz-networkAIOZ Network (AIOZ) $ 0.482658
  • arbitrum-bridged-weth-arbitrum-oneArbitrum Bridged WETH (Arbitrum One) (WETH) $ 2,846.28
  • pax-goldPAX Gold (PAXG) $ 2,662.87
  • zksyncZKsync (ZK) $ 0.142633
  • sats-ordinalsSATS (Ordinals) (SATS) $ 0.00000025
  • beldexBeldex (BDX) $ 0.078147
  • roninRonin (RON) $ 1.44
  • dydxdYdX (ETHDYDX) $ 1.12
  • terra-lunaTerra Luna Classic (LUNC) $ 0.000093
  • pancakeswap-tokenPancakeSwap (CAKE) $ 1.81
  • havvenSynthetix Network (SNX) $ 1.52
  • true-usdTrueUSD (TUSD) $ 0.994851
  • dexeDeXe (DEXE) $ 8.33
  • oasis-networkOasis (ROSE) $ 0.070471
  • fwogFwog (FWOG) $ 0.478063
  • frax-etherFrax Ether (FRXETH) $ 2,822.37
  • super-oethSuper OETH (SUPEROETHB) $ 2,845.06
  • binance-staked-solBinance Staked SOL (BNSOL) $ 190.19
  • blurBlur (BLUR) $ 0.221020
  • bitcoin-avalanche-bridged-btc-bAvalanche Bridged BTC (Avalanche) (BTC.B) $ 74,799.00
  • trust-wallet-tokenTrust Wallet (TWT) $ 1.02
  • xdce-crowd-saleXDC Network (XDC) $ 0.028334
  • dog-go-to-the-moon-runeDOG•GO•TO•THE•MOON (Runes) (DOG) $ 0.004218
  • apenftAPENFT (NFT) $ 0.00000043
  • l2-standard-bridged-weth-blastL2 Standard Bridged WETH (Blast) (WETH) $ 2,844.47
  • astarAstar (ASTR) $ 0.056405
  • compound-governance-tokenCompound (COMP) $ 46.83
  • polygon-pos-bridged-weth-polygon-posPolygon PoS Bridged WETH (Polygon POS) (WETH) $ 2,845.76
  • iotaIOTA (IOTA) $ 0.118531
  • layerzeroLayerZero (ZRO) $ 3.68
  • bitcoin-goldBitcoin Gold (BTG) $ 22.99
  • usdbUSDB (USDB) $ 0.991347
  • ondo-us-dollar-yieldOndo US Dollar Yield (USDY) $ 1.06
  • quantixaiQuantixAI (QAI) $ 95.92
  • hashnote-usycHashnote USYC (USYC) $ 1.06
  • virtual-protocolVirtuals Protocol (VIRTUAL) $ 0.395936
  • livepeerLivepeer (LPT) $ 10.94
  • baby-doge-coinBaby Doge Coin (BABYDOGE) $ 0.00000000
  • stepnGMT (GMT) $ 0.133189
  • iotexIoTeX (IOTX) $ 0.040905
  • echelon-primeEchelon Prime (PRIME) $ 7.68
  • aleoALEO (ALEO) $ 1.58
  • swethSwell Ethereum (SWETH) $ 3,047.15
  • kavaKava (KAVA) $ 0.341106
  • binance-peg-busdBinance-Peg BUSD (BUSD) $ 1.00
  • theta-fuelTheta Fuel (TFUEL) $ 0.054706
  • ethereum-pow-iouEthereumPoW (ETHW) $ 3.38

OP_CAT and the Infinite Nothing

0 84

Introduction

You may have heard about re-enabling OP_CAT as a potential upgrade for bitcoin’s script language. Depending on where you get your news OP_CAT has been called «only 10 lines of code», «the best way to enable experimentation with covenants», «too powerful», «dangerous and leading to miner centralization», or «guaranteed to lead to a contentious soft fork». I’m going to make the case that all of these perspectives are mistaken. OP_CAT is very useful, can be used as a covenant, and not (alone) the best next move for bitcoin. Nothing more, and nothing less.

To make that case, I’m going to explore several (apparently disjoint) topics, some of which were new to me a few short months ago. I’m going to try and arrange this in a way that provides the necessary background in one place.

How and What OP_CAT Does

Introspection with CAT

Let’s tackle the burning question that many have when first exposed to OP_CAT. How can a few lines of code that combine two items from the stack into one (A B CAT -> AB) possibly enable anything interesting? Andrew Poelstra has eloquently explained in recent interviews, and I posted a silly and brief explanation:

Bitcoin is a bit weird, so it can also split things. Then SHA256 lets us undo hashes. Then because cryptography is just math and we know how to grind, CAT lets us extract a hash from a signature verification. And as a result we can inspect anything hashed inside a signature…

— Rearden 🍯🦡 🦢 | embrace forks (@reardencode) May 17, 2024

Because bitcoin script is strictly a verification language, each opcode can be used in forward or reverse. A script can be given a hash and require a preimage, or given a preimage and require a hash using OP_SHA256. This insight gives us the first two parts of how OP_CAT covenants work.

If a bitcoin script could get access to a hash of the transaction it’s verifying, it could require that the spend stack provide the hash preimage, split in whatever way the script requires, and then validate any particular part of that preimage. This is exactly what a covenant is — validating a part of the transaction spending some bitcoin.

That’s great, but bitcoin doesn’t have an opcode like OP_TXHASH to give the script access to the transaction’s hash. Here, we take advantage of the BIP340 Schnorr signature verification equation to require that the user provide the hash. If the user provides a value that will be a valid transaction hash if the script concatenates the byte 0x00 to the end of it, that value will also be a part of a valid BIP340 signature (with certain other parameters fixed) if the script concatenates the byte 0x01 to it.

Combining these techniques, enables OP_CAT to check any part of its spending transaction that can be signed, and even to look back at its parent transactions in some limited ways. With some careful codecraft, one can build Purrfect Vaults, CatVM, and more.

Other uses for CAT

But we shouldn’t. Building these things with OP_CAT results in difficult to maintain abominations. Instead, we should use OP_CAT for what it’s good for, and there’s plenty of that: It enables the equivalent of OP_CHECKSEPARATESIG, checking Merkle inclusion proofs, combining data for signature verification with OP_CHECKSIGFROMSTACK, and more.

Problems with CAT

Now that we know what CAT does, what’s the problem? Why have people (myself included) said that it’s a dangerous beast? Using the introspection technique described above, CAT enables two specific constructions: Hashrate escrows, and (supposedly) automated market makers (AMMs). Until recently, both of these were considered significant risks of bringing centralizing MEV to bitcoin.

MEV, MEVil and Miner Centralization

The term MEV (Miner Extractable Value) is a bit confusing. In the plainest interpretation it would include transaction fees, which of course we want paid to miners to help ensure the security of bitcoin long into the future. MEV is generally used to mean additional value that miners can extract from their blocks beyond the fees visible on the public relay network. This could come in the form of out of band payments, miners participating in contracts and reordering transactions in ways that favor themselves, or even outright theft of goods and services by miners mining blocks that reorg and double spend a confirmed payment to a merchant. All of these forms of MEV can be considered generally bad for the participants in the network, as the miners are using their position in the network to their own benefit at the expense of other network participants. However, MEV alone does not present a systemic problem by driving miner centralization, only a local problem for the specifically impacted participants.

MEVil is a term that is sometimes used for MEV which drives miner centralization — I prefer the term centralizing MEV and will use it going forward. Several things are necessary to change MEV into centralizing MEV:

  1. It must be sufficiently difficult to extract that an open source block template builder cannot reasonably extract it
  2. The total value extractable must grow with a miner’s bitcoin hash rate
  3. The extractable value must justify the cost of extraction

If all of these requirements are met then only a sufficiently large miner will have the incentive to begin extracting the MEV. Once they do, they will be able to outpace their smaller peers’ growth thanks to the additional revenue extracted. The more costly the MEV is to extract (up to the point where it is not worth it for any miner) the worse the centalizing pressure it creates.

Avoiding centralizing MEV then is (in a sense) simple: Ensure that whatever opportunities for MEV exist on bitcoin are either so easy to extract that everyone does it or cost more to extract than they’re worth (either because they’re so small or because they’re so costly).

For more information, check out @TheBlueMatt’s recent post.

Hashrate Escrows (née Drivechains)

Many years ago (before the Lightning Network or ideas like Ark, Timeout Trees, roll-ups, BitVM, or CatVM) sidechains were considered the ultimate scaling solution for bitcoin. The idea was conceptually simple: bitcoin blocks must stay limited in size for all the usual decentralization reasons, but we can attach sidechains to bitcoin and those can have faster blocks, bigger blocks, more computation, or whatever. In practice, however, implementing sidechains was not so easy. Bitcoin’s final settlement is fundamentally tied to proof of work, an unfalsifiable cost to reorder transactions, how does a sidechain inherit that? Also, how can bitcoin be transferred to and from the sidechain? The best known proposal to answer these two questions is called Drivechains (BIPs 300 and 301). I won’t bore you with the details of Drivechains, but suffice it to say, there are only two outcomes of such sidechain systems: Either they are relatively unused (and therefore useless) or they are widely used and become a de facto block size increase for bitcoin. A de facto block size increase of this sort is a form of centralizing MEV where only larger miners will be able to cost effectively participate in the additional revenue opportunities offered by the potentially large and complex sidechain blocks.

Hashrate escrows, which can be built with OP_CAT, are one small part of the Drivechains proposals. This is a system of restricting withdrawals from sidechains by using a counter whose value can only be changed by miners, starts at a high value, and must reach zero before a sidechain withdrawal can be processed. This is claimed to be a «trustless» transfer out from a sidechain, but actually creates a federation of miners with control of all bitcoin held in sidechains.

Since the development of the Drivechains proposals, it has become (to our detriment) common to refer to any proposal which can be used to create a withdrawal predicated on a miner-controlled counter as «Drivechains». Hopefully it clear at this point why this inappropriate shorthand is unhelpful — Drivechains are either worthless or dangerous, but hashrate escrows are merely a way to transfer control the outcome of some transaction to the implicit federation of miners.

Tokens and AMMs

Tokens

For reasons that will never be entirely clear to me, humans love a good token (or a bad token or really just tokens). Nearly from the beginning of bitcoin there has been talk of how to embed other tokens into the protocol, from Colored Coins and Counterparty, to the more recent Taproot Assets and Runes. All of these protocols have one thing in common: They require an external index of bitcoin transactions that either has knowledge of external data or processes data from the sequence of bitcoin transactions in order to determine the transformations of tokens within the protocol. The salient point for this article is that bitcoin locking scripts are completely unaware of the existence of the tokens, and even bitcoin nodes that validate transactions are unaware of the tokens (i.e. even if a bitcoin locking script had full access to the complete bitcoin UTXO set, it could not discover the state of any of these tokens).

Automated Market Makers (AMMs)

On other blockchain systems it is common for contracts known as AMMs to be used to (for example) peg the ratio between two tokens by buying and selling at a fixed price. The rules that can be encoded in an AMM are beyond the scope of this article. Suffice it to say that AMMs create huge opportunities for MEV and because of the private exchange relationships needed to maximize the returns on that MEV also centralizing MEV. This has often been used as an argument against building more expressive bitcoin scripts — we genuinely do want to avoid exposing the bitcoin network to the vagaries of centralizing MEV. However, as I’ve described above there simply is no practical way for bitcoin scripts, no matter how expressive, to evaluate the state of any token other than bitcoin. Bitcoin scripts cannot locate a rare sat. They can’t find a Rune balance. They can’t identify a Taproot Asset.

Without access to any information about the disposition of non-bitcoin assets, the entire concept of a bitcoin script based AMM ceases to make sense. Token locations can be attested to by a signature from an oracle, but oracle attestations do not make an AMM. They can be used to facilitate specific manual trades, but not a durable automated system. Moreover, such an oracle-based system could be built today with no changes to bitcoin.

Conclusion

As you can hopefully see, CAT is not such a frightful beast. It’s not really much of a beast at all. It has neither infinite capability nor magical powers. It’s just a little opcode that can be very helpful. The one thing we probably want to avoid is activating OP_CAT without another way to do transaction introspection, such as OP_TXHASH, OP_TX, or both. Even enabling it with LNHANCE is an improvement on OP_CAT alone because it reduces the size and complexity of the scripts needed to achieve many OP_CAT introspection protocols.

I think at this point, the «CAT introduces infinite everything» has been reduced to ~nothing.

It introduces helpful introspection in a shitty way that nobody should use. To help people not use it, we should enable CAT along with TXHASH or similar.https://t.co/nvnxYn66Um https://t.co/1Ag5TwjuUw

— Rearden 🍯🦡 🦢 | embrace forks (@reardencode) May 17, 2024

This is a guest post by Brandon Black. Opinions expressed are entirely their own and do not necessarily reflect those of BTC Inc or Bitcoin Magazine.

Source

Leave A Reply

Your email address will not be published.