> For the complete documentation index, see [llms.txt](https://www.ankitavirani.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://www.ankitavirani.com/experience/protocols/ercs-and-eips/erc-3643.md).

# ERC-3643

## 📜 ERC-3643: The Security Token Standard

ERC-3643 is a comprehensive standard for security tokens on the Ethereum blockchain. It provides a framework for issuing, managing, and trading compliant security tokens.

### 🏗️ Architecture

The ERC-3643 standard consists of several interconnected components:

<figure><img src="/files/ZGI2c1gbY44EDfLKwwlq" alt=""><figcaption></figcaption></figure>

### 🧠 Core Concepts

#### 1. Token 💰

The main ERC-3643 token contract that implements the standard's interfaces.

#### 2. Identity Registry 🆔

Manages the identities of token holders and their associated claims.

#### 3. Compliance 📋

Enforces transfer restrictions and other compliance rules.

#### 4. Trusted Issuers Registry 📚

Maintains a list of trusted claim issuers.

#### 5. Claim Topics Registry 📝

Defines the types of claims that can be associated with identities.

### 🚶 User Flow

Here's a typical user flow for interacting with ERC-3643 tokens:

<figure><img src="/files/y0K04f5zlxDrCG4LlQPc" alt=""><figcaption></figcaption></figure>

### 💻 Implementation Details

#### Token Interface

```solidity
interface IERC3643 is IERC20 {
    function setIdentityRegistry(address _identityRegistry) external;
    function setCompliance(address _compliance) external;
    function forcedTransfer(address _from, address _to, uint256 _amount) external returns (bool);
    function mint(address _to, uint256 _amount) external;
    function burn(address _from, uint256 _amount) external;
    // ... additional functions
}
```

#### Identity Registry Interface

```solidity
interface IIdentityRegistry {
    function registerIdentity(address _address, uint16 _country, bytes32 _hash) external;
    function updateIdentity(address _address, uint16 _country, bytes32 _hash) external;
    function deleteIdentity(address _address) external;
    function isVerified(address _address) external view returns (bool);
    // ... additional functions
}
```

#### Compliance Interface

```solidity
interface ICompliance {
    function canTransfer(address _from, address _to, uint256 _amount) external view returns (bool);
    function transferred(address _from, address _to, uint256 _amount) external;
    function created(address _to, uint256 _amount) external;
    function destroyed(address _from, uint256 _amount) external;
    // ... additional functions
}
```

### 🚀 Example Implementation

Here's a basic implementation of the ERC-3643 token:

```solidity
pragma solidity ^0.8.0;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "./interfaces/IERC3643.sol";
import "./interfaces/IIdentityRegistry.sol";
import "./interfaces/ICompliance.sol";

contract ERC3643Token is ERC20, IERC3643 {
    IIdentityRegistry public identityRegistry;
    ICompliance public compliance;

    constructor(string memory name, string memory symbol) ERC20(name, symbol) {
        // Initialize with default identity registry and compliance
    }

    function setIdentityRegistry(address _identityRegistry) external override {
        // Implementation
    }

    function setCompliance(address _compliance) external override {
        // Implementation
    }

    function transfer(address recipient, uint256 amount) public virtual override(ERC20, IERC20) returns (bool) {
        require(compliance.canTransfer(msg.sender, recipient, amount), "Transfer not allowed");
        bool success = super.transfer(recipient, amount);
        if (success) {
            compliance.transferred(msg.sender, recipient, amount);
        }
        return success;
    }

    // Implement other required functions...
}
```

### 🔑 Key Features

* 🔒 Built-in compliance and regulatory features
* 🆔 Identity management for token holders
* 🔄 Flexible transfer restrictions
* 📊 Granular control over token issuance and management
* 🌐 Support for global regulatory requirements

ERC-3643 provides a comprehensive framework for security tokens, addressing the complex regulatory requirements of tokenized securities. Its modular design allows for flexibility in implementing various compliance rules and identity verification processes.
