Opcodes · token · habilitado

OP_OUTPUTTOKENCATEGORY (0xd1)

Apila la categoría de token de la salida i, con un byte de capacidad añadido al final para los NFTs mutables (0x01) o con capacidad de acuñación (0x02). Apila 0 si la salida no contiene tokens.

Verificado
Pila: entrada → salida
i → category[+cap] | 0
Costo
Base instruction cost 100 plus the byte length of the pushed result (2025 VM limits).
Estado en Bitcoin
No existe en Bitcoin (BTC)BTC has no native tokens. In Tapscript (BIP-342) this byte is an OP_SUCCESSx code reserved for future soft forks.

Ejemplo

OP_0 OP_OUTPUTTOKENCATEGORY OP_INPUTINDEX OP_UTXOTOKENCATEGORY OP_EQUAL
Paso Pila después (cima a la derecha) Qué ocurre
OP_0 0
OP_OUTPUTTOKENCATEGORY cat Output 0's 32-byte category, plus 0x01 or 0x02 if it holds a mutable or minting NFT.
OP_INPUTINDEX cat 0 This input's index, here 0.
OP_UTXOTOKENCATEGORY cat cat The category of the token this input spends.
OP_EQUAL 1 Output 0 carries the same category and capability as the token this input spends. A covenant also checks OP_OUTPUTBYTECODE to pin where it goes.

Recórrelo opcode por opcode en Bitauth IDE, el depurador de la VM de BCH en el navegador.

Dónde se usa OP_OUTPUTTOKENCATEGORY

Fuentes

  1. CHIP-2022-02 CashTokens: Token Primitives for Bitcoin Cash
  2. Libauth BCH_2023_05 opcodes (bch-2023-opcodes.ts)