Operations

In this section, we will provide a detailed explanation of various operations of the BRC137 protocol. For ease of understanding, the Bitcoin script will be simplified in the presentation, such as displaying text in plain text form, whereas actual transactions would require encoding first.

OperationDescription

Mint a certain number of BRC137-DID inscriptions.

Set or update the name for a given BRC137-DID inscription.

Bind a BRC137-DID inscription to a BRC137-TLD inscription.

Set a name for a BRC137-TLD inscription.

Update the royalty amount for a BRC137-TLD inscription.

Batch operations applicable to Delegators.

DID_MINT

The DID_MINT operation is used to create a certain number of BRC137-DID inscriptions. At the Bitcoin script level, it can be represented as follows:

OP_0
OP_IF
    OP_PUSH "ord"
    OP_PUSH 01
    OP_PUSH "text/plain;charset=utf-8"
    OP_PUSH 07
    # it specifies that the BRC137 protocol is used, version v1, for the DID_MINT operation.
    OP_PUSH "brc137:v1:DID_MINT"
    OP_0
    # Mint operation compatible with the BRC20 protocol.
    OP_PUSH {"p":"brc-20","op":"mint","tick":"<TICK>","amt":"<AMOUNT>"}
OP_ENDIF

Where<TICK> should be filled with the BRC20 token name of the BRC137-DID, and <AMOUNT> represents the number of inscriptions being minted in this operation, with a maximum of 1000 per transaction.

DID_UPDATE

DID_UPDATE operation is used to set or update the name for a given BRC137-DID inscription. At the Bitcoin script level, it can be represented as follows:

OP_0
OP_IF
    OP_PUSH "ord"
    OP_PUSH 01
    OP_PUSH "text/plain;charset=utf-8"
    OP_PUSH 07
    # It specifies that the BRC137 protocol is used, version v1, for the DID_UPDATE operation.
    OP_PUSH "brc137:v1:DID_UPDATE"
    OP_PUSH 05
    # It indicates the name of the DID and the index of the bound BRC137-DID inscription.
    OP_PUSH {"name":"<STRING>","inscription_did":"<SAT_NUMBER>/<INDEX>"}
    OP_0
    ...
OP_ENDIF

As illustrated in the Bitcoin script above, you can update the following content of the BRC137 inscription during the DID_UPDATE operation:

  • Which BRC137-DID inscription you want to name?

  • What name you want to assign to the corresponding inscription?

To ensure the validity of this operation, there are several points to note:

  • You must ensure that the address initiating the transaction is the holder of the BRC137-DID inscription specified in inscription_did.

  • You must ensure that the new name has not been taken by another BRC137-DID inscription.

  • Other rules described in the Core Concept / BRC137-DID section, such as character set limitations, must be adhered to.

If the transaction for this operation is confirmed on the Bitcoin network and does not meet the above conditions, the operation will be considered invalid, even if the conditions are met later.

DID_BIND

DID_BIND operation is used to establish a binding relationship between a BRC137-DID inscription and a BRC137-TLD inscription. At the Bitcoin script level, it can be represented as follows:

OP_0
OP_IF
    OP_PUSH "ord"
    OP_PUSH 01
    OP_PUSH "text/plain;charset=utf-8"
    OP_PUSH 07
    # It specifies that the BRC137 protocol is used, version v1, for the DID_BIND operation.
    OP_PUSH "brc137:v1:DID_BIND"
    OP_PUSH 05
    # The indices of the two inscriptions being bound.
    OP_PUSH {"inscription_did":"<SAT_NUMBER>/<INDEX>", "inscription_tld": "<SAT_NUMBER>/<INDEX>"}
    OP_0
    ...
OP_ENDIF

In the context of the DID_BIND operation, the inscription_did field specifies the index of the BRC137-DID inscription, and the inscription_tld field specifies the index of the BRC137-TLD inscription. At the time of initiating the operation, the following conditions must be met:

  • The address initiating the transaction must be the holder of the BRC137-DID inscription specified in inscription_did.

  • The BRC137-TLD inscription specified in inscription_tld must have had a name set before the transaction is initiated.

  • In this transaction, the correct amount of satoshis corresponding to the royalty set by the BRC137-TLD inscription must be sent to the holder of the BRC137-TLD inscription.

If the transaction for this operation is confirmed on the Bitcoin network and does not meet the above conditions, the operation will be considered invalid, and even if the conditions are met later, the operation will still be deemed invalid.

TLD_OPEN

TLD_OPEN operation is used to set a name for a BRC137-TLD inscription. At the Bitcoin script level, it can be represented as follows:

OP_0
OP_IF
    OP_PUSH "ord"
    OP_PUSH 01
    OP_PUSH "text/plain;charset=utf-8"
    OP_PUSH 07
    # It specifies that the BRC137 protocol is used, version v1, for the TLD_OPEN operation.
    OP_PUSH "brc137:v1:TLD_OPEN"
    OP_PUSH 05
    # The name of TLD, fixed royalty fee in Satoshis, and the index of the inscription being bound
    OP_PUSH {"name":"<STRING>", "royalty": "<NUMBER>", "inscription_tld": "<SAT_NUMBER>/<INDEX>"}
    OP_0
    ...
OP_ENDIF

As explained in the TLD_OPEN operation, the inscription_tld field specifies the index of the BRC137-TLD inscription, the name field specifies the name to be set, and the royalty field specifies the royalty, which is in satoshis, with a minimum value of 0.

At the time of initiating the transaction, the following conditions must be met:

  • The address initiating the transaction must be the holder of the BRC137-TLD inscription specified in inscription_tld.

  • The BRC137-TLD inscription has not previously had a name set.

  • Other rules described in the Core Concept / BRC137-TLD section, such as character set limitations, must be adhered to.

If the transaction for this operation is confirmed on the Bitcoin network and does not meet the above conditions, the operation will be considered invalid, and even if the conditions are met later, the operation will still be deemed invalid.

TLD_UPDATE

TLD_UPDATE operation is used to update the royalty amount for a BRC137-TLD inscription. At the Bitcoin script level, it can be represented as follows:

OP_0
OP_IF
    OP_PUSH "ord"
    OP_PUSH 01
    OP_PUSH "text/plain;charset=utf-8"
    OP_PUSH 07
    # It specifies that the BRC137 protocol is used, version v1, for the TLD_UPDATE operation.
    OP_PUSH "brc137:v1:TLD_UPDATE"
    OP_PUSH 05
    # The updated Royalty amount, expressed in satoshis, and the index of the updated TLD inscription.
    OP_PUSH {"royalty": "<NUMBER>", "inscription_tld": "<SAT_NUMBER>/<INDEX>"}
    OP_0
    ...
OP_ENDIF

the inscription_tld field specifies the index of the BRC137-TLD inscription, and the royalty specifies the royalty, which is in satoshis, with a minimum value of 0.

When initiating the transaction, it is necessary to ensure that the address initiating the transaction is the holder of the BRC137-TLD inscription specified in inscription_tld. If the transaction for this operation is confirmed on the Bitcoin network and does not meet this condition, the operation will be considered invalid, even if the condition is met later.

Additionally, to prevent unexpected DID_BIND operation failures due to royalty amount changes, all royalty amounts confirmed on the Bitcoin mainnet have a minimum survival period of 24 hours from the time of transaction confirmation. Royalties within this survival period are considered valid royalty amounts.

DELEGATE_BATCH

Delegators can aggregate operations by collecting user transactions, thereby reducing the on-chain costs for user actions. DELEGATE_BATCH will be used for the on-chain execution of batch operations.

For more details, please refer to: Batch

Last updated