Verax Attestation Registry
  • 👋Introduction
  • ⚒️Getting Started
  • Core Concepts
    • High-Level Overview
    • Attestations
    • Schemas
    • Linked Data
    • Modules
    • Portals
    • Ecosystem
  • Developer Guides
    • ♒For Attestation Issuers
      • Create and register a Schema
      • Create a Module
      • Register a Module
      • Create a Portal
      • Register a Portal
      • Create an Attestation
      • Encoding Attestation Data
      • Revoke an Attestation
      • Replace an Attestation
      • Link Attestations
      • Bulk Create Attestations
      • EAS compatibility
    • 🧑‍🏫Tutorials
      • From a Schema to an Attestation
      • Using Ceramic to store the Attestation Payload
    • 🚀Examples
    • 🌐Using the Subgraph
    • 🛠️Using the SDK
  • Discover
    • 📚Modules Standard Library
      • ECDSAModule
      • ERC1271Module
      • FeeModule
      • IndexerModule
      • IssuersModule
      • SchemaModule
      • SenderModule
    • 🤝Integrations
  • Get Involved
    • Get in Touch
    • Contribute
    • Governance
      • Governance Charter
      • Governance Parameters
      • Overview of Governance
      • Proposal Templates
Powered by GitBook
On this page
  • Module creation
  • Module registration
  • Manually registering a deployed Module in the ModuleRegistry contract
  • Using a blockchain explorer
  • Using the official Verax SDK
  1. Developer Guides
  2. For Attestation Issuers

Register a Module

PreviousCreate a ModuleNextCreate a Portal

Last updated 9 months ago

are smart contracts that are registered in the "Module Registry" and that perform specific validation logic on attestations before they are issued into the registry.

The Module mechanism may change in the future, following and what we call "".

Module creation

Modules are intended to perform a single specific function. They should be designed to be minimalistic, atomic, and reusable. Modules can be chained together in series so that they are executed in order, with any module in the chain being able to prevent an attestation being issued to the registry by simply reverting if its verification checks fail.

To create a module, you must deploy a smart contract that inherits the AbstractModule abstract contract, which looks like this:

abstract contract AbstractModule {
  function run(
    AttestationPayload memory attestationPayload,
    bytes memory validationPayload,
    address txSender,
    uint256 value
  ) public virtual returns (bytes[] memory moduleValidationPayload);
}

The run function accepts four arguments:

  1. attestationPayload, the raw attestation data that will be stored in the registry

  2. validationPayload, validation logic that the module needs to execute its verification logic

  3. txSender, the address of the initial transaction sender

  4. value, the amount of ETH paid to get this attestation

The validationPayload can be any data, which may encompass fields from the attestation metadata or additional data such as ZKP proof, a signature, merkle proof, and so on.

function supportsInterface(bytes4 interfaceID) public pure override returns (bool) {
  return interfaceID == type(AbstractModule).interfaceId || interfaceID == type(IERC165Upgradeable).interfaceId;
}

Module registration

Module registration takes 3 parameters, defined as follows:

Parameter
Description

name

A descriptive name for the module that's stored on-chain

description

A link to an off-chain document that describes the module

moduleAddress

The address of the module smart contract

Manually registering a deployed Module in the ModuleRegistry contract

Once you have deployed your module contract, you can then register it in the ModuleRegistry contract using the register function:

function register(
    string memory name,
    string memory description,
    address moduleAddress
);

A few caveats: a module contract must be first deployed and cannot be registered twice under different names, and it must implement the interfaces described above. Also, the name parameter must not be empty.

Using a blockchain explorer

  1. Connect your allow-listed wallet and fill the register form with the parameters described above

  2. Send the transaction

Using the official Verax SDK

We have seen rather manual ways to register a Module, now let's focus on the easiest way: via the Verax SDK.

Once you have an SDK instance, you can register a Module like this:

await veraxSdk.module.register(
    "ExampleModule",
    "This Module is used as an example",
    "0xda14ac2b6fb17cca948ea74a051af75c92998643",
);

As well as implementing the AbstractModule interface, the module contract must also implement the interface, which involves including this function:

Instead of crafting the smart contract call by hand, you can benefit from a chain explorer interface. Let's use the Linea Sepolia explorer, .

Retrieve the ModuleRegistry contract address from the

Access the ModuleRegistry contract on

Go to the

Go to the

Check to discover how to instantiate the Verax SDK.

To dive deeper on exactly how the ModuleRegistry contract works, you can check out the .

Once you have deployed one or more schemas and optionally also deployed one or more modules, you are ready to register a and tie them all together so that you can issue your first attestations.

♒
Modules
Verax Improvement Proposal #5
Modules V2
IERC165Upgradeable
Lineascan
project README
Lineascan
"Contract" tab
"Write as Proxy" tab
this page
source code on GitHub
portal
The form generated by Lineascan to interact with the ModuleRegistry contract