Skip to content

Module

Modules are the starting point for all contracts and tokens on the blockchain. Modules can be deployed through an Account Transaction with effect module_deployed. Each module bundles the Wasm bytecode plus metadata describing its entrypoints.

Modules are stored in the collection modules in the db and have the following class:

MongoTypeModule represents a module stored in the modules collection.

Attributes:

Name Type Description
id str

The hex string identifier for the module, stored as _id in the database.

module_name str

The name of the module.

methods Optional[list[str]]

A list of method names associated with the module.

contracts Optional[list[str]]

A list of contract instances from this module.

init_date Optional[datetime]

The initialization date of the module.

verification Optional[ModuleVerification]

The verification details of the module.

Source code in .venv/lib/python3.13/site-packages/ccdexplorer/domain/mongo.py
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
class MongoTypeModule(BaseModel):
    """
    MongoTypeModule represents a module stored in the `modules` collection.

    Attributes:
        id (str): The hex string identifier for the module, stored as `_id` in the database.
        module_name (str): The name of the module.
        methods (Optional[list[str]]): A list of method names associated with the module.
        contracts (Optional[list[str]]): A list of contract instances from this module.
        init_date (Optional[dt.datetime]): The initialization date of the module.
        verification (Optional[ModuleVerification]): The verification details of the module.
    """

    id: str = Field(..., alias="_id")
    module_name: Optional[str] = None
    methods: Optional[list[str]] = None
    contracts: Optional[list[str]] = None
    init_date: Optional[dt.datetime] = None
    verification: Optional[ModuleVerification] = None

How is a module stored in the system?

  1. ms_block_analyser notices a module_deployed effect and publishes a module_deployed task.
  2. The New Module Service (ms_modules) consumes the task, fetches the Wasm bytes via gRPC, parses the export section (using wasm_decoder), and writes a MongoTypeModule document into the modules collection.
  3. If the module exposes verification metadata, the service invokes the concordium_client CLI to run cargo concordium verify-build. Results are stored alongside the module and surfaced in the Explorer UI.
  4. Downstream services map modules to recognized projects; ms_instances uses this link whenever a new contract is initialized.***