URL:
https://forge.synapticchain.xyz
Version: 2.0
Last Updated: 2026-06-05
- Overview
- Architecture
- Getting Started
- Contract Templates
- AI Natural Language Generator
- API Reference
- Wallet Integration
- Subdomain Auto-Provisioning
- Contract Verification
- Template Marketplace
- Frontend Generation
- Deployment Guide
- Security Considerations
- Troubleshooting
Synaptic Forge is a no-code smart contract development environment for SynapticChain. It allows anyone to generate, compile, deploy, and verify audited smart contracts through a professional web interface — no coding required.
- 10 Verified Contract Templates — All compiler-safe, tested with
synlang v2 - AI Natural Language Generation — Describe your contract in English, get SynapticLang code
- One-Click Compile & Deploy — Server-side
synlangcompilation, direct testnet/mainnet deploy - Contract Verification — Submit source code to explorer for public auditability
- Subdomain Auto-Provisioning — Deployed dApps get their own
*.forge.synapticchain.xyzURL - Template Marketplace — Save and share custom contract templates
- Web4 Wallet Connect — Ed25519-based wallet with balance/nonce queries
- BYOK AI Frontend Generation — Use your own Kimi API key for AI-generated React frontends
┌─────────────────────────────────────────────────────────────────┐
│ USER BROWSER │
│ ┌──────────────┐ ┌──────────────┐ ┌──────────────────────┐ │
│ │ Forge UI │ │ Wallet Lib │ │ Kimi API (BYOK) │ │
│ │ (React) │ │ (Ed25519) │ │ (client-side) │ │
│ └──────┬───────┘ └──────┬───────┘ └──────────┬───────────┘ │
└─────────┼─────────────────┼─────────────────────┼───────────────┘
│ │ │
│ HTTPS │ RPC │ HTTPS
│ │ │
┌─────────┼─────────────────┼─────────────────────┼───────────────┐
│ │ │ │ │
│ ┌──────▼───────┐ ┌──────▼───────┐ ┌─────────▼────────┐ │
│ │ Nginx │ │ Gateway-v3 │ │ api.moonshot.cn │ │
│ │ (Charlie) │ │ (Charlie) │ │ (Kimi) │ │
│ └──────┬───────┘ └──────┬───────┘ └──────────────────┘ │
│ │ │ │
│ ┌──────▼─────────────────▼────────┐ │
│ │ Synaptic Forge App │ │
│ │ (Next.js 14, port 3456) │ │
│ │ │ │
│ │ ┌─────────┐ ┌──────────────┐ │ │
│ │ │Compile │ │Deploy │ │ → synlang CLI │
│ │ │API │ │API │ │ │
│ │ └─────────┘ └──────────────┘ │ │
│ │ ┌─────────┐ ┌──────────────┐ │ │
│ │ │Verify │ │Subdomain │ │ → nginx + certbot │
│ │ │API │ │API │ │ │
│ │ └─────────┘ └──────────────┘ │ │
│ │ ┌─────────┐ ┌──────────────┐ │ │
│ │ │AI Gen │ │Marketplace │ │ → taxonomy.json + files │
│ │ │API │ │API │ │ │
│ │ └─────────┘ └──────────────┘ │ │
│ └─────────────────────────────────┘ │
│ Charlie Gateway (203.161.56.222) │
└─────────────────────────────────────────────────────────────────┘
| Layer | Technology |
|---|---|
| Frontend | Next.js 14 (App Router), React 18, Tailwind CSS 3 |
| Icons | Lucide React |
| Crypto | @noble/curves/ed25519.js, js-sha3 |
| Fonts | Inter (UI), JetBrains Mono (code) |
| Backend | Next.js API Routes (Node.js) |
| Compiler | synlang CLI (Rust binary) |
| Reverse Proxy | Nginx 1.24 |
| SSL | Let's Encrypt (Certbot) |
| Process Manager | PM2 |
- Visit
https://forge.synapticchain.xyz - Click Templates in the sidebar to browse 10 verified categories
- Or click AI Generator and describe your contract in natural language
- Fill parameters, click Build Contract
- Click Compile to generate
.planfile - Enter your private key and RPC endpoint in Settings
- Click Deploy to deploy to the blockchain
- Click Verify on Explorer to publish source code
- Click Provision Subdomain to get a public URL
cd /opt/synapticchain/forge
npm install
npm run dev # port 3456
# or
npm run build
npm start # productionRequired environment:
- Node.js 18+
synlangbinary in PATH or at/usr/local/bin/synlang- Nginx (for subdomain provisioning)
- Certbot (for SSL)
| ID | Name | Complexity | Functions | Compiles |
|---|---|---|---|---|
token |
Fungible Token (SRC-20) | simple | 17 | ✅ |
staking |
Staking Vault | simple | 13 | ✅ |
nft |
NFT Collection (ERC-721) | simple | 15 | ✅ |
dex |
AMM DEX (Constant Product) | advanced | 12 | ✅ |
governance |
Simple DAO Governance | intermediate | 8 | ✅ |
vesting |
Token Vesting | intermediate | 8 | ✅ |
referral |
Referral Rewards | simple | 10 | ✅ |
crowdfunding |
Crowdfunding Campaign | simple | 9 | ✅ |
escrow |
Two-Party Escrow | simple | 10 | ✅ |
multisig |
Multi-Signature Wallet | intermediate | 11 | ✅ |
All templates follow these rules for guaranteed compilation with synlang v2:
- Every function MUST declare
#[reads(...)]and/or#[writes(...)]annotations - Use direct map indexing:
self.balances[key] - Use
.insert(key, value)for map writes - Use
emit EventName { field: value }syntax - Use
returnfor return values - Use
require!(condition, "message")for assertions - Helper functions also need reads/writes annotations
The /api/ai-generate endpoint uses keyword-based intent detection:
- Intent Detection — Scans prompt for category keywords (e.g., "staking", "vault", "farm" →
staking) - Parameter Extraction — Regex patterns extract values from natural language:
- Token names:
"called GreenCoin"→TOKEN_NAME=GreenCoin - Percentages:
"10% APY"→REWARD_RATE_BPS=1000 - Durations:
"30 days"→CLIFF_DURATION=2592000(seconds)
- Token names:
- Template Selection — Loads the matching template from
data/templates/ - Substitution — Fills
{{PARAM}}placeholders with extracted values
| Prompt | Detected | Extracted Params |
|---|---|---|
| "Create a token called GreenCoin with symbol GRC" | token |
name=GreenCoin, symbol=GRC |
| "Staking vault with 10% APY" | staking |
rate=1000 bps |
| "NFT collection called CryptoArt, max 10000" | nft |
name=CryptoArt, max_supply=10000 |
| "Multisig wallet with 3 signers" | multisig |
threshold=3 |
Edit forge/app/api/ai-generate/route.ts:
const INTENTS: CategoryIntent[] = [
{
id: 'your_category',
keywords: ['keyword1', 'keyword2'],
requiredParams: ['PARAM_NAME'],
paramExtractors: {
PARAM_NAME: /regex pattern (\d+)/i,
},
},
];Generate contract code from template + parameters.
Request:
{
"categoryId": "token",
"params": {
"TOKEN_NAME": "MyToken",
"TOKEN_SYMBOL": "MTK",
"TOKEN_DECIMALS": "18",
"MAX_SUPPLY": "0"
}
}Response:
{
"code": "contract MyToken { ... }",
"category": { ... }
}Compile SynapticLang code to .plan file.
Request:
{
"code": "contract Test { ... }"
}Response:
{
"success": true,
"message": "Compilation successful!",
"planPath": "/tmp/forge_123.plan"
}Deploy compiled .plan to blockchain.
Request:
{
"planPath": "/tmp/forge_123.plan",
"rpcUrl": "https://forge.synapticchain.xyz/rpc",
"privateKey": "0x..."
}Response:
{
"success": true,
"message": "Deployed successfully",
"contractAddress": "syn1..."
}Generate contract from natural language prompt.
Request:
{
"prompt": "Create a staking vault with 10% APY"
}Verify contract source code on explorer.
Request:
{
"contractAddress": "syn1...",
"code": "contract Test { ... }",
"contractName": "Test",
"deployer": "syn1...",
"rpcUrl": "https://..."
}Response:
{
"success": true,
"explorerUrl": "https://explorer.synapticchain.xyz/contract/syn1..."
}Provision a subdomain for a deployed contract.
Request:
{
"subdomain": "my-project",
"contractAddress": "syn1..."
}Response:
{
"success": true,
"url": "https://my-project.forge.synapticchain.xyz"
}Note: If DNS isn't ready, falls back to HTTP-only. For full auto-SSL, add a wildcard A record:
*.forge.synapticchain.xyz → 203.161.56.222
Marketplace CRUD operations.
GET — List all templates
POST — Save new template ({name, description, categoryId, code, params, author})
DELETE — Remove template (?id=<template_id>)
Generate basic Web4 frontend (server fallback).
For AI-enhanced generation, use BYOK in the UI with your Kimi API key.
The Forge includes a lightweight Ed25519 wallet implementation (app/lib/wallet.ts):
- Address derivation —
privateKey → publicKey → sha3_256 → last 20 bytes → bech32m('syn', ...) - Balance query —
syn_getBalanceRPC call (returnsdata.resultdirectly) - Nonce query —
syn_getNonceRPC call - Balance display —
fromUnits()converts raw 18-decimal units to human-readable SYN
- Go to Settings sidebar tab
- Paste your private key (hex, with or without
0xprefix) - Click Connect Wallet
- Address and balance display in the top bar
- Private keys are stored in component state only (never persisted)
- All signing happens in the browser
- For production, integrate with the SynapticChain wallet app or hardware wallets
- User deploys a contract
- User enters a subdomain prefix (e.g.,
my-project) - Forge API creates:
- Nginx server block for
my-project.greenverse.synapticchain.xyz - Web root directory at
/opt/synaptic/apps/subdomains/my-project/ - Placeholder
index.html
- Nginx server block for
- Certbot attempts SSL certificate expansion
- Nginx reloads
Option A: Wildcard DNS (Recommended)
Add this A record in your DNS provider (Namecheap):
*.forge.synapticchain.xyz → 203.161.56.222
Option B: Per-Subdomain DNS
Manually add A records for each subdomain, or implement the Namecheap API:
// In subdomain API — add before nginx config creation
await createNamecheapDNSRecord({
type: 'A',
host: subdomain,
value: '203.161.56.222',
});Namecheap API Credentials:
- Set
NAMECHEAP_API_USER,NAMECHEAP_API_KEY,NAMECHEAP_CLIENT_IPenv vars - Requires whitelisted IP
- Deploy contract
- Click Verify on Explorer
- Forge saves:
- Contract address
- Source code
- Compiler version
- Deployer address
- Timestamp
- Returns explorer URL for public viewing
Verified contracts are stored at:
forge/data/verified/<contract_address>.json
The verify endpoint also attempts to forward data to the explorer backend:
POST http://127.0.0.1:8000/api/contracts/verify
- Save — Publish your generated contract as a community template
- Browse — View all saved templates with author, date, stars, downloads
- Load — One-click import of any marketplace template into the editor
Templates are stored server-side at:
forge/data/marketplace/<template_id>.json
{
"id": "abc123",
"name": "My Custom Token",
"description": "...",
"categoryId": "token",
"code": "contract ...",
"params": { "TOKEN_NAME": "MyToken" },
"author": "syn1...",
"createdAt": "2026-06-05T00:00:00Z",
"stars": 0,
"downloads": 0
}If no Kimi API key is configured, Forge generates a basic React + Tailwind dApp with:
- Read function buttons
- Write function forms
- Wallet connect placeholder
- Web4 RPC integration
For cinema-quality frontends:
- Get a Kimi API key from
https://platform.moonshot.cn - Go to Settings → Kimi API Key (BYOK)
- Paste your key (stored in
localStorage, never sent to server) - Click Generate Frontend
- Forge calls Kimi directly from your browser with the contract code
- Returns a complete, styled React component
Why BYOK?
- You pay for your own API usage
- Your contract code stays private
- No key management liability for the operator
# On Charlie (203.161.56.222)
cd /opt/synaptic/apps/forge
npm install
npm run build
pm2 start npm --name forge -- start
pm2 save
# Nginx config already exists at:
# /etc/nginx/sites-enabled/forge.synapticchain.xyz
# SSL cert (shared with other subdomains):
# /etc/letsencrypt/live/rpc.synapticchain.xyz/| Variable | Required | Description |
|---|---|---|
SYNLANG_PATH |
No | Path to synlang binary. Auto-detected if omitted. |
PORT |
No | Defaults to 3456 |
No server-side API keys required. All external AI calls are client-side (BYOK).
# On Delta (build box)
cd /opt/synapticchain/forge
npm run build
rsync -avz --exclude=node_modules --exclude=.next/cache . root@203.161.56.222:/opt/synaptic/apps/forge/
# On Charlie
ssh root@203.161.56.222
cd /opt/synaptic/apps/forge
npm run build
pm2 restart forge- ✅ Contract templates are audited and compiler-safe
- ✅ Kimi API keys are client-side only (BYOK)
- ✅ Private keys are ephemeral (component state, not persisted)
- ✅
.planfiles are temporary and cleaned up
⚠️ Private keys — Users paste keys in the browser. Warn them about phishing.⚠️ Subdomain provisioning — Requires server access. Restrict API if needed.⚠️ Template marketplace — No auth currently. Add rate limiting for public instances.⚠️ Compiler binary —synlangruns server-side with shell execution. Keep binary trusted.
- Add rate limiting to all API routes (express-rate-limit)
- Add CAPTCHA to template marketplace submissions
- Validate all user inputs (already done for subdomains)
- Run
synlangin a sandbox/container for compilation - Add authentication for admin functions
This means the generated code has a state access pattern the compiler doesn't allow. Check:
- All functions have
#[reads]/#[writes]annotations - No
!operator on state reads (use== false) - Only one write per state slot per function branch
The deployer's nonce is out of sync. Solutions:
- Query current nonce via wallet connect
- Manually specify nonce in deploy request
- Wait for pending transactions to clear
The wallet's bech32 implementation was using the wrong checksum variant or address length. Fixed in commit a13c5648:
bech32Encodemust append 6 zeros for checksum computation:bech32Polymod([...combined, 0,0,0,0,0,0]) ^ 0x2bc830a3bech32Decodemust validate against0x2bc830a3(bech32m), not1(bech32)- Address derivation must use
hashBytes.slice(12, 32)(last 20 bytes), not full 32 bytes - Transfer payload variant index must be
2(matches RustPayload::Transfer), not0
Use fromUnits(balance) from wallet.ts to convert 18-decimal raw units to human-readable SYN.
Check that the derived address matches your working wallet. The bech32m checksum must match the Rust SDK implementation. If the address differs, the private key derivation is wrong (see transfer fix above).
DNS record doesn't exist. Solutions:
- Add wildcard A record:
*.greenverse.synapticchain.xyz → 203.161.56.222 - Or add specific A record for the subdomain
- Wait for DNS propagation (up to 24 hours)
Certbot couldn't validate the domain. Solutions:
- Ensure DNS resolves before provisioning
- The API automatically falls back to HTTP-only
- Re-run provisioning after DNS is ready
The compiler binary isn't in the expected location. Solutions:
- Copy binary:
scp synlang root@charlie:/usr/local/bin/ - Or set
SYNLANG_PATHenvironment variable - Ensure binary is executable:
chmod +x /usr/local/bin/synlang
| Feature | Status | Priority |
|---|---|---|
| 10 verified templates | ✅ Done | — |
| AI natural language | ✅ Done | — |
| Compile & deploy | ✅ Done | — |
| Contract verification | ✅ Done | — |
| Subdomain provisioning | ✅ Done | — |
| Template marketplace | ✅ Done | — |
| Wallet connect | ✅ Done | — |
| BYOK Kimi integration | ✅ Done | — |
| Wildcard DNS automation | 🔄 Needs DNS API | Medium |
| Web4 real signing | 🔄 Needs wallet protocol | High |
| Contract import from address | ⏳ Planned | Low |
| Gas estimation UI | ⏳ Planned | Medium |
| Multi-chain support | ⏳ Planned | Low |
Synaptic Forge is part of the SynapticChain project. See GIT_SAFE/LICENSE.txt for details.
- Explorer:
https://explorer.synapticchain.xyz - Gateway:
https://forge.synapticchain.xyz/rpc - Documentation: This file +
GIT_SAFE/API_REFERENCE.md