zrc-20

zrc-20

This standard is fully based on domo-2's brc-20 standard, with an extension of one extra op code(delegate) to introduce brc-20 tokens to bitcoin L2 chains. The purpose is to extend the usability of brc-20 token, so users could port brc-20 tokens into the layer 2 tokens and operate brc-20 tokens same way as erc-20 tokens on L2 chains.​

Changes:

  • The deploy operation of the zrc-20 tokens on Bitcoin will be interpreted into erc-20 contract deployment on L2, so each zrc-20 token will have a mirror erc-20 token on L2.
{ 
  "p": "zrc-20",
  "op": "deploy",
  "tick": "ordi",
  "max": "21000000",
  "lim": "1000",
  "difficulty": "5"
}
  • Bitcoin account (address A) will have a mapped account (address a) so that: a = keccak(A)[12:], mapped account does not have the permission to operate the token since no one will have the private key of p.
  • A L2 chain will serve as the ledge of zrc-20 tokens. That means all zrc-20 token operations on the Bitcoin chain will be tracked and interpreted into L2 token contract interactions, so the balance of zrc-20 tokens can be easily checked by calling the mirror erc-20 contract. There’ll be a dedicated module(the indexer module) in Layer 2 node to index the zrc-20 inscriptions, this module works just like brc-20 indexer but with the extended feature supported.
  • With the op code delegate, a zrc-20 user A could delegate some of the balance to L2 account b, so that the private key holder of account b will be capable of operating these tokens while the balance will be deducted from user A's account. The delegate operation doing the exact operation of transferring tokens to a L2 account. After this operation, the L2 account user could operate the token the same way as erc-20 tokens, no matter if it's a transfer, swap or lock. The inscription should be sent to the sender again as a second step. When the sequencer of the L2 network produce L2 blocks, it will execute these zrc-20 operations on the erc-20 mirror contracts.

def derive_zrc20_delegations(delegations: List[Delegattion]) -> List[DelegationSystemTxs]:
    return [derive_delegation_transaction(delegation) for delegation in delegations if is_delegation_valid(delegation)]
            
def produce_l2_block(parent: L2Block, current_l1_block: L1Block) -> L2Block:
    l2_block_candidate = new_l2_block_from_parent(parent)
    if parent.l1_block.number != current_l1_block.number:
        delegations = fetch_l1_zrc20_delegations(parent.l1_block.number, current_l1_block.number)
        delegations_transactions = derive_zrc20_delegations(delegations)
        l2_block_candidate.system_txs = [*l2_block_candidate.system_txs, *delegations_transactions]
    return l2_block_candidate
    
{ 
  "p": "zrc-20",
  "op": "delegate",
  "tick": "ordi",
  "amt": "100",
  "chain": "l2-chain-a",
  "to": "0x3Ea1756E8Ce21a41E15eC3F026A0eA379Cc3e1A5"
}
  • If L2 account b transfers some of the balance to a L2 mapped account (address a), that means an operation of un-delegate. After this operation, the transferred balance will be only spendable by the private key holder of the original L1 account A(such that a = keccak(A)[12:]).
  • Each time a newer state of the L2 network is submitted to the Bitcoin and verified in a way(ZKP etc), the afterward transfers which follow un-delegations can be assumed valid.

​With this extension proposal, brc-20 token could be ported to an erc-20 token on Bitcoin L2 chains. Users will need no more to worry about the Bitcoin network congestions or inscriptions since the token will be treated same as erc-20 token on layer 2s. This greatly increases the usability of brc-20 tokens.​ The next page is the original brc20 standard.

The original brc-20 standard: https://domo-2.gitbook.io/brc-20-experiment/