Skip to content

etchRune ​

etchRune(config, params): Promise<{ etchingTx: string; fundingTx: string; revealTx: string; }>

Etches (mints) a rune on Bitcoin. The rune will be etched and revealed in the consecutive transactions. This function creates the etching, funding, and reveal transactions. The transactions won't be broadcasted. Once the transactions are created, you can broadcast them using the broadcastTransaction function in the following order: funding, etching, reveal.

Import ​

ts
import { etchRune } from "@midl/core";

Example ​

ts
import { etchRune } from "@midl/core";
import { broadcastTransaction } from "@midl/core";

const etching = await etchRune(config, {
    name: "RUNE•NAME",
    receiver: "bc1q...",
    amount: 100,
 ...
});

const fundingTxHash = await broadcastTransaction(config, etching.fundingTx);
const etchingTxHash = await broadcastTransaction(config, etching.etchingTx);
const revealTxHash = await broadcastTransaction(config, etching.revealTx);

console.log(fundingTxHash, etchingTxHash, revealTxHash);

Parameters ​

NameTypeDescription
configConfigThe configuration object
paramsEtchRuneParamsThe etch rune parameters

EtchRuneParams ​

NameTypeDescription
namestringThe name of the rune to etch. Should be uppercase and spaced with • (U+2022). Example: "RUNE•NAME"
amount?numberThe amount minted per each mint.
cap?numberThe maximum number of mints allowed.
content?stringThe content to inscribe on the rune.
divisibility?numberThe divisibility of the rune.
feeRate?numberThe fee rate to use for the etching transaction.
from?stringThe address to etch the rune from.
heightEnd?numberThe height at which the minting ends.
heightStart?numberThe height at which the minting starts.
offsetEnd?numberThe offset after etching when minting ends.
offsetStart?numberThe offset after etching when minting starts.
premine?numberThe amount of premined runes to include in the etching.
receiver?stringThe address to mint the rune to.
symbol?stringThe symbol of the rune to etch. One character only.

Returns ​

Promise<{ etchingTx: string; fundingTx: string; revealTx: string; }>

The etching, funding, and reveal transactions hex transactions.

NameTypeDescription
etchingTxstringThe etching transaction hex
fundingTxstringThe funding transaction hex
revealTxstringThe reveal transaction hex

Released under the MIT License