Operations

The format for Operations mentioned in this document has not been updated yet. Please refer to the latest indexer specifications and official inscription tools of B137.

In this section, we will provide a detailed explanation of various operations of the B137 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 B137-DID inscriptions.

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

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

Set a name for a B137-TLD inscription.

Update the royalty amount for a B137-TLD inscription.

Batch operations applicable to Delegators.

DID_MINT

The DID_MINT operation is used to create a certain number of B137-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 B137 protocol is used, version v1, for the DID_MINT operation.
    OP_PUSH "b137: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 B137-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 B137-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 B137 protocol is used, version v1, for the DID_UPDATE operation.
    OP_PUSH "b137:v1:DID_UPDATE"
    OP_PUSH 05
    # It indicates the name of the DID and the index of the bound B137-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 B137 inscription during the DID_UPDATE operation:

  • Which B137-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 B137-DID inscription specified in inscription_did.

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

  • Other rules described in the Core Concept / B137-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 B137-DID inscription and a B137-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 B137 protocol is used, version v1, for the DID_BIND operation.
    OP_PUSH "b137: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 B137-DID inscription, and the inscription_tld field specifies the index of the B137-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 B137-DID inscription specified in inscription_did.

  • The B137-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 B137-TLD inscription must be sent to the holder of the B137-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 B137-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 B137 protocol is used, version v1, for the TLD_OPEN operation.
    OP_PUSH "b137: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 B137-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 B137-TLD inscription specified in inscription_tld.

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

  • Other rules described in the Core Concept / B137-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 B137-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 B137 protocol is used, version v1, for the TLD_UPDATE operation.
    OP_PUSH "b137: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 B137-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 B137-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