Blockchain Integration
ERC-3643 on Polygon — Identity, Compliance, Security Tokens
blockchain-svc :8082Go / Fibergo-ethereumOfficial TREXFactoryONCHAINIDOfficial ERC-3643 T-REX Suite — Polygon Amoy (Chain 80002)
Deployed own TREXFactory stack (not Tokeny's shared factory). Single-transaction deployment of 6 upgradeable beacon proxy contracts per token. ONCHAINID-based identity with signed KYC claims.
0xdD82e41585A34750B93f4237aBaB2F5c4305B49F0x35eCf826e4EEBC909d8274C7579fA96185EaeC610x2cd28d69ae53c7a4f4d9da8f0b4b056e345ca97c0x1EAa6562063d3F84Fdc4c467af0D81adAE6126060x63Bb4bb32a4C696863562323353549f9CDE225F40x28a002Cff880372987c85e3505542e770f3fA3E66
Contracts per token
1
Deploy transactions
Beacon
Proxy type
Complete lifecycle from token creation to investor trading, using official ERC-3643 T-REX with ONCHAINID claim-based identity verification.
Admin platform-api blockchain-svc Polygon Amoy
│ │ │ │
│── Create token (draft) ──▶│ │ │
│ │ │ │
│── Deploy token ──────────▶│ │ │
│ │── POST /deploy ──────▶│ │
│ │ │── TREXFactory │
│ │ │ .deployTREXSuite() ▶│
│ │ │◀─ 6 contracts ────────│
│ │ │── addModule() ×N ────▶│
│ │◀─ 6 addresses ───────│ │
│ │ │ │
Investor │ │ │
│── Submit KYC ────────────▶│ │ │
│ (Sumsub WebSDK) │ │ │
│ │◀─ webhook GREEN ─────│ Sumsub │
│ │ │ │
│ │── identity/deploy ───▶│ │
│ │ │── Node.js bridge ────▶│
│ │ │ createIdentity() │
│ │ │◀─ ONCHAINID addr ────│
│ │ │── addClaim(KYC) ─────▶│
│ │ │── registerIdentity() ▶│
│ │ │ │
│ │── mint ──────────────▶│ │
│ │ │── Token.mint() ──────▶│
│ │ │ │
Trading │ │ │
│── Place order ───────────▶│ trading-server │ │
│ │── match ──────────────│ │
│ │── settle ─────────────▶│ │
│ │ │── forcedTransfer() ──▶│
│ │◀─ tx_hash ────────────│ │Gas Costs Per Operation (Polygon Amoy)
| Operation | Gas | MATIC (30 gwei) | USD ($0.40) |
|---|---|---|---|
| deployTREXSuite (6 contracts) | 3,925K | 0.118 | $0.047 |
| addModule (per module) | 39K | 0.001 | $0.0005 |
| createIdentity (ONCHAINID) | 458K | 0.014 | $0.005 |
| addClaim (KYC) | ~100K | 0.003 | $0.001 |
| registerIdentity (per token) | 80K | 0.002 | $0.001 |
| mint | ~150K | 0.005 | $0.002 |
| forcedTransfer (settlement) | ~100K | 0.003 | $0.001 |
| setAddressFrozen | ~40K | 0.001 | $0.0005 |
blockchain-svc is the sole interface to the Polygon chain. Neither platform-api nor trading-server have any go-ethereum dependency. All chain interactions are HTTP calls to blockchain-svc.
platform-api:8081 trading-server:8080 blockchain-svc:8082 Polygon
│ │ │ │
│ (token deploy, │ │ │
│ identity registration, │ │ │
│ minting) │ │ │
│───── HTTP POST ───────────────────────────────────────▶│ │
│ │ │── Contract calls ────▶│
│ │ │◀─ TX receipts ────────│
│ │ │ │
│ │ (settlement transfers) │ │
│ │───── HTTP POST ──────────▶│ │
│ │ │── forcedTransfer ────▶│
│ │◀──── {tx_hash} ──────────│ │
│ │ │ │
│ │ │── Event Indexer ──────│
│ │ │ (30s polling) │
│ │ │◀─ FilterLogs ─────────│
│ │ │── INSERT events ──────▶DBThree contracts deployed per token. ERC-3643 is the standard for regulated security tokens with built-in identity verification and transfer compliance.
IdentityRegistry
Maps investor addresses to verified identities with country codes.
registerIdentity(address investor, uint16 countryCode) removeIdentity(address investor) isVerified(address investor) → bool addAgent(address agent) // grants registration permissions
Compliance
Enforces transfer rules. Linked to IdentityRegistry at construction.
constructor(address identityRegistry) canTransfer(address from, address to) → bool // Checks both sender and receiver are verified in IR
SecurityToken
ERC-20 compatible with compliance-checked transfers. Agent role for platform operations.
constructor(string name, string symbol, uint8 decimals,
address identityRegistry, address compliance)
mint(address to, uint256 amount) // agent only
forcedTransfer(address from, address to,
uint256 amount) // agent only
setAddressFrozen(address target, bool frozen)
pause() / unpause()
canTransferTokens(address from, address to) → boolToken deployment creates 3 contracts and grants agent roles in 5 sequential transactions. All transactions are waited for mining before proceeding.
blockchain-svc Polygon
│ │
│─── TX1: Deploy IdentityRegistry ──────────────────────▶│
│ (no constructor args) │
│◀── receipt (IR address) ───────────────────────────────│
│ gas recorded: token_deploy_ir │
│ │
│─── TX2: Deploy Compliance(IR address) ────────────────▶│
│◀── receipt (Compliance address) ───────────────────────│
│ gas recorded: token_deploy_compliance │
│ │
│─── TX3: Deploy SecurityToken(name, symbol, decimals, │
│ IR address, Compliance address) ───────────────▶│
│◀── receipt (Token address) ────────────────────────────│
│ gas recorded: token_deploy_token │
│ │
│─── TX4: IR.addAgent(deployer address) ────────────────▶│
│◀── receipt ────────────────────────────────────────────│
│ gas recorded: token_deploy_add_agent │
│ │
│─── TX5: Token.addAgent(deployer address) ─────────────▶│
│◀── receipt ────────────────────────────────────────────│
│ gas recorded: token_deploy_add_agent │Gas Estimates (per TX)
TX1: IR
~2.5M
TX2: Compliance
~1.5M
TX3: Token
~3M
TX4: addAgent
~50K
TX5: addAgent
~50K
{
"name": "DAGRI Token",
"symbol": "DAGRI",
"decimals": 18,
"total_supply": 10000000,
"token_id": "uuid-v7-here"
}{
"identity_registry_addr": "0x...",
"compliance_addr": "0x...",
"token_addr": "0x...",
"ir_deploy_tx_hash": "0x...",
"comp_deploy_tx_hash": "0x...",
"token_deploy_tx_hash": "0x...",
"chain_id": 31337
}