runes_etch

Use the runes_etch method to execute a Rune etch order, and prompt your user to sign the funding transaction required to process the order.

You can use the runes_estimateEtch method to estimate the cost of a Rune mint order for your user, before executing it.

You can specify the characteristics of the Runes etch order you wish to execute, by passing a RunesEtchParams object to the method, with the below properties:

RunesEtchParams Property Description

runeName

a string representing the name of the Rune to etch

divisibility (ℹī¸ optional)

a number representing the rune's divisibility, i.e. how finely it may be divided into its atomic units. Divisibility is expressed as the number of digits permissible after the decimal point in an amount of runes. The default value is 0.

symbol (ℹī¸ optional)

a string representing the rune's currency symbol as a single . If a rune does not have a symbol, the generic currency sign ¤, also called a scarab, should be used

premine (ℹī¸ optional)

a string representing rune premine: the amount of rune units which the etcher can optionally allocate to themselves.

isMintable

a boolean indicating if the rune may have an open mint, allowing anyone to create and allocate units of that rune for themselves.

terms (ℹī¸ optional)

an object describing the terms governing minting if the rune is mintable, with the below properties:

  • amount a string representing the fixed amount of new units of the rune that each mint transaction creates

  • cap a string representing the number of times a rune may be minted.

  • heightStart the mint is open starting in the block with the given start height. ℹī¸Optional

  • heightEnd the rune may not be minted in or after the block with the given end height. ℹī¸Optional

  • offsetStart the mint is open starting in the block whose height is equal to the start offset plus the height of the block in which the rune was etched. ℹī¸Optional

  • offsetEnd the rune may not be minted in or after the block whose height is equal to the end offset plus the height of the block in which the rune was etched. ℹī¸Optional

inscriptionDetails (ℹī¸ optional)

You can optionally use the Rune etching transactions to create an inscription: - the etched Runes will be linked to the inscription, which marketplaces and apps can use as logo - the inscription will be sent to the specified destinationAddress, along with the premined Runes If you wish to use that option, pass an inscriptionDetails object with the below properties to specify the content to inscribe:

  • contentType a string representing the content/mime type of the content being inscribed. Make sure you extract and pass the correct content type for the content you wish to inscribe

  • contentBase64 a string representing the content you wish to inscribe, encoded in Base64 format

delegateInscriptionId (ℹī¸ optional)

If you wish to use the Rune etching transactions to create an inscription, you can optionally nominate a delegate for your inscription, as an alternative to specifying its content with inscriptionDetail (see above)

You can instead choose to pass a delegateInscriptionId string representing the inscription ID of the delegate.

turbo (ℹī¸ optional)

a boolean marking the rune etching as opting into future rune protocol changes if set to true According to the Runes specifications: These protocol changes may increase light client validation costs, or just be highly degenerate ℹī¸the default value is false

destinationAddress

The Bitcoin address to which the minted runes should be allocated. ℹī¸If minting Runes for your user, you can fetch their wallet addresses with the getAccounts method.

⚠ī¸ We recommend managing runes holdings on taproot/ordinal addresses.

feeRate

a number representing the desired fee rate to set for the Rune etch transactions, in sats per vbytes

appServiceFee (ℹī¸ optional)

a number representing the sats value of the fee to charge your user for your service.

appServiceFeeAddress (ℹī¸ optional)

a string representing the Bitcoin address which will receive the appServiceFee, if a fee is specified

refundAddress

The Bitcoin address to which the amount of the funding transaction should be returned, should the etch order fail. ℹī¸ If etching Runes for your user, you can fetch their wallet addresses with the getAccounts method. ⚠ī¸ We recommend managing refunds on Bitcoin payment addresses.

network (ℹī¸ optional)

a string representing the Bitcoin network to use for the etch transactions: 'Mainnet' or 'Testnet'

import { Wallet } from "sats-connect";

     const response = await Wallet.request('runes_etch', {
      runeName: "UNCOMMONGOODS",
      premine: ,
      isMintable: ,
      destinationAddress: ,
      // add request params described above
      refundAddress: paymentAddress,
    });

    if (response.status === 'success') {
      setFundTxId(response.result.fundTransactionId);
    } else {
      console.error(response.error);
      alert('Error etching UNCOMMONGOODS. See console for details.');
    }
  };

The runes_etch method will trigger the following workflow:

  1. Create an etch Runes order for Sats Connect to process, identified by an orderId

  2. Prompt your user to sign a send Bitcoin transaction with their connected Bitcoin payment address, to fund the Runes etch order. The funds are sent to a Sats Connect funding address dedicated to processing the order.

  3. return a RunesEtchResponse object to your app:

RunesEtchResponse property Description

orderId

a string representing the ID of the Runes etch order created by Sats Connect.

fundTransactionId

a string representing the ID of the funding transaction required from your user for Sats Connect to process the Runes etch order.

fundingAddress

a string representing the BTC address which will collect the funds required to process the order, and sign the required etch transactions to process the order.

  1. Sats Connect uses a two-phase commit/reveal procedure to process your order and etch the rune:

    • The funding transaction for the order also acts as a commit transaction: it contains a taproot output committing to a script containing the Rune to etch (and optionally the inscription content, if you chose to link an inscription with either inscriptionDetails or delegateInscriptionId)

    • Once the commit transaction has reached 6 block confirmations, Sats Connect will craft & broadcast a reveal transaction, which etches the rune (and optionally reveals your linked inscription). The reveal transaction is broadcast at the desired feeRate specified in the request, and signed with the funding address for the order. This mechanism protects your rune etching from mempool detection and front-running.

  2. Sats Connect will then monitor the confirmation of the funding transaction required from your user to the funding address, as well as the confirmation of the rune reveal transaction. You can track the status of a Rune etch order using the runes_getOrder method.

Sats Connect charges a 2,000 sats fee for every rune etching order.

Last updated