Skip to Content
MCN Blockchain

Process deposits

Scan direct native transfers, validate finality and credit each deposit once.

This workflow credits direct native MCN transfers to assigned exchange addresses. No memo or token-contract event is needed. Use a synchronized execution and consensus node, and verify Mainnet identity before scanning.

Scan finalized blocks

  1. Store the last processed block height and hash in a durable database.
  2. Read the current finalized block. Process each unprocessed height up to that height using eth_getBlockByNumber with full transactions (true).
  3. Check parent-hash continuity against your saved cursor. A mismatch in previously finalized history requires investigation, not automatic ledger rewriting.
  4. Match to against assigned deposit addresses and require a positive native value.
  5. Fetch each candidate receipt. Require successful execution and a matching canonical block hash.
  6. In one database transaction, insert the deposit, post the ledger entry and advance the cursor. Enforce a unique key on chain ID + transaction hash for this direct-transfer workflow.

If scanning latest for early UI visibility, keep those entries provisional until the same finality checks pass. Do not advance the finalized accounting cursor based only on the UI scan.

Validate one candidate with ethers

Use the ethers setup. This function returns validated deposit data; it does not modify a ledger.

import { getAddress } from "ethers";

// Call only after checking this provider's MCN chain ID and genesis.
export async function inspectNativeDeposit(provider, hash, assignedAddress) {
  const [tx, receipt, finalized] = await Promise.all([
    provider.getTransaction(hash),
    provider.getTransactionReceipt(hash),
    provider.getBlock("finalized"),
  ]);
  if (!tx || !receipt || !finalized) return null;
  if (receipt.status !== 1 || tx.value <= 0n || !tx.to) return null;
  if (getAddress(tx.to) !== getAddress(assignedAddress)) return null;
  if (tx.blockHash !== receipt.blockHash) throw new Error("Block mismatch");
  const canonical = await provider.getBlock(receipt.blockNumber);
  if (!canonical || canonical.hash !== receipt.blockHash) return null;
  if (finalized.number < receipt.blockNumber) return null;
  return {
    chainId: 2325,
    transactionHash: receipt.hash,
    blockNumber: receipt.blockNumber,
    blockHash: receipt.blockHash,
    address: getAddress(tx.to),
    amountBaseUnits: tx.value.toString(),
  };
}

Post the returned integer amount atomically with its idempotency key. A returned object is not a replacement for database uniqueness and cursor recovery.

History API

MCNScan provides account history for support, investigation and reconciliation. Indexer lag or a missing history item must not override a canonical receipt from your node.

Other movement types

TypeProcessing requirement
Direct native transferTop-level to, value and successful finalized receipt
Contract-originated native transferSuccessful execution trace or equivalent indexed evidence; separate identifiers and deduplication
Token transferReviewed network and token contract, receipt and event log index; separate asset
Consensus withdrawalWithdrawal payload/balance-credit indexing; no ordinary transaction receipt

Publish the transfer types your exchange accepts. Do not infer native MCN from a token symbol or event log, and do not count one movement through overlapping discovery paths twice.

Pause and recover

Pause new credits if finality stops or trusted nodes disagree at the same finalized height. Preserve the cursor and candidate data. After resolving the cause, replay from the last durable checkpoint with the same idempotency rules and reconcile wallet balances against the ledger.

On this page