DocsTechnicalSmart Contract

Technical

Smart Contract

Architecture, interface, and security properties of the MonadInscriptions contract.

Design philosophy

The MonadInscriptions contract is intentionally minimal. Its job is not to understand token semantics — it is simply a trusted, immutable anchor that validates fees, stores nothing, and emits events. All token logic lives off-chain in the indexer.

This design means the contract can be small, auditable, and extremely gas-efficient. There are no storage mappings, no access control tables, and no upgrade proxies in the core inscription path.

Minimal attack surface

Because the contract holds no user balances and makes no external calls, the attack surface is limited to: fee extraction, event emission correctness, and reentrancy during the fee collection step. All three are handled by the contract design.

Contract interface

The primary interface exposed to users is a single function:

IMonadInscriptions.sol
interface IMonadInscriptions {
// Emit an inscription. Requires msg.value == PROTOCOL_FEE.
function inscribe(string calldata payload) external payable;
// Returns the current protocol fee in wei.
function protocolFee() external view returns (uint256);
// Total fees collected since deployment.
function totalFees() external view returns (uint256);
}

inscribe(string)

FieldTypeDescriptionRequired
payloadstring calldataUTF-8 JSON string conforming to the MON-20 standard. The contract does not parse or validate JSON — it only checks that the string is non-empty.YES

The function requires msg.value to equal exactly protocolFee() (10 MON = 10 × 10¹⁸ wei). If the value is wrong — too high or too low — the call reverts.

Events

The contract emits one event per successful inscription:

events.sol
event Inscribed(
address indexed from,
string payload,
uint256 timestamp
);
FieldTypeDescriptionRequired
fromaddress indexedThe msg.sender — the wallet that signed and submitted the transaction. Used by the indexer as the initiator of the operation.YES
payloadstringThe raw JSON payload passed to inscribe(). Not validated on-chain — the indexer is responsible for JSON parsing and rule enforcement.YES
timestampuint256block.timestamp at the time of inclusion. Used for display purposes only — the indexer uses block number + tx index for canonical ordering.YES
Events are indexed by from address, allowing efficient filtering. To query all inscriptions by a specific wallet, filter Inscribed events by the from topic.

Fee collection

Collected fees accumulate in the contract's ETH balance. The contract exposes a withdraw function restricted to the protocol treasury address:

treasury.sol
// Only callable by the protocol treasury address
function withdrawFees(address payable recipient) external onlyTreasury;

No user refunds

The contract has no refund mechanism. If an inscription is confirmed on-chain but rejected by the indexer, the protocol fee is not returned. The contract cannot distinguish between valid and invalid MON-20 operations — it only sees the raw payload string.

Security properties

No reentrancy risk

The inscribe() function uses the checks-effects-interactions pattern. Fees are recorded before any external ETH transfer occurs. There is no external call in the mint path.

No upgrade proxy

The core contract is not upgradeable. Once deployed, inscription logic and event schemas are permanent. Future versions of the protocol will use a new contract address.

No token custody

The contract holds only collected protocol fees in MON. It never custodies user tokens because MON-20 tokens have no on-chain representation — balances are purely indexer-derived.

Deterministic ordering

Monad's consensus ensures a canonical block and transaction order. The indexer relies on this ordering to resolve conflicts (e.g. racing deploys of the same ticker).

Open source

The contract source code is publicly available and has been reviewed by the team. A formal third-party audit is planned prior to mainnet launch.

Contract addresses

The current deployment is on Monad Testnet. Mainnet addresses will be published separately at launch.

NetworkMonad Mainnet
Chain ID143
Contract0x30A155C2C57a90e8827aea55B62d6CF0C5F42B4f
ABIAvailable on GitHub