Merge branch 'master' of https://github.com/SamiAhmed7777/triangles_v5
This commit is contained in:
+54
@@ -0,0 +1,54 @@
|
||||
# Build artifacts
|
||||
*.o
|
||||
*.exe
|
||||
*.dll
|
||||
*.so
|
||||
*.dylib
|
||||
*.a
|
||||
build/
|
||||
release/
|
||||
debug/
|
||||
Makefile.Debug
|
||||
Makefile.Release
|
||||
.qmake.stash
|
||||
|
||||
# Qt
|
||||
moc_*.cpp
|
||||
ui_*.h
|
||||
qrc_*.cpp
|
||||
*.pro.user
|
||||
*.pro.user.*
|
||||
|
||||
# Blockchain data
|
||||
*.dat
|
||||
*.log
|
||||
peers.dat
|
||||
wallet.dat
|
||||
*.lock
|
||||
database/
|
||||
txleveldb/
|
||||
blktree/
|
||||
chainstate/
|
||||
blocks/
|
||||
*.bak
|
||||
|
||||
# IDE
|
||||
.vscode/
|
||||
.idea/
|
||||
*.swp
|
||||
*.swo
|
||||
*~
|
||||
.DS_Store
|
||||
|
||||
# Temp files
|
||||
*.json
|
||||
.*.json
|
||||
temp/
|
||||
tmp/
|
||||
|
||||
# Private/Local
|
||||
triangles.conf
|
||||
*.pem
|
||||
*.key
|
||||
*.cert
|
||||
*.gpg
|
||||
@@ -1,21 +0,0 @@
|
||||
QMAKE_CXX.QT_COMPILER_STDCXX = 201703L
|
||||
QMAKE_CXX.QMAKE_GCC_MAJOR_VERSION = 15
|
||||
QMAKE_CXX.QMAKE_GCC_MINOR_VERSION = 2
|
||||
QMAKE_CXX.QMAKE_GCC_PATCH_VERSION = 0
|
||||
QMAKE_CXX.COMPILER_MACROS = \
|
||||
QT_COMPILER_STDCXX \
|
||||
QMAKE_GCC_MAJOR_VERSION \
|
||||
QMAKE_GCC_MINOR_VERSION \
|
||||
QMAKE_GCC_PATCH_VERSION
|
||||
QMAKE_CXX.INCDIRS = \
|
||||
C:/msys64/mingw64/include/c++/15.2.0 \
|
||||
C:/msys64/mingw64/include/c++/15.2.0/x86_64-w64-mingw32 \
|
||||
C:/msys64/mingw64/include/c++/15.2.0/backward \
|
||||
C:/msys64/mingw64/lib/gcc/x86_64-w64-mingw32/15.2.0/include \
|
||||
C:/msys64/mingw64/include \
|
||||
C:/msys64/mingw64/lib/gcc/x86_64-w64-mingw32/15.2.0/include-fixed
|
||||
QMAKE_CXX.LIBDIRS = \
|
||||
C:/msys64/mingw64/lib/gcc/x86_64-w64-mingw32/15.2.0 \
|
||||
C:/msys64/mingw64/lib/gcc \
|
||||
C:/msys64/mingw64/x86_64-w64-mingw32/lib \
|
||||
C:/msys64/mingw64/lib
|
||||
@@ -1,320 +0,0 @@
|
||||
# Triangles (TRI) Chain Restart - Complete Operations Guide
|
||||
|
||||
## For Krystie: This document contains everything needed to help Sami restart the Triangles cryptocurrency chain from Telegram. Use Pegasus for server operations on the VPSes.
|
||||
|
||||
---
|
||||
|
||||
## Overview
|
||||
|
||||
Triangles is a Bitcoin-derived Proof-of-Stake cryptocurrency. The chain froze at approximately **block 2,000,000**. The goal is to restart the chain from that point, preserving all existing wallets and balances.
|
||||
|
||||
**Domain**: `cryptographic-triangles.org`
|
||||
**Block Explorer**: `blocks.cryptographic-triangles.org`
|
||||
**Source Code**: `e:\repos\triangles` (on Sami's Windows PC)
|
||||
|
||||
---
|
||||
|
||||
## Chain Technical Specs
|
||||
|
||||
| Parameter | Value |
|
||||
|---|---|
|
||||
| Algorithm | Hash9 (13-step cascade: Blake→BMW→Groestl→Skein→JH→Keccak→Luffa→CubeHash→SHAvite→SIMD→Echo→Hamsi→Fugue) |
|
||||
| Consensus | PoW blocks 0-9000, **PoS only from block 9001+** |
|
||||
| Block Time | 2 minutes (120 sec target) |
|
||||
| PoS Reward | 33% annual (coin-age based) |
|
||||
| Max Supply | 120,000 TRI |
|
||||
| Min Stake Age | 1 hour |
|
||||
| Max Stake Age | 12 hours |
|
||||
| P2P Port | 24112 (mainnet), 24111 (testnet) |
|
||||
| RPC Port | 19112 (mainnet), 19111 (testnet) |
|
||||
| Protocol Version | 70205 |
|
||||
| Data Dir (Windows) | `%APPDATA%\triangles\` |
|
||||
| Data Dir (Linux) | `~/.triangles/` |
|
||||
| Last Hardcoded Checkpoint | Block 17650 |
|
||||
| V5 Hard Fork Height | Block 17651 |
|
||||
| Chain Froze At | ~Block 2,000,000 |
|
||||
| Genesis Hash | `0x7e7a6e4dd5fe895106fca912dfbacaeaf2a89e76c6a588df8ff96e0e18b96021` |
|
||||
|
||||
---
|
||||
|
||||
## What Needs to Happen (5 Phases)
|
||||
|
||||
### Phase 1: Code Changes (on Sami's PC in IDE)
|
||||
|
||||
These are source code edits in `e:\repos\triangles\src\`:
|
||||
|
||||
**1.1 — Update DNS Seeds**
|
||||
File: `src/net_bootstrap.h` (lines 19-24)
|
||||
Change from `triangles.network` to `cryptographic-triangles.org`:
|
||||
```
|
||||
seed1.cryptographic-triangles.org
|
||||
seed2.cryptographic-triangles.org
|
||||
seed3.cryptographic-triangles.org
|
||||
backup-seed.cryptographic-triangles.org
|
||||
```
|
||||
|
||||
**1.2 — Add Hardcoded Seed Node IPs**
|
||||
File: `src/net.cpp` (line 1362)
|
||||
Currently empty: `unsigned int pnSeed[] = {};`
|
||||
Must add the VPS IP addresses in network byte order (little-endian).
|
||||
IP conversion formula: for IP `a.b.c.d` → `(d << 24) | (c << 16) | (b << 8) | a`
|
||||
Example: `192.168.1.100` = `0x6401A8C0`
|
||||
|
||||
Also update the duplicate array in `src/net_bootstrap.h` (lines 29-33).
|
||||
|
||||
**1.3 — Fix Linux Build System**
|
||||
File: `src/makefile.unix`
|
||||
The makefile references old Tor v2 object files that were removed in v5. The OBJS list must be updated to match the current source files (the Qt .pro file has the correct list). Key files to add: `net_bootstrap.o`, `anonymize.o`, `onion_v3.o`. Remove all old embedded Tor v2 references.
|
||||
|
||||
**1.4 — Add Checkpoint at Block 2,000,000**
|
||||
File: `src/checkpoints.cpp` (lines 25-39)
|
||||
Once we have the block hash at height 2,000,000, add it as a checkpoint:
|
||||
```cpp
|
||||
(2000000, uint256("0x<hash_at_block_2000000>"))
|
||||
```
|
||||
This helps new nodes sync faster and validates chain integrity.
|
||||
|
||||
**1.5 — Build Binaries**
|
||||
- Linux `trianglesd` (headless daemon for VPS seed nodes)
|
||||
- Windows `triangles-qt.exe` (Qt GUI wallet for users)
|
||||
|
||||
Build deps (Linux): `build-essential libssl-dev libboost-all-dev libdb++-dev libleveldb-dev libevent-dev`
|
||||
Build system: `qmake` or corrected `makefile.unix`
|
||||
|
||||
---
|
||||
|
||||
### Phase 2: Infrastructure Setup (VPS + DNS)
|
||||
|
||||
**2.1 — DNS Records** (at `cryptographic-triangles.org` registrar/DNS)
|
||||
|
||||
| Record | Type | Value |
|
||||
|---|---|---|
|
||||
| `seed1.cryptographic-triangles.org` | A | VPS1 IP |
|
||||
| `seed2.cryptographic-triangles.org` | A | VPS2 IP |
|
||||
| `seed3.cryptographic-triangles.org` | A | VPS3 IP |
|
||||
| `backup-seed.cryptographic-triangles.org` | A | VPS1 IP |
|
||||
| `blocks.cryptographic-triangles.org` | A | Explorer VPS IP |
|
||||
|
||||
**2.2 — Deploy Blockchain Data to VPSes**
|
||||
|
||||
Copy from Sami's Windows `%APPDATA%\triangles\` to each VPS `~/.triangles/`:
|
||||
- `blk0001.dat`, `blk0002.dat`, etc. (blockchain data)
|
||||
- `txleveldb/` directory (transaction index)
|
||||
- **DO NOT** copy `peers.dat` (stale peer data)
|
||||
- **ONLY** copy `wallet.dat` to the PRIMARY staking node
|
||||
|
||||
**2.3 — Firewall (on each VPS)**
|
||||
```bash
|
||||
sudo ufw allow 24112/tcp # P2P
|
||||
# RPC - localhost only (or allow explorer IP)
|
||||
sudo ufw allow from 127.0.0.1 to any port 19112 proto tcp
|
||||
```
|
||||
|
||||
**2.4 — triangles.conf (on each VPS)**
|
||||
|
||||
Primary staking node (`~/.triangles/triangles.conf`):
|
||||
```ini
|
||||
listen=1
|
||||
server=1
|
||||
daemon=1
|
||||
rpcuser=trianglesrpc
|
||||
rpcpassword=<STRONG_RANDOM_PASSWORD>
|
||||
rpcport=19112
|
||||
rpcallowip=127.0.0.1
|
||||
staking=1
|
||||
addnode=seed2.cryptographic-triangles.org
|
||||
addnode=seed3.cryptographic-triangles.org
|
||||
logtimestamps=1
|
||||
```
|
||||
|
||||
Secondary seed nodes — same but with `staking=0` and different `addnode` entries pointing to other seeds.
|
||||
|
||||
---
|
||||
|
||||
### Phase 3: Chain Restart (the critical part)
|
||||
|
||||
**Order of operations:**
|
||||
|
||||
1. **Start secondary seed nodes first** (they have blockchain data but no wallet, `staking=0`)
|
||||
```bash
|
||||
./trianglesd -daemon
|
||||
./trianglesd getblockcount # verify blockchain loaded
|
||||
```
|
||||
|
||||
2. **Start primary staking node** (has wallet.dat with coins)
|
||||
```bash
|
||||
./trianglesd -daemon
|
||||
./trianglesd getinfo # verify it's running
|
||||
```
|
||||
|
||||
3. **Verify peer connectivity**
|
||||
```bash
|
||||
./trianglesd getconnectioncount # must be >= 1
|
||||
./trianglesd getpeerinfo # shows connected peers
|
||||
```
|
||||
|
||||
4. **Unlock wallet for staking** (if encrypted)
|
||||
```bash
|
||||
./trianglesd walletpassphrase "passphrase" 999999999 true
|
||||
# The 'true' = staking only (can't spend, only stake)
|
||||
```
|
||||
|
||||
5. **Verify staking is active**
|
||||
```bash
|
||||
./trianglesd getstakinginfo
|
||||
# Look for: "enabled": true, "staking": true, "weight": > 0
|
||||
```
|
||||
|
||||
6. **Monitor for first new block**
|
||||
```bash
|
||||
watch -n 10 './trianglesd getblockcount'
|
||||
# Or: tail -f ~/.triangles/debug.log | grep "proof-of-stake"
|
||||
```
|
||||
|
||||
**Important staking notes:**
|
||||
- Staking thread needs at least 1 peer connected to attempt staking
|
||||
- With 2 nodes, staking works (the peer count check at `miner.cpp:554` passes when `nBestHeight >= GetNumBlocksOfPeers()`)
|
||||
- Coins from old chain already exceed min stake age (1 hour) — they'll stake immediately
|
||||
- V5 fork resets PoS difficulty to minimum — first blocks should come within minutes
|
||||
- `IsInitialBlockDownload()` returns false once blockchain is fully loaded and no new blocks arrive for >10 seconds
|
||||
|
||||
**If staking isn't working, check:**
|
||||
- Wallet unlocked? (`walletpassphrase`)
|
||||
- Peers connected? (`getconnectioncount`)
|
||||
- Chain synced? (`getblockcount` matches expected height)
|
||||
- Coins mature enough? (1 hour minimum age)
|
||||
|
||||
---
|
||||
|
||||
### Phase 4: Block Explorer (Iquidus)
|
||||
|
||||
**Install on a VPS (can share with a seed node):**
|
||||
|
||||
```bash
|
||||
# Dependencies
|
||||
sudo apt install -y nodejs npm mongodb
|
||||
|
||||
# Clone and install
|
||||
git clone https://github.com/iquidus/explorer.git iquidus-explorer
|
||||
cd iquidus-explorer && npm install
|
||||
|
||||
# Configure settings.json with:
|
||||
# - wallet.host: 127.0.0.1, wallet.port: 19112
|
||||
# - wallet.user/pass matching triangles.conf RPC credentials
|
||||
# - genesis_block: "7e7a6e4dd5fe895106fca912dfbacaeaf2a89e76c6a588df8ff96e0e18b96021"
|
||||
# - coin: "Triangles", symbol: "TRI"
|
||||
|
||||
# Set up MongoDB
|
||||
mongo --eval 'db = db.getSiblingDB("explorerdb"); db.createUser({user:"iquidus",pwd:"dbpassword",roles:["readWrite"]})'
|
||||
|
||||
# Start explorer
|
||||
npm start &
|
||||
|
||||
# Sync blockchain into explorer (run via cron every minute)
|
||||
node scripts/sync.js index update
|
||||
```
|
||||
|
||||
**Caddy reverse proxy** for `blocks.cryptographic-triangles.org`:
|
||||
```
|
||||
blocks.cryptographic-triangles.org {
|
||||
reverse_proxy localhost:3001
|
||||
}
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Phase 5: User Wallet Restoration
|
||||
|
||||
**Users don't need to do anything special.** Their wallets are preserved automatically:
|
||||
|
||||
1. Wallet keys live in `wallet.dat` — completely independent of blockchain
|
||||
2. Users download the new binary (with updated seed addresses)
|
||||
3. Binary connects to seed nodes, syncs the full blockchain
|
||||
4. `ScanForWalletTransactions()` (in `init.cpp:876`) automatically finds all their transactions
|
||||
5. Balances appear correctly
|
||||
|
||||
**Tips for users:**
|
||||
- Delete old `peers.dat` for faster initial connection
|
||||
- Or add `addnode=seed1.cryptographic-triangles.org` to their `triangles.conf`
|
||||
- Existing encrypted wallets stay encrypted — same passphrase works
|
||||
|
||||
---
|
||||
|
||||
## Key Source Files Reference
|
||||
|
||||
| File | Purpose |
|
||||
|---|---|
|
||||
| `src/net_bootstrap.h` | DNS seeds, hardcoded IP seeds |
|
||||
| `src/net.cpp` | Main peer discovery, `pnSeed[]` array (line 1362) |
|
||||
| `src/onionseed.h` | Tor v3 onion seeds (currently empty) |
|
||||
| `src/main.cpp` | Consensus rules, block rewards, `IsInitialBlockDownload()` |
|
||||
| `src/main.h` | Constants: fork heights, max money, maturity |
|
||||
| `src/miner.cpp` | Staking thread logic, peer count gates |
|
||||
| `src/checkpoints.cpp` | Hardcoded checkpoints, sync checkpoint |
|
||||
| `src/kernel.cpp` | PoS kernel hash computation |
|
||||
| `src/wallet.h/cpp` | Wallet operations, staking interface |
|
||||
| `src/init.cpp` | Node startup, wallet loading, blockchain scan |
|
||||
| `src/version.h` | Protocol versions |
|
||||
| `src/makefile.unix` | Linux headless daemon build (needs fixing) |
|
||||
| `triangles-qt.pro` | Qt GUI build (Windows/Linux) |
|
||||
|
||||
---
|
||||
|
||||
## RPC Commands Cheat Sheet
|
||||
|
||||
| Command | Purpose |
|
||||
|---|---|
|
||||
| `getinfo` | Node status overview |
|
||||
| `getblockcount` | Current block height |
|
||||
| `getblockhash <height>` | Get hash of block at height |
|
||||
| `getblock <hash>` | Full block details |
|
||||
| `getstakinginfo` | Staking status and weight |
|
||||
| `getconnectioncount` | Number of connected peers |
|
||||
| `getpeerinfo` | Detailed peer information |
|
||||
| `getbalance` | Wallet balance |
|
||||
| `walletpassphrase "<pass>" <timeout> true` | Unlock for staking only |
|
||||
| `walletlock` | Lock wallet |
|
||||
| `sendtoaddress "<addr>" <amount>` | Send coins |
|
||||
| `getnewaddress` | Generate new receiving address |
|
||||
| `dumpprivkey "<addr>"` | Export private key |
|
||||
| `importprivkey "<key>"` | Import private key |
|
||||
| `backupwallet "<path>"` | Backup wallet.dat |
|
||||
|
||||
---
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
**No peers connecting:**
|
||||
- Check firewall: `sudo ufw status` — port 24112 must be open
|
||||
- Check DNS: `dig seed1.cryptographic-triangles.org` — must resolve
|
||||
- Fallback: use `addnode=<IP>` in triangles.conf with direct VPS IPs
|
||||
|
||||
**Staking not starting:**
|
||||
- `getstakinginfo` → check `enabled`, `staking`, `weight` fields
|
||||
- Weight = 0 means no mature coins (wait 1 hour after wallet loads)
|
||||
- Need at least 1 peer connected
|
||||
|
||||
**Node stuck in initial block download:**
|
||||
- Normal if best block is >24 hours old and still loading
|
||||
- Wait for blockchain to fully load from blk*.dat files
|
||||
- Check `debug.log` for progress
|
||||
|
||||
**Explorer not syncing:**
|
||||
- Check RPC credentials match between `settings.json` and `triangles.conf`
|
||||
- Verify `rpcallowip` permits the explorer's connection
|
||||
- Test: `curl -u user:pass http://127.0.0.1:19112 -d '{"method":"getblockcount"}'`
|
||||
|
||||
---
|
||||
|
||||
## Forking at Block 2,000,000
|
||||
|
||||
The chain froze at approximately block 2,000,000. To fork/restart from there:
|
||||
|
||||
1. The existing blockchain data up to block ~2M is preserved as-is
|
||||
2. All wallet balances and UTXOs at block 2M are the canonical state
|
||||
3. New PoS blocks (2,000,001+) will be produced by the restarted staking
|
||||
4. Any blocks that existed after 2M on a dead/stale fork are naturally orphaned — nodes with the new binary will follow the chain with the most cumulative stake weight
|
||||
5. If corrupt blocks exist near 2M, use `invalidateblock <hash>` RPC to manually reject them and let the chain reorganize
|
||||
|
||||
**Adding the block 2M checkpoint (after restart):**
|
||||
Once we confirm the hash at block 2,000,000, we add it to `src/checkpoints.cpp` so all new nodes validate against it. This prevents any alternative chain from being accepted.
|
||||
@@ -1,307 +0,0 @@
|
||||
# Triangles (TRI) Chain Restart - Briefing for Krystie
|
||||
|
||||
**Project**: Reviving the Triangles cryptocurrency blockchain
|
||||
**For**: Krystie (@Krystie7777bot) via Telegram / Pegasus
|
||||
**From**: Sami
|
||||
**Date**: March 9, 2026
|
||||
**Source Code**: `e:\repos\triangles` on Sami's Windows PC
|
||||
|
||||
---
|
||||
|
||||
## What Is Triangles?
|
||||
|
||||
Triangles (TRI) is a Bitcoin-derived Proof-of-Stake cryptocurrency. It uses the Hash9 algorithm (13-step hash cascade) and has a 2-minute block target time. Max supply is 222,222 TRI.
|
||||
|
||||
The chain **froze on December 8, 2022** at block **2,186,951** when there were no longer enough active nodes staking. All wallets, balances, and transaction history are preserved in the blockchain data. The goal is to restart staking from that exact point so the chain continues where it left off.
|
||||
|
||||
---
|
||||
|
||||
## Current Status (What's Done)
|
||||
|
||||
### Code Changes (all completed)
|
||||
- **DNS seeds** updated to `cryptographic-triangles.org` (seed1, seed2, seed3, backup-seed)
|
||||
- **Hardcoded seed IP**: 194.233.88.206 (DNS2-OpenClaw) baked into the binary
|
||||
- **V5 hard fork** at block 17,651: disabled checkpoint master key, removed old Tor v2
|
||||
- **Checkpoint added** at block **2,186,940** with hash `0xbd952e8d4a612e336d840ad924a7e09395e36bcd9d929b302e47e60b5c3098c0`
|
||||
- This checkpoint makes syncing dramatically faster (skips signature verification for all 2.18M historical blocks)
|
||||
- **Linux build system** (`src/makefile.unix`) fixed for v5
|
||||
- **OpenSSL 3.x** and **modern Boost** compatibility fixed
|
||||
- **Protocol version**: 70205 (old nodes on 70002-70203 will be disconnected)
|
||||
|
||||
### Windows Binary (completed)
|
||||
- `triangles-qt.exe` built on Mar 9, 2026 with all updates
|
||||
- Located at `e:\repos\triangles\release\triangles-qt.exe`
|
||||
- All required DLLs are in the release directory
|
||||
|
||||
### Blockchain Data
|
||||
- `blk0001.dat` (~984 MB) contains the full chain: 2,186,951 blocks
|
||||
- Available at `E:\Coins\TRIagain\blk0001.dat` on Sami's PC
|
||||
- A LevelDB index rebuild is currently in progress (importing blocks into `E:\Coins\TRI\txleveldb\`)
|
||||
|
||||
---
|
||||
|
||||
## What Needs to Happen Next
|
||||
|
||||
### Phase 1: Build Linux Binary (trianglesd)
|
||||
|
||||
The headless daemon needs to be compiled on a Linux VPS. The source code must be transferred from Sami's PC.
|
||||
|
||||
**Build dependencies** (Ubuntu/Debian):
|
||||
```bash
|
||||
sudo apt update
|
||||
sudo apt install -y build-essential libssl-dev libboost-all-dev libdb++-dev libleveldb-dev libevent-dev git
|
||||
```
|
||||
|
||||
**Build steps**:
|
||||
```bash
|
||||
# Get source code from Sami (via git push, scp, or zip upload)
|
||||
cd triangles/src
|
||||
mkdir -p obj
|
||||
make -f makefile.unix -j$(nproc)
|
||||
# Output: ./trianglesd
|
||||
```
|
||||
|
||||
If the build fails on `anonymize.o` or `onion_v3.o`, make sure the `tor/` subdirectory and its files exist:
|
||||
- `tor/anonymize.cpp`
|
||||
- `tor/onion_v3.cpp`
|
||||
- `tor/onion_v3.h`
|
||||
- `tor/tor_crypto_compat.h`
|
||||
|
||||
---
|
||||
|
||||
### Phase 2: DNS Records
|
||||
|
||||
Set up A records at the `cryptographic-triangles.org` registrar:
|
||||
|
||||
| Record | Type | Value |
|
||||
|---|---|---|
|
||||
| `seed1.cryptographic-triangles.org` | A | *Primary staking VPS IP* |
|
||||
| `seed2.cryptographic-triangles.org` | A | *DNS2 VPS IP (194.233.88.206?)* |
|
||||
| `seed3.cryptographic-triangles.org` | A | *DNS3 VPS IP* |
|
||||
| `backup-seed.cryptographic-triangles.org` | A | *Same as seed1* |
|
||||
| `blocks.cryptographic-triangles.org` | A | *Explorer VPS IP (later)* |
|
||||
|
||||
---
|
||||
|
||||
### Phase 3: Deploy Seed Nodes (DNS2 + DNS3)
|
||||
|
||||
Each seed node needs:
|
||||
|
||||
#### 3a. Blockchain Data
|
||||
Copy from Sami's PC to each VPS at `~/.triangles/`:
|
||||
- `blk0001.dat` (the full ~984 MB blockchain)
|
||||
- **DO NOT** copy `peers.dat` (stale peer data)
|
||||
- **DO NOT** copy `wallet.dat` to seed nodes (only to the staking node)
|
||||
|
||||
The binary will rebuild the LevelDB index (`txleveldb/`) automatically on first run when it finds a `blk0001.dat` but no index. Alternatively, use `-loadblock=<path>` to import.
|
||||
|
||||
#### 3b. Firewall
|
||||
```bash
|
||||
sudo ufw allow 24112/tcp # P2P port
|
||||
sudo ufw allow from 127.0.0.1 to any port 19112 proto tcp # RPC localhost only
|
||||
sudo ufw enable
|
||||
```
|
||||
|
||||
#### 3c. Configuration File
|
||||
Create `~/.triangles/triangles.conf`:
|
||||
|
||||
**For DNS2 (seed node, no staking)**:
|
||||
```ini
|
||||
listen=1
|
||||
server=1
|
||||
daemon=1
|
||||
rpcuser=trianglesrpc
|
||||
rpcpassword=CHANGE_THIS_TO_SOMETHING_STRONG
|
||||
rpcport=19112
|
||||
rpcallowip=127.0.0.1
|
||||
staking=0
|
||||
addnode=seed1.cryptographic-triangles.org
|
||||
addnode=seed3.cryptographic-triangles.org
|
||||
logtimestamps=1
|
||||
maxconnections=50
|
||||
```
|
||||
|
||||
**For DNS3 (seed node, no staking)**:
|
||||
```ini
|
||||
listen=1
|
||||
server=1
|
||||
daemon=1
|
||||
rpcuser=trianglesrpc
|
||||
rpcpassword=CHANGE_THIS_TO_SOMETHING_DIFFERENT
|
||||
rpcport=19112
|
||||
rpcallowip=127.0.0.1
|
||||
staking=0
|
||||
addnode=seed1.cryptographic-triangles.org
|
||||
addnode=seed2.cryptographic-triangles.org
|
||||
logtimestamps=1
|
||||
maxconnections=50
|
||||
```
|
||||
|
||||
#### 3d. Start Seed Nodes
|
||||
```bash
|
||||
# Start the daemon
|
||||
./trianglesd -daemon
|
||||
|
||||
# Verify it's running
|
||||
./trianglesd getinfo
|
||||
|
||||
# Check block count (should reach 2,186,951 after sync)
|
||||
./trianglesd getblockcount
|
||||
|
||||
# Check peer connections
|
||||
./trianglesd getconnectioncount
|
||||
./trianglesd getpeerinfo
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### Phase 4: Start the Primary Staking Node
|
||||
|
||||
This is the node that will produce the first new block and restart the chain. It needs `wallet.dat` with coins.
|
||||
|
||||
**Which node**: Can be DNS2, DNS3, or a separate VPS. Whichever has `wallet.dat`.
|
||||
|
||||
**Configuration** (same as above but with `staking=1`):
|
||||
```ini
|
||||
listen=1
|
||||
server=1
|
||||
daemon=1
|
||||
rpcuser=trianglesrpc
|
||||
rpcpassword=STRONG_PASSWORD_HERE
|
||||
rpcport=19112
|
||||
rpcallowip=127.0.0.1
|
||||
staking=1
|
||||
addnode=seed2.cryptographic-triangles.org
|
||||
addnode=seed3.cryptographic-triangles.org
|
||||
logtimestamps=1
|
||||
```
|
||||
|
||||
**Start order**:
|
||||
1. Start DNS2 and DNS3 seed nodes **first** (let them sync)
|
||||
2. Start the staking node **after** seeds are running
|
||||
3. Unlock the wallet for staking:
|
||||
```bash
|
||||
./trianglesd walletpassphrase "YOUR_PASSPHRASE" 999999999 true
|
||||
# The 'true' = staking only (wallet can stake but not spend)
|
||||
```
|
||||
4. Verify staking is active:
|
||||
```bash
|
||||
./trianglesd getstakinginfo
|
||||
# Look for: "enabled": true, "staking": true, "weight": > 0
|
||||
```
|
||||
5. Monitor for the first new block:
|
||||
```bash
|
||||
watch -n 10 './trianglesd getblockcount'
|
||||
# Or: tail -f ~/.triangles/debug.log | grep "proof-of-stake"
|
||||
```
|
||||
|
||||
**Important notes about staking**:
|
||||
- Staking needs at least **1 connected peer** to start attempting
|
||||
- Coins from the old chain already exceed the 1-hour minimum stake age
|
||||
- The V5 fork reset PoS difficulty to minimum, so the first block should come within **minutes**
|
||||
- `IsInitialBlockDownload()` must return false (chain must be fully loaded, no new blocks for >10 seconds)
|
||||
|
||||
---
|
||||
|
||||
## Chain Technical Specs Quick Reference
|
||||
|
||||
| Parameter | Value |
|
||||
|---|---|
|
||||
| Algorithm | Hash9 (13-step cascade) |
|
||||
| Consensus | PoW blocks 0-9000, **PoS only from 9001+** |
|
||||
| Block Time | 2 minutes (120 sec target) |
|
||||
| PoS Reward | 33% annual (coin-age based) |
|
||||
| Max Supply | 222,222 TRI |
|
||||
| Min Stake Age | 1 hour |
|
||||
| P2P Port | **24112** |
|
||||
| RPC Port | **19112** |
|
||||
| Protocol Version | 70205 |
|
||||
| Data Dir (Linux) | `~/.triangles/` |
|
||||
| Chain Tip | Block **2,186,951** (Dec 8, 2022) |
|
||||
| Checkpoint | Block **2,186,940** |
|
||||
| Genesis Hash | `0x7e7a6e4dd5fe895106fca912dfbacaeaf2a89e76c6a588df8ff96e0e18b96021` |
|
||||
|
||||
---
|
||||
|
||||
## RPC Commands Cheat Sheet
|
||||
|
||||
| Command | What It Does |
|
||||
|---|---|
|
||||
| `getinfo` | Node status overview |
|
||||
| `getblockcount` | Current block height |
|
||||
| `getblockhash <height>` | Get hash of block at height |
|
||||
| `getstakinginfo` | Staking status and weight |
|
||||
| `getconnectioncount` | Number of connected peers |
|
||||
| `getpeerinfo` | Detailed peer info |
|
||||
| `getbalance` | Wallet balance |
|
||||
| `walletpassphrase "<pass>" <timeout> true` | Unlock for staking |
|
||||
| `walletlock` | Lock wallet |
|
||||
| `stop` | Gracefully shut down the node |
|
||||
|
||||
---
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
**No peers connecting:**
|
||||
- Check firewall: `sudo ufw status` -- port 24112 must be open
|
||||
- Check DNS: `dig seed1.cryptographic-triangles.org` -- must resolve
|
||||
- Fallback: use `addnode=<IP>` in conf with direct VPS IPs
|
||||
- Check: `./trianglesd getpeerinfo`
|
||||
|
||||
**Staking not starting:**
|
||||
- `getstakinginfo` -- check `enabled`, `staking`, `weight` fields
|
||||
- Weight = 0 means no mature coins (wait 1 hour after wallet loads)
|
||||
- Need at least 1 peer connected
|
||||
- Chain must be fully synced (not in initial block download)
|
||||
|
||||
**Node won't start:**
|
||||
- Check `~/.triangles/debug.log` for errors
|
||||
- Make sure port 24112 isn't already in use: `netstat -tlnp | grep 24112`
|
||||
- Delete `peers.dat` if it contains stale data
|
||||
- Try starting with `-debug` for verbose logging
|
||||
|
||||
**Node stuck at genesis (height=0):**
|
||||
- The `blk0001.dat` needs to be imported. Either:
|
||||
- Place it in `~/.triangles/` and restart (the node reads it during `LoadBlockIndex`)
|
||||
- Use `./trianglesd -loadblock=/path/to/blk0001.dat` to import explicitly
|
||||
- Note: `-loadblock` exits after import. Restart normally after.
|
||||
|
||||
---
|
||||
|
||||
## Wallet Preservation (for end users later)
|
||||
|
||||
Users don't need to do anything special. Their wallets work automatically:
|
||||
1. `wallet.dat` contains keys -- completely independent of blockchain
|
||||
2. Users download the new binary with updated seed addresses
|
||||
3. Binary connects to seed nodes, syncs the blockchain
|
||||
4. `ScanForWalletTransactions()` automatically finds all their transactions
|
||||
5. Balances appear correctly
|
||||
|
||||
**Tips for users:**
|
||||
- Delete old `peers.dat` for faster connection
|
||||
- Add `addnode=seed1.cryptographic-triangles.org` to `triangles.conf`
|
||||
- Encrypted wallets stay encrypted -- same passphrase works
|
||||
|
||||
---
|
||||
|
||||
## File Transfer Checklist
|
||||
|
||||
**From Sami's PC to each VPS:**
|
||||
|
||||
| File | Size | Destination | Notes |
|
||||
|---|---|---|---|
|
||||
| Source code (zip/git) | ~50 MB | Any temp dir | For building `trianglesd` |
|
||||
| `blk0001.dat` | ~984 MB | `~/.triangles/` | Full blockchain data |
|
||||
| `wallet.dat` | ~3.2 MB | `~/.triangles/` | **STAKING NODE ONLY** |
|
||||
| `trianglesd` | N/A | Build on VPS | Compiled from source |
|
||||
|
||||
**DO NOT transfer**: `peers.dat`, `txleveldb/` (node rebuilds it), any `.lock` files
|
||||
|
||||
---
|
||||
|
||||
## Contact & Resources
|
||||
|
||||
- **Domain**: `cryptographic-triangles.org`
|
||||
- **Source**: `e:\repos\triangles` (Sami's PC)
|
||||
- **Full ops guide**: `e:\repos\triangles\CHAIN-RESTART-GUIDE.md`
|
||||
- **Block explorer** (future): `blocks.cryptographic-triangles.org` (Iquidus)
|
||||
-4231
File diff suppressed because one or more lines are too long
-4231
File diff suppressed because one or more lines are too long
@@ -1,186 +0,0 @@
|
||||
# Triangles (TRI) Blockchain Revival - Project Status
|
||||
|
||||
**Date:** March 11, 2026
|
||||
**Prepared by:** Sami
|
||||
**For:** Krystie (@Krystie7777bot)
|
||||
|
||||
---
|
||||
|
||||
## Executive Summary
|
||||
|
||||
The Triangles blockchain has been successfully revived. The chain froze on December 8, 2022 at block 2,186,951 due to all nodes going offline. As of March 11, 2026, two seed nodes are running, connected, and actively staking new blocks. All wallet balances from the original chain have been preserved.
|
||||
|
||||
---
|
||||
|
||||
## What Was Done
|
||||
|
||||
### 1. Code Modernization (v5.0.0.0 "Black Pharao" Release)
|
||||
|
||||
The Triangles codebase was updated to compile and run on modern systems:
|
||||
|
||||
- **OpenSSL 3.x compatibility** - Updated all deprecated SHA256/RIPEMD160 calls
|
||||
- **Boost 1.83+ support** - Fixed compatibility with modern Boost libraries
|
||||
- **Tor v2 removal** - Removed obsolete Tor v2 onion service code (deprecated Oct 2021)
|
||||
- **Tor v3 integration** - Added new Onion v3 hidden service support with Ed25519 keys
|
||||
- **V5 hard fork at block 17,651** - Disabled checkpoint master key, removed Tor v2
|
||||
- **Hardcoded checkpoint at block 2,186,940** - Protects the chain history
|
||||
- **MAX_MONEY set to 222,222 TRI** - Updated supply cap
|
||||
- **Bind fix** - Nodes now listen on all interfaces (0.0.0.0) for external connections
|
||||
|
||||
### 2. Blockchain Data Recovery
|
||||
|
||||
- Extracted all 2,186,967 blocks from the original `blk0001.dat` file
|
||||
- Built a custom sorting tool to order blocks by height (they were stored out of order)
|
||||
- Produced `sorted_blk0001.dat` (927.8 MB) containing the complete verified chain
|
||||
- Validated the full chain: genesis block through block 2,186,940 (checkpoint)
|
||||
|
||||
### 3. Seed Node Deployment
|
||||
|
||||
Two seed nodes are now running on geographically distributed VPS servers:
|
||||
|
||||
| Property | DNS2 (Staking Node) | DNS3 (Relay Node) |
|
||||
|----------|-------------------|-------------------|
|
||||
| **Hosting** | DigitalOcean (OpenClaw) | Contabo (IONOS) |
|
||||
| **Public IP** | 194.233.88.206 | 74.208.167.19 |
|
||||
| **OS** | Ubuntu 24.04 LTS | AlmaLinux 9.7 |
|
||||
| **RAM** | 11 GB | 1.6 GB |
|
||||
| **Onion Address** | gxvrhv3qitnc6kobrhsrse46bmcfitnybapor3or3oczzuxn6hfzxyid.onion | futmtrvh6j34t7s6yjdxfia6iwuyfzwh4k5eqfof5kfhoqk3xmi3qoqd.onion |
|
||||
| **Role** | Staking + Seed | Seed/Relay |
|
||||
| **Wallet** | Has wallet.dat with coins | Fresh wallet (no coins) |
|
||||
|
||||
### 4. Chain Status (Live as of March 11, 2026)
|
||||
|
||||
```
|
||||
Block Height: 2,186,984 (and counting - 44 new blocks minted!)
|
||||
Money Supply: 222,072.39 TRI
|
||||
Wallet Balance: 2,567.72 TRI (on DNS2)
|
||||
Staking: ACTIVE on DNS2
|
||||
Connections: 1 (DNS2 <-> DNS3 peer link)
|
||||
PoS Difficulty: 0.00001381
|
||||
```
|
||||
|
||||
### 5. Features Verified Working
|
||||
|
||||
- **Proof-of-Stake**: Staking is active and producing new blocks (~2 min intervals)
|
||||
- **Secure Messaging**: Encrypted peer-to-peer messaging tested and confirmed working
|
||||
- First messages sent on the revived network:
|
||||
- "THE TRIANGLES ARE FREE."
|
||||
- "LONG LIVE THE RESISTANCE. WE ARE THE RESISTANCE."
|
||||
- **Tor v3 Hidden Services**: Both nodes accessible via .onion addresses
|
||||
- **Wallet Preservation**: Original wallet.dat loaded successfully, all balances intact
|
||||
|
||||
---
|
||||
|
||||
## Technical Architecture
|
||||
|
||||
### Network Ports
|
||||
- **P2P Port:** 24112 (node-to-node communication)
|
||||
- **RPC Port:** 19112 (local management commands)
|
||||
- **Protocol Version:** 70205
|
||||
|
||||
### Consensus Rules
|
||||
- **Blocks 0-9000:** Proof-of-Work (Hash9 algorithm - 13-step hash cascade)
|
||||
- **Blocks 9001+:** Proof-of-Stake only (33% annual, coin-age based)
|
||||
- **Block Time:** ~2 minutes
|
||||
- **Max Supply:** 222,222 TRI
|
||||
|
||||
### Key Files
|
||||
- **Binary:** `trianglesd` (Linux daemon, ~3.5-3.7 MB stripped)
|
||||
- **Config:** `~/.triangles/triangles.conf`
|
||||
- **Blockchain:** `~/.triangles/txleveldb/` (LevelDB)
|
||||
- **Wallet:** `~/.triangles/wallet.dat` (BDB 5.3)
|
||||
|
||||
### Build Dependencies (Linux)
|
||||
- GCC/G++ 11+
|
||||
- Boost 1.74+ (system, filesystem, program_options, thread, chrono)
|
||||
- OpenSSL 3.x
|
||||
- Berkeley DB 5.3 (C++ bindings)
|
||||
- LevelDB (included in source tree)
|
||||
- libevent
|
||||
- zlib
|
||||
- miniupnpc (optional)
|
||||
|
||||
---
|
||||
|
||||
## DNS Configuration Needed
|
||||
|
||||
For the domain `cryptographic-triangles.org`, the following DNS records should be set up:
|
||||
|
||||
```
|
||||
seed1.cryptographic-triangles.org A 194.233.88.206 (DNS2)
|
||||
seed2.cryptographic-triangles.org A 74.208.167.19 (DNS3)
|
||||
seed3.cryptographic-triangles.org A <future node IP>
|
||||
```
|
||||
|
||||
These DNS seeds are hardcoded in the wallet binary so new nodes can find peers automatically.
|
||||
|
||||
---
|
||||
|
||||
## How Wallets Are Preserved
|
||||
|
||||
**Important:** All existing wallet.dat files from the original Triangles network are fully compatible. Here's how it works:
|
||||
|
||||
1. The `wallet.dat` file contains private keys in a BDB database - it is completely independent of the blockchain
|
||||
2. When a user starts the new v5.0.0.0 binary with their old wallet.dat, it:
|
||||
- Loads all private keys from the wallet
|
||||
- Syncs the blockchain from seed nodes
|
||||
- Scans all blocks for transactions matching those keys
|
||||
- Reconstructs the correct balance automatically
|
||||
3. No migration, export, or special action is needed - just use the old wallet.dat with the new binary
|
||||
|
||||
---
|
||||
|
||||
## What's Next
|
||||
|
||||
### Immediate Priorities
|
||||
1. **Build Windows Qt wallet** - So users can connect from desktop with the familiar GUI
|
||||
2. **Set up DNS records** - Point seed1/seed2.cryptographic-triangles.org to the VPS IPs
|
||||
3. **Add more seed nodes** - For network resilience (at least 3-5 recommended)
|
||||
|
||||
### Medium-Term
|
||||
4. **Block explorer** - Deploy at blocks.cryptographic-triangles.org
|
||||
5. **Website update** - Publish new wallet downloads and chain status
|
||||
6. **Community distribution** - Distribute updated wallet binaries to TRI holders
|
||||
|
||||
### Already Implemented (in codebase, needs next binary release)
|
||||
- Onion v3 seed addresses hardcoded
|
||||
- Seeder network message handlers wired up
|
||||
- Both DNS2 and DNS3 IPs in hardcoded seed list
|
||||
- Tor v3 bootstrap seeder list populated
|
||||
|
||||
---
|
||||
|
||||
## Node Management Quick Reference
|
||||
|
||||
### SSH Access (via Tailscale)
|
||||
```bash
|
||||
# DNS2
|
||||
ssh -o ProxyCommand="tailscale nc dns2-openclaw %p" root@dns2-openclaw
|
||||
|
||||
# DNS3
|
||||
ssh -o ProxyCommand="tailscale nc dns3-sami %p" root@dns3-sami
|
||||
```
|
||||
|
||||
### Common RPC Commands
|
||||
```bash
|
||||
trianglesd getinfo # Node status, balance, block height
|
||||
trianglesd getstakinginfo # Staking status
|
||||
trianglesd getpeerinfo # Connected peers
|
||||
trianglesd smsginbox all # Read encrypted messages
|
||||
trianglesd smsgsend <from> <to> <msg> # Send encrypted message
|
||||
trianglesd stop # Graceful shutdown
|
||||
```
|
||||
|
||||
### Config Location
|
||||
- DNS2: `/root/.triangles/triangles.conf`
|
||||
- DNS3: `/root/.triangles/triangles.conf`
|
||||
|
||||
### Binary Location
|
||||
- Both: `/usr/local/bin/trianglesd`
|
||||
- Source: `/opt/triangles-build/src/`
|
||||
|
||||
---
|
||||
|
||||
## Summary
|
||||
|
||||
The Triangles blockchain is alive again. Two seed nodes are running and connected, staking is producing new blocks, encrypted messaging works, and Tor v3 hidden services are active. All original wallet balances are preserved and accessible. The chain picked up exactly where it left off in December 2022, as if it had never stopped.
|
||||
@@ -1,136 +0,0 @@
|
||||
build/triangles-qt_res.o
|
||||
build/txdb-leveldb.o
|
||||
build/blake.o
|
||||
build/groestl.o
|
||||
build/jh.o
|
||||
build/keccak.o
|
||||
build/skein.o
|
||||
build/bmw.o
|
||||
build/cubehash.o
|
||||
build/echo.o
|
||||
build/fugue.o
|
||||
build/hamsi.o
|
||||
build/luffa.o
|
||||
build/shavite.o
|
||||
build/simd.o
|
||||
build/triangles.o
|
||||
build/trianglesgui.o
|
||||
build/transactiontablemodel.o
|
||||
build/addresstablemodel.o
|
||||
build/optionsdialog.o
|
||||
build/sendcoinsdialog.o
|
||||
build/coincontroldialog.o
|
||||
build/coincontroltreewidget.o
|
||||
build/addressbookpage.o
|
||||
build/aboutdialog.o
|
||||
build/editaddressdialog.o
|
||||
build/trianglesaddressvalidator.o
|
||||
build/anonymize.o
|
||||
build/alert.o
|
||||
build/version.o
|
||||
build/sync.o
|
||||
build/smessage.o
|
||||
build/util.o
|
||||
build/netbase.o
|
||||
build/key.o
|
||||
build/script.o
|
||||
build/main.o
|
||||
build/miner.o
|
||||
build/init.o
|
||||
build/net.o
|
||||
build/irc.o
|
||||
build/checkpoints.o
|
||||
build/addrman.o
|
||||
build/db.o
|
||||
build/walletdb.o
|
||||
build/clientmodel.o
|
||||
build/guiutil.o
|
||||
build/transactionrecord.o
|
||||
build/optionsmodel.o
|
||||
build/monitoreddatamapper.o
|
||||
build/transactiondesc.o
|
||||
build/transactiondescdialog.o
|
||||
build/trianglesstrings.o
|
||||
build/trianglesamountfield.o
|
||||
build/wallet.o
|
||||
build/keystore.o
|
||||
build/transactionfilterproxy.o
|
||||
build/transactionview.o
|
||||
build/walletmodel.o
|
||||
build/trianglesrpc.o
|
||||
build/rpcdump.o
|
||||
build/rpcnet.o
|
||||
build/rpcmining.o
|
||||
build/rpcwallet.o
|
||||
build/rpcblockchain.o
|
||||
build/rpcrawtransaction.o
|
||||
build/rpcsmessage.o
|
||||
build/overviewpage.o
|
||||
build/csvmodelwriter.o
|
||||
build/crypter.o
|
||||
build/sendcoinsentry.o
|
||||
build/qvalidatedlineedit.o
|
||||
build/trianglesunits.o
|
||||
build/qvaluecombobox.o
|
||||
build/askpassphrasedialog.o
|
||||
build/protocol.o
|
||||
build/notificator.o
|
||||
build/qtipcserver.o
|
||||
build/rpcconsole.o
|
||||
build/messagepage.o
|
||||
build/dialog_move_handler.o
|
||||
build/signmessagepage.o
|
||||
build/verifymessagepage.o
|
||||
build/messagemodel.o
|
||||
build/sendmessagesdialog.o
|
||||
build/sendmessagesentry.o
|
||||
build/qvalidatedtextedit.o
|
||||
build/mrichtextedit.o
|
||||
build/noui.o
|
||||
build/kernel.o
|
||||
build/net_bootstrap.o
|
||||
build/onion_v3.o
|
||||
build/scrypt-arm.o
|
||||
build/scrypt-x86.o
|
||||
build/scrypt-x86_64.o
|
||||
build/scrypt.o
|
||||
build/pbkdf2.o
|
||||
build/qrc_triangles.o
|
||||
build/moc_trianglesgui.o
|
||||
build/moc_transactiontablemodel.o
|
||||
build/moc_addresstablemodel.o
|
||||
build/moc_optionsdialog.o
|
||||
build/moc_coincontroldialog.o
|
||||
build/moc_coincontroltreewidget.o
|
||||
build/moc_sendcoinsdialog.o
|
||||
build/moc_addressbookpage.o
|
||||
build/moc_aboutdialog.o
|
||||
build/moc_editaddressdialog.o
|
||||
build/moc_trianglesaddressvalidator.o
|
||||
build/moc_clientmodel.o
|
||||
build/moc_guiutil.o
|
||||
build/moc_optionsmodel.o
|
||||
build/moc_monitoreddatamapper.o
|
||||
build/moc_transactiondesc.o
|
||||
build/moc_transactiondescdialog.o
|
||||
build/moc_trianglesamountfield.o
|
||||
build/moc_transactionfilterproxy.o
|
||||
build/moc_transactionview.o
|
||||
build/moc_walletmodel.o
|
||||
build/moc_overviewpage.o
|
||||
build/moc_csvmodelwriter.o
|
||||
build/moc_sendcoinsentry.o
|
||||
build/moc_qvalidatedlineedit.o
|
||||
build/moc_qvaluecombobox.o
|
||||
build/moc_askpassphrasedialog.o
|
||||
build/moc_notificator.o
|
||||
build/moc_rpcconsole.o
|
||||
build/moc_messagepage.o
|
||||
build/moc_dialog_move_handler.o
|
||||
build/moc_signmessagepage.o
|
||||
build/moc_verifymessagepage.o
|
||||
build/moc_messagemodel.o
|
||||
build/moc_sendmessagesdialog.o
|
||||
build/moc_sendmessagesentry.o
|
||||
build/moc_mrichtextedit.o
|
||||
build/moc_qvalidatedtextedit.o
|
||||
@@ -1,136 +0,0 @@
|
||||
build/triangles-qt_res.o
|
||||
build/txdb-leveldb.o
|
||||
build/blake.o
|
||||
build/groestl.o
|
||||
build/jh.o
|
||||
build/keccak.o
|
||||
build/skein.o
|
||||
build/bmw.o
|
||||
build/cubehash.o
|
||||
build/echo.o
|
||||
build/fugue.o
|
||||
build/hamsi.o
|
||||
build/luffa.o
|
||||
build/shavite.o
|
||||
build/simd.o
|
||||
build/triangles.o
|
||||
build/trianglesgui.o
|
||||
build/transactiontablemodel.o
|
||||
build/addresstablemodel.o
|
||||
build/optionsdialog.o
|
||||
build/sendcoinsdialog.o
|
||||
build/coincontroldialog.o
|
||||
build/coincontroltreewidget.o
|
||||
build/addressbookpage.o
|
||||
build/aboutdialog.o
|
||||
build/editaddressdialog.o
|
||||
build/trianglesaddressvalidator.o
|
||||
build/anonymize.o
|
||||
build/alert.o
|
||||
build/version.o
|
||||
build/sync.o
|
||||
build/smessage.o
|
||||
build/util.o
|
||||
build/netbase.o
|
||||
build/key.o
|
||||
build/script.o
|
||||
build/main.o
|
||||
build/miner.o
|
||||
build/init.o
|
||||
build/net.o
|
||||
build/irc.o
|
||||
build/checkpoints.o
|
||||
build/addrman.o
|
||||
build/db.o
|
||||
build/walletdb.o
|
||||
build/clientmodel.o
|
||||
build/guiutil.o
|
||||
build/transactionrecord.o
|
||||
build/optionsmodel.o
|
||||
build/monitoreddatamapper.o
|
||||
build/transactiondesc.o
|
||||
build/transactiondescdialog.o
|
||||
build/trianglesstrings.o
|
||||
build/trianglesamountfield.o
|
||||
build/wallet.o
|
||||
build/keystore.o
|
||||
build/transactionfilterproxy.o
|
||||
build/transactionview.o
|
||||
build/walletmodel.o
|
||||
build/trianglesrpc.o
|
||||
build/rpcdump.o
|
||||
build/rpcnet.o
|
||||
build/rpcmining.o
|
||||
build/rpcwallet.o
|
||||
build/rpcblockchain.o
|
||||
build/rpcrawtransaction.o
|
||||
build/rpcsmessage.o
|
||||
build/overviewpage.o
|
||||
build/csvmodelwriter.o
|
||||
build/crypter.o
|
||||
build/sendcoinsentry.o
|
||||
build/qvalidatedlineedit.o
|
||||
build/trianglesunits.o
|
||||
build/qvaluecombobox.o
|
||||
build/askpassphrasedialog.o
|
||||
build/protocol.o
|
||||
build/notificator.o
|
||||
build/qtipcserver.o
|
||||
build/rpcconsole.o
|
||||
build/messagepage.o
|
||||
build/dialog_move_handler.o
|
||||
build/signmessagepage.o
|
||||
build/verifymessagepage.o
|
||||
build/messagemodel.o
|
||||
build/sendmessagesdialog.o
|
||||
build/sendmessagesentry.o
|
||||
build/qvalidatedtextedit.o
|
||||
build/mrichtextedit.o
|
||||
build/noui.o
|
||||
build/kernel.o
|
||||
build/net_bootstrap.o
|
||||
build/onion_v3.o
|
||||
build/scrypt-arm.o
|
||||
build/scrypt-x86.o
|
||||
build/scrypt-x86_64.o
|
||||
build/scrypt.o
|
||||
build/pbkdf2.o
|
||||
build/qrc_triangles.o
|
||||
build/moc_trianglesgui.o
|
||||
build/moc_transactiontablemodel.o
|
||||
build/moc_addresstablemodel.o
|
||||
build/moc_optionsdialog.o
|
||||
build/moc_coincontroldialog.o
|
||||
build/moc_coincontroltreewidget.o
|
||||
build/moc_sendcoinsdialog.o
|
||||
build/moc_addressbookpage.o
|
||||
build/moc_aboutdialog.o
|
||||
build/moc_editaddressdialog.o
|
||||
build/moc_trianglesaddressvalidator.o
|
||||
build/moc_clientmodel.o
|
||||
build/moc_guiutil.o
|
||||
build/moc_optionsmodel.o
|
||||
build/moc_monitoreddatamapper.o
|
||||
build/moc_transactiondesc.o
|
||||
build/moc_transactiondescdialog.o
|
||||
build/moc_trianglesamountfield.o
|
||||
build/moc_transactionfilterproxy.o
|
||||
build/moc_transactionview.o
|
||||
build/moc_walletmodel.o
|
||||
build/moc_overviewpage.o
|
||||
build/moc_csvmodelwriter.o
|
||||
build/moc_sendcoinsentry.o
|
||||
build/moc_qvalidatedlineedit.o
|
||||
build/moc_qvaluecombobox.o
|
||||
build/moc_askpassphrasedialog.o
|
||||
build/moc_notificator.o
|
||||
build/moc_rpcconsole.o
|
||||
build/moc_messagepage.o
|
||||
build/moc_dialog_move_handler.o
|
||||
build/moc_signmessagepage.o
|
||||
build/moc_verifymessagepage.o
|
||||
build/moc_messagemodel.o
|
||||
build/moc_sendmessagesdialog.o
|
||||
build/moc_sendmessagesentry.o
|
||||
build/moc_mrichtextedit.o
|
||||
build/moc_qvalidatedtextedit.o
|
||||
-166
@@ -1,166 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Scan a blk0001.dat file to find all blocks and determine the chain tip.
|
||||
Reads block headers to extract height from the serialized block data.
|
||||
"""
|
||||
|
||||
import struct
|
||||
import hashlib
|
||||
import sys
|
||||
import os
|
||||
|
||||
# Triangles mainnet magic bytes (from main.cpp pchMessageStart)
|
||||
MAGIC = b'\x70\x35\x22\x05'
|
||||
|
||||
def double_sha256(data):
|
||||
return hashlib.sha256(hashlib.sha256(data).digest()).digest()
|
||||
|
||||
def read_varint(f):
|
||||
"""Read a Bitcoin-style variable-length integer."""
|
||||
n = struct.unpack('<B', f.read(1))[0]
|
||||
if n < 0xFD:
|
||||
return n
|
||||
elif n == 0xFD:
|
||||
return struct.unpack('<H', f.read(2))[0]
|
||||
elif n == 0xFE:
|
||||
return struct.unpack('<I', f.read(4))[0]
|
||||
else:
|
||||
return struct.unpack('<Q', f.read(8))[0]
|
||||
|
||||
def scan_blocks(filepath):
|
||||
"""Scan blk file and collect block headers with their file positions."""
|
||||
filesize = os.path.getsize(filepath)
|
||||
print(f"File size: {filesize:,} bytes ({filesize/1024/1024:.1f} MB)")
|
||||
|
||||
blocks = {} # hash -> (prev_hash, position, block_time)
|
||||
block_count = 0
|
||||
|
||||
with open(filepath, 'rb') as f:
|
||||
while True:
|
||||
pos = f.tell()
|
||||
|
||||
# Progress
|
||||
if block_count % 50000 == 0:
|
||||
pct = pos / filesize * 100
|
||||
print(f" Scanned {block_count:,} blocks ({pct:.1f}% of file)...", flush=True)
|
||||
|
||||
# Read magic bytes
|
||||
magic = f.read(4)
|
||||
if len(magic) < 4:
|
||||
break
|
||||
|
||||
if magic != MAGIC:
|
||||
# Try to find next magic bytes
|
||||
f.seek(pos + 1)
|
||||
continue
|
||||
|
||||
# Read block size
|
||||
size_data = f.read(4)
|
||||
if len(size_data) < 4:
|
||||
break
|
||||
block_size = struct.unpack('<I', size_data)[0]
|
||||
|
||||
if block_size == 0 or block_size > 4000000:
|
||||
f.seek(pos + 1)
|
||||
continue
|
||||
|
||||
# Read block header (80 bytes)
|
||||
header_data = f.read(80)
|
||||
if len(header_data) < 80:
|
||||
break
|
||||
|
||||
# Parse header
|
||||
version = struct.unpack('<I', header_data[0:4])[0]
|
||||
prev_hash = header_data[4:36][::-1].hex()
|
||||
merkle_root = header_data[36:68][::-1].hex()
|
||||
block_time = struct.unpack('<I', header_data[68:72])[0]
|
||||
bits = struct.unpack('<I', header_data[72:76])[0]
|
||||
nonce = struct.unpack('<I', header_data[76:80])[0]
|
||||
|
||||
# Calculate block hash
|
||||
block_hash = double_sha256(header_data)[::-1].hex()
|
||||
|
||||
blocks[block_hash] = (prev_hash, pos, block_time, version)
|
||||
block_count += 1
|
||||
|
||||
# Skip rest of block
|
||||
remaining = block_size - 80
|
||||
if remaining > 0:
|
||||
f.seek(remaining, 1)
|
||||
|
||||
print(f"\nTotal blocks found in file: {block_count:,}")
|
||||
return blocks
|
||||
|
||||
def build_chain(blocks):
|
||||
"""Build the chain from genesis and find the tip."""
|
||||
# Find genesis block (prev_hash is all zeros)
|
||||
genesis_hash = None
|
||||
for bhash, (prev_hash, pos, btime, version) in blocks.items():
|
||||
if prev_hash == '0' * 64:
|
||||
genesis_hash = bhash
|
||||
break
|
||||
|
||||
if not genesis_hash:
|
||||
print("ERROR: Genesis block not found!")
|
||||
return
|
||||
|
||||
print(f"Genesis block: {genesis_hash}")
|
||||
|
||||
# Build forward chain
|
||||
# Create reverse lookup: prev_hash -> next_hash
|
||||
children = {}
|
||||
for bhash, (prev_hash, pos, btime, version) in blocks.items():
|
||||
if prev_hash not in children:
|
||||
children[prev_hash] = []
|
||||
children[prev_hash].append(bhash)
|
||||
|
||||
# Walk from genesis
|
||||
current = genesis_hash
|
||||
height = 0
|
||||
last_hashes = []
|
||||
|
||||
while current in children:
|
||||
nexts = children[current]
|
||||
if len(nexts) == 1:
|
||||
current = nexts[0]
|
||||
else:
|
||||
# Multiple children (fork) - pick the one that leads to longest chain
|
||||
# For simplicity, just pick the first one
|
||||
current = nexts[0]
|
||||
height += 1
|
||||
|
||||
if height % 100000 == 0:
|
||||
prev_hash, pos, btime, version = blocks[current]
|
||||
import datetime
|
||||
dt = datetime.datetime.fromtimestamp(btime)
|
||||
print(f" Height {height:,}: {current[:16]}... time={dt}")
|
||||
|
||||
# Keep last 10 blocks for reference
|
||||
if height > 0:
|
||||
last_hashes.append((height, current))
|
||||
if len(last_hashes) > 20:
|
||||
last_hashes.pop(0)
|
||||
|
||||
print(f"\n{'='*60}")
|
||||
print(f"CHAIN TIP:")
|
||||
print(f" Height: {height:,}")
|
||||
print(f" Hash: 0x{current}")
|
||||
prev_hash, pos, btime, version = blocks[current]
|
||||
import datetime
|
||||
dt = datetime.datetime.fromtimestamp(btime)
|
||||
print(f" Time: {dt}")
|
||||
print(f" Version: {version}")
|
||||
print(f"{'='*60}")
|
||||
|
||||
print(f"\nLast 20 blocks:")
|
||||
for h, bhash in last_hashes:
|
||||
prev_hash, pos, btime, version = blocks[bhash]
|
||||
dt = datetime.datetime.fromtimestamp(btime)
|
||||
print(f" {h:>10,}: 0x{bhash[:40]}... ({dt})")
|
||||
|
||||
if __name__ == '__main__':
|
||||
filepath = sys.argv[1] if len(sys.argv) > 1 else r'E:\Coins\TRIagain\blk0001.dat'
|
||||
print(f"Scanning: {filepath}")
|
||||
blocks = scan_blocks(filepath)
|
||||
if blocks:
|
||||
build_chain(blocks)
|
||||
Binary file not shown.
Reference in New Issue
Block a user