Skip to main content

ERC-3643 Protocol Introduction

Contents

  1. At a glance
  2. Five core concepts
  3. Overall contract architecture
  4. Contract responsibilities and on-chain state
  5. Contract interactions
  6. Permissions and multisig
  7. Research and demo conclusions
  8. Security boundaries
  9. Glossary

1. At a glance

ERC-3643 is an ERC-20 issuance framework with identity verification and compliance checks. It defines who may hold a token, whether a transfer may proceed, how authorized parties freeze, force-transfer, or recover assets, and how implementations are upgraded consistently.

DimensionRegular ERC-20ERC-3643
Who can receiveAny addressVerified identities only
TransfersCannot reject based on business rulesCompliance modules may reject
Freeze, force transfer, wallet recoveryUnavailableAvailable
Rule changesUsually require another contractChange configuration or modules

2. Five core concepts

ConceptMeaning
ONCHAINIDOn-chain user identity separate from a wallet; one identity may link several wallets
ClaimA signed qualification assertion attached to an identity
Claim IssuerInstitution contract authorized to issue or revoke Claims
Identity RegistryDetermines whether an address belongs to an eligible investor—the person check
Compliance moduleDetermines whether a transaction follows the rules—the transaction check

Both gates must pass. A KYC-approved investor can still be rejected by a holding limit or another compliance rule.


3. Overall contract architecture

3.1 Four layers

LayerInstance countPurpose
PlatformUsually one per chainIssuance access, identity creation, shared upgrades
SuiteSix contracts per assetBalances, identity, compliance, governance
ONCHAINIDOne per userKeys and Claims
Compliance moduleDeployed by rule and reusableExecutable transaction rules

The contracts are separated so each responsibility can evolve independently: Token manages the ledger; IR, IRS, CTR, and TIR manage identity qualifications; MC manages transaction rules. Proxy addresses remain stable: the proxy stores state and the implementation supplies logic.

3.2 Three upgrade mechanisms

ObjectMechanismUpgrade entry pointScope
Six TREX contractsIA pointer proxyTREX IAAssets still referencing that IA
ONCHAINIDONCHAINID IAupdateImplementationIdentities referencing that IA
Compliance moduleERC1967 + UUPSModule owner upgradeToAssets bound to that module

4. Contract responsibilities and on-chain state

The chain stores business state and rule configuration, not identity-document images. Names, identity numbers, and other sensitive data stay in the off-chain KYC system. The chain records conclusions such as qualification types, holdings, and transfer eligibility.

4.1 Chain-wide platform contracts

ContractPurposeMain on-chain stateImportant limit
TREXImplementationAuthoritySelects the implementation version used by RWA assetsCurrent version and six implementation addresses per versionAll six implementations must be registered together
IAFactoryCreates an independent upgrade authority for an assetAssets that received an independent authorityOnly the global authority administrator can create one
TREXFactoryDeploys and initializes a complete RWA SuiteUsed salts, authority, identity factory, authorized deployersInitial configuration: at most 5 Topics, issuers, and agents; 30 module operations
TREXGatewayControls issuers, public issuance, fees, and discountsPublic setting, fee token/amount/recipient, issuer list, discounts, adminsAt most 5 Suites per batch
IdFactoryCreates on-chain identity profiles and wallet mappingsWallet-to-identity and identity-to-wallet mappingsAt most 101 wallets per identity
ONCHAINID ImplementationAuthoritySelects the identity implementation versionCurrent implementation and upgrade authorityA change affects all referencing identities
ONCHAINID GatewayLets users create identities with platform-authorized signaturesAuthorized signers and revoked signaturesUsually outside the demo's main flow

4.2 Six core contracts per RWA asset

ContractPurposeMain on-chain stateImportant limit
TokenLedger plus transfer, mint, burn, pause, freeze, force transfer, and wallet recoveryBalances, allowances, supply, metadata, pause state, wallet and partial freezes, attached IR/MC, owners and agentsdecimals from 0 to 18
IdentityRegistryChecks recipient eligibility before transfer or mintReferences to CTR, TIR, IRS and registry administratorsMore requirements and issuers increase gas cost
IdentityRegistryStorageStores wallet identity and country; may be sharedWallet → identity + country and registries using the storageAt most 300 IdentityRegistries; one record per wallet
ClaimTopicsRegistryDefines qualifications required to hold the assetRequired Topics and administratorsAt most 15 unique Topics
TrustedIssuersRegistryDefines accepted issuers and their allowed TopicsIssuers and qualification typesAt most 50 issuers and 15 Topics each
ModularComplianceApplies amount, country, lock-up, and other transaction rulesBound Token, attached modules, administratorsOne Token and at most 25 modules

4.3 User identities and rule modules

ContractPurposeMain on-chain state
ONCHAINID / IdentityOne reusable on-chain identity per person; wallets are replaceable toolsManagement, action, and Claim keys; received Claims
ClaimIssuerKYC/AML institution contract that issues and revokes attestationsIdentity keys plus revoked signatures
ModuleProxyStable entry point for one business ruleCurrent implementation plus per-asset parameters

Source locations: platform contracts are under contracts/factory/ and proxy/authority/; asset contracts are under token/, registry/, and compliance/modular/; identity capabilities come from @onchain-id/solidity.


5. Contract interactions

5.1 Dependencies

5.3 Issuance

The Gateway salt is generally the hexadecimal owner address plus Token name. When fees are enabled, approve the fee token first.

5.4 Investor onboarding: identity, KYC signature, and on-chain Claim

Onboarding consists of four stages: identity-contract creation, qualification signing, Claim submission, and asset-side registration. Keep these distinctions clear:

  1. Creating an ONCHAINID is an on-chain transaction that deploys an investor identity contract.
  2. The ClaimSigner KYC signature is off-chain and creates no transaction or gas cost.
  3. addClaim is an on-chain transaction that stores the ClaimSigner signature and KYC conclusion in the investor's ONCHAINID.

5.4.1 Production flow: self-service identity creation through ONCHAINID Gateway

IdFactory.createIdentity is onlyOwner, so investors cannot call the factory directly. For production, deploy the official Gateway.sol, transfer IdFactory ownership to it, and let investors call Gateway.deployIdentityForWallet(investor). The Gateway calls IdFactory.createIdentity as owner, while the investor remains the transaction sender and pays gas.

5.4.2 Caller and gas payer by step

StepActionInitiatorOn-chainGas payerNotes
1KYC reviewInvestor and review systemNoNonePlaintext personal information remains off-chain
2Create ONCHAINIDInvestor calls Gateway.deployIdentityForWalletYesInvestorGateway calls IdFactory.createIdentity
3Sign KYCClaimSigner signs hash(identity, topic, data)NoNoneEOA/HSM/MPC signature, not a transaction
4Submit KYC ClaimInvestor calls Identity.addClaimYesInvestorContract calls ClaimIssuer.isClaimValid
5Register for the assetIR Agent calls IdentityRegistry.registerIdentityYesIR AgentRecords wallet, identity, and country in a Suite
6Verify resultAnyone calls IdentityRegistry.isVerifiedNo, viewNoneMust return true before mint or transfer reception

5.4.3 Is the ClaimSigner KYC signature on-chain?

The signature itself is off-chain:

digest = keccak256(abi.encode(identity, topic, data))
signature = ClaimSigner.signMessage(digest)

The next addClaim transaction stores these arguments:

Identity.addClaim(
topic,
1,
claimIssuer,
signature,
data,
uri
)

The investor submits addClaim, while the identity contract calls ClaimIssuer.isClaimValid(...) to validate that the issuer is trusted, the signature comes from a registered Claim key, the signature has not been revoked, and the Topic is required. Trust comes from the ClaimSigner signature, not the addClaim sender.

5.5 Transfer, mint, and burn matrix

OperationCallerPaused checkFreeze checkIdentity checkCompliance checkAuto-unfreeze
Transfer / delegated transferHolder / approved spenderYesBoth sidesRecipientYesNo
MintAgentNoNoRecipientYesNo
BurnAgentNoNoNoNoYes
Forced transferAgentNoNoRecipientNo, still calls transferredYes
Wallet recoveryAgentNoNoUses forced transferNoYes

Gate 1 validates only the recipient. Pausing does not block administrative operations. Forced transfer skips canTransfer, and partial freezes do not block an Agent.

5.7 Upgrade interactions

ObjectCall chainImpact
TREX contractsIA owner → addTREXVersionuseTREXVersionProxies referencing the reference IA
Detach one assetSame address owns all six → changeImplementationAuthorityTarget asset only
ONCHAINIDOID IA owner → updateImplementationAll referencing identities
Compliance moduleModule owner → upgradeToMCs bound to that module

6. Permissions and multisig

6.1 Four permission models

ModelAuthorizationPurposeSafe compatibility
Ownermsg.sender == ownerGovernance, component replacement, upgrades, rulesSupported, no EOA restriction
AgentAgent listFrequent mint, freeze, registration operationsTechnically supported; multisig is inefficient for every high-frequency action
onlyToken / onlyComplianceCallBound contract addressAutomatic callbacks and parameter forwardingNot a human account
ONCHAINID KeyPurpose-based keccak256(address)Key management, external calls, ClaimsSafe can manage action keys; cannot sign Claims natively

There is no native Timelock. transferOwnership may assign ownership to a Safe. renounceOwnership permanently removes the owner and must be guarded against in production.

6.2 Permission matrix

ContractRoleCritical capabilitySafe recommendation
TREX IA / ONCHAINID IAOwnerGlobal upgradesHighest-security Safe + Timelock
TREXFactoryOwnerDeploy Suites and recover contracts still owned by FactoryUsually owned by Gateway
TREXGatewayOwner / AgentAccess, fees, Factory ownership, deployersOwner → Safe; Agent → service account
TokenOwner / AgentReplace IR/MC, manage agents, mint, burn, freeze, force transfer, recoveryOwner → Safe; separate Agent duties
IROwner / AgentReplace CTR/TIR/IRS and manage investor registrationsOwner → Safe; Agent → KYC account
IRSOwner / AgentBind IR and write identity master dataEstablish ownership model first
CTR / TIR / MCOwnerTopics, issuers, modules, parametersCompliance Safe + Timelock
Upgradeable ModuleModule ownerUUPS upgradeSafe + Timelock
IdFactoryOwnerCreate identitiesPlatform Safe
IdentityManagement/action/Claim keysManage keys, execute calls, manage ClaimsSafe may hold management/action keys
ClaimIssuerManagement + Claim keysRevoke and issueManagement → Safe; issuance → EOA/HSM/MPC

6.3 Safe conclusions

Safe works directly for: Suite and platform owners, module upgrade owners, ONCHAINID management/action keys, and per-asset IA replacement when the same Safe owns all six contracts.

Safe cannot natively sign Claims: validation uses ecrecover, which recovers an EOA. Use Safe for issuer administration and an independent signer for Purpose 3.

High-frequency actions should use constrained service accounts: investor registration, routine mint/burn, deployer maintenance, rapid pause/freeze, force transfer, and recovery. Apply off-chain approval and alerting, with dual approval or dedicated multisig for exceptional risk.

  1. IRS ownership is not transferred with the other five contracts. It remains with Factory, usually owned by Gateway, until recoverContractOwnership is called.
  2. Changing IA for one asset requires all six owner() values to equal the same msg.sender. Separate Safes cannot approve it independently.
  3. Safe and Timelock provide different controls. Global upgrades, IR/MC replacement, and Topic/issuer/module changes require an external execution delay.

7. Research and demo conclusions

ConclusionCode fact
Topics have no fixed numbersNo hard-coded 1=KYC; demo uses keccak256("KYC_APPROVED"), so maintain a chain-level Topic registry
Identity is not a BeaconONCHAINID uses ImplementationAuthority from npm 2.2.1
Production compliance modules are missingOnly unaudited DemoCountryAllowlistModule and TestModule; legacy features are not deployable modules
Transfer entry pointInvestors call Token directly; IdentityProxy.execute is unnecessary
Country codeuint16, ISO 3166-1 numeric, such as 156 and 702; demo module checks recipient only
Module parametersIsolated by MC address, so one module may serve multiple assets
Identity reuseShared issuers avoid repeated KYC; shared IRS adds reuse with a larger governance surface
Dependency versionpackage.json uses ^2.0.0, installed version is 2.2.1; pin the production version

Recommended custom-module priority beyond the demo: country access, per-holder cap, total supply cap, holder count → lock-up, investor class, amount limits → conditional transfers and venue restrictions.

KYC/AML issuers and module parameters directly drive on-chain configuration. Custody, audit, and fiat rails mainly affect approvals. Never put plaintext PII in Claim data.


8. Security boundaries

  • Compromise of Owner, Agent, IA, or ClaimIssuer can directly change assets or eligibility. Separate long-lived Owner and Agent signers.
  • Forced transfer and burn may automatically unfreeze units; pause does not block administrative operations.
  • Removing a trusted issuer or clearing Topics changes eligibility for many users at once.
  • A global IA upgrade has broad impact and requires multisig, Timelock, storage-layout validation, and rollback rehearsal.
  • Contracts cannot establish underlying-asset authenticity, legal title, redemption, or cross-jurisdiction legality; define these in a separate rule matrix.

9. Glossary

TermMeaning
T-REX / SuiteERC-3643 reference implementation / six business contracts for one asset
ONCHAINID / Claim / Topic / IssuerIdentity contract / qualification assertion / assertion type / issuing institution
IR / IRS / CTR / TIR / MCIdentity registry / identity storage / Topic registry / issuer registry / compliance coordinator
Owner / AgentConfiguration governance authority / operational authority
Implementation AuthorityVersion authority that selects the current proxy implementation
TREXFactory / Gateway / IdFactoryAsset factory / issuance access gateway / identity factory