Bitcoin ecosystem
Introduction

Introduction#

The Bitcoin Ecosystem is a cornerstone of the blockchain landscape. As the inaugural decentralized digital currency, Bitcoin has the largest market capitalization, unmatched security due to extensive computational power, and unparalleled decentralization. Its influence extends across the cryptocurrency market, setting trends and precedents.

Distinctively, Bitcoin serves as a 'digital gold', acting as a store of value with a limited supply, distinguishing it from other application-focused cryptocurrencies. Its widespread adoption, acceptance by a multitude of merchants, and integration by various service providers underscore its prominence. Despite the emergence of other blockchain ecosystems, Bitcoin's foundational role and influence remain significant in the blockchain and cryptocurrency sectors.

What is Ordinals?#

Ordinals are a protocol that allows for the inscription of unique data on individual satoshis, the smallest unit of Bitcoin. This unique data can represent a variety of things, such as tokens or other forms of data.

Ordinal theory#

Ordinal theory is a way of numbering and tracking individual satoshis (the smallest unit of Bitcoin) using a numbering system called ordinal numbers. These numbers are assigned based on the order in which the satoshis are mined and transferred in transactions. Ordinal numbers, such as integer, decimal, degree, and percentile notations, can be represented differently.

One key aspect of ordinal theory is its potential for creating rarity levels for satoshis based on the timing of certain events in the Bitcoin network, such as block mining, difficulty adjustments, and halvings.

These rarity levels are defined as...

  • Common: This applies to any satoshi, not the first sat of its block. These are the most common sats in Bitcoin and can be found in almost every transaction.

  • Uncommon: The first satoshi of each block. These sats are relatively rare since only about 144 new blocks are added to the Bitcoin blockchain daily.

  • Tare: This is the first satoshi of Bitcoin's difficulty adjustment period. It occurs every 2016 blocks, or every two weeks.

  • Epic: The first satoshi of each halving epoch. A halving epoch occurs every 210,000 blocks, or approximately every four years.

  • Legendary: The first satoshi of each cycle. A cycle is a longer term Bitcoin market cycle that spans from one halving to the next.

  • Mythic: The first satoshi of the Genesis block. This is the first ever Bitcoin transaction, which was included in the very first block of the Bitcoin blockchain. Mythic sats are the rarest of all, occurring only once in the entire history of Bitcoin. On December 14th, 2022, artist and programmer Casey Rodarmor, who launched the Bitcoin ordinals protocol, inscribed pixel art of a skull as the genesis ordinal.

One phrase you may read a lot is 'degree notation'. This refers to a way of representing an ordinal number that makes it easy to see the rarity of a satoshi at a glance. The notation includes block height, difficulty adjustment period, halving epoch, and cycle information.

Ordinal inscription mechanics#

Imagine you have an awesome video you want to share with the world. You can now "inscribe" it onto the Bitcoin blockchain using ordinal inscriptions. This creates a unique digital artifact, like an NFT, but it's entirely built on the Bitcoin network without needing a separate token or sidechain.

Once your digital content is inscribed onto the blockchain, it becomes a permanent record that can't be changed or deleted. This means you can trust that your content is genuine and original, as can anyone who wants to buy or sell it. You can even send it to other Bitcoin addresses like regular Bitcoin transactions.

The way inscriptions work, as we mentioned, is based on ordinal theory, where each sat has a specific order and value. This makes sending and receiving inscribed sats possible, but it also means that transactions must be carefully constructed to follow the rules of ordinal theory.

The inscribed content is stored entirely on the blockchain using "taproot script-path spend scripts". It doesn't sound effortless, but it's a way of storing your digital content efficiently and economically. It also means your content can be returned from a web server, like regular web pages, and remixed with other inscriptions to create a new artifact.

You must undergo a two-phase commit/reveal procedure to make an inscription. This means you first create a taproot output that commits to a script containing your inscription content, then spend that output to reveal the content on the blockchain. Next, the content is serialized using "envelopes", which are a way of wrapping up the content and metadata so that other users can easily read it. We'll provide the steps in the next section, if you're a programmer, but don't worry if you're not; we've got a solution for you.

What is BRC20?#

BRC-20 is a fungible token standard made explicitly for the Bitcoin blockchain. BRC-20 uses ordinal inscriptions of JavaScript Object Notation (JSON) to deploy token contracts and mint and transfer tokens. Tokens can be attributed to satoshis and then traded or swapped with others, just like with other tokens.

Although it sounds similar to Ethereum's ERC-20 token standard, there are key differences you need to be aware of. BRC-20 uses a proof-of-work mechanism since it's on the Bitcoin blockchain, while ERC-20 uses proof-of-stake mechanism on the Ethereum blockchain.

The BRC-20 token standard also doesn't support smart contracts, a feature that has made ERC-20 tokens popular in the DeFi community. Smart contracts enable developers to create programmable money, automating various financial processes and creating new types of financial products. However, despite this limitation, BRC-20 tokens like ORDI, PEPE, and PUNK are gaining traction and attention.

The benefits of BRC-20#

While it's still early days for BRC-20, the token standard is gaining momentum as people experiment with its capabilities.

  • Fungibility: BRC-20 tokens are fungible, meaning they are interchangeable and easily traded on exchanges. Bitcoin can be intimidating to new traders, but the innovation of BRC-20 provides an opportunity to use the Bitcoin blockchain without trading BTC itself.
  • Security: BRC-20 tokens are built on the Bitcoin protocol, known for its high level of security and resistance to hacking attempts. This is due to Bitcoin's use of a proof-of-work mechanism, which makes it difficult for attackers to manipulate the blockchain.
  • Compatibility: BRC-20 tokens are designed to work seamlessly with the Bitcoin protocol, which means they can be easily integrated into the Bitcoin ecosystem. There are also relatively low barriers to entry for developers looking to build on top of the Bitcoin protocol.

What is BRC20-S?#

BRC20-S is a simplified version of the BRC20 token standard. It is designed to be easier to use and more accessible for developers and users, while still maintaining the key features of the original BRC20 standard.

With the introduction of BRC20-S, users can now stake their own BRC-20 tokens or bitcoin and receive BRC20-S tokens in return. BRC20-S tokens are an extension of the functionality of BRC-20 tokens, with an added description of the staking protocol. In this way, BRC-20 token holders can be rewarded for putting their digital assets to work, demonstrating their commitment to the community, and participating in the Bitcoin network.

BRC20-S protocol is open-source and available for all developers to build upon.

Motivation#

The introduction of BRC20-S and its staking functionalities provide BRC-20 token holders and projects with expanded design space and additional opportunities to engage with their communities.

By implementing BRC20-S, we envision a future where BRC-20 token and Bitcoin holders can do more with their tokens and be rewarded for their commitment towards the ecosystem. This staking mechanism introduces a new dimension to the BRC-20 token ecosystem, fostering greater participation, and a stronger connection between token holders and the underlying blockchain network.

Specifications#

User scenarios#

Project team

  • Issuing their own BRC20-S tokens by creating a staking pool, gaining seed users

Users

  • Staking BTC earns other BRC20-S like abcd (newly issued BRC20-S token)
  • Staking BRC-20 tokens earns other BRC20-S like abcd (newly issued BRC20-S token)

Interaction flow#

interaction-flow

Project Party: Carries out the deploy operation, defining the attributes of the staking pool, including the staking token, earned token, mining rate, total mining rewards, and permission for coin holders to engage in multi-mining. Following this operation, the user's deposit operation will be recognized and recorded (following the BRC-20).

User: Executes staking activities such as depositing, minting (claiming), and withdrawing. Users have the freedom to claim their mining rewards at any time by minting earned tokens.

Server: Performs a comprehensive interpretation of the BRC-20 and BRC20-S proposal, providing an open-source interface for profit calculation. The staking profits for any user are consistently computed using both the backend and open-source tools, ensuring uniformity across all calculations.

Instruction#

instruction

Operations#

  1. Deploy brc20-s pool
// case 1: 
{
  "p": "brc20-s",
  "op": "deploy",
  "t": "pool",
  "pid": "f7c515d6b7#01",
  "stake": "btc",
  "earn": "abcd",
  "erate": "10",
  "dmax": "21000000",
  "total": "21000000",
  "only": "1",
  "dec": 18
}

// case 2: 
{
  "p": "brc20-s",
  "op": "deploy",
  "t": "fixed",
  "pid": "f7c515d6b7#01",
  "stake": "btc",
  "earn": "abcd",
  "erate": "10",
  "dmax": "12000000",
  "total": "21000000",
  "only": "1",
  "dec": 18
}
{
  "p": "brc20-s",
  "op": "deploy",
  "t": "pool",
  "pid": "f7c515d6b7#02",
  "stake": "ordi",
  "earn": "abcd",
  "erate": "100",
  "dmax": "9000000",
  "total": "21000000",
  "only": "1",
  "dec": 18
}

User can choose whether to put all BRC20-S tokens as mining rewards in a single pool.

  • In case 1, the user puts the total supply of abcd tokens (21,000,000) as mining rewards in the f7c515d6b7#01 pool.
  • In case 2, the user puts 12,000,000 abcd tokens as mining rewards in the f7c515d6b7#01 pool and the remaining 9,000,000 abcd tokens in the f7c515d6b7#02 pool. In order to better understand the erate field, let's take the example of case 2 mentioned above.
  • In the "f7c515d6b7#01" pool, which is of type "fixed", the user's earnings depend on the amount of tokens they have staked: userReward = erate * userStakeAmount .
  • In the "f7c515d6b7#02" pool, which is of type "pool", the user's earnings depend on the proportion of tokens they have staked in the pool: userReward = erate * userStakeAmount / totalStakeAmount .
KeyRequiredDescription
pYesProtocol: Helps other systems identify and process brc20-s events
opYesOperation: Type of event (deploy, deposit, mint, withdraw, transfer)
tYestype: type of earning(pool, fixed). pool: share earning with all pool deposits. fixed: earn solo,and have a fixed rate.
pidYes10 letter identifier of the tick id + "#" + 2 letter of pool number
stakeYesticker: 4 letter identifier of the brc-20, "btc" for special
earnYesticker: 4-6 letter identifier of the brc20-s, "btc" for special
erateYesdistribution rate every block
dmaxYesmaximum token distribution of the pool
totalYestotal distribution of the token (specified by tick ID)
onlyYesassets only deposit this pool, must be yes
decNodecimal precision of earn token, default: 18
  1. Stake: deposit brc-20 token/btc into brc20-s pool
{
  "p": "brc20-s",
  "op": "deposit",
  "pid": "f7c515d6b7#01",
  "amt": "100"
}
KeyRequiredDescription
pYesProtocol: Helps other systems identify and process brc20-s events
opYesOperation: Type of event (deploy, deposit, mint, withdraw, transfer)
pidYes10 letter identifier of the tick id + "#" + 2 letter of pool number
amtYesAmount to deposit: States the amount of the brc-20 to deposit
  1. Claim: mint brc20-s earned token

Notice: Users simply need to mint brc20-s inscriptions to execute the "claim" operation and realize profits.

{ 
  "p": "brc20-s",
  "op": "mint",
  "tick": "abcd",
  "pid": "f7c515d6b7#01",
  "amt": "100"
}
KeyRequiredDescription
pYesProtocol: Helps other systems identify and process brc20-s events
opYesOperation: Type of event (deploy, deposit, mint, withdraw, transfer)
tickYesTicker: 4-6 letter identifier of the brc20-s
pidYes10 letter identifier of the tick id + "#" + 2 letter of pool number
amtYesAmount to mint: States the amount of the brc20-s to mint. Has to be less than "lim" above if stated
  1. Unstake: withdraw brc-20 token/btc from brc20-s pool

Notice: the logic for withdrawing and transferring staking tokens is equivalent.

{ 
  "p": "brc20-s",
  "op": "withdraw",
  "pid": "f7c515d6b7#01",
  "amt": "100"
}
KeyRequiredDescription
pYesProtocol: Helps other systems identify and process brc20-s events
opYesOperation: Type of event (deploy, deposit, mint, withdraw, transfer)
pidYes10 letter identifier of the tick id + "#" + 2 letter of pool number
amtYesAmount to withdraw: States the amount of the brc-20 to withdraw
  1. Transfer brc20-s token

Be careful when using inscription service. Some tools first inscribe and transfer to themselves and then forward it to the customer. So make sure to send tokens to the address that holds the balance, especially in the situation that some ordinal compatible wallet generates a different address each time.

{ 
  "p": "brc20-s",
  "op": "transfer",
  "tid": "f7c515d6b7",
  "tick": "abcd",
  "amt": "100"
}
KeyRequiredDescription
pYesProtocol: Helps other systems identify and process brc20-s events, same compatible with brc-20 in transfer op
opYesOperation: Type of event (deploy, deposit, mint, withdraw, transfer)
tidYes10 letter identifier of the tick id,pool number not included
tickYesTicker: 4-6 letter identifier of the brc20-s
amtYesAmount to transfer: States the amount of the brc20-s to transfer

The parsing rules of BRC20-S are compatible with BRC-20. When there are line breaks or spaces between the text fields in the JSON, it does not affect the parsing result. The validity of the inscription is determined according to the rules of the field itself.

Rules#

Tick id(tid) generation rule#

pid: 10 letter identifier of the tick id (tid) + "#" + 2 letter of pool number.

The rule for generating tid is as follows:

Take the values from the plaintext information and combine them in order. Apply a hash operation, specifically SHA256, and obtain the first 10 characters.

Here is an example of generating a tid based on the provided information:

input:

  • tick = "abcd",
  • total = "21000000",
  • dec = "18",
  • from = "bc1pvk535u5eedhsx75r7mfvdru7t0kcr36mf9wuku7k68stc0ncss8qwzeahv",
  • to = "bc1pvk535u5eedhsx75r7mfvdru7t0kcr36mf9wuku7k68stc0ncss8qwzeahv"

tid example:

  • SHA256("abcd2100000018bc1pvk535u5eedhsx75r7mfvdru7t0kcr36mf9wuku7k68stc0ncss8qwzeahvbc1pvk535u5eedhsx75r7mfvdru7t0kcr36mf9wuku7k68stc0ncss8qwzeahv")
  • d15a61a12da6dfa51d386477ecadc35bbddddfb47733401fcd44bae5162a16ab => First 10 characters => tid: d15a61a12d

Passive withdraw rule#

When users stake their tokens, they can still transfer these tokens, which could trigger a passive withdraw operation. If the number of tokens in the non-staked state is more than the transfer amount, the transfer will proceed directly. However, if the number of tokens in the non-staked state is less than the transfer amount, the insufficient portion will trigger the passive withdraw operation. Tokens will be withdrawn following a "Last-In-First-Out" order, where tokens that were staked last will be withdrawn first. Consider the following example.

User A holds a total of 20 ordi tokens. First, he stakes 10 ordi tokens in the 215a686504#01 pool. Then, 7 ordi tokens are staked in the 2d66a43166#01 pool. At this point, User A has 3 ordi tokens remaining that are not staked.

  1. User A transfers 3 ordi tokens to User B, which does not trigger the passive withdraw operation, and the staking status doesn't change. The remaining 3 ordi tokens are transferred to User B.
  2. User A transfers 5 ordi tokens to User B, the protocol triggers passive withdraw operation. The staking status of pool 215a686504#01 doesn't change, while the pool 2d66a43166#01 changes. User A passively withdraws 2 ordi tokens from the latter, which, along with the 3 non-staked ordi tokens, are transferred.
  3. User A transfers 15 ordi tokens to User B, the protocol triggers passive withdraw operation. The staking status of both pools changes. User A first passively withdraws 7 ordi tokens from pool 2d66a43166#01, then 5 ordi tokens from pool 215a686504#01. These, along with the 3 non-staked ordi tokens, are transferred.

Risk Associated#

We have proposed an extended version of the BRC-20 protocol, which is available for ecosystem developers to continue building upon. Similar to BRC-20, anyone can deploy their own pool, and we do not endorse or audit the created staking pools. We advise users to conduct thorough research and understand the project (DYOR) before participating in staking. Even so, during the staking period, your assets remain securely stored in your own wallet, and there will be no negative returns.

References#

standards

1.BRC-20 Token Standard.

This proposal is licensed under the BSD 2-clause license.

Contact Us#

We're eager to listen to feedback. Additionally, if you are a developer or project looking to build on top of the BRC20-S protocol and/or wish to collaborate, we'd love to hear from you. Please contact us at web3earn@OKX.com.

What's the relationship between Ordinals, BRC20, and BRC20-S?#

In general, while Ordinals provide the underlying technology for inscribing data onto the Bitcoin blockchain, BRC20 and BRC20-S provide the rules for creating and managing tokens using this technology.

Ordinals is a protocol that enables the inscription of unique data on individual satoshis, the smallest unit of Bitcoin. This unique data can represent various entities, including tokens. This is where BRC20 and BRC20-S come into play.

BRC20 is a token standard for the Bitcoin blockchain, akin to the ERC20 standard on Ethereum. It provides a set of rules for creating and managing tokens on the Bitcoin blockchain. In contrast, BRC20-S is a simplified version of the BRC20 standard. It retains the key functionalities of BRC20 but offers a more streamlined set of functionalities. This makes the standard more accessible and easier to use for developers and users.