Multisig (0x0C)
Weighted multisig accounts in Minter v3.3.0: CreateMultisig (0x0C), EditMultisig (0x12), SignatureMulti (0x02) assembly, and an isolated Cooler policy signer.
CreateMultisig (0x0C) creates a protocol Mx... account configured with 1 to 32 unique participant addresses[], per-signer weights[] (each <= 1023), and a threshold (threshold <= sum(weights)). ExecutorV3 executes any of the 37 active transaction types from that address under signatureType = 0x02 once the weights of unique valid signers reach threshold.
Creation (0x0C), rotation (0x12) and SignatureMulti
| Opcode | Operation | Fee (USDTE) | Inner RLP data schema | Protocol constraints |
|---|---|---|---|---|
0x0C | CREATE_MULTISIG | $0.10 | [threshold: u32, weights: u32[], addresses: bytes20[]] | 1..32 unique Mx... addresses; weight <= 1023; threshold <= sum(weights) |
0x12 | EDIT_MULTISIG | $0.10 | [threshold: u32, weights: u32[], addresses: bytes20[]] | Sent from the multisig address itself (signatureType = 0x02) |
The created multisig address is derived deterministically from the creator's address and creation transaction nonce: deriveMultisigAddress(creatorMx, nonce) (Keccak256(RLP([creator20B, nonce]))[12..32]).
Rules for assembling SignatureMulti (signatureType = 0x02):
- Set
noncetotransaction_count + 1nof the multisig account itself (a newly created multisig starts attransaction_count = 0, so its first outgoing transaction usesnonce: 1n). - Each co-signer signs
signingHash = Keccak256(RLP([nonce, chainId, gasPrice, gasCoin, type, dataBytes, payload, serviceData, 0x02])). - Encode outer field
#9(signatureData) asRLP([multisigAddress20B, [[v1, r1, s1], [v2, r2, s2], ...]]). - The Minter protocol does not require lexicographical signature sorting: the node recovers each signer via
ecrecover, rejects duplicate signers, matches each recovered address againstaddresses[], and verifiessum(weights) >= threshold. Orderingsignatures[]to matchaddresses[]is an application convention so independent co-signers produce byte-identicalsignedRawTxHexand the sameMt...hash. - Off-chain
.msigJSON draft files are an external application convention rather than a built-in@minter-network/tx-coreformat (decodeRawTxdecodes complete 10-field signed transactions; to inspect an unsigned draft, pass structuredUnsignedTxfields and decode innerdataviadecodeTxData).
import {
MinterGateClient,
assembleMultisigTx,
buildCreateMultisigTx,
buildSendTx,
deriveMultisigAddress,
parsePip,
signTx,
signTxForMultisig,
} from "@minter-network/tx-core";
import type { MinterWallet } from "@minter-network/tx-core";
// Supply these inputs from your application.
declare const owner1: MinterWallet;
declare const owner2: MinterWallet;
declare const owner3: MinterWallet;
const gate = new MinterGateClient(
process.env.MINTER_GATE_URL ?? "https://gate.minter.network/v2",
);
// 1. Create a 2-of-3 multisig (weights [400, 400, 600], threshold 800)
const creatorNonce = await gate.getNextNonce(owner1.address);
const createUnsigned = buildCreateMultisigTx(
{
threshold: 800,
weights: [400, 400, 600],
addresses: [owner1.address, owner2.address, owner3.address],
},
{ nonce: creatorNonce, chainId: 1, gasCoin: 1993 },
);
const createSigned = signTx(createUnsigned, owner1.privateKey);
await gate.sendTransaction(createSigned.signedRawTxHex);
await gate.waitForTransaction(createSigned.txHash);
const multisigMx = deriveMultisigAddress(owner1.address, creatorNonce);
// 2. First payout from the multisig account (transaction_count = 0 -> nonce = 1n)
const unsignedPayout = buildSendTx(
{
coinId: 1993,
to: "Mx3a7b9104e82d19c64f01b5a8e9c72104d3e811f0",
valuePip: parsePip("1000"),
},
{
nonce: 1n,
chainId: 1,
gasPrice: 1,
gasCoin: 1993,
payload: "treasury:payout-Q4",
signatureType: 2,
},
);
const sig1 = signTxForMultisig(unsignedPayout, owner1.privateKey);
const sig2 = signTxForMultisig(unsignedPayout, owner2.privateKey);
const { signedRawTxHex, txHash } = assembleMultisigTx(
unsignedPayout,
multisigMx,
[sig1, sig2],
);
await gate.sendTransaction(signedRawTxHex);
await gate.waitForTransaction(txHash);Hot / Cooler / Cold custody and policy signer
If the only signing key resides on an internet-facing server, a compromised process can drain the treasury. Assigning weights [400, 400, 600] with threshold = 800 splits authority across three keys:
Hot(weight400) runs inside the application worker or AI agent, buildsUnsignedTx, and producessigHot, which alone cannot reach800.Cooler(weight400) runs on an isolated host with no inbound ports, pulls signing requests from a queue, verifiessigHotviaecrecover, validateschainId,signatureType,gasCoin, opcode, recipient allowlist, and per-coinIdcaps, and appendssigCooler(400 + 400 = 800).Cold(weight600) stays offline and pairs withCooler(1000 >= 800) to rotate a compromisedHotkey viaEditMultisig (0x12), or pairs withHot(1000 >= 800) duringCoolerhardware maintenance.
| Signer combination | Weight sum | Node decision (threshold = 800) | Operational role |
|---|---|---|---|
Hot only | 400 | Rejected (< 800) | Compromised web worker or agent cannot move funds |
Hot + Cooler | 800 | Executed (>= 800) | Automated payouts within policy limits |
Cold + Cooler | 1000 | Executed (>= 800) | Rotate Hot key via EditMultisig (0x12) |
Cold + Hot | 1000 | Executed (>= 800) | Recovery signing if Cooler host is offline |
import {
SIGNATURE_TYPE,
TX_TYPE,
assembleMultisigTx,
computeSigningHash,
decodeTxData,
parsePip,
recoverAddressFromVrs,
signTxForMultisig,
type EcdsaSignatureVrs,
type MxAddress,
type SendTxData,
type UnsignedTx,
} from "@minter-network/tx-core";
const ALLOWED_GAS_COINS = new Set<number>([0, 1993]);
const ALLOWED_RECIPIENTS = new Set<string>([
"mx3a7b9104e82d19c64f01b5a8e9c72104d3e811f0",
]);
// Separate per-coinId caps in pip
const MAX_PER_TX_BY_COIN = new Map<number, bigint>([
[1993, parsePip("250")], // max 250 USDTE per transaction
[0, parsePip("50000")], // max 50,000 BIP per transaction
]);
export function coolerCoSignIfCompliant(params: {
unsignedTx: UnsignedTx;
multisigMx: MxAddress;
expectedHotMx: MxAddress;
sigHot: EcdsaSignatureVrs;
coolerPrivateKey: Uint8Array;
}) {
const { unsignedTx, multisigMx, expectedHotMx, sigHot, coolerPrivateKey } = params;
if (unsignedTx.chainId !== 1) {
throw new Error(`Unexpected chainId: ${unsignedTx.chainId}`);
}
if (unsignedTx.signatureType !== SIGNATURE_TYPE.MULTISIG) {
throw new Error(`Expected signatureType 2, got ${unsignedTx.signatureType}`);
}
if (ALLOWED_GAS_COINS.has(unsignedTx.gasCoin) === false) {
throw new Error(`Disallowed gasCoin: ${unsignedTx.gasCoin}`);
}
if (unsignedTx.gasPrice !== 1) {
throw new Error(`Disallowed gasPrice: ${unsignedTx.gasPrice}`);
}
if (unsignedTx.payload.length + unsignedTx.serviceData.length > 256) {
throw new Error("Payload/serviceData exceeds Cooler policy (256 bytes)");
}
const signingHash = computeSigningHash(unsignedTx);
const recoveredHot = recoverAddressFromVrs(signingHash, sigHot);
if (recoveredHot.toLowerCase() !== expectedHotMx.toLowerCase()) {
throw new Error(`sigHot signer mismatch: ${recoveredHot}`);
}
// Reject EditMultisig (0x12), Unbond (0x08), and all opcodes except Send (0x01)
if (unsignedTx.type !== TX_TYPE.SEND) {
throw new Error(`Opcode not permitted by policy: 0x${unsignedTx.type.toString(16)}`);
}
const send = decodeTxData(TX_TYPE.SEND, unsignedTx.data) as SendTxData;
if (ALLOWED_RECIPIENTS.has(send.to.toLowerCase()) === false) {
throw new Error(`Recipient not in allowlist: ${send.to}`);
}
const maxPip = MAX_PER_TX_BY_COIN.get(send.coinId);
if (maxPip === undefined) {
throw new Error(`Asset coinId ${send.coinId} is not permitted`);
}
if (send.valuePip > maxPip) {
throw new Error(`Amount ${send.valuePip} pip exceeds cap ${maxPip} pip for coinId ${send.coinId}`);
}
const sigCooler = signTxForMultisig(unsignedTx, coolerPrivateKey);
return assembleMultisigTx(unsignedTx, multisigMx, [sigHot, sigCooler]);
}