MTM Mode

MTM Mode (Multi-Transaction Mode) allows accounts to send multiple transactions with incremental nonces per block. This mode enables users to send many transactions per second, up to 700 tps for medium SKALE Chains.

Without MTM mode enabled, an account’s subsequent transaction within the same block will revert. Therefore transactions would have to be rate limited per block to avoid a revert.
Currently, MTM must be enabled upon chain creation. Future SKALE Chains will allow toggling this mode on or off by the assigned MTM_ADMIN_ROLE. See the List of Permissions.

Using MTM Mode

To use MTM and fire off multiple transactions, run an async method that calls the current nonce and then increment from this nonce. To see this code in action checkout SKALE Platformer or see the code.

/** For ethers 6.x use:
    import { JsonRpcProvider, Wallet, Contract } from "ethers"
*/

import { providers, Wallet, Contract } from "ethers" /// v5.7.2

/**
 * @description Example of MTM Mode using ethers.js with manual nonce incrementation
 */
const provider = new providers.JsonRpcProvider("https://staging-v3.skalenodes.com/v1/staging-fast-active-bellatrix");
const signer = new Wallet(PRIVATE_KEY).connect(provider);
const contract = new Contract("<address>", [/** abi **/], signer);

/**
 * The nonce should be set to the current transaction count (i.e next nonce) before first use
 */
let nonce = await provider.getTransactionCount(signer.address);

/**
 * @description The write function is an async function that manually increments the signers nonce locally to handle high transactional throughput
 *
 * @param {string} functionName - The function to call on the contract e.g. "mint"
 * @param {Array} args - The function arguements to pass into the contract write
 */
async function write(functionName, args = []) {
    await signer.sendTransaction({
        to: contract.address,
        data: contract.interface.encodeFunctionData(
            functionName,
            args
        ),
        nonce: nonce++
    });
}