CAT20 Protocol Analysis: How Fractal BTC Implements Bitcoin Smart Contracts

robot
Abstract generation in progress

Is the BTC smart contracts coming soon? Analysis of the new Token protocol CAT20 on Fractal BTC

Recently, a layer two network called Fractal BTC in the Bitcoin ecosystem has officially launched its mainnet after undergoing multiple rounds of testing. One of the highlights of Fractal BTC is its smart contracts capability, and on the occasion of the mainnet launch, it introduced a new token protocol CAT20. So what clever technical designs does CAT20 have? What can we learn from it?

Technical Interpretation of CAT20: A New Token Protocol on Fractal Bitcoin

Fractal Bitcoin Introduction

Before understanding CAT20, we need to briefly understand Fractal Bitcoin. Fractal Bitcoin is a "layer two" network that is fully compatible with BTC, with a block confirmation time of only 1 minute, which is faster than BTC. Its basic principle is to replicate the BTC network multiple times, with each chain capable of processing transactions, thereby increasing the overall processing speed.

One of Fractal's key features is the activation of the OP_CAT opcode, which was abandoned in the early days of BTC for security reasons. This gives Fractal Bitcoin capabilities similar to smart contracts, providing more possibilities for future development.

Technical Interpretation of CAT20: New Token Protocol on Fractal Bitcoin

CAT Protocol Overview

Based on the support of the underlying OP_CAT, the CAT Protocol has emerged. Currently, the CAT20 protocol is in actual operation, and a certain trading platform has also added corresponding interface support. CAT20 is similar to ERC20 in both name and functionality, so how does it achieve a lifecycle similar to that of ERC20?

deployment process

When deploying the CAT20 Token, users need to specify the wallet address and the basic information of the Token. Unlike ERC20, CAT20 allows for pre-mining and a single minting cap.

Deployment is divided into two phases: "commit" and "reveal":.

  1. Commit Phase: Write the basic information of the Token into the transaction output script.
  2. Reveal Phase: Save the hash value of the initial state of the CAT20 and generate a Minter for subsequent minting.

This two-step deployment method is relatively common in blockchain projects and can reveal the complete information of the project only during the reveal phase.

Technical Interpretation of CAT20: New Token Protocol on Fractal Bitcoin

Minting Mechanism

The minting process has the following characteristics:

  • The input is a minter, initially generated at the time of deployment.
  • Each minting only has one minter as input, but can have multiple minters as output.
  • Each mint generates a token
  • The output order is fixed, the token must come after the minter.

The quantity management of minters is crucial. If only one is produced each time, it can cause congestion; producing too many increases costs. The V2 version defaults to generating two closely related Minters to balance efficiency and cost.

Technical Interpretation of CAT20: New Token Protocol on Fractal Bitcoin

transaction construction

CAT20 can construct transactions using UTXOs from non-ownership addresses, thanks to its clever script design:

  1. By adjusting the public key generation method, achieve control over different address UTXOs.
  2. The minter itself acts as a smart contract, allowing anyone to use it.

Technical Perspective on CAT20: New Token Protocol on Fractal Bitcoin

State Management

The minter stores state information, including:

  1. The hash value of the current transaction output state is stored in OP_RETURN.
  2. Store remaining Mintable quantity in the contract

The newly generated Minter can mint an amount equal to half of the remaining total, until all minting is complete.

The CAT20 Token itself is also a smart contract, recording the quantity and ownership address. This is different from the inscription mechanisms like BRC20.

Technical Interpretation of CAT20: New Token Protocol on Fractal Bitcoin

transfer and burn

The input and output token amounts must remain consistent during the transfer. Multiple tokens can be transferred in a single transaction.

To burn a Token, simply transfer it to a regular address.

Technical Interpretation of CAT20: New Token Protocol on Fractal Bitcoin

Summary

The design flexibility of CAT20 is very high, allowing users to independently construct various operations. This design has the following advantages:

  1. To check the token holdings, simply query the token's UTXO.
  2. The minting progress can be easily tracked through OP_RETURN data.

However, flexibility also brings security risks, and it is necessary to strengthen the verification logic in the contract. Overall, CAT20 brings new possibilities to the BTC ecosystem, and it is worth our continued attention to its development.

Technical Interpretation of CAT20: New Token Protocol on Fractal Bitcoin

Technical Interpretation of CAT20: New Token Protocol on Fractal Bitcoin

BTC-0.82%
View Original
This page may contain third-party content, which is provided for information purposes only (not representations/warranties) and should not be considered as an endorsement of its views by Gate, nor as financial or professional advice. See Disclaimer for details.
  • Reward
  • 4
  • Share
Comment
0/400
SignatureAnxietyvip
· 07-22 15:23
Is it really necessary to write so much? It's giving me a headache.
View OriginalReply0
RugDocDetectivevip
· 07-22 15:21
Another layer, a lump of code flavor.
View OriginalReply0
liquiditea_sippervip
· 07-22 15:21
Another layer of a vest, it gives me a headache.
View OriginalReply0
RegenRestorervip
· 07-22 15:13
Back then, Bitcoin was 2000 coins, and I regret it so much now.
View OriginalReply0
Trade Crypto Anywhere Anytime
qrCode
Scan to download Gate app
Community
English
  • 简体中文
  • English
  • Tiếng Việt
  • 繁體中文
  • Español
  • Русский
  • Français (Afrique)
  • Português (Portugal)
  • Bahasa Indonesia
  • 日本語
  • بالعربية
  • Українська
  • Português (Brasil)