Checks Mc… (0x09)
Two-key secp256k1 specification for Mc… checks and RedeemCheck (0x09): Lock encoding as big.Int, 16-byte nonce cap, gasPrice/gasCoin invariants, and off-chain balance rules.
An Mc... check is an off-chain voucher protected by two secp256k1 signatures (issuerKey and passKey) and redeemed on-chain via RedeemCheck (0x09). The $0.03 fee in check.gasCoin is deducted from the check issuer, allowing a recipient address with 0 pip balance to claim funds without prior gas funding.
Issuing a check happens offline and does not lock coins on the issuer's account. Both the check principal value and the $0.03 fee are deducted from the issuer only when RedeemCheck (0x09) is committed in a block. If the issuer's balance is below the required principal or fee in check.gasCoin at redemption time, the node rejects the transaction. Before dueBlock, an unredeemed check can only be invalidated by moving the funds out of the issuer's address.
Two-key scheme and Lock encoding
Building an Mc... check takes five local steps:
- Derive the 32-byte scalar
passKey = SHA256(UTF8(passphrase)). - Choose a
nonceof1to16bytes. Iflen(nonce) > 16, the node rejects redemption withTooLongNonce. - Hash the 6-field check body (
dueBlockis encoded asuint64):textbodyHash = Keccak256(RLP([nonce, chainId, dueBlock, coinId, value, gasCoin])) - Sign
bodyHashwithpassKey(RFC 6979,lowS) to produce the 65-byte Go-layout recoverable signaturelockBytes65 = r_be32 || s_be32 || recoveryByte(recoveryBytein{0, 1}). In the reference Go node (check.go),Lockhas type*big.Int, so RLP encodestrimLeadingZeros(lockBytes65)with any leading0x00bytes removed. Encoding all 65 bytes verbatim whenr[0] == 0x00(roughly 1 in 256 checks) alterscheckHashand breaks issuer address recovery. - Hash the 7-element list and sign
checkHashwithissuerKey(v = recovery + 27, stripping leading0x00bytes fromrands):textlockTrimmed = trimLeadingZeros(lockBytes65) checkHash = Keccak256(RLP([nonce, chainId, dueBlock, coinId, value, gasCoin, lockTrimmed])) rawCheck = "Mc" + hexLower(RLP([nonce, chainId, dueBlock, coinId, value, gasCoin, lockTrimmed, v, r, s]))
To redeem (RedeemCheck 0x09), the recipient (recipientAddress20B) computes addrHash = Keccak256(RLP([recipientAddress20B])) and signs addrHash with passKey to form the 65-byte proofBytes65 = r_be32 || s_be32 || recoveryByte. The node recovers ecrecover(bodyHash, lock) and ecrecover(addrHash, proof): matching public keys prove knowledge of passphrase bound to tx.sender. A mempool observer cannot redirect the check to another address because changing tx.sender changes addrHash, though anyone who obtains passphrase off-chain can submit their own RedeemCheck first.
Consensus envelope rules for RedeemCheck (0x09):
tx.gasPrice === 1: any multiplier greater than1fails withTooHighGasPrice(preventing a redeemer from draining the issuer's balance through inflated gas).tx.gasCoin === check.gasCoin: any mismatch between the outer transactiongasCoinandcheck.gasCoinfails withWrongGasCoin.
Issuing and redeeming in @minter-network/tx-core
buildRedeemCheckTx decodes rawCheck, validates nonce byte length, and sets gasPrice: 1 and gasCoin: check.gasCoin.
import {
MinterGateClient,
buildRedeemCheckTx,
createCheckProof,
decodeCheck,
issueCheck,
parsePip,
signTx,
} from "@minter-network/tx-core";
import type { MinterWallet } from "@minter-network/tx-core";
// Supply these inputs from your application.
declare const issuerWallet: MinterWallet;
declare const recipientWallet: MinterWallet;
const gate = new MinterGateClient(
process.env.MINTER_GATE_URL ?? "https://gate.minter.network/v2",
);
const status = await gate.getStatus();
const dueBlock = BigInt(status.latest_block_height) + 200_000n;
// 1. Issue an off-chain check for 50 USDTE (UTF-8 nonce <= 16 bytes)
const { rawCheck } = issueCheck(
{
nonce: "onboarding-001",
chainId: 1,
dueBlock,
coinId: 1993,
valuePip: parsePip("50"),
gasCoin: 1993,
passphrase: "correct-horse-battery-staple",
},
issuerWallet.privateKey,
);
// 2. Decode metadata locally and build recipient-bound proof (0 BIP on recipient)
const decoded = decodeCheck(rawCheck);
const { proofBytes } = createCheckProof(
recipientWallet.address,
"correct-horse-battery-staple",
);
const recipientNonce = await gate.getNextNonce(recipientWallet.address);
const redeemUnsigned = buildRedeemCheckTx({
nonce: recipientNonce,
chainId: 1,
rawCheck,
proof: proofBytes,
});
const signed = signTx(redeemUnsigned, recipientWallet.privateKey);
const mempool = await gate.sendTransaction(signed.signedRawTxHex);
if (mempool.code !== "0") {
throw new Error(`CheckTx rejected (${mempool.code}): ${mempool.log}`);
}
const committed = await gate.waitForTransaction(signed.txHash);
console.log("Redeemed at height:", committed.height, "amount pip:", decoded.valuePip);Passing checks in web links
When building a web claim link, place Mc... and the passphrase in the URL #fragment rather than ?query parameters (https://app.example/claim#redeem=Mc...&p=...). Query strings travel in HTTP requests, server access logs, and Referer headers. Although the #fragment is not sent over the network, it remains readable to scripts running on the page (analytics tags, browser extensions) and persists in browser history, so read window.location.hash into memory on mount and clear the address bar via history.replaceState(null, "", window.location.pathname).