Introduction to inscriptions

user-image
BEOSIN
BEOSIN
Mar 04, 2024

 

Introduction to inscriptions|Understand the use cases, implementation and asset security of inscription protocols

On February 1st, Binance Web3 Wallet officially launched its inscription market, supporting various inscription protocols such as BRC-20 and Ethscription. A few days ago, OKX also announced its support for inscription protocols such as ARC-20, Runes, Doginals, etc., which triggered the entire market's attention to inscriptions. During the wave of inscription, various security issues arise frequently due to the complexity and novelty of inscription protocols. This not only threatens users’ asset security, but also has a negative impact on the healthy development of the entire Inscription ecosystem.

In response to this, Beosin security team will analyze the mainstream inscription protocols to help users understand the purpose and implementation of the inscription protocols and how to protect inscription assets.

Introduction to inscriptions

The so-called inscription on the blockchain is to record some specific and meaningful information on the blockchain through certain characteristics of the blockchain. Once this information is recorded on the blockchain, it will be permanently stored on the blockchain and difficult to tamper with. The information recorded to the blockchain can be of many types, such as simple text information, complex codes, images, etc. can be written to the blockchain. In this way, we can use a set of standards to implement the functions of digital assets.

Current status of inscriptions

From the initial emergence of Bitcoin Inscriptions such as BRC-20, to the current Inscription ecology, there are endless new Inscription protocols and new projects emerging almost every day. The development of Inscription can be said to be advancing by leaps and bounds. Various common public chains have also joined the inscription ecosystem, such as the Ethscription protocol on the ETH public chain, the ARC-20 protocol on the BTC public chain, BSC-20 and other protocols on the BSC public chain, and the PRC- on the Polygon public chain. 20 etc agreement …. These protocols are all generated for the purpose of publishing inscriptions on their public chains. In the following content, we will introduce the implementation methods and use cases of various protocols.

Detailed explanation of inscription 

Let’s introduce the protocols that currently attract a lot of attention in the market, and compare the commonalities and differences between the inscription protocols of various public chains.

1. BRC-20

To explain BRC-20 clearly, we must first introduce UTXO and Ordinals.

BTC uses the UTXO model, and transactions are transferred in UTXO units. UTXO is the abbreviation of Unspent Transaction Output, which means unspent transaction output. The UTXO model is different from the account model of public chains such as Ethereum in that it records transaction events but not the final status. To calculate how many Bitcoins a user has, you need to sum up all the UTXOs of his address, and the result is the number of coins held by the user.

Ordinals is a systematic protocol for numbering Satoshis (sats), the smallest unit of Bitcoin. It can assign a unique number to each Satoshi in each UTXO (including several Satoshis). Ordinals also supports the function of writing text, pictures, audio, video, etc. to satoshis, making each satoshi unique, similar to the familiar Ethereum non-fungible token NFT, which we call Bitcoin NFT.

The founder of BRC-20 came up with another concept based on the Ordinals protocol. Since the Ordinals protocol can create Bitcoin NFTs by giving each Satoshi different "attributes", it can also create Bitcoin FTs by giving a unified "format" and "attributes", that is, homogeneous tokens.

BRC-20 writes unified JSON format text data into Satoshi through the Ordinals protocol. This text data is the accounting book of BRC-20 tokens. Based on this text data, token holdings and transfers can be parsed, which mainly includes the following contents:


The above are the three standards of BRC-20. Among them, the op field represents the operation that needs to be performed, including deploy (deployment), mint (minting) and transfer (transfer). The tick represents the name of the token that needs to be performed. max represents the total amount of tokens issued, lim represents the maximum number of coins minted per token, amt represents the number of tokens that need to be operated. In the transfer standard, there are also fields such as "to", but this is not necessary. Transfer is done by The inscription is sent to the target address to implement the balance change.

2. ARC-20

ARC-20 is still the inscription protocol on the Bitcoin public chain. Like the BRC-20 protocol, it is implemented by writing standard data in UTXO, but the difference is that the ARC-20 protocol does not need to specify ARC-20 in the data. Instead, the number of ARC-20 tokens is represented by sats (satoshi, the smallest unit of Bitcoin) in the UTXO. The rule is 1 sat=1 ARC-20 token.

The ARC-20 protocol, like the BRC-20 protocol, is also divided into three steps: deployment, minting, and transfer. In the deployment phase, the standard token name, total amount of tokens, casting restrictions, and block information need to be filled in the UTXO. , image information, etc.; in the minting stage, the user needs to fill in the name of the token into the UTXO, and the number of sats of the UTXO is the minting amount of the ARC-20 token , and is not filled in the UTXO together with the token name; when the user mints ARC-20 tokens can be sent to other addresses. When sending tokens, users do not need to fill in any data in the UTXO, but directly transfer the UTXO holding the token to other addresses.

When querying ARC-20 tokens, only one index is needed. The offline index server can read the token registration information and minting and transfer transactions. There is no need for the server to calculate the fund transfer relationship and query the ARC-20 tokens owned by the address. The quantity can be obtained by directly reading the sats quantity of the UTXO holding the token.

After understanding BRC-20 and ARC-20, you should know why some people mistakenly transfer inscribed assets to other addresses or "burn" them.

Since BTC inscription protocols such as BRC-20 and ARC-20 are based on UTXO transactions, inscription transactions are actually appended to BTC transactions, and users may perform ordinary BTC transfer operations without fully understanding the inscription. Its current UTXO is merged and split with other UTXOs and then sent to unintended addresses, causing the inscribed assets to be mistransferred or "burned", causing irreversible losses.

3. Ethscription

Ethscription is a protocol for creating and sharing data on Ethereum. Some inscriptions use this protocol to replace smart contracts to implement token issuance. Using inscriptions can reduce user costs to extremely low levels.

When Ethereum sends a transaction, it provides a calldata data block. Generally, this data block will be left blank for ordinary ETH transfers. If a smart contract is called, the data block will be designated as the signature of the calling function and each parameter data. The Ethscription protocol uses the calldata data block to add some standard data to give relevant meaning when sending ordinary ETH transfers.

How does Ethscription specify these standard data?

First, if you want to create an Ethscription whose content is image data, you need to convert the image (image size is limited to 96KB) into a URI of Base64-encoded data in the format (data:image/png;base64,...); next Convert the URI to a hexadecimal string; send an ordinary transfer transaction to the target address through Ethereum, and fill in the above hexadecimal string into calldata, as shown below:

In this way, the 0xf1bf address owns the Ethscription, and any Ethscription created later with the same calldata will be considered invalid.

If you want to transfer the Ethscription, you need the Ethscription owner to send an ordinary transfer to the receiving address, and fill in the transaction hash that created the Ethscription in the calldata, then the receiving address will own the Ethscription, as shown below:

4. Inscription of EVM Blockchain

For EVM blockchains such as BSC Chain, Ethereum, and polygon, there is a common method of burning inscriptions, which is to use the calldata data block to store fixed format data . Different from the above-mentioned saving of image data, this method is to write a standard format into the calldata. text data.

When inscriptions are burned on the BSC Chain, the inscription format is similar to the BRC20 inscription format. For example, the inscription format is: data:,{"p":"_","op":"_","tick":"_"," amt":"_"}, then the p field represents the protocol name, such as bsc-20, bnbs-20, ltc-20, bep-20, drc-20, nrc-20, src-20, etc.; The op field represents the operation, usually "mint"; the tick field represents the token name; the amt field represents the number of tokens.

Taking the bnbs token as an example, we can see that as long as an ordinary transfer is sent to the target address, fill in data:,{"p":"bsc-20","op":"mint" in the calldata ,"tick":"bnbs","amt":"1000"} then completes the bnbs token minting operation, as shown below. At this time, the 0x22ef address has 1,000 bnbs tokens.