Three pure helper functions extracted from ThreadHTTPSeedFetch2 into
netbase.{h,cpp} so the HTTPS seed-list code path can be unit-tested
without the SSL/Tor network stack:
int DechunkTransferEncoding(const std::string& body, std::string& out)
std::vector<std::string> ParseSeedListBody(const std::string& body)
bool IsValidSocksNegotiationTimeout(int nMs)
DechunkTransferEncoding is now strict (was lenient):
- Hex validation: every byte of the chunk-size line is checked with
isxdigit() before strtoull. Old code passed a raw strtoul() result
which silently accepted leading '+', '-', and whitespace.
- strtoull + errno + size_t bounds check replaces the silent
'if (pos+chunkSize > body.size()) chunkSize = body.size()-pos'
clamp. The old behavior would mask truncated network reads.
- Empty size lines, '+5' / '-5' / ' 5', and unsigned overflow all
return DECHUNK_INVALID_HEX (or DECHUNK_OVERSIZE_CHUNK for the
bounds case) instead of being treated as 0/last-chunk.
- Missing CRLF after chunk data returns DECHUNK_MISSING_DATA_CRLF
rather than being read as the next chunk-size line.
- Body without a '0\r\n' last-chunk terminator returns
DECHUNK_NO_CHUNK_TERMINATOR instead of silently being accepted.
- Chunk extensions ('5;foo=bar') are still preserved — the ';'
delimiter is stripped from the size line, not from the framing.
ParseSeedListBody is a 1:1 extraction of the old loop. Same behavior
on every input. Trims inline '#' comments, splits on whitespace /
comma / semicolon, normalizes CR-only line endings.
IsValidSocksNegotiationTimeout is the central policy: 5000..180000 ms
inclusive. Replaces the inline 'nTorTimeout >= 5000 && nTorTimeout <=
180000' check in init.cpp's AppInit2. Out-of-range values now emit an
InitWarning so the operator sees why their setting was ignored.
Six distinct failure-mode log messages in ThreadHTTPSeedFetch2:
1. 'cannot connect to %s through Tor proxy' — connect failure
2. 'malformed response (no header terminator)' — no \r\n\r\n
3. 'malformed chunked transfer encoding (%s)' — DechunkResult enum
reason string
4. 'empty response from %s' — 0 bytes read
5. 'parsed response contained zero valid addresses' — body parsed
but CService
validation
dropped all
6. '%d addresses found from HTTPS seed list' — success path
Help text for -torconnecttimeout now precisely describes what the
value bounds (the SOCKS5 handshake — send/recv of init/auth/connect),
not 'time to reach the onion' which was misleading. The onion-resolution
time is bounded by Tor's own SocksTimeout (~120s) and is not directly
controllable from the daemon.
src/test/http_seed_tests.cpp adds 43 new Boost.Test cases covering
every scenario in the hardening brief:
DechunkTransferEncoding: 16 cases
- single chunk, multiple chunks, chunk extensions (one and
multiple), uppercase hex, payload containing CRLF, awkward
boundary that looks like a chunk-size line, last-chunk with
extension
- empty body, no CRLF after size, invalid hex, empty size line,
oversize chunk, truncated last-chunk marker, missing data CRLF,
strtoul overflow, sign in size, whitespace in size, no last
chunk
ParseSeedListBody: 14 cases
- empty, single-per-line, CRLF endings, multiple-per-line
(space, comma, semicolon, mixed), inline comments, blank lines,
all-comments, portless onion, invalid entry preserved, trailing
whitespace, mixed CRLF/LF
IsValidSocksNegotiationTimeout: 9 cases
- 4999 (out), 5000 (in, exact lower), 60000 (in, default), 180000
(in, exact upper), 180001 (out), 0 (out), -1 (out), INT_MAX
(out, guard against wraparound), 3 midrange values
Integration: 1 round-trip case
- Encode a seed body as chunked, dechunk it, then parse the
result. Verifies the two helpers compose correctly.
Test results: 183 test cases total, *** No errors detected. Existing
onion_v3_tests (8) and netbase_tests (10) still pass.
Cryptographic Triangles (TRI)
Triangles is a privacy-focused cryptocurrency featuring Proof-of-Stake consensus, Tor v3 onion routing, and built-in encrypted messaging. Originally launched in July 2014, the chain was revived in March 2026 after being frozen since December 2022.
Key Features
- Proof-of-Stake - Energy-efficient block production with 33% annual staking rewards (coin-age based)
- Hash9 Algorithm - Unique 13-step hash cascade (Fugue, Hamsi, Groestl, Blake, BMW, Skein, Keccak, Shavite, JH, Luffa, Cubehash, Echo, SIMD)
- Encrypted Messaging - Send and receive encrypted messages directly through the wallet
- Tor v3 Integration - Connect and transact over the Tor network with v3 onion hidden services
- 120-second Block Time - Fast confirmations with 2-minute target spacing
Specifications
| Property | Value |
|---|---|
| Algorithm | Hash9 (PoW blocks 0-9000), PoS from block 9001 |
| Block Time | ~120 seconds |
| Max Supply | 2,222,222 TRI |
| PoS Reward | 33% annual, coin-age based |
| P2P Port | 24112 |
| RPC Port | 19112 |
| Protocol | 70205 |
Network Status
The Triangles network operates exclusively over Tor for privacy:
Tor v3 Seeds:
jbpfhe7zw3qm67wy3j2ayysp3mnrjobopthnko3b3sgahqtecblwqmid.onion:24112uddaxjbo3lh2zskg7w6gwln4ty5cel7q4c5jbx7fdtv6zf2j47gdlyad.onion:24112el5sirhhleecuctpeeprelzubpqmoqivvra3rzlwbjttinxa4fq3wnid.onion:24112sj5dhybnlp3v4y5niyc5unrnd6s43lyx5ibup7rolyosjbi2u2hsbvyd.onion:24112i3kr5meha7se4ns3wss3h7v46m6uksfzv4wrohdqxpj6n35wyo2bvlid.onion:24112
HTTP Seed List:
seeds.cryptographic-triangles.org/seeds.txt- Dynamically updated list of active onion peers
Building from Source
Triangles uses CMake. All platforms follow the same build pattern.
Dependencies
| Dependency | Minimum Version |
|---|---|
| CMake | 3.16+ |
| C++ compiler | C++17 support |
| OpenSSL | 3.x |
| Boost | 1.90+ |
| Berkeley DB | 5.3 (with C++ bindings) |
| libevent | 2.x |
| LevelDB | bundled |
Linux (Ubuntu 24.04 / Debian 12+)
Install dependencies:
sudo apt-get install -y build-essential cmake ninja-build \
libboost-all-dev libssl-dev libdb5.3++-dev libevent-dev \
zlib1g-dev libminiupnpc-dev
For the Qt wallet, also install:
sudo apt-get install -y qtbase5-dev qt5-qmake libqrencode-dev
Build:
cmake -B build -G Ninja -DBUILD_QT=ON
cmake --build build
Linux (AlmaLinux 9 / RHEL 9)
Install dependencies:
sudo dnf install -y gcc-c++ cmake ninja-build boost-devel openssl-devel \
libevent-devel zlib-devel miniupnpc-devel
BDB 5.3 C++ bindings must be built from source on RHEL-based systems (the libdb-devel package does not include C++ headers). Download BDB 5.3.28 from Oracle and build with --enable-cxx.
Then build as above.
Windows (MSYS2 MinGW64)
Open an MSYS2 MinGW64 shell and install:
pacman -S mingw-w64-x86_64-cmake mingw-w64-x86_64-ninja \
mingw-w64-x86_64-boost mingw-w64-x86_64-openssl \
mingw-w64-x86_64-db mingw-w64-x86_64-miniupnpc \
mingw-w64-x86_64-qt5-base mingw-w64-x86_64-qrencode \
mingw-w64-x86_64-libevent
Build:
cmake -B build -G Ninja -DBUILD_QT=ON
cmake --build build
Build Options
| Option | Default | Description |
|---|---|---|
BUILD_QT |
ON | Build the Qt GUI wallet |
BUILD_DAEMON |
ON | Build the headless daemon |
BUILD_TESTS |
OFF | Build unit tests |
Running
First Run
mkdir -p ~/.triangles
cat > ~/.triangles/triangles.conf << 'EOF'
port=24112
rpcport=19112
rpcuser=trianglesrpc
rpcpassword=<generate-a-strong-password>
rpcallowip=127.0.0.1
staking=1
txindex=1
listen=1
server=1
daemon=1
proxy=127.0.0.1:9050
EOF
trianglesd
The node will connect to seed nodes over Tor and sync the blockchain automatically.
Existing Wallet Holders
If you have a wallet.dat from the original Triangles network:
- Place your
wallet.datin~/.triangles/(Linux) or%APPDATA%\triangles\(Windows) - Start the wallet - it will sync the blockchain and your balance will appear automatically
- No migration or special action is needed - all keys and balances are preserved
Staking
To stake, your wallet must be:
- Running with
staking=1in the config - Connected to at least one peer
- Containing coins with sufficient coin-age (mature inputs)
Check staking status:
trianglesd getstakinginfo
Encrypted Messaging
Send and receive encrypted messages between wallet addresses:
# Enable messaging
trianglesd smsgenable
# Send a message
trianglesd smsgsend <your-address> <recipient-address> "Hello from Triangles!"
# Check inbox
trianglesd smsginbox all
# Send anonymous message
trianglesd smsgsendanon <recipient-address> "Anonymous message"
Messages are encrypted end-to-end using AES and distributed through the peer network in time-bucketed batches.
Tor Support
Triangles is designed as a Tor-only network. Install the Tor daemon and configure your proxy:
# triangles.conf
proxy=127.0.0.1:9050
To run your own hidden service, add to /etc/tor/torrc:
HiddenServiceDir /var/lib/tor/triangles/
HiddenServiceVersion 3
HiddenServicePort 24112 127.0.0.1:24112
Then set externalip=<your-onion-address> in triangles.conf.
RPC Commands
General
getinfo- Node status, balance, block height, connectionsgetpeerinfo- Connected peer detailsgetstakinginfo- Staking status and weight
Wallet
getbalance- Current balancelistunspent- Unspent transaction outputssendtoaddress <addr> <amount>- Send TRIgetnewaddress- Generate new receiving address
Messaging
smsgenable/smsgdisable- Toggle secure messagingsmsgsend <from> <to> <message>- Send encrypted messagesmsgsendanon <to> <message>- Send anonymous messagesmsginbox [all|unread|clear]- View received messagessmsgoutbox [all|clear]- View sent messagessmsglocalkeys- List messaging-enabled addressessmsgscanchain- Scan blockchain for public keys
Chain History
- July 16, 2014 - Genesis block
- Block 0-9000 - Proof-of-Work mining phase (Hash9)
- Block 9001+ - Proof-of-Stake only
- Block 17,651 - V5 hard fork (removed Tor v2, disabled checkpoint master key)
- December 8, 2022 - Chain frozen (all nodes offline)
- March 11, 2026 - Chain revived, staking resumed
Project Structure
src/
main.cpp - Core blockchain logic, block/tx validation, message routing
miner.cpp - Staking miner thread
net.cpp - P2P networking
init.cpp - Daemon initialization
wallet.cpp - Wallet management
smessage.cpp/h - Encrypted messaging system
kernel.cpp - PoS kernel (stake validation)
checkpoints.cpp - Hardcoded checkpoints
net_bootstrap.h - DNS/IP seed configuration
onionseed.h - Tor v3 onion seed addresses
tor/
onion_v3.cpp/h - Tor v3 hidden service management
tor_crypto_compat.h - Ed25519/SHA3 crypto compatibility
License
Distributed under the MIT/X11 software license. See COPYING for details.
Links
- Website: cryptographic-triangles.org
- Explorer: blocks.cryptographic-triangles.org