Smart contract documentation (NatSpec)

We design and develop full-cycle blockchain solutions: from smart contract architecture to launching DeFi protocols, NFT marketplaces and crypto exchanges. Security audits, tokenomics, integration with existing infrastructure.
Showing 1 of 1 servicesAll 1306 services
Smart contract documentation (NatSpec)
Simple
~1 business day
FAQ
Blockchain Development Services
Blockchain Development Stages
Latest works
  • image_website-b2b-advance_0.png
    B2B ADVANCE company website development
    1238
  • image_web-applications_feedme_466_0.webp
    Development of a web application for FEEDME
    1167
  • image_websites_belfingroup_462_0.webp
    Website development for BELFINGROUP
    867
  • image_ecommerce_furnoro_435_0.webp
    Development of an online store for the company FURNORO
    1080
  • image_logo-advance_0.png
    B2B Advance company logo design
    563
  • image_crm_enviok_479_0.webp
    Development of a web application for Enviok
    829

Smart Contract Documentation (NatSpec)

A contract without documentation is a contract that cannot be safely integrated. A developer who will use your token six months from now shouldn't have to reconstruct logic from bytecode and tests. NatSpec is the inline documentation standard for Solidity, read by humans, generated by tools, and displayed in MetaMask when signing transactions.

What NatSpec Is and How It Works

NatSpec (Natural Language Specification) is a set of tags in Solidity comments that the compiler includes in the ABI and a separate JSON document. Supports two formats: single-line (///) and block (/** */).

Main tags:

  • @title — contract name
  • @notice — description for end user (displayed in MetaMask)
  • @dev — technical details for developer
  • @param — description of function parameter
  • @return — description of return value
  • @custom:tag — custom tags (audit notes, security notices)

Example of properly documented function:

/// @notice Transfers tokens to the specified address
/// @dev Doesn't work with ERC-777 tokens due to hooks; use safeTransfer for unknown recipients
/// @param to Recipient address, cannot be address(0)
/// @param amount Number of tokens in minimum units (wei)
/// @return success True if transfer succeeded
function transfer(address to, uint256 amount) external returns (bool success);

What Gets Generated from NatSpec

forge doc (Foundry) or solidity-docgen generates Markdown/HTML documentation from NatSpec comments. Result is structured API reference with descriptions of each contract, function, event, and error.

For public protocols this is critical: auditors work faster with documented code, integrators don't ask questions in Discord, users see clear text in wallet before signing.

@custom:security and @custom:oz-upgrades-unsafe-allow are special tags read by tools (OpenZeppelin Upgrades checks marked unsafe patterns). Not just documentation — machine-readable annotations.

What to Document

Mandatory: all public and external functions, all events (event), all custom errors (error), all state-changing operations. @notice from user perspective, @dev from integrator perspective.

Optional but useful: internal functions in libraries, complex algorithms (AMM formulas, reward calculation), security-critical assumptions (@dev Assumes price oracle is not manipulable within single block).

Full documentation of a medium-sized contract (500-1000 lines) — 1 working day. Documentation generation and docgen pipeline setup — another 2-4 hours.