Mint step by step
Commands use Bitcoin Core's bitcoin-cli. Add -regtest or -signet while practising.
Note
About the example values. The rules on this page are the current proposal: issuance Draft C (leading hex zeros in the txid) and claim Format B (a runestone). The example outputs in steps 3, 5 and 7 are real, from one mint on a private test network made with an earlier reference build. That build used claim Format A and a scaled-down lock level, so those outputs show Format A bytes where your mint will carry Format B bytes. Each place is pointed out. A Format B example will replace them once the current client's test run is written up.
1. Read the job
curl -s "$INDEXER/api/mintjob" | jq '{height, wave, zeros, units, min_tier, claim, token_output_index, min_lock_sats}'
Expected output (proposed shape for Draft C; issuance values from Constants):
{
"height": 321,
"wave": "<n>",
"zeros": "<n − 1>",
"units": "<R>",
"min_tier": 80,
"claim": "6a5d087fd0a2cd92b4a013",
"token_output_index": 0,
"min_lock_sats": "<R>"
}
Write down zeros: your txid must start with that many hex 0s. min_tier is 80 in every wave. claim must equal 6a5d087fd0a2cd92b4a013 (claim only) or the same runestone with a companion-rune mint appended (Claim output); if it differs, stop — the indexer and this manual disagree.
2. Create a lock — not yet available
The reference miner will provide:
pqsb-miner new-lock --level 80 --out lock.json # not yet available
and print the P2WSH address of a fresh lock (79 commitments, 9 positions, 4 pins). lock.json holds secrets: anyone with it can spend the lock. Keep it offline until the spend confirms, then delete it.
3. Build and sign the funding transaction (do not broadcast yet)
LOCK_ADDR=bcrt1q... # from step 2
bitcoin-cli -named walletcreatefundedpsbt \
inputs='[]' outputs="[{\"$LOCK_ADDR\": 0.00005000}]" \
options='{"fee_rate": 2}' | jq -r .psbt > fund.psbt
bitcoin-cli walletprocesspsbt "$(cat fund.psbt)" | jq -r .psbt > fund.signed.psbt
bitcoin-cli finalizepsbt "$(cat fund.signed.psbt)" | jq -r .hex > fund.hex
bitcoin-cli decoderawtransaction "$(cat fund.hex)" | jq '{txid, vsize, vout: [.vout[] | {n, value, type: .scriptPubKey.type}]}'
Expected output (the test-network funding transaction of the example mint; the change went to a P2TR address):
{
"txid": "4c07bb535bf144f8091487cf5e855c8493d370fda89e4d6348ff8f10d7d656aa",
"vsize": 212,
"vout": [
{ "n": 0, "value": 0.00181629, "type": "witness_v1_taproot" },
{ "n": 1, "value": 0.00005000, "type": "witness_v0_scripthash" }
]
}
The lock output is the witness_v0_scripthash one paying LOCK_ADDR (n = 1 here). Its value must be at least R plus the mint's fee plus any change. 5,000 sat is the example used on the test network.
Holding the funding transaction back keeps the lock address unseen until the search is done. Broadcasting it first is also fine; it only exposes an unspent P2WSH output.
4. Search — not yet available
pqsb-miner search --lock lock.json \
--prevout 4c07bb53…56aa:1 --prevout-value 5000 \
--out0 bcrt1qRECIPIENT:1000 \
--claim 6a5d087fd0a2cd92b4a013 \
--change bcrt1qCHANGE --fee-rate 2 \
--zeros 1 --level 80 > mint.hex # not yet available
The miner varies sequence and locktime, finds a transaction that satisfies the lock and starts with the required number of hex zeros, signs it, and writes the raw hex. Its output must state the level used, the txid and its leading zeros.
5. Check before broadcasting
bitcoin-cli decoderawtransaction "$(cat mint.hex)" | jq '{txid, weight, vin0: .vin[0].txinwitness | length, vout: [.vout[] | {n, value, hex: .scriptPubKey.hex}]}'
Expected output (the test-network mint 03b4ed47…834f; output 1 is its Format A claim — yours will show 6a5d087fd0a2cd92b4a013 there):
{
"txid": "03b4ed472bd5a7b80120409beab9d2e80976c33355b023cf43e56b632f1d834f",
"weight": 4453,
"vin0": 51,
"vout": [
{ "n": 0, "value": 0.00001000, "hex": "0014ef2c287d26c67661acdb1a2151b3c5c5fc606441" },
{ "n": 1, "value": 0.00000000, "hex": "6a0b50515342024d5051534200" },
{ "n": 2, "value": 0.00001600, "hex": "0014ef2c287d26c67661acdb1a2151b3c5c5fc606441" }
]
}
Check: 51 witness items; output 0 is yours; one output is exactly the claim. Then count the leading hex zeros of the txid and compare with zeros from a fresh /api/mintjob:
python3 -c "import sys; t=sys.argv[1]; print(len(t) - len(t.lstrip('0')))" \
03b4ed472bd5a7b80120409beab9d2e80976c33355b023cf43e56b632f1d834f
1
One leading zero: this txid would be accepted in waves 1 and 2, not in wave 3. The count must be at least the current zeros; if a wave ended while you searched, the mint confirms and is rejected (E07).
6. Broadcast
bitcoin-cli submitpackage "[\"$(cat fund.hex)\", \"$(cat mint.hex)\"]"
Expected output (shape, abridged; submitpackage needs Bitcoin Core 28 or later outside regtest):
{ "package_msg": "success", "tx-results": { "…": { "txid": "4c07bb53…56aa" }, "…": { "txid": "03b4ed47…834f" } } }
If the funding transaction is already confirmed, use bitcoin-cli sendrawtransaction "$(cat mint.hex)", which prints the txid.
Do not use replace-by-fee on the mint. Any change voids the search, and a second spend of the same lock would reveal more of it.
7. Confirm
bitcoin-cli getrawtransaction 03b4ed472bd5a7b80120409beab9d2e80976c33355b023cf43e56b632f1d834f 1 | jq .confirmations
curl -s "$INDEXER/api/tx/03b4ed472bd5a7b80120409beab9d2e80976c33355b023cf43e56b632f1d834f" | jq '{mint, reject}'
Expected output once mined (from the earlier reference build, which still reported a score; the Draft C indexer reports the wave and leading zeros instead):
1
{ "mint": { "n": 33, "height": 255, "tier": 64, "difficulty": 1.0, "score": 69.06 }, "reject": null }
(tier: 64 is the test network's scaled-down level; on the frozen rules it is 80.) If reject is set, see Troubleshooting.
8. See the units
curl -s "$INDEXER/api/address/bcrt1qRECIPIENT" | jq '{balance, utxos}'
Expected output (shape; in the test network this output has since been spent):
{ "balance": "<R>", "utxos": [ { "outpoint": "03b4ed47…834f:0", "value": 1000, "amount": "<R>", "height": 255 } ] }
Now freeze that output in your wallet (Holding units) and delete lock.json.