bc1plainview / cat20

FAIR CAT-20: A Fair Experimental Bitcoin Token Standard Leveraging OP_CAT & Ordinal Consensus
10 stars 0 forks source link

FAIR CAT-20: A Fair Experimental Bitcoin Token Standard Leveraging OP_CAT & Ordinal Consensus

Welcome to the official documentation for CAT-20, an innovative and experimental metaprotocol standard for fungible tokens on the Bitcoin blockchain. This version of CAT-20, created by Twitter user @bc1plainview, predates the newer CAT-20 standard by sCrypt by one month. Inspired by BRC-20 and rooted in Ordinals, this experimental CAT-20 introduces the use of Bitcoin's OP_CAT opcode to streamline token creation and management.

Note: This CAT-20 is purely experimental and will only be operational on Fractal Mainnet after block 21,000. As such, anyone is free to build an indexer for it, and it operates similarly to BRC-20 in terms of minting, deploying, and transferring tokens via Ordinal inscriptions.

For more information on the newer CAT-20 standard created by sCrypt, you can check out ProtocolCAT. However, this document will focus solely on the experimental CAT-20 designed by bc1plainview, which is based on Ordinals and should feel familiar to users accustomed to BRC-20.


What is CAT-20?

CAT-20 is a cutting-edge token standard specifically designed for Bitcoin, leveraging the powerful capabilities of the OP_CAT opcode to handle token operations more efficiently. With CAT-20, token creation, minting, and transferring are all performed directly within Bitcoin’s script language, minimizing off-chain dependencies and ensuring efficient on-chain operations.

This experimental version of CAT-20 is fully compatible with Bitcoin's Ordinal system, meaning that deploying, minting, and transferring tokens is as simple as creating Ordinal inscriptions, just like with BRC-20 tokens.


Why CAT-20?

CAT-20 introduces several key advantages over previous standards, such as BRC-20:


The Power of OP_CAT in CAT-20

At the heart of CAT-20 is the OP_CAT opcode, a critical tool that allows the concatenation of two values on the Bitcoin stack. This capability is essential for constructing efficient token operations within a single Bitcoin transaction.

How OP_CAT Works:

  1. Pushing Values to the Stack: The script pushes various components of the token operation (e.g., protocol identifier, operation type, ticker, etc.) onto the stack.
  2. Concatenation with OP_CAT: OP_CAT pops the top two items from the stack, concatenates them, and pushes the result back onto the stack. This process is repeated for each element, gradually building the final operation string.
  3. Final Output: The final output is a concatenated string that represents the token operation (e.g., deployment, minting, or transferring), which is then inscribed on the blockchain.

Example: Deploying a CAT-20 Token

Let’s walk through a simple example to demonstrate the power of OP_CAT in a CAT-20 token deployment. In this case, we will deploy a CAT-20 token called CAT with a maximum supply of 210,000,000 tokens, a mint limit of 1 token per inscription, and 8 decimal places.

Deployment Script:

OP_FALSE OP_IF
    OP_PUSH "ord"                  # Ordinal magic code
    OP_PUSH 1                      # Version number
    OP_PUSH "text/plain;charset=utf-8"  # MIME type
    OP_PUSH 0                      # Push 0 to signal start of data

    # Begin CAT-20 deploy operation
    OP_PUSH "cat20:"
    OP_CAT

    OP_PUSH "deploy:"
    OP_CAT

    OP_PUSH "CAT="
    OP_CAT

    OP_PUSH "210000000,"
    OP_CAT

    OP_PUSH "lim=1,"
    OP_CAT

    OP_PUSH "dec=8"
    OP_CAT

    # End of CAT-20 deploy operation
OP_ENDIF

Concatenated Output:

"cat20:deploy:CAT=210000000,lim=1,dec=8"

This script showcases the efficiency and simplicity of CAT-20. Each component of the deployment is pushed to the stack and concatenated using OP_CAT, resulting in a fully-formed deployment string that is inscribed on the Bitcoin blockchain.


Experimental Nature of CAT-20

This version of CAT-20 is experimental, and its full functionality will only be available after block 21,000 on the Fractal Mainnet. As an open standard, anyone can create an indexer for CAT-20 tokens, making it a highly flexible and community-driven protocol. Since CAT-20 is based on Ordinals, users familiar with BRC-20 will find the process of minting, deploying, and transferring tokens straightforward and familiar.

Keep in mind that this CAT-20 is purely for experimentation and development purposes. It provides the opportunity for the Bitcoin community to explore new ways of handling fungible tokens on Bitcoin using OP_CAT, while maintaining the simplicity and compatibility of the Ordinals system.


Conclusion

CAT-20 represents a significant step forward in how tokens can be managed on Bitcoin. By incorporating the OP_CAT opcode, CAT-20 simplifies token operations, reduces reliance on off-chain systems, and enhances Bitcoin’s native scripting capabilities. As an experimental protocol, it is open for developers and enthusiasts to test, modify, and build indexers.

In the following sections, we will explore how to deploy, mint, and transfer CAT-20 tokens, as well as the specific rules that govern the CAT-20 metaprotocol. Stay tuned as we delve deeper into the world of CAT-20, where efficiency and innovation meet on the Bitcoin blockchain.

CAT-20 Token Operations: Deploying, Minting, and Transferring

In this section, we’ll walk through the detailed process of deploying, minting, and transferring CAT-20 tokens on the Bitcoin blockchain. Each operation leverages the power of the OP_CAT opcode within the Ordinal Envelope to ensure efficient and streamlined execution. Whether you’re creating a new token or managing an existing one, these instructions will guide you through the steps.


1. Deploying a CAT-20 Token

The deployment process initializes a new CAT-20 token with specific parameters like the ticker, maximum supply, mint limit, and decimal precision. Here’s how to deploy a CAT-20 token:

Script for Deploying a CAT-20 Token:

OP_FALSE OP_IF
    OP_PUSH "ord"                  # Ordinal magic code
    OP_PUSH 1                      # Version number
    OP_PUSH "text/plain;charset=utf-8"  # MIME type
    OP_PUSH 0                      # Push 0 to signal start of data

    # Begin CAT-20 deploy operation
    OP_PUSH "cat20:"
    OP_CAT

    OP_PUSH "deploy:"
    OP_CAT

    OP_PUSH "CAT="
    OP_CAT

    OP_PUSH "210000000,"
    OP_CAT

    OP_PUSH "lim=1,"
    OP_CAT

    OP_PUSH "dec=8"
    OP_CAT

    # End of CAT-20 deploy operation
OP_ENDIF

Final Concatenated String:

"cat20:deploy:CAT=210000000,lim=1,dec=8"

Explanation:

Once this script is inscribed on the Bitcoin blockchain, it creates a new CAT-20 token with the specified parameters.


2. Minting CAT-20 Tokens

Minting creates new tokens within the limits set during deployment. The first wallet to inscribe a mint operation will receive the specified amount of tokens.

Script for Minting CAT-20 Tokens:

OP_FALSE OP_IF
    OP_PUSH "ord"                  # Ordinal magic code
    OP_PUSH 1                      # Version number
    OP_PUSH "text/plain;charset=utf-8"  # MIME type
    OP_PUSH 0                      # Push 0 to signal start of data

    # Begin CAT-20 mint operation
    OP_PUSH "cat20:"
    OP_CAT

    OP_PUSH "mint:"
    OP_CAT

    OP_PUSH "CAT="
    OP_CAT

    OP_PUSH "1"
    OP_CAT

    # End of CAT-20 mint operation
OP_ENDIF

Final Concatenated String:

"cat20:mint:CAT=1"

Explanation:

This script mints 1 CAT token to the wallet that inscribes this operation. The minting process respects the limits set during the deployment.


3. Transferring CAT-20 Tokens

Transferring CAT-20 tokens involves moving a specified amount from one wallet to another. The transfer script ensures that the correct amount is deducted from the sender’s balance and added to the receiver’s balance.

Script for Transferring CAT-20 Tokens:

OP_FALSE OP_IF
    OP_PUSH "ord"                  # Ordinal magic code
    OP_PUSH 1                      # Version number
    OP_PUSH "text/plain;charset=utf-8"  # MIME type
    OP_PUSH 0                      # Push 0 to signal start of data

    # Begin CAT-20 transfer operation
    OP_PUSH "cat20:"
    OP_CAT

    OP_PUSH "transfer:"
    OP_CAT

    OP_PUSH "CAT="
    OP_CAT

    OP_PUSH "5"
    OP_CAT

    # End of CAT-20 transfer operation
OP_ENDIF

Final Concatenated String:

"cat20:transfer:CAT=5"

Explanation:

When this script is executed, 5 CAT tokens are transferred from the sender’s wallet to the receiver’s wallet.


Summary

Deploying, minting, and transferring CAT-20 tokens are all managed through Bitcoin’s script language, enhanced by the OP_CAT opcode. Each operation concatenates its respective components into a final string that represents the action on-chain. This method not only leverages Bitcoin’s existing infrastructure but also introduces a level of efficiency and simplicity that makes CAT-20 a powerful tool for token management on the Bitcoin blockchain.

In the next section, we will dive into the specific rules and guidelines that govern the CAT-20 metaprotocol, ensuring consistent and reliable operation across the network.

Practical Examples: Deploying, Minting, and Transferring CAT-20 Tokens

In this section, we'll provide practical, hands-on examples of how to deploy, mint, and transfer CAT-20 tokens on the Bitcoin blockchain. These examples will guide you through the process step by step, using the scripts and rules outlined in the previous sections.


1. Deploying a CAT-20 Token

Let’s start with an example of deploying a new CAT-20 token called CAT with a maximum supply of 210,000,000 tokens, a mint limit of 1,000 tokens per inscription, and 8 decimal places.

Deployment Script:

OP_FALSE OP_IF
    OP_PUSH "ord"                  # Ordinal magic code
    OP_PUSH 1                      # Version number
    OP_PUSH "text/plain;charset=utf-8"  # MIME type
    OP_PUSH 0                      # Push 0 to signal start of data

    # Begin CAT-20 deploy operation
    OP_PUSH "cat20:"
    OP_CAT

    OP_PUSH "deploy:"
    OP_CAT

    OP_PUSH "CAT="
    OP_CAT

    OP_PUSH "210000000,"
    OP_CAT

    OP_PUSH "lim=1,"
    OP_CAT

    OP_PUSH "dec=8"
    OP_CAT

    # End of CAT-20 deploy operation
OP_ENDIF

Final Concatenated String:

"cat20:deploy:CAT=210000000,lim=1,dec=8"

Outcome:

This deployment script initializes a new CAT-20 token with the ticker CAT, a maximum supply of 210,000,000 tokens, a mint limit of 1,000 per inscription, and 8 decimal places. The script is inscribed on the blockchain, making the CAT token officially deployed and available for minting.


2. Minting CAT-20 Tokens

Once a token is deployed, you can mint additional tokens up to the maximum supply defined during deployment. In this example, we’ll mint 1,000 CAT tokens.

Minting Script:

OP_FALSE OP_IF
    OP_PUSH "ord"                  # Ordinal magic code
    OP_PUSH 1                      # Version number
    OP_PUSH "text/plain;charset=utf-8"  # MIME type
    OP_PUSH 0                      # Push 0 to signal start of data

    # Begin CAT-20 mint operation
    OP_PUSH "cat20:"
    OP_CAT

    OP_PUSH "mint:"
    OP_CAT

    OP_PUSH "CAT="
    OP_CAT

    OP_PUSH "1"
    OP_CAT

    # End of CAT-20 mint operation
OP_ENDIF

Final Concatenated String:

"cat20:mint:CAT=1"

Outcome:

This minting script creates 1,000 CAT tokens and assigns them to the first wallet that inscribes this operation. This operation respects the mint limit of 1,000 tokens per inscription, as specified during deployment.


3. Transferring CAT-20 Tokens

After minting, you may want to transfer tokens to another wallet. In this example, we’ll transfer 500 CAT tokens from one wallet to another.

Transfer Script:

OP_FALSE OP_IF
    OP_PUSH "ord"                  # Ordinal magic code
    OP_PUSH 1                      # Version number
    OP_PUSH "text/plain;charset=utf-8"  # MIME type
    OP_PUSH 0                      # Push 0 to signal start of data

    # Begin CAT-20 transfer operation
    OP_PUSH "cat20:"
    OP_CAT

    OP_PUSH "transfer:"
    OP_CAT

    OP_PUSH "CAT="
    OP_CAT

    OP_PUSH "5"
    OP_CAT

    # End of CAT-20 transfer operation
OP_ENDIF

Final Concatenated String:

"cat20:transfer:CAT=5"

Outcome:

This transfer script moves 500 CAT tokens from the sender’s wallet to the receiver’s wallet. The script ensures that the correct amount is deducted from the sender's balance and added to the receiver's balance upon completion of the transfer.


4. Advanced Example: Combined Operations

For users who wish to perform multiple operations in a single script, CAT-20 allows for flexibility. Here’s an example of minting and then immediately transferring 200 CAT tokens to another wallet.

Combined Mint and Transfer Script:

OP_FALSE OP_IF
    OP_PUSH "ord"                  # Ordinal magic code
    OP_PUSH 1                      # Version number
    OP_PUSH "text/plain;charset=utf-8"  # MIME type
    OP_PUSH 0                      # Push 0 to signal start of data

    # Begin CAT-20 mint operation
    OP_PUSH "cat20:"
    OP_CAT

    OP_PUSH "mint:"
    OP_CAT

    OP_PUSH "CAT="
    OP_CAT

    OP_PUSH "1"
    OP_CAT

    # Begin CAT-20 transfer operation
    OP_PUSH "cat20:"
    OP_CAT

    OP_PUSH "transfer:"
    OP_CAT

    OP_PUSH "CAT="
    OP_CAT

    OP_PUSH "2"
    OP_CAT

    # End of CAT-20 operations
OP_ENDIF

Final Concatenated Strings:

Outcome:

This combined script first mints 200 CAT tokens and then immediately transfers them to another wallet. This example demonstrates the flexibility of CAT-20 scripts, allowing multiple operations to be chained together in a single transaction.


Conclusion

These practical examples provide a clear roadmap for using CAT-20 tokens on the Bitcoin blockchain. By following these scripts, you can confidently deploy, mint, and transfer tokens, taking full advantage of the power and flexibility offered by the OP_CAT opcode.

Whether you’re a developer, a token creator, or simply exploring the possibilities of CAT-20, these examples will serve as your guide to executing token operations efficiently and effectively. As CAT-20 continues to evolve, so too will the strategies and best practices for managing tokens on Bitcoin, opening up new opportunities for innovation and growth.

CAT-20 Rules and Guidelines

The CAT-20 standard is governed by a set of rules and guidelines that ensure consistent behavior, compatibility, and security across the Bitcoin network. Understanding these rules is essential for anyone looking to deploy, mint, or transfer CAT-20 tokens. This section outlines the key rules and best practices to follow when working with CAT-20 tokens.


1. Ticker Uniqueness and Case Sensitivity


2. Maximum Supply and Mint Limits


3. Decimal Precision


4. Token Operations and Balance Management

Transfer Validation and Redundancies


5. Order of Operations and Block Confirmation


6. Inscriptions and Transaction Fees


7. Security and Best Practices

Best Practices:


Conclusion

By adhering to these rules and guidelines, you can ensure that your CAT-20 tokens are managed effectively and securely on the Bitcoin blockchain. Understanding these principles is key to leveraging the full potential of CAT-20, whether you are deploying new tokens, minting additional supply, or transferring tokens between wallets.