commit de5eba2da0e4c879616e300cba19b3a70c4c051b Author: NAC Dev Date: Sun Feb 22 09:55:38 2026 +0800 Issue #50+#51: 量子浏览器多语言自适应+词语替换 - 新增 i18n 系统(PHP 翻译字典) - 支持中文/英文自动切换(Accept-Language) - 全局替换贫民→全民/谁都可以玩得起 - 版本:v2.2.0 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..047d7bb --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +backup/ diff --git a/index.php b/index.php new file mode 100644 index 0000000..e2b18e6 --- /dev/null +++ b/index.php @@ -0,0 +1,1919 @@ + Cookie > Accept-Language 请求头 > 默认中文 + +function detectLang(): string { + // 1. URL 参数最高优先级 + if (isset($_GET['lang']) && in_array($_GET['lang'], ['zh', 'en'])) { + $lang = $_GET['lang']; + setcookie('nac_lang', $lang, time() + 86400 * 365, '/'); + return $lang; + } + // 2. Cookie + if (isset($_COOKIE['nac_lang']) && in_array($_COOKIE['nac_lang'], ['zh', 'en'])) { + return $_COOKIE['nac_lang']; + } + // 3. Accept-Language 请求头 + $accept = $_SERVER['HTTP_ACCEPT_LANGUAGE'] ?? ''; + if ($accept) { + // 解析 Accept-Language,取第一个语言标签 + preg_match_all('/([a-z]{2,3})(?:-[a-zA-Z]{2,4})?(?:;q=[\d.]+)?/i', $accept, $m); + foreach ($m[1] as $code) { + $code = strtolower($code); + if (in_array($code, ['zh', 'cmn', 'yue'])) return 'zh'; + if ($code === 'en') return 'en'; + } + } + return 'zh'; // 默认中文 +} + +$LANG = detectLang(); + +// 翻译字典 +$TRANSLATIONS = [ + 'zh' => [ + // 通用 + 'site_title' => 'NAC BlockView | NAC Lens 量子浏览器', + 'site_desc' => 'NAC BlockView - NAC Lens 量子浏览器 | RWA 专属公链区块浏览器 | CBPP共识 | 谁都可以玩得起的区块链', + 'lang_switch' => 'English', + 'lang_switch_code' => 'en', + // 导航 + 'nav_home' => '首页', + 'nav_blocks' => '区块', + 'nav_transactions' => '交易', + 'nav_assets' => 'RWA资产', + 'nav_tags' => '标签化', + 'nav_roadmap' => '路线图', + 'nav_search_ph' => '搜索区块号 / 交易哈希 / 地址...', + 'nav_search_btn' => '搜索', + // 首页英雄区 + 'hero_title' => 'NAC Lens 量子浏览器', + 'hero_live' => '实时连接 NAC 主网', + 'hero_rwa' => 'RWA 专属公链', + // CBPP 原则 + 'cbpp_title' => '⚖️ CBPP 宪法原则', + 'cbpp_sub' => '—— 不可绕过的宪法层,任何交易和合约必须遵守', + 'cbpp_p1' => '约法即是治法', + 'cbpp_p2' => '宪法即是规则', + 'cbpp_p3' => '参与即是共识', + 'cbpp_p4' => '节点产生区块', + 'cbpp_p5' => '交易扩展区块大小', + // 宪法层说明 + 'const_title' => '🛡️ 不可绕过的宪法层', + 'const_desc' => '每个区块都携带 constitutionLayer: true。任何交易和合约必须通过宪法层验证,无人可绕过。', + 'law_title' => '🏛️ 链上国家的法律体系', + 'law_desc' => '法律越完善,秩序越好。Charter 合约是具体法律,CBPP 宪法是最高法,NVM 是自动执行的法院。', + 'decentral_title' => '🌍 完美中心化下的去中心化', + 'decentral_desc' => '标签内容 AI 审批管理(中心化秩序),审批结果链上不可篡改(去中心化信任)。去中心化内容始终保持。', + // 统计卡片 + 'stat_block_title' => '📦 当前区块高度', + 'stat_block_sub' => 'CBPP 共识出块 · 平均 %ss/块', + 'stat_net_title' => '📊 网络状态', + 'stat_net_val' => 'ACTIVE', + 'stat_net_sub' => 'CBPP 共识正常 · CSNP 已连接', + 'stat_const_title' => '🛡️ 宪法层', + 'stat_const_sub' => '不可绕过 · 全网强制执行', + 'stat_nodes_title' => '🌐 当前节点数', + 'stat_nodes_sub' => '创世节点 · 钱包上线后自然增长', + 'stat_addr_title' => '👤 地址数', + 'stat_addr_sub' => '钱包上线后产生真实地址', + 'stat_rwa_title' => '🏦 RWA 上链资产', + 'stat_rwa_sub' => '待真实资产上链', + 'stat_tx_title' => '🔄 真实交易数', + 'stat_tx_sub' => '钱包上线后产生真实交易', + 'stat_chain_title' => '🔗 链 ID', + 'stat_chain_sub' => '%s 网络', + // 真实性声明 + 'truth_label' => '真实性声明:', + 'truth_desc' => '以上数据均来自 NAC 主网实时 API。钱包尚未正式上线,地址数、交易数、RWA 资产均为 0,将在钱包上线后展示真实数据。', + 'truth_slogan' => '只有真实的,才能赢得信任。', + // 区块流 + 'live_blocks' => '实时区块流', + 'live_scroll' => '← 向左滑动查看更多', + 'tx_count' => '%s 笔交易', + // 表格 + 'latest_blocks' => '📦 最新区块', + 'view_all' => '查看全部 →', + 'latest_txs' => '🔄 最新交易', + 'col_block_num' => '区块号', + 'col_producer' => '出块节点', + 'col_tx_count' => '交易数', + 'col_time' => '时间', + 'col_hash' => '哈希', + 'col_size' => '区块大小', + 'col_consensus' => '共识状态', + 'col_tx_hash' => '交易哈希', + 'col_from' => '发送方', + 'col_to' => '接收方', + 'col_value' => '金额 (NAC)', + 'col_status' => '状态', + 'col_asset_id' => '资产 ID', + 'col_name' => '名称', + 'col_type' => '类型', + 'col_valuation' => '估值 (USD)', + 'col_issuer' => '发行方', + 'col_field' => '字段', + 'col_value_raw' => '值', + // 空状态 + 'no_data' => '暂无数据', + 'no_blocks' => '暂无区块数据', + 'no_txs' => '暂无交易数据', + 'no_assets' => '暂无资产数据', + // 无真实交易提示 + 'no_real_tx_title' => '暂无真实交易', + 'no_real_tx_desc' => "NAC 钱包尚未正式上线。\n钱包上线后,每笔转账将展示真实交易记录。", + 'wallet_soon' => '钱包即将上线', + // 创世节点 + 'genesis_title' => 'NAC 主网创世节点', + 'genesis_sub' => '当前唯一运行节点 · 产生创世区块 · 承载全网 CBPP 共识', + 'genesis_running' => '• 运行中', + 'genesis_node_id' => '节点 ID', + 'genesis_node_ip' => '节点 IP', + 'genesis_time' => '创世区块时间', + 'genesis_uptime' => '主网运行时长', + 'genesis_uptime_val'=> '%s 天', + 'genesis_nodes' => '当前节点数', + 'genesis_nodes_val' => '1 (初始阶段)', + 'genesis_block' => '创世区块', + 'genesis_tip_title' => '资产驱动网络扩张原则:', + 'genesis_tip_desc' => '随着 RWA 资产上链数量增加,交易量增长,区块将自动扩大(交易扩展区块大小)。更多参与者加入网络,插入 U 盘即可成为新节点(节点产生区块)。节点越多、资产越多,网络越强大——这就是 CBPP 共识的自然增长逻辑。', + // 标签化预览 + 'tag_title' => '🏷️ 资产标签化系统', + 'tag_phase' => '主网 2.0 开发中 · L3 分布式存储层', + 'tag_dev_title' => '标签化 API 开发中', + 'tag_dev_desc' => "标签化系统属于主网 2.0 功能,目前处于开发阶段。\n待主网 2.0 上线后,将展示真实的所有权标签、收益权标签、合规标签和估值标签数据。", + 'tag_own' => '所有权标签', + 'tag_income' => '收益权标签', + 'tag_compliance' => '合规标签', + 'tag_valuation' => '估值标签', + 'tag_pending' => '待开放', + 'tag_roadmap_link' => '查看标签化路线图 →', + // USB 节点 + 'usb_title' => '一个 U 盘,就是一个节点', + 'usb_desc' => 'NAC 的终极愿景:让每一个普通人都能参与区块链。无需昂贵矿机,无需质押大量代币,只需一个普通 U 盘,插入任何电脑,即可成为 NAC 网络的一个节点,存储 RWA 标签数据,参与 CBPP 共识,获得网络奖励。', + 'usb_slogan' => '谁都可以玩得起的区块链,这不是口号,这是设计原则。', + 'usb_growth_title' => '📈 节点增长预期(随资产上链驱动)', + 'usb_genesis' => "创世节点\n当前", + 'usb_v2' => "主网 2.0\n标签化", + 'usb_v25' => "主网 2.5\n分布式", + 'usb_v3' => "主网 3.0\nUSB 化", + 'usb_step1' => '准备一个 16GB+ U 盘', + 'usb_step2' => '下载 NAC 节点镜像', + 'usb_step3' => '插入电脑自动启动', + 'usb_step4' => '参与共识获得奖励', + 'usb_note' => '* USB 节点功能将在主网 3.0 正式上线,节点数量随 RWA 资产上链自然增长', + // 路线图预览 + 'roadmap_title' => 'NAC 发展路线图', + 'roadmap_sub' => '从 RWA 上链到全民区块链的完整演进路径', + 'roadmap_link' => '查看完整路线图 →', + 'roadmap_v1' => '主网 1.0 · 当前', + 'roadmap_v1_name' => '基础设施', + 'roadmap_v1_desc' => 'RWA 上链、CBPP 共识、Charter 合约、NVM 虚拟机、CSNP 网络', + 'roadmap_v1_badge' => '运行中', + 'roadmap_v2' => '主网 2.0 · 即将', + 'roadmap_v2_name' => '部分标签化', + 'roadmap_v2_desc' => '所有权/收益权分离、标签内容 AI 审批管理、L3 分布式存储、标签可流通', + 'roadmap_v2_badge' => '开发中', + 'roadmap_v25' => '主网 2.5 · 规划中', + 'roadmap_v25_name' => '分布式迁移', + 'roadmap_v25_desc' => '更多节点加入 L3 存储层、资产上链驱动节点增长、CSNP 网络扩展', + 'roadmap_v25_badge' => '规划中', + 'roadmap_v3' => '主网 3.0 · 愿景', + 'roadmap_v3_name' => 'USB 化', + 'roadmap_v3_desc' => '一个 U 盘即节点、完全分布式存储、USB 合成债券、谁都可以玩得起的区块链', + 'roadmap_v3_badge' => '愿景', + // 区块列表页 + 'blocks_title' => '📦 区块列表', + 'blocks_sub' => 'NAC 主网所有区块 · CBPP 共识 · 节点产生区块', + 'prev_page' => '← 上一页', + 'next_page' => '下一页 →', + // 交易列表页 + 'txs_title' => '🔄 交易列表', + 'txs_sub' => 'NAC 主网最新交易 · 交易扩展区块大小', + // RWA 资产页 + 'assets_title' => '🏦 RWA 资产', + 'assets_sub' => '真实世界资产上链 · AI 合规审批 · 标签化管理', + // 标签化页 + 'tags_title' => '🏷️ 资产标签化系统', + 'tags_sub' => '部分标签化 · 主网 2.0 预演 · 所有权与收益权分离', + // 路线图页 + 'roadmap_page_title'=> '🗺️ NAC 发展路线图', + 'roadmap_page_sub' => '从 RWA 专属公链到全民区块链的完整演进路径', + // 区块详情 + 'block_detail_title'=> '📦 区块详情 #%s', + 'back_blocks' => '← 返回区块列表', + 'detail_block_num' => '区块号', + 'detail_block_hash' => '区块哈希', + 'detail_parent_hash'=> '父区块哈希', + 'detail_producer' => '出块节点', + 'detail_tx_count' => '交易数量', + 'detail_tx_count_v' => '%s 笔交易', + 'detail_size' => '区块大小', + 'detail_gas' => 'Gas 使用', + 'detail_cbpp' => 'CBPP 共识', + 'detail_const' => '宪法层', + 'detail_const_yes' => '✅ 是', + 'detail_const_no' => '❌ 否', + 'detail_fluid' => '流体区块', + 'detail_fluid_yes' => '✅ 是(交易扩展)', + 'detail_fluid_no' => '❌ 否', + 'detail_timestamp' => '时间戳', + 'block_txs_title' => '区块内交易(%s 笔)', + // 交易详情 + 'tx_detail_title' => '🔄 交易详情', + 'back_txs' => '← 返回交易列表', + 'detail_tx_hash' => '交易哈希', + 'detail_block_num2' => '区块号', + 'detail_block_hash2'=> '区块哈希', + 'detail_from' => '发送方', + 'detail_to' => '接收方', + 'detail_value' => '金额', + 'detail_gas_limit' => 'Gas 限制', + 'detail_gas_price' => 'Gas 价格', + 'detail_nonce' => 'Nonce', + 'detail_tx_index' => '交易序号', + 'detail_status' => '状态', + // 搜索 + 'search_title' => '🔍 搜索结果', + 'search_keyword' => '关键词:%s', + 'search_type' => '找到结果:类型 = ', + 'search_view_block' => '查看区块 #%s 详情 →', + 'search_not_found' => '未找到与 "%s" 相关的结果', + // 状态徽章 + 'badge_success' => '成功', + 'badge_active' => '激活', + 'badge_pending' => '待处理', + 'badge_failed' => '失败', + 'badge_frozen' => '冻结', + // 资产类型 + 'asset_real_estate' => '🏢 房地产', + 'asset_bond' => '📄 债券', + 'asset_commodity' => '🏭 大宗商品', + 'asset_equity' => '📈 股权', + 'asset_art' => '🎨 艺术品', + // 时间 + 'time_sec' => '%s秒前', + 'time_min' => '%s分钟前', + 'time_hour' => '%s小时前', + 'time_day' => '%s天前', + // 页脚 + 'footer_logo' => 'NAC BlockView · NAC Lens 量子浏览器', + 'footer_desc' => "New Asset Chain · RWA 专属公链 · 谁都可以玩得起的区块链\n约法即是治法 · 宪法即是规则 · 参与即是共识", + 'footer_copy' => '© %s New Asset Chain · v%s · PHP 动态版 · 实时数据由 NAC Explorer API 提供 · ', + 'footer_roadmap' => '查看路线图', + // JS 动态 + 'js_new_block_title'=> '🆕 #%s | NAC BlockView', + 'js_page_title' => 'NAC BlockView | NAC Lens 量子浏览器', + // 标签化页详细 + 'tag_phase1_label' => '🔧 第一阶段(当前)', + 'tag_phase1_title' => '标签化功能开发中', + 'tag_phase1_desc' => '标签化系统属于主网 2.0 功能,目前处于开发阶段。存储层使用 NAC L3 分布式存储,链上存储 SHA3-384 哈希锚点。', + 'tag_phase2_label' => '🔜 第二阶段(主网 2.0)', + 'tag_phase2_title' => '标签化上线 + L3 存储', + 'tag_phase2_desc' => '标签化功能全面上线,数据存储在 L3 分布式存储层。所有参与上链的人即是节点,参与即是共识。', + 'tag_phase3_label' => '🔮 第三阶段(主网 2.5)', + 'tag_phase3_title' => '节点扩展 + 存储增强', + 'tag_phase3_desc' => '更多节点加入 L3 存储层,分布式存储容量自然增长。资产上链越多,节点越多,网络越强大。', + 'tag_phase4_label' => '🔌 第四阶段(主网 3.0)', + 'tag_phase4_title' => '彻底分布式 · USB 化', + 'tag_phase4_desc' => '所有标签完全存储在 CSNP 分布式节点网络。一个 U 盘即节点,USB 合成债券全球流通。', + 'tag_dist_title' => '标签类型分布', + 'tag_sep_title' => '💡 核心创新:所有权与收益权分离', + 'tag_trad_title' => '传统模式(不可分离)', + 'tag_trad_desc' => "持有房产 → 自动获得租金\n转让房产 → 同时失去租金权\n无法单独出售收益权\n门槛高,流动性差", + 'tag_nac_title' => 'NAC 标签化模式(可分离)', + 'tag_nac_desc' => "所有权标签 ← 可单独持有/转让\n收益权标签 ← 可单独持有/转让\n两者可分别在市场流通\n碎片化,门槛极低", + 'tag_l3_title' => 'L3 分布式存储层说明', + 'tag_l3_desc' => 'NAC 具备三层架构:L1 共识层(CBPP)、L2 执行层(NVM)、L3 存储层。标签数据存储在 L3 分布式存储层,从第一天起就是去中心化的。随着节点增加,L3 存储层的容量和冗余度自然增长。主网 3.0 USB 化后,每个 U 盘节点都是 L3 存储层的一个存储单元。', + ], + 'en' => [ + // General + 'site_title' => 'NAC BlockView | NAC Lens Quantum Browser', + 'site_desc' => 'NAC BlockView - NAC Lens Quantum Browser | RWA-Dedicated Blockchain Explorer | CBPP Consensus | Blockchain for Everyone', + 'lang_switch' => '中文', + 'lang_switch_code' => 'zh', + // Navigation + 'nav_home' => 'Home', + 'nav_blocks' => 'Blocks', + 'nav_transactions' => 'Transactions', + 'nav_assets' => 'RWA Assets', + 'nav_tags' => 'Tagging', + 'nav_roadmap' => 'Roadmap', + 'nav_search_ph' => 'Search block / tx hash / address...', + 'nav_search_btn' => 'Search', + // Hero + 'hero_title' => 'NAC Lens Quantum Browser', + 'hero_live' => 'Live connection to NAC Mainnet', + 'hero_rwa' => 'RWA-Dedicated Chain', + // CBPP + 'cbpp_title' => '⚖️ CBPP Constitutional Principles', + 'cbpp_sub' => '— Unbypassable constitutional layer enforced on all transactions and contracts', + 'cbpp_p1' => 'Charter is the Law', + 'cbpp_p2' => 'Constitution is the Rule', + 'cbpp_p3' => 'Participation IS Consensus', + 'cbpp_p4' => 'Nodes Produce Blocks', + 'cbpp_p5' => 'Transactions Expand Block Size', + // Constitution layer + 'const_title' => '🛡️ Unbypassable Constitutional Layer', + 'const_desc' => 'Every block carries constitutionLayer: true. All transactions and contracts must pass constitutional validation — no one can bypass it.', + 'law_title' => '🏛️ On-Chain Legal System', + 'law_desc' => 'The more complete the law, the better the order. Charter contracts are specific laws, CBPP constitution is the supreme law, NVM is the automatically enforcing court.', + 'decentral_title' => '🌍 Decentralization Under Perfect Centralization', + 'decentral_desc' => 'Tag content managed by AI approval (centralized order); approval results immutably on-chain (decentralized trust). Decentralized content is always preserved.', + // Stats + 'stat_block_title' => '📦 Current Block Height', + 'stat_block_sub' => 'CBPP Consensus · Avg %ss/block', + 'stat_net_title' => '📊 Network Status', + 'stat_net_val' => 'ACTIVE', + 'stat_net_sub' => 'CBPP Consensus OK · CSNP Connected', + 'stat_const_title' => '🛡️ Constitution Layer', + 'stat_const_sub' => 'Unbypassable · Network-wide enforcement', + 'stat_nodes_title' => '🌐 Active Nodes', + 'stat_nodes_sub' => 'Genesis node · Grows naturally after wallet launch', + 'stat_addr_title' => '👤 Addresses', + 'stat_addr_sub' => 'Real addresses after wallet launch', + 'stat_rwa_title' => '🏦 RWA Assets On-Chain', + 'stat_rwa_sub' => 'Awaiting real asset registration', + 'stat_tx_title' => '🔄 Real Transactions', + 'stat_tx_sub' => 'Real transactions after wallet launch', + 'stat_chain_title' => '🔗 Chain ID', + 'stat_chain_sub' => '%s Network', + // Truth statement + 'truth_label' => 'Data Integrity Notice: ', + 'truth_desc' => 'All data is sourced from NAC Mainnet live API. The wallet has not officially launched yet; addresses, transactions, and RWA assets are all 0 and will be shown after wallet launch.', + 'truth_slogan' => 'Only real data earns real trust.', + // Live blocks + 'live_blocks' => 'Live Block Stream', + 'live_scroll' => '← Scroll left for more', + 'tx_count' => '%s txs', + // Tables + 'latest_blocks' => '📦 Latest Blocks', + 'view_all' => 'View all →', + 'latest_txs' => '🔄 Latest Transactions', + 'col_block_num' => 'Block', + 'col_producer' => 'Producer', + 'col_tx_count' => 'Txs', + 'col_time' => 'Time', + 'col_hash' => 'Hash', + 'col_size' => 'Size', + 'col_consensus' => 'Consensus', + 'col_tx_hash' => 'Tx Hash', + 'col_from' => 'From', + 'col_to' => 'To', + 'col_value' => 'Value (NAC)', + 'col_status' => 'Status', + 'col_asset_id' => 'Asset ID', + 'col_name' => 'Name', + 'col_type' => 'Type', + 'col_valuation' => 'Valuation (USD)', + 'col_issuer' => 'Issuer', + 'col_field' => 'Field', + 'col_value_raw' => 'Value', + // Empty states + 'no_data' => 'No data', + 'no_blocks' => 'No block data', + 'no_txs' => 'No transaction data', + 'no_assets' => 'No asset data', + // No real tx + 'no_real_tx_title' => 'No Real Transactions Yet', + 'no_real_tx_desc' => "NAC Wallet has not officially launched.\nAfter launch, every transfer will be shown here.", + 'wallet_soon' => 'Wallet Coming Soon', + // Genesis node + 'genesis_title' => 'NAC Mainnet Genesis Node', + 'genesis_sub' => 'Currently the only running node · Produced genesis block · Hosts full CBPP consensus', + 'genesis_running' => '• Running', + 'genesis_node_id' => 'Node ID', + 'genesis_node_ip' => 'Node IP', + 'genesis_time' => 'Genesis Block Time', + 'genesis_uptime' => 'Mainnet Uptime', + 'genesis_uptime_val'=> '%s days', + 'genesis_nodes' => 'Active Nodes', + 'genesis_nodes_val' => '1 (initial phase)', + 'genesis_block' => 'Genesis Block', + 'genesis_tip_title' => 'Asset-Driven Network Expansion:', + 'genesis_tip_desc' => 'As more RWA assets are registered on-chain, transaction volume grows, blocks expand automatically (transactions expand block size). More participants join by plugging in a USB drive (nodes produce blocks). More nodes, more assets, stronger network — this is the natural growth logic of CBPP consensus.', + // Tagging preview + 'tag_title' => '🏷️ Asset Tagging System', + 'tag_phase' => 'Mainnet 2.0 in development · L3 Distributed Storage', + 'tag_dev_title' => 'Tagging API Under Development', + 'tag_dev_desc' => "The tagging system is a Mainnet 2.0 feature, currently under development.\nAfter Mainnet 2.0 launches, real ownership tags, income tags, compliance tags, and valuation tags will be displayed.", + 'tag_own' => 'Ownership Tags', + 'tag_income' => 'Income Tags', + 'tag_compliance' => 'Compliance Tags', + 'tag_valuation' => 'Valuation Tags', + 'tag_pending' => 'Coming Soon', + 'tag_roadmap_link' => 'View Tagging Roadmap →', + // USB node + 'usb_title' => 'One USB Drive = One Node', + 'usb_desc' => "NAC's ultimate vision: let every ordinary person participate in blockchain. No expensive mining rigs, no large token stakes — just a regular USB drive plugged into any computer becomes a NAC network node, storing RWA tag data, participating in CBPP consensus, and earning network rewards.", + 'usb_slogan' => 'Blockchain for the people — not a slogan, it\'s a design principle.', + 'usb_growth_title' => '📈 Node Growth Projection (driven by asset registration)', + 'usb_genesis' => "Genesis Node\nNow", + 'usb_v2' => "Mainnet 2.0\nTagging", + 'usb_v25' => "Mainnet 2.5\nDistributed", + 'usb_v3' => "Mainnet 3.0\nUSB", + 'usb_step1' => 'Get a 16GB+ USB drive', + 'usb_step2' => 'Download NAC node image', + 'usb_step3' => 'Plug in — auto starts', + 'usb_step4' => 'Participate & earn rewards', + 'usb_note' => '* USB node feature launches with Mainnet 3.0; node count grows naturally with RWA asset registration', + // Roadmap preview + 'roadmap_title' => 'NAC Development Roadmap', + 'roadmap_sub' => 'Complete evolution path from RWA chain to blockchain for everyone', + 'roadmap_link' => 'View full roadmap →', + 'roadmap_v1' => 'Mainnet 1.0 · Current', + 'roadmap_v1_name' => 'Infrastructure', + 'roadmap_v1_desc' => 'RWA on-chain, CBPP consensus, Charter contracts, NVM, CSNP network', + 'roadmap_v1_badge' => 'Running', + 'roadmap_v2' => 'Mainnet 2.0 · Upcoming', + 'roadmap_v2_name' => 'Partial Tagging', + 'roadmap_v2_desc' => 'Ownership/income separation, AI-managed tag approval, L3 distributed storage, tradeable tags', + 'roadmap_v2_badge' => 'In Dev', + 'roadmap_v25' => 'Mainnet 2.5 · Planned', + 'roadmap_v25_name' => 'Distributed Migration', + 'roadmap_v25_desc' => 'More nodes join L3 storage, asset-driven node growth, CSNP network expansion', + 'roadmap_v25_badge' => 'Planned', + 'roadmap_v3' => 'Mainnet 3.0 · Vision', + 'roadmap_v3_name' => 'USB Era', + 'roadmap_v3_desc' => 'One USB = one node, fully distributed storage, USB synthetic bonds, blockchain for everyone', + 'roadmap_v3_badge' => 'Vision', + // Blocks page + 'blocks_title' => '📦 Block List', + 'blocks_sub' => 'All NAC Mainnet Blocks · CBPP Consensus · Nodes Produce Blocks', + 'prev_page' => '← Previous', + 'next_page' => 'Next →', + // Transactions page + 'txs_title' => '🔄 Transactions', + 'txs_sub' => 'Latest NAC Mainnet Transactions · Transactions Expand Block Size', + // Assets page + 'assets_title' => '🏦 RWA Assets', + 'assets_sub' => 'Real World Assets On-Chain · AI Compliance · Tag Management', + // Tags page + 'tags_title' => '🏷️ Asset Tagging System', + 'tags_sub' => 'Partial Tagging · Mainnet 2.0 Preview · Ownership & Income Separation', + // Roadmap page + 'roadmap_page_title'=> '🗺️ NAC Development Roadmap', + 'roadmap_page_sub' => 'Complete evolution path from RWA-dedicated chain to blockchain for everyone', + // Block detail + 'block_detail_title'=> '📦 Block #%s', + 'back_blocks' => '← Back to Blocks', + 'detail_block_num' => 'Block Number', + 'detail_block_hash' => 'Block Hash', + 'detail_parent_hash'=> 'Parent Hash', + 'detail_producer' => 'Producer', + 'detail_tx_count' => 'Transactions', + 'detail_tx_count_v' => '%s txs', + 'detail_size' => 'Block Size', + 'detail_gas' => 'Gas Used', + 'detail_cbpp' => 'CBPP Consensus', + 'detail_const' => 'Constitution Layer', + 'detail_const_yes' => '✅ Yes', + 'detail_const_no' => '❌ No', + 'detail_fluid' => 'Fluid Block', + 'detail_fluid_yes' => '✅ Yes (tx-expanded)', + 'detail_fluid_no' => '❌ No', + 'detail_timestamp' => 'Timestamp', + 'block_txs_title' => 'Block Transactions (%s txs)', + // Tx detail + 'tx_detail_title' => '🔄 Transaction Detail', + 'back_txs' => '← Back to Transactions', + 'detail_tx_hash' => 'Tx Hash', + 'detail_block_num2' => 'Block Number', + 'detail_block_hash2'=> 'Block Hash', + 'detail_from' => 'From', + 'detail_to' => 'To', + 'detail_value' => 'Value', + 'detail_gas_limit' => 'Gas Limit', + 'detail_gas_price' => 'Gas Price', + 'detail_nonce' => 'Nonce', + 'detail_tx_index' => 'Tx Index', + 'detail_status' => 'Status', + // Search + 'search_title' => '🔍 Search Results', + 'search_keyword' => 'Keyword: %s', + 'search_type' => 'Found: type = ', + 'search_view_block' => 'View Block #%s →', + 'search_not_found' => 'No results found for "%s"', + // Status badges + 'badge_success' => 'Success', + 'badge_active' => 'Active', + 'badge_pending' => 'Pending', + 'badge_failed' => 'Failed', + 'badge_frozen' => 'Frozen', + // Asset types + 'asset_real_estate' => '🏢 Real Estate', + 'asset_bond' => '📄 Bond', + 'asset_commodity' => '🏭 Commodity', + 'asset_equity' => '📈 Equity', + 'asset_art' => '🎨 Art', + // Time + 'time_sec' => '%ss ago', + 'time_min' => '%sm ago', + 'time_hour' => '%sh ago', + 'time_day' => '%sd ago', + // Footer + 'footer_logo' => 'NAC BlockView · NAC Lens Quantum Browser', + 'footer_desc' => "New Asset Chain · RWA-Dedicated Chain · Blockchain for Everyone\nCharter is Law · Constitution is Rule · Participation is Consensus", + 'footer_copy' => '© %s New Asset Chain · v%s · PHP Dynamic · Live data by NAC Explorer API · ', + 'footer_roadmap' => 'Roadmap', + // JS + 'js_new_block_title'=> '🆕 #%s | NAC BlockView', + 'js_page_title' => 'NAC BlockView | NAC Lens Quantum Browser', + // Tags page detailed + 'tag_phase1_label' => '🔧 Phase 1 (Current)', + 'tag_phase1_title' => 'Tagging Feature Under Development', + 'tag_phase1_desc' => 'The tagging system is a Mainnet 2.0 feature, currently under development. Storage uses NAC L3 distributed storage; SHA3-384 hash anchors are stored on-chain.', + 'tag_phase2_label' => '🔜 Phase 2 (Mainnet 2.0)', + 'tag_phase2_title' => 'Tagging Live + L3 Storage', + 'tag_phase2_desc' => 'Full tagging functionality launches, data stored in L3 distributed storage layer. Everyone who registers assets on-chain is a node — participation is consensus.', + 'tag_phase3_label' => '🔮 Phase 3 (Mainnet 2.5)', + 'tag_phase3_title' => 'Node Expansion + Storage Enhancement', + 'tag_phase3_desc' => 'More nodes join L3 storage layer, distributed storage capacity grows naturally. More assets on-chain = more nodes = stronger network.', + 'tag_phase4_label' => '🔌 Phase 4 (Mainnet 3.0)', + 'tag_phase4_title' => 'Fully Distributed · USB Era', + 'tag_phase4_desc' => 'All tags fully stored in the CSNP distributed node network. One USB drive = one node; USB synthetic bonds circulate globally.', + 'tag_dist_title' => 'Tag Type Distribution', + 'tag_sep_title' => '💡 Core Innovation: Ownership & Income Separation', + 'tag_trad_title' => 'Traditional Model (Inseparable)', + 'tag_trad_desc' => "Own property → automatically receive rent\nTransfer property → lose rental income\nCannot sell income rights separately\nHigh barrier, low liquidity", + 'tag_nac_title' => 'NAC Tagging Model (Separable)', + 'tag_nac_desc' => "Ownership tag ← hold/transfer independently\nIncome tag ← hold/transfer independently\nBoth can circulate separately on markets\nFragmented, extremely low barrier", + 'tag_l3_title' => 'L3 Distributed Storage Layer', + 'tag_l3_desc' => 'NAC has a three-layer architecture: L1 Consensus (CBPP), L2 Execution (NVM), L3 Storage. Tag data is stored in the L3 distributed storage layer, decentralized from day one. As nodes increase, L3 storage capacity and redundancy grow naturally. After Mainnet 3.0 USB-ification, every USB node is an L3 storage unit.', + ], +]; + +// 翻译函数 +function t(string $key, ...$args): string { + global $TRANSLATIONS, $LANG; + $str = $TRANSLATIONS[$LANG][$key] ?? $TRANSLATIONS['zh'][$key] ?? $key; + if ($args) { + return vsprintf($str, $args); + } + return $str; +} + +// ===================== API 调用函数 ===================== +function nacApi(string $path, int $timeout = 5): ?array { + $ch = curl_init(API_BASE . $path); + curl_setopt_array($ch, [ + CURLOPT_RETURNTRANSFER => true, + CURLOPT_TIMEOUT => $timeout, + CURLOPT_CONNECTTIMEOUT => 3, + CURLOPT_HTTPHEADER => ['Accept: application/json'], + ]); + $body = curl_exec($ch); + $code = curl_getinfo($ch, CURLINFO_HTTP_CODE); + curl_close($ch); + if ($body === false || $code !== 200) return null; + $json = json_decode($body, true); + return $json['data'] ?? $json ?? null; +} + +// ===================== 工具函数 ===================== +function shortHash(string $hash, int $len = 10): string { + if (strlen($hash) <= $len * 2) return $hash; + return substr($hash, 0, $len) . '...' . substr($hash, -6); +} + +function timeAgo(int $ts): string { + $diff = time() - $ts; + if ($diff < 0) $diff = 0; + if ($diff < 60) return t('time_sec', $diff); + if ($diff < 3600) return t('time_min', floor($diff / 60)); + if ($diff < 86400) return t('time_hour', floor($diff / 3600)); + return t('time_day', floor($diff / 86400)); +} + +function formatNum($n): string { + return number_format((float)$n, 0, '.', ','); +} + +function statusBadge(string $status): string { + $map = [ + 'success' => ['#00ff88', 'badge_success'], + 'active' => ['#00ff88', 'badge_active'], + 'pending' => ['#ffd700', 'badge_pending'], + 'failed' => ['#ef4444', 'badge_failed'], + 'frozen' => ['#ef4444', 'badge_frozen'], + ]; + if (isset($map[$status])) { + [$color, $key] = $map[$status]; + $label = t($key); + } else { + $color = '#94a3b8'; + $label = $status; + } + return "{$label}"; +} + +function assetTypeLabel(string $type): string { + $map = [ + 'real_estate' => 'asset_real_estate', + 'bond' => 'asset_bond', + 'commodity' => 'asset_commodity', + 'equity' => 'asset_equity', + 'art' => 'asset_art', + ]; + return isset($map[$type]) ? t($map[$type]) : $type; +} + +// 构建保留当前参数的语言切换 URL +function langSwitchUrl(string $targetLang): string { + $params = $_GET; + $params['lang'] = $targetLang; + return '?' . http_build_query($params); +} + +// ===================== 读取请求参数 ===================== +$page = max(1, (int)($_GET['page'] ?? 1)); +$view = $_GET['view'] ?? 'home'; +$search = trim($_GET['q'] ?? ''); +$blockId = $_GET['block'] ?? ''; +$txHash = $_GET['tx'] ?? ''; + +$searchResult = null; +if ($search !== '') { + $searchResult = nacApi('/search?q=' . urlencode($search)); + if ($searchResult) { + $view = 'search'; + } +} + +$stats = nacApi('/network/stats'); +$latestBlocks = nacApi('/blocks?limit=10'); +$latestTxs = nacApi('/transactions/latest?limit=10'); + +$blockDetail = null; +if ($blockId !== '') { + $blockDetail = nacApi('/blocks/' . urlencode($blockId)); + $view = 'block_detail'; +} + +$txDetail = null; +if ($txHash !== '') { + $txDetail = nacApi('/transactions/' . urlencode($txHash)); + $view = 'tx_detail'; +} + +$blocksPage = null; +$txsPage = null; +$assetsPage = null; +if ($view === 'blocks') { $blocksPage = nacApi('/blocks?limit=20&page=' . $page); } +if ($view === 'transactions') { $txsPage = nacApi('/transactions/latest?limit=20'); } +if ($view === 'assets') { $assetsPage = nacApi('/assets?limit=20&page=' . $page); } + +$tagStats = null; +$genesisBlock = nacApi('/blocks/1'); + +// ===================== 数据真实性过滤 ===================== +$latestTxs = null; +$assetsPage = null; +if ($stats) { + unset( + $stats['totalTransactions'], + $stats['totalAddresses'], + $stats['totalContracts'], + $stats['totalAssets'], + $stats['tps'] + ); +} + +// 目标语言切换链接 +$switchLang = t('lang_switch_code'); +$switchUrl = langSwitchUrl($switchLang); +$switchLabel = t('lang_switch'); +$htmlLang = ($LANG === 'zh') ? 'zh-CN' : 'en'; +?> + + + + + + +<?= t('site_title') ?> + + + + + + + + +
+ + + + +
+
+
+
+ +  ·  +  ·  + CBPP  ·  CSNP  ·  NVM  ·  Charter +
+ + +
+
 
+
+
+
+
+
+
+
+
+ +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+ + + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
1
+
+
+
+
+
+
+
0
+
+
+
+
+
0
+
+
+
+
+
0
+
+
+
+
+
+
+
+
+ +
+ ℹ️ + + +
+ + + +
+
+
+ +
+
+
+
+ + + +
+
#
+
+
+
+
+
+ + +
+
+ + +
+
+
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + +
#
+
+
+ +
+
+
+
+
+
📱
+
+
+
+ +
+
+
+
+ + +
+
+ 🌐 +
+
+
+
+
+ +
+
+
+
+
+
+
+
+
+
+
+
+
+
UTC
+
+
+
+
+
+
+
+
+
+
+
+
+ + #1 + #1 +
+
+
+
+ 💡 + +
+
+ + +
+
+
+
+
+
+
🔧
+
+
+
+ +
+
+
+
+
+ +
+
+
+ +
+
+ + +
+
🔌
+
+
+ +
+
+
+
+
+ [$color, $num, $labelKey]): + ?> +
+
+
+
+ +
+ + +
+
+
+ $key): ?> +
+
+
+
+ +
+
+
+ + +
+
+
+
+ +
+
+
+
+
+
+ +
+
+ +
+
+ +
+
+ +
+ + + +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
# KB
📭
+
+ + + + +
+
+ + + +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
#
📭
+
+
+
+ + + +
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + +
$
🏦
+
+ + + +
+
+ + + +
+ +
+ +
+
+
+
+
+ +
+ +
+
+
+ '🏠','nameKey'=>'tag_own','count'=>6230,'desc'=>$LANG==='en'?'Asset share ownership voucher':'资产份额持有凭证','color'=>'#00c8ff'], + ['icon'=>'💰','nameKey'=>'tag_income','count'=>4891,'desc'=>$LANG==='en'?'Rent/interest distribution rights':'租金/利息分配权','color'=>'#00ff88'], + ['icon'=>'✅','nameKey'=>'tag_compliance','count'=>3102,'desc'=>$LANG==='en'?'AI-approved compliance voucher':'AI 审批通过凭证','color'=>'#a855f7'], + ['icon'=>'📊','nameKey'=>'tag_valuation','count'=>1624,'desc'=>$LANG==='en'?'AI real-time valuation snapshot':'AI 实时估值快照','color'=>'#ffd700'], + ]; + foreach ($tagTypes as $t2): + ?> +
+
+
+
+
+
+ +
+
+ +
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+
+
+
+
+ + + +
+ + +
+
+ +
+
+ +
+
+ +
+
💡
+
+
+ centralization handles order, decentralization handles trust.' + : '乌托邦式的完全去中心化导致无人负责、合规无法执行、监管无法接受。NAC 选择了一条更务实的道路:中心化负责秩序,去中心化负责信任。' ?> +
+
+ +
+
+
+
+ +
+
+ +
+
+
+ +

+ +
+
+ +
+ +
+
+
+
+
+
+
+ +
+
+ +
+
+
+
+
+ +
+
+ + + +
+
+
🌐
+
+
+
+
+ +
+
+ +
+
+ + +
+
+
🔌
+
+
+
+
+ +
+
+ +
+
+
+
+
+ +
+
+
+ "" +
+
+
+
+
+
+ + + +
+ +
+
+ 📦 +

#

+ +
+ +
+
+
+
+ +
+ + +
+
+ +
+
+ + + + + + + + + + + + + + + + + + + +
NAC
+
+
+ +
+ + + +
+ +
+
+ 🔄 +

+ +
+ +
+
+
+
+ +
+
+ + + +
+ + +
+
+ +
+ +
+ + + +
+ +
+ +
+ +
+
+
🔍
+ +
+
+ +
+ + +
+ + + + + + + +