NAC_Blockchain/nvm_v2/nvm-l1/start-testnet.sh

181 lines
4.0 KiB
Bash
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
# NAC测试网启动脚本
# Chain ID: 20260131
# 网络名称: NAC Testnet
set -e
echo "========================================="
echo "NAC Testnet 启动脚本"
echo "Chain ID: 20260131"
echo "========================================="
echo ""
# 检查是否在正确的目录
if [ ! -f "Cargo.toml" ]; then
echo "❌ 错误请在NAC项目根目录执行此脚本"
exit 1
fi
# 创建测试网配置目录
mkdir -p testnet/{config,data,logs}
# 生成创世区块配置
cat > testnet/config/genesis.json << 'EOF'
{
"chainId": 20260131,
"networkName": "NAC Testnet",
"consensusType": "CBPP",
"timestamp": 1738627200,
"validators": [
"0x1111111111111111111111111111111111111111",
"0x2222222222222222222222222222222222222222",
"0x3333333333333333333333333333333333333333",
"0x4444444444444444444444444444444444444444"
],
"initialAllocation": {
"0x0000000000000000000000000000000000000001": "1000000000000000000000000"
},
"xtzh": {
"initialSupply": "10000000000000000000000000",
"goldReserveRatio": 0.625,
"leverageRatio": 1.25,
"sdrPeg": true
},
"governance": {
"proposalThreshold": "100000000000000000000000",
"votingPeriod": 604800,
"executionDelay": 86400
}
}
EOF
echo "✅ 创世区块配置已生成: testnet/config/genesis.json"
echo ""
# 生成节点配置
cat > testnet/config/node.toml << 'EOF'
[network]
chain_id = 20260131
network_name = "NAC Testnet"
rpc_port = 8545
p2p_port = 30303
ws_port = 8546
[consensus]
type = "CBPP"
block_time = 6
epoch_length = 100
[storage]
data_dir = "./testnet/data"
log_dir = "./testnet/logs"
[api]
enable_rpc = true
enable_ws = true
cors_origins = ["*"]
[xtzh]
enable_staking = true
min_stake_amount = "1000000000000000000000"
reserve_ratio = 0.625
EOF
echo "✅ 节点配置已生成: testnet/config/node.toml"
echo ""
# 创建启动信息文件
cat > testnet/TESTNET_INFO.md << 'EOF'
# NAC Testnet 信息
## 网络参数
- **Chain ID**: 20260131
- **网络名称**: NAC Testnet
- **共识类型**: CBPP (宪法收据 + 开放生产网络 + 流体区块模型)
- **区块时间**: 6秒
- **TPS**: 3,000+
## RPC端点
- **HTTP RPC**: http://103.96.148.7:8545
- **WebSocket**: ws://103.96.148.7:8546
- **域名**: https://rpc.newassetchain.io
## 浏览器
- **区块浏览器**: https://explorer.newassetchain.io
## 水龙头
- **测试币水龙头**: https://faucet.newassetchain.io
- **每次领取**: 100 XTZH
- **冷却时间**: 24小时
## 钱包配置
### MetaMask配置
```json
{
"chainId": "0x1352523",
"chainName": "NAC Testnet",
"nativeCurrency": {
"name": "XTZH",
"symbol": "XTZH",
"decimals": 18
},
"rpcUrls": ["https://rpc.newassetchain.io"],
"blockExplorerUrls": ["https://explorer.newassetchain.io"]
}
```
## 创世验证者
1. 0x1111111111111111111111111111111111111111
2. 0x2222222222222222222222222222222222222222
3. 0x3333333333333333333333333333333333333333
4. 0x4444444444444444444444444444444444444444
## XTZH参数
- **初始供应量**: 10,000,000 XTZH
- **黄金储备比例**: 62.5%
- **杠杆比例**: 1.25倍
- **SDR锚定**: 启用
## 治理参数
- **提案门槛**: 100,000 XIC
- **投票周期**: 7天
- **执行延迟**: 1天
## 技术支持
- **文档**: https://docs.newassetchain.io
- **GitHub**: https://github.com/newassetchain
- **Discord**: https://discord.gg/newassetchain
EOF
echo "✅ 测试网信息已生成: testnet/TESTNET_INFO.md"
echo ""
echo "========================================="
echo "✅ NAC Testnet 配置完成!"
echo "========================================="
echo ""
echo "测试网配置文件:"
echo " - 创世区块: testnet/config/genesis.json"
echo " - 节点配置: testnet/config/node.toml"
echo " - 网络信息: testnet/TESTNET_INFO.md"
echo ""
echo "下一步:"
echo " 1. 启动节点: cargo run --release --bin nac-node"
echo " 2. 查看日志: tail -f testnet/logs/node.log"
echo " 3. 访问RPC: curl http://localhost:8545"
echo ""
echo "测试网已就绪!"
echo ""