paint-brush
An In-Depth Guide to BRC-20 Tokens and Bitcoin NFTsby@0xkishan
405 reads
405 reads

An In-Depth Guide to BRC-20 Tokens and Bitcoin NFTs

by Kishan KumarJuly 3rd, 2023
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

BRC-20 is a token standard that allows anyone to create their own tokens on the Bitcoin blockchain. However, unlike ERC-20 tokens, BRC-20 tokens are not created
featured image - An In-Depth Guide to BRC-20 Tokens and Bitcoin NFTs
Kishan Kumar HackerNoon profile picture

To understand the concept of BRC-20, we might first need to start with ERC-20. If you are familiar with Java, you can think of ERC-20 as something like an Interface.

What is an Interface, you ask?

It is a skeleton (blueprint) that defines the structure of classes that will implement it.
E.g., let’s say we want to create a class that defines acar. What are the attributes that you can come up with?


A car can have different features, such as color, model, speed, etc. But a car also has common behaviors, such as starting, stopping, accelerating, etc. These behaviors are what an interface can define. An interface is like a contract that says what a class can do but not how it does it.

What are ERC-20 Tokens?

Similarly, ERC-20 is like a contract that says what a Token can do but not how it does it. It defines some common behaviors, such as

  1. totalSupply(): Returns the total token supply.
  2. balanceOf(address): Retrieves the token balance of a specific address.
  3. transfer(address, uint256): Sends tokens from the sender’s address to the specified address.
  4. transferFrom(address, address, uint256): Allows a third-party (usually called an “approved spender”) to transfer tokens from one address to another on behalf of the token owner.
  5. approve(address, uint256): Grants approval to a specific address to transfer a certain amount of tokens on behalf of the token owner.
  6. allowance(address, address): Checks the number of tokens an approved spender can transfer from a token owner’s address.

Alright, now that we have established some ground level, you might be wondering, What does ERC stand for? ERC stands for Ethereum Request for Comments.
If you are a tech student, you might have heard of RFC, which stands forRequest for Comments. It is a protocol that defines how things should be. Let me take one example:


RFC: 791 defines Internet Protocol.


Similarly, ERC-20 is a token standard that allows anyone to create their own tokens on the Ethereum blockchain. Tokens are like digital coins representing anything, such as money, loyalty points, game items, etc.


For example, you can create a token calledABC that represents one dollar, and then you can send and receive ABC tokens to anyone with an Ethereum wallet.


Image by Unsplash.comThe ERC-20 standard defines a set of rules that every token must follow to work properly on the Ethereum network. These rules include the following:


  1. How to name the token,

  2. How to check the balance of the token,

  3. How to transfer the token, and

  4. How to approve of others using the token on your behalf


By following these rules, ERC-20 tokens can be compatible with any application that supports Ethereum, such as wallets, exchanges, or decentralized apps.

What are the benefits of ERC-20?

One of the benefits of ERC-20 is that it makes it easy for developers to create and deploy new tokens without having to write complex code or worry about security issues. Another benefit is that it enables a lot of innovation and experimentation in the Ethereum ecosystem, as anyone can create and use tokens for various purposes, such as fundraising, governance, lending, borrowing, etc.


Some examples of ERC-20 tokens are:

  • USDT: A stablecoin that is pegged to the US dollar and is widely used as a medium of exchange in the crypto market.

  • LINK: The native token of Chainlink, a decentralized oracle network that provides real-world data to smart contracts.

  • UNI: The governance token of Uniswap, a popular decentralized exchange that allows users to swap any ERC-20 token with low fees and high liquidity.


Okay, since we now know about ERC-20. Let me explain BRC-20.

What are BRC-20 Tokens?


BRC-20 is a token standard that allows anyone to create their own tokens on the Bitcoin blockchain*.*


Tokens are like digital coins that can represent anything, just like ERC-20 tokens. However, unlike ERC-20 tokens, BRC-20 tokens are not created by deploying smart contracts on the Bitcoin networkInstead, they are created by attaching a piece of data called JSON to satoshis, which are the smallest unit of Bitcoin.


The JSON data contains all the information about the token, such as its name, symbol, decimals, total supply, and distribution.


The Bitcoin network can read and decode this data and recognize it as a valid BRC-20 token. To create or transfer BRC-20 tokens, you need a special type of Bitcoin wallet called anordinal wallet that can handle JSON data.


The BRC-20 standard is an experimental token standard that was created by an anonymous person named Domo in March 2023. It is based on a protocol called Ordinals that uses ordinal inscriptions to enable new functionalities on the Bitcoin blockchain. Ordinal inscriptions are a way of encoding data into numbers using mathematical formulas.

What are the advantages of BRC-20?

One of the advantages of BRC-20 is that it allows Bitcoin users to create and use tokens without switching to another blockchain platform. Another advantage is that it enables new use cases for Bitcoin, such as decentralized finance (DeFi), non-fungible tokens (NFTs), gaming, and social media.

Some examples of BRC-20 tokens are:


  • PEPE: A meme coin inspired by Pepe the Frog that aims to be a fun and social currency for the internet.
  • MEME: A meme coin that allows users to create and trade NFTs based on popular memes.
  • ORDI: The native token of Ordinals protocol that powers the BRC-20 token standard. It is used for governance, staking, and rewards.

How are BRC-20 tokens made? Where do they reside? How can one transfer them?

BRC-20 tokens are made by attaching a piece of data called JSON to satoshis. JSON is a format that can store information in a structured way. For example, JSON data for a BRC-20 token can look like this:

{
"name": "Kishan",
"symbol": "0xKISHAN",
"decimals": 18,
"totalSupply": 1000000000000000000000000,
"distribution": {
  "0x113456759abcqef01204l678vabc3ef212345678": 500000000000000000000000,
  "0xpjqxef01234552789pbcdof01d345f781abcdef01": 500000000000000000000000
  }
}

This JSON data tells us that the token's name is Kishan, the symbol is 0xKISHAN, the decimals are 18, the total supply is 1 million, and the distribution is 50% to each of the two addresses.


To create a BRC-20 token, you need to encode this JSON data into numbers using mathematical formulas. These formulas are called ordinal inscriptionsThey can turn any data into numbers and vice versa. For example, the JSON data above can be encoded into this number: 1341567890123987789000345678901234567890


This number is then attached to satoshis. For example, you can attach this number to 1 satoshi and send it to another address. The Bitcoin network can read and decode this number and recognize it as a BRC-20 token.


BRC-20 tokens reside on the Bitcoin blockchain, just like Bitcoin transactions. They are stored as script files within the blocks. A script file is a piece of code that tells the network how to process a transaction. For example, a script file for a BRC-20 token transfer can look like this: OP_RETURN 1341567890123987789000345678901234567890


This script file tells the network to return the number 1341567890123987789000345678901234567890 as output. This number is the encoded JSON data for the BRC-20 token.


To transfer BRC-20 tokens, you need to alter the JSON data and encode it into a new number. For example, if you want to transfer 100 0xKISHAN tokens from address A to address B, you need to change the distribution in the JSON data like this:

{
"name": "Kishan",
"symbol": "0xKISHAN",
"decimals": 18,
"totalSupply": 1000000000000000000000000,
"distribution": {
  "0x113456759abcqef01204l678vabc3ef212345678": 499999900000000000000000,
  "0xpjqxef01234552789pbcdof01d345f781abcdef01": 500000100000000000000000
  }
}

Then you need to encode this JSON data into a new number using ordinal inscriptions. For example, the new number can be: 9876543210987654321098765432109876543210


Then you must attach this number to Satoshis and send it to address B. The Bitcoin network can read and decode this number and recognize it as a BRC-20 token transfer.


To use BRC-20 tokens, you need a special type of Bitcoin wallet that can handle JSON data and ordinal inscriptions. These wallets are called ordinal wallets. Some examples of ordinal wallets are Ordinal Wallet and Ordinal Browser Extension.


Let’s say we inscribed the data {name: KISHAN, symbol: 0xKISHAN…} to one satoshi, and we transferred this to address B from A. Now can B alter the JSON data? If they can alter the data, doesn’t this contradict the whole purpose of blockchain, which is to be immutable?


The answer is that B can alter the JSON data, but only if they have permission from A. This permission is given by A when they approve B to spend their BRC-20 tokens on their behalf. This is similar to how ERC-20 tokens work on Ethereum.


When A approves B to spend their BRC-20 tokens, they essentially give B access to their JSON data and the ability to change it. However, this does not mean that B can change the JSON data arbitrarily. They can only change it according to the rules defined by the token contract. For example, they can only transfer the tokens to another address, but they cannot change the name or symbol of the token.


Also, when B alters the JSON data, they are not changing the original data that was inscribed by A. They are creating new data that is inscribed by B. The original data is still stored on the Bitcoin blockchain and can be verified by anyone. The new data is also stored on the Bitcoin blockchain and can be verified by anyone. Therefore, the blockchain is still immutable and transparent.


The reason why BRC-20 tokens use this approach is because they do not have smart contracts to enforce the token rules. Instead, they rely on ordinal inscriptions and JSON data to define and execute the token logic. This makes them more lightweight and efficient than ERC-20 tokens but also more experimental and risky.

How does one attach BRC-20 Tokens to Satoshi? And How does BRC-20 get its value?

To attach BRC-20 tokens to satoshis, you must use a special type of Bitcoin wallet that can handle JSON data and ordinal inscriptions. These wallets are called ordinal wallets. Some examples of ordinal wallets are Ordinal Wallet and Ordinal Browser Extension.


An ordinal wallet can help you create JSON data that defines your BRC-20 token, such as its name, symbol, decimals, total supply, and distribution. Then it can encode this JSON data into a number using ordinal inscriptions. This number is then attached to satoshis and sent to another address on the Bitcoin network.


To transfer BRC-20 tokens, you need to use an ordinal wallet to alter the JSON data and encode it into a new number. Then you need to attach this new number to satoshis and send it to another address on the Bitcoin network. BRC-20 tokens get their value from the market demand and supplyThey are not backed by any asset or currency, unlike some ERC-20 tokens that are pegged to fiat currencies or commodities. The value of BRC-20 tokens depends on how useful they are for their users and how scarce they are in circulation.

How secure are BRC-20 tokens?

BRC-20 tokens are secure because they are built on the Bitcoin protocol, which is 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.


However, BRC-20 tokens also have some security risks that users should be aware of. Some of these risks are:

  1. BRC-20 tokens are still in an experimental stage and may face technical challenges or regulatory issues in the future.
  2. BRC-20 tokens do not have smart contracts to enforce the token rules. Instead, they rely on ordinal inscriptions and JSON data to define and execute the token logic. This makes them more lightweight and efficient than ERC-20 tokens but also more prone to human errors or malicious attacks.
  3. BRC-20 tokens are not widely supported by exchanges, wallets, or other platforms, limiting their liquidity and accessibility. Users may encounter difficulties or delays in transferring or trading their BRC-20 tokens.
  4. BRC-20 tokens may compete with other token standards on Bitcoin, such as RGB or Omni Layer. These token standards may offer more features or functionality than BRC-20 tokens.
  5. Therefore, users should exercise caution and research before engaging in BRC-20 token activities. They should also use reputable ordinal wallets that handle JSON data and ordinal inscriptions, such as Ordinal Wallet or Ordinal Browser Extension.


Disclaimer: This article is for educational purposes only. In no way do I advise you to buy BRC-20. Please DYOR before making any investment.


Dive into insightful articles on decentralized systems, Tech, and AI trends: https://www.0xkishan.com. Do visit to show your support.


Also published here.