CAT20 protocol: A new breakthrough in smart contracts on Fractal Bitcoin

robot
Abstract generation in progress

Smart Contracts on BTC: An In-Depth Analysis of the Fractal Bitcoin CAT20 Protocol

Recently, the Bitcoin ecosystem has witnessed a significant advancement. After several rounds of testnet, Fractal BTC officially launched its mainnet in September. One of the highlights of Fractal is its smart contracts functionality, and it introduced a new token protocol CAT20 at the launch of the mainnet. So, what clever features does CAT20 have in its technical design? What can we learn from it?

Technical Interpretation of CAT20: New Token Protocol on Fractal Bitcoin

Fractal Bitcoin Introduction

Before delving into CAT20, we need to understand Fractal Bitcoin. Their relationship is similar to ERC20 and ETH, as the CAT20 protocol is deployed on the Fractal Bitcoin network.

Fractal Bitcoin, also known as Fractal 比特币, is a fully compatible "layer two" network with BTC. Compared to BTC, its block confirmation time is shorter, taking only 1 minute. The basic principle, as its name suggests, is to replicate the BTC network multiple times, allowing each chain to process transactions, thereby increasing the overall processing speed.

One important feature of Fractal is the re-enabling of the BTC opcode OP_CAT, which was abandoned in the early days for security reasons. This move significantly enhances the functionality of Fractal Bitcoin, equipping it with the capability of smart contracts and opening up more possibilities for future development.

Technical Interpretation of CAT20: New Token Protocol on Fractal Bitcoin

CAT Protocol Analysis

With the underlying support of OP_CAT, the CAT Protocol has emerged. Currently, the CAT20 protocol is already running in practical applications.

deployment process

Before deploying the CAT20 token, users need to specify the wallet address and the basic information of the token. Compared to ERC20, CAT20 also allows for setting the pre-mining amount and the limit on the number minted each time.

The deployment is divided into two stages: "commit" and "reveal". In the "commit" stage, the output script of the transaction will write the basic information of the token. The transaction hash generated in the "commit" stage will serve as the unique identifier for that token.

The "reveal" phase will generate two key outputs: one OP_RETURN to store the initial state hash of the CAT20, and the other is the Minter, which is used for the subsequent minting process.

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

minting mechanism

During the minting process, the input of the transaction is a minter, initially generated during the deployment phase. Each minting has only one minter as input, but there can be multiple minters as outputs.

Interestingly, the number of outputs from the minter can be flexibly set. If only 1 is output each time, the available number of minters in the network will remain unchanged, which may lead to minting congestion. On the other hand, outputting multiple minters requires paying additional UTXO fees, which means some users need to voluntarily bear this part of the cost.

In the V2 version, two Minter with similar states are generated by default to balance efficiency and cost.

Technical Interpretation of CAT20: New Token Protocol on Fractal Bitcoin

technical details of transaction construction

The trading construction of CAT20 employs some clever techniques. For example, during the reveal process, by adjusting the logic of the Bitcoin script, users can control UTXOs that appear to be from different addresses. Meanwhile, the minter's UTXO may utilize the smart contract capabilities provided by OP_CAT, allowing anyone to use these UTXOs as inputs.

Technical Perspective on CAT20: New Token Protocol on Fractal Bitcoin

State Management

CAT20 stores state information in the minter, stored in OP_RETURN and smart contracts. After each minting, the newly generated minting amount of Minter will equal half of the remaining mintable amount until all have been minted.

Technical Interpretation of CAT20: New Token Protocol on Fractal Bitcoin

transfer and burn

When transferring, the number of input and output tokens in the transaction must remain consistent. To destroy tokens, simply transfer them to a regular address.

Technical Perspective on CAT20: A New Token Protocol on Fractal Bitcoin

Summary

The design of CAT20 provides users with great flexibility, while also placing higher demands on the verification logic of the smart contracts. This design facilitates the querying of token holdings and minting status, improving efficiency.

With the development of Fractal Bitcoin and CAT20, the Bitcoin ecosystem is moving towards richer application scenarios, bringing new possibilities for decentralized finance and smart contracts.

Technical Perspective on CAT20: New Token Protocol on Fractal Bitcoin

Technical Interpretation of CAT20: New Token Protocol on Fractal Bitcoin

FB-4.9%
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
  • 5
  • Repost
  • Share
Comment
0/400
PumpDetectorvip
· 7h ago
seen this pattern before.. kinda sus timing with all the whale movement lately ngl
Reply0
StakeOrRegretvip
· 8h ago
Smart contracts? Just a new tool to Be Played for Suckers.
View OriginalReply0
OnChainArchaeologistvip
· 8h ago
What about another smart contract?
View OriginalReply0
AlphaBrainvip
· 8h ago
Here comes the hype for a new protocol again.
View OriginalReply0
NftDeepBreathervip
· 8h ago
Looks like BTC is also playing with smart contracts?
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)