Как использовать протокол порядковых номеров для создания протоколов регистрации, таких как CBRC-20

D2

Администратор
Регистрация
19 Фев 2025
Сообщения
4,380
Реакции
0
Author : code666
Article for xss



How to use the ordinals protocol to create registration protocols like CBRC-20

Introduction
:

The Ordinals Protocol is a cryptographic protocol that allows data to be stored on the Bitcoin blockchain without modifying its structure or increasing its size. It uses cryptography and compression techniques to encode data in Bitcoin transactions, respecting the network's consensus rules. The ordinals protocol was developed by Casey Rodarmor in January 2023, and it made it possible to create non-fungible tokens (NFTs) directly on the Bitcoin blockchain¹.

CBRC-20, or "Cy [Bord]", is a fungible token standard that functions similarly to BRC-20, another standard based on the ordinals protocol. The difference is how the status of token balances is indexed off-chain, by a third party. Thus, CBRC-20 tokens do not require storing all information on the blockchain, which reduces the burden and fees. CBRC-20 tokens are also easier to integrate into exchanges and decentralized applications (dApps).

In this article, we will explain how to use the ordinals protocol to create registration protocols like CBRC-20. We will address the following points:

- What are the advantages of the ordinals protocol for creating tokens on Bitcoin?
- How does the ordinals protocol work to encode data on satoshis?
- How to create, deploy and use CBRC-20 tokens with the ordinals protocol?

What are the advantages of the ordinals protocol for creating tokens on Bitcoin?

The ordinals protocol has several advantages for creating tokens on Bitcoin, compared to other existing protocols, such as Omni Layer or Counterparty. Here are some of these benefits:

- The Ordinals protocol is compatible with existing wallets and platforms, as it uses the standard Bitcoin transaction format. There is no need to use specific software or services to manage tokens based on the ordinals protocol.

- The ordinals protocol is flexible, because it allows JSON type data to be stored on satoshis. JSON is an easy-to-read and manipulate data format that can represent objects, arrays, numbers, strings, Booleans or null values. Thus, the ordinals protocol can adapt to different types of tokens, such as NFTs, fungible tokens, governance tokens, etc.

- The ordinals protocol is secure, because it respects the principles of decentralization, transparency and security of the Bitcoin blockchain. Data stored on satoshis is protected by cryptography and network consensus. There is no risk of censorship, falsification or loss of tokens based on the ordinals protocol.

How does the ordinals protocol work to encode data on satoshis?

The ordinals protocol is based on the concept of registration, which is JSON type data associated with a satoshi. A registration may contain information about the name, symbol, amount and operation of the token. For example, here is an inscription that represents a CBRC-20 token named “Cy [Bord]”:

JSON: Скопировать в буфер обмена
Код:
{
"name": "Cy [Bord]",
"symbol": "CBRC",
"amount": 100,
"operation": "Mint"
}
Код: Скопировать в буфер обмена


To encode an inscription on a satoshi, the ordinals protocol uses the following steps:

- It converts the JSON registration into a binary string, using UTF-8 encoding.

- It compresses the binary string, using the Zlib compression algorithm.

- It adds a prefix and a suffix to the compressed string, to distinguish it from other data on the blockchain. The prefix is "0x6a4c50" and the suffix is "0x4f524449", which correspond respectively to the opcodes OP_RETURN, OP_PUSHDATA1 and the characters "ORDI" in hexadecimal.

- It splits the resulting string into 80-byte segments, which corresponds to the maximum OP_RETURN data size on the Bitcoin blockchain.

- It creates a Bitcoin transaction that contains one or more OP_RETURN outputs, with the segments of the chain as data. Each OP_RETURN output costs one satoshi, which is destroyed by the network. The transaction is signed with the private key of the token creator, and broadcast on the network.

Once the transaction is confirmed, the entry is stored on the Bitcoin blockchain, and can be read by anyone. To decode an inscription, simply do the reverse steps: extract the OP_RETURN data, remove the prefix and suffix, decompress the binary string, and convert it to JSON.

How to create, deploy and use CBRC-20 tokens with the ordinals protocol?

To create CBRC-20 tokens with the ordinals protocol, you must follow the following steps:

- Set token parameters, such as its name, symbol, maximum supply and limit per mint.

- Deploy the token on the Bitcoin blockchain, by creating a "Deploy" type registration with the token parameters, and associating it with a satoshi. This satoshi becomes the deployment satoshi, which serves as a reference for the token.

- Mint the token, by creating one or more “Mint” type inscriptions with the symbol of the token and the mint amount, and associating them with satoshis. These satoshis become mint satoshis, which represent the tokens issued.

- Transfer the token, by creating “Transfer” type inscriptions with the symbol of the token, the amount and the recipient, and associating them with satoshis. These satoshis become transfer satoshis, which represent the transferred tokens.

- Exchange the token, using decentralized exchange platforms (DEX) that support CBRC-20 tokens, such as [Unisat] or [Magic Eden]. These platforms make it possible to create trading pairs between tokens and bitcoin, and to provide liquidity to the markets.

To facilitate the creation, deployment and use of CBRC-20 tokens, there are several tools and interfaces that use the ordinals protocol, such as [UniSat Wallet] or [Magic Eden] . These tools allow you to choose token parameters, pay transaction fees in bitcoin, and manage registrations and associated satoshis.

Conclusion

The ordinals protocol is an innovative protocol that allows you to create tokens on the Bitcoin blockchain, using satoshis as a data carrier. It offers a simple, flexible and secure solution for the creation of diverse and innovative digital assets. CBRC-20 is an example of a fungible token standard based on the ordinals protocol, which aims to reduce costs and facilitate the integration of tokens into platforms and applications. We hope this article has given you a better understanding of how to use the ordinals protocol to create registration protocols like CBRC-20.
 
Сверху Снизу