Conceptual Diagrams
These diagrams illustrate the conceptual flow and interpretation of BRC-20 operations under the OP_RETURN + Indexer model. They highlight that the BRC-20 state is derived by indexers observing on-chain Bitcoin transactions.
Mint Function (OP_RETURN)
graph LR subgraph On-Chain Bitcoin Transaction A[Initial UTXO (BTC)] --> B{Mint Transaction}; B -- Standard Output<br>(Recipient Address<br>+ Satoshi Amount) --> C; B -- OP_RETURN Output<br>({"op":"mint", "amt":...}) --> D(Blockchain - OP_RETURN Data); B -- Optional Change Output (BTC) --> E; end subgraph Off-Chain Indexer Processing D -- Reads Mint Data & TXID --> F[BRC-20 Indexer]; C -- Reads Recipient Output(s) --> F; E -- Reads Change Output --> F; F -- Validates Mint Op<br>Checks Deploy, Limits, Total Supply --> G{Indexer's<br>Token State DB}; G -- Updates State --> H[Recipient's Token Balance<br>(Associated with their new UTXO)]; G -- Updates State --> I[Total Minted Supply<br>for Token]; end B --> F; %% Indexer observes the transaction
- The minter creates a standard Bitcoin transaction, sending BTC to one or more outputs and including the mint instruction in the OP_RETURN.
- The indexer monitors the blockchain for these transactions. Upon detecting a valid Mint transaction, it reads the OP_RETURN data and output details.
- The indexer validates the mint based on the OP_RETURN data and the token's deployment rules (limit per operation, maximum supply).
- The minted tokens (up to the validated amount) are attributed by the indexer to the addresses controlling the standard outputs of the transaction, proportionally based on the satoshis in those outputs. The indexer updates the total supply and the balance tied to these new UTXOs in its state database.
Transfer Function (OP_RETURN)
graph LR subgraph On-Chain Bitcoin Transaction A[Sender's UTXO(s)<br>(Associated with Sender's Balance + BTC by Indexer)] --> B{Transfer Transaction}; B -- Standard Output<br>(Receiver Address<br>+ Satoshi Amount) --> C; B -- OP_RETURN Output<br>({"op":"transfer", "amt":...}) --> D(Blockchain - OP_RETURN Data); B -- Optional Change Output<br>(Sender Address<br>+ Satoshi Amount) --> E; end subgraph Off-Chain Indexer Processing D -- Reads Transfer Data & TXID --> F[BRC-20 Indexer]; A -- Reads Input UTXO(s) --> F; %% Identifies Sender & checks balance C -- Reads Recipient Output(s) --> F; E -- Reads Change Output --> F; F -- Validates Transfer Op<br>Checks Sender Balance, Limits --> G{Indexer's<br>Token State DB}; G -- Updates Balances Based on Outputs --> H[Receiver's Token Balance<br>(Associated with Receiver's new UTXO)]; G -- Updates --> I[Sender's Remaining Balance<br>(Associated with Sender's new UTXO)]; end B --> F; %% Indexer observes the transaction
- The sender creates a standard Bitcoin transaction spending a UTXO (or UTXOs) that the indexer associates with their token balance. The transaction includes the transfer instruction and amount in the OP_RETURN.
- The indexer monitors the blockchain. Upon detecting a valid Transfer transaction, it identifies the sender based on the spent input UTXO(s).
- The indexer validates that the sender possesses sufficient token balance (based on its internal state associated with the input UTXO(s)) to cover the amount specified in the OP_RETURN.
- The transferred tokens (up to the validated amount) are re-allocated by the indexer to the addresses controlling the new standard outputs of the transaction (receiver(s) and potentially the sender's change output), based on the proportional satoshis in those outputs. The indexer updates the balances associated with these new UTXOs. The token balance associated with the spent input UTXO(s) is removed.
Self-Transfer (OP_RETURN)
graph LR subgraph On-Chain Bitcoin Transaction A[Sender's UTXO(s)<br>(Associated with Sender's Balance + BTC by Indexer)] --> B{Transfer Transaction}; B -- Standard Output<br>(Sender Address<br>- New UTXO + Satoshi Amount) --> C; B -- OP_RETURN Output<br>({"op":"transfer", "amt":...}) --> D(Blockchain - OP_RETURN Data); end subgraph Off-Chain Indexer Processing D -- Reads Transfer Data & TXID --> F[BRC-20 Indexer]; A -- Reads Input UTXO(s) --> F; %% Identifies Sender & checks balance C -- Reads New Output UTXO(s) --> F; F -- Validates Transfer Op<br>Checks Sender Balance, Limits --> G{Indexer's<br>Token State DB}; G -- Updates Balance --> H[Sender's Token Balance<br>(Now associated with the new UTXO(s))]; end B --> F; %% Indexer observes the transaction
- A user creates a transfer transaction where the standard output(s) are directed back to an address they control. This is often done to consolidate token balances onto a new UTXO.
- The indexer processes this like a regular transfer, validating the source balance from the input UTXO(s).
- The indexer then attributes the transferred amount to the new output UTXO(s) controlled by the sender, effectively moving the token balance association to the new UTXO(s).