From aef95bdf786167c0c5d034c7d0fd7ba1484c36e1 Mon Sep 17 00:00:00 2001 From: Sami Ahmed Date: Fri, 24 Apr 2026 21:59:37 -0700 Subject: [PATCH] Bump version to v5.9.3 and add RPC command reference Pairs net.h heartbeat-throttle field with the IBD header-sync fix in 2a484e4, and ships a full RPC reference doc. Co-Authored-By: Claude Opus 4.7 (1M context) --- CMakeLists.txt | 2 +- TRIANGLES-RPC-COMMANDS.md | 281 ++++++++++++++++++++++++++++++++++++++ src/clientversion.h | 2 +- src/net.h | 2 + 4 files changed, 285 insertions(+), 2 deletions(-) create mode 100644 TRIANGLES-RPC-COMMANDS.md diff --git a/CMakeLists.txt b/CMakeLists.txt index 70c43c5..d18ea49 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,7 +6,7 @@ if(POLICY CMP0167) endif() project(Triangles - VERSION 5.9.2 + VERSION 5.9.3 DESCRIPTION "Cryptographic Triangles Wallet" LANGUAGES C CXX ) diff --git a/TRIANGLES-RPC-COMMANDS.md b/TRIANGLES-RPC-COMMANDS.md new file mode 100644 index 0000000..b21e159 --- /dev/null +++ b/TRIANGLES-RPC-COMMANDS.md @@ -0,0 +1,281 @@ +# Triangles (TRI) RPC Command Reference + +This document describes every RPC command available in the Triangles daemon (`trianglesd`) and Qt wallet. Connect via JSON-RPC on port **19112** (default). All commands can also be run from the Qt wallet's debug console. + +Triangles is a Tor-only PoS cryptocurrency. PoW ended at block 9000; from block 9001 onward the chain is pure Proof-of-Stake with 33% annual interest (coin-age based). Block time is 2 minutes. Max supply is 2,222,222 TRI. + +--- + +## Server Control + +| Command | Parameters | Description | +|---------|-----------|-------------| +| `help` | `[command]` | List all commands, or get detailed help for a specific command. | +| `stop` | | Shut down the daemon. | + +--- + +## Blockchain + +| Command | Parameters | Description | +|---------|-----------|-------------| +| `getbestblockhash` | | Returns the hash of the tip of the best chain. | +| `getblockcount` | | Returns the current block height. | +| `getblockhash` | `` | Returns the block hash at the given height. | +| `getblock` | ` [txinfo]` | Returns block details for the given hash. Set `txinfo=true` for full transaction data. | +| `getblockbynumber` | ` [txinfo]` | Same as `getblock` but accepts a height instead of a hash. | +| `getblockheader` | ` [verbose=true]` | Returns block header data. If verbose is false, returns hex-encoded header. | +| `getblockchaininfo` | | Returns chain state info: chain name, block height, best hash, difficulty, etc. | +| `getdifficulty` | | Returns current PoW and PoS difficulty values. | +| `gettxoutsetinfo` | | Returns statistics about the UTXO set (total txouts, size, etc.). | +| `getrawmempool` | | Returns all transaction IDs currently in the mempool. | +| `getcheckpoint` | | Returns info about the current synchronized checkpoint. | +| `getchaintips` | | Returns info about all known chain tips (forks). | +| `invalidateblock` | `` | Permanently marks a block as invalid and rewinds the chain past it. | +| `reconsiderblock` | `` | Removes the invalid mark from a previously invalidated block. | +| `recalculatesupply` | | Recalculates money supply by summing all UTXOs. Updates the stored value at the chain tip and persists to disk. Returns old/new supply and difference. | +| `settxfee` | `` | Sets the transaction fee per kB. Amount is rounded to nearest 0.01. | +| `estimatefee` | `` | Estimates the fee per kB needed for confirmation within `nblocks` blocks. | + +--- + +## Address Index + +These commands query the address index. The daemon must be running with `-addressindex=1`. + +| Command | Parameters | Description | +|---------|-----------|-------------| +| `getaddressbalance` | `{"addresses":["addr",...]}` | Returns confirmed balance for the given address(es). | +| `getaddressutxos` | `{"addresses":["addr",...]}` | Returns all unspent outputs for the given address(es). | +| `getaddresstxids` | `{"addresses":["addr",...], "start":n, "end":n}` | Returns transaction IDs for the given address(es), optionally filtered by block range. | + +--- + +## Mining & Staking + +| Command | Parameters | Description | +|---------|-----------|-------------| +| `getmininginfo` | | Returns mining-related info: height, difficulty, network hashrate, etc. | +| `getstakinginfo` | | Returns staking-related info: whether staking is active, weight, expected time to stake, etc. | +| `getsubsidy` | `[nTarget]` | Returns the PoW subsidy value for the given target height (historical reference only since PoW ended at block 9000). | + +--- + +## Network + +| Command | Parameters | Description | +|---------|-----------|-------------| +| `getconnectioncount` | | Returns the number of peer connections. | +| `getpeerinfo` | | Returns detailed info about each connected peer (address, version, ping time, etc.). | +| `getnetworkinfo` | | Returns P2P network state: version, protocol, peer mix, connections, relay fee, etc. | +| `getseedlist` | | Returns the list of configured seed nodes. | +| `addnode` | ` ` | Add or remove a node from the manual peer list, or try connecting once. For Tor nodes use the `.onion` address. | +| `disconnectnode` | `` | Immediately disconnects from the specified peer. | +| `sendalert` | ` [cancelupto]` | Broadcasts a network alert (requires the alert master private key). | + +--- + +## Wallet — General + +| Command | Parameters | Description | +|---------|-----------|-------------| +| `getinfo` | | Returns general info: version, balance, stake, block height, connections, etc. | +| `getwalletinfo` | | Returns wallet-specific info: balance, unconfirmed, immature, txcount, keypoolsize, etc. | +| `getbalance` | `[account] [minconf=1]` | Returns total available balance (optionally for a specific account). | +| `checkwallet` | | Checks wallet database for consistency errors. | +| `repairwallet` | | Attempts to repair the wallet database. | +| `resendtx` | | Re-broadcasts all unconfirmed wallet transactions. | + +--- + +## Wallet — Addresses & Accounts + +| Command | Parameters | Description | +|---------|-----------|-------------| +| `getnewaddress` | `[account]` | Generates a new receiving address (optionally assigned to an account). | +| `getnewpubkey` | `[account]` | Returns a new public key for the wallet. | +| `getaccountaddress` | `` | Returns the current receiving address for the given account. | +| `setaccount` | `
` | Assigns an address to the given account label. | +| `getaccount` | `
` | Returns the account label for the given address. | +| `getaddressesbyaccount` | `` | Returns all addresses assigned to the given account. | +| `listaddressgroupings` | | Returns addresses grouped by common ownership (based on transaction history). | +| `validateaddress` | `
` | Validates a Triangles address and returns info (ismine, account, pubkey, etc.). | +| `validatepubkey` | `` | Validates a Triangles public key. | +| `listaccounts` | `[minconf=1]` | Returns all account names and their balances. | + +--- + +## Wallet — Sending + +| Command | Parameters | Description | +|---------|-----------|-------------| +| `sendtoaddress` | `
[comment] [comment-to]` | Sends TRI to an address. Returns the transaction ID. | +| `sendfrom` | `
[minconf=1] [comment] [comment-to]` | Sends TRI from a specific account. | +| `sendmany` | ` {"addr":amount,...} [minconf=1] [comment]` | Sends TRI to multiple addresses in a single transaction. | +| `move` | ` [minconf=1] [comment]` | Moves funds between accounts (internal bookkeeping only, no on-chain tx). | + +--- + +## Wallet — Transaction History + +| Command | Parameters | Description | +|---------|-----------|-------------| +| `listtransactions` | `[account] [count=10] [from=0]` | Returns the most recent transactions (optionally filtered by account). | +| `listsinceblock` | `[blockhash] [target-confirmations]` | Returns all transactions since the given block. | +| `gettransaction` | `` | Returns detailed info about a wallet transaction. | +| `getreceivedbyaddress` | `
[minconf=1]` | Returns total amount received by an address. | +| `getreceivedbyaccount` | ` [minconf=1]` | Returns total amount received by an account. | +| `listreceivedbyaddress` | `[minconf=1] [includeempty=false]` | Returns amounts received for each address. | +| `listreceivedbyaccount` | `[minconf=1] [includeempty=false]` | Returns amounts received for each account. | + +--- + +## Wallet — Staking Control + +| Command | Parameters | Description | +|---------|-----------|-------------| +| `reservebalance` | `[reserve] [amount]` | Show or set a reserve balance that will not be used for staking. `reserve` is true/false, `amount` is the TRI to reserve. | + +--- + +## Wallet — Security + +| Command | Parameters | Description | +|---------|-----------|-------------| +| `encryptwallet` | `` | Encrypts the wallet with the given passphrase. **This shuts down the daemon.** The wallet must be re-started and unlocked afterward. | +| `walletpassphrase` | ` [stakingonly]` | Unlocks the wallet for `timeout` seconds. Set `stakingonly=true` to allow staking but prevent sending. | +| `walletpassphrasechange` | ` ` | Changes the wallet encryption passphrase. | +| `walletlock` | | Immediately locks the wallet (removes decryption key from memory). | +| `keypoolrefill` | `[new-size]` | Tops up the pre-generated key pool. | +| `makekeypair` | `[prefix]` | Generates a new public/private keypair (not added to wallet). | + +--- + +## Wallet — Backup & Import + +| Command | Parameters | Description | +|---------|-----------|-------------| +| `backupwallet` | `` | Copies `wallet.dat` to the given file path. | +| `dumpwallet` | `` | Exports all wallet private keys to a plaintext file. | +| `dumpprivkey` | `
` | Returns the private key (WIF format) for the given address. | +| `importwallet` | `` | Imports keys from a wallet dump file. | +| `importprivkey` | ` [label]` | Imports a single private key (WIF format) with optional label. | + +--- + +## Wallet — Multisig + +| Command | Parameters | Description | +|---------|-----------|-------------| +| `addmultisigaddress` | ` ["key",...] [account]` | Creates an M-of-N multisig address. `nrequired` is the number of signatures needed. | +| `addredeemscript` | ` [account]` | Adds a P2SH redeem script to the wallet. | + +--- + +## Wallet — Message Signing + +| Command | Parameters | Description | +|---------|-----------|-------------| +| `signmessage` | `
` | Signs a message with the private key of the given address. | +| `verifymessage` | `
` | Verifies a signed message. Returns true/false. | + +--- + +## Raw Transactions + +| Command | Parameters | Description | +|---------|-----------|-------------| +| `listunspent` | `[minconf=1] [maxconf=9999999] ["addr",...]` | Returns unspent transaction outputs, optionally filtered by address and confirmation count. | +| `createrawtransaction` | `[{"txid":"id","vout":n},...] {"addr":amount,...}` | Creates an unsigned raw transaction from the given inputs and outputs. | +| `decoderawtransaction` | `` | Decodes a raw transaction hex string into a JSON object. | +| `decodescript` | `` | Decodes a hex-encoded script into human-readable form. | +| `signrawtransaction` | ` [prevtxs] [privkeys] [sighashtype="ALL"]` | Signs a raw transaction. Can provide previous tx outputs and private keys for offline signing. | +| `sendrawtransaction` | `` | Broadcasts a signed raw transaction to the network. Returns the txid. | +| `getrawtransaction` | ` [verbose=0]` | Returns raw transaction data. Set verbose=1 for decoded JSON output. | + +--- + +## Secure Messaging (SMSG) + +Triangles has a built-in encrypted peer-to-peer messaging system. Messages are stored in a DHT-like bucket system and relayed through the network. + +| Command | Parameters | Description | +|---------|-----------|-------------| +| `smsgenable` | | Enables the secure messaging system. | +| `smsgdisable` | | Disables the secure messaging system. | +| `smsgoptions` | `[list\|set ]` | View or change secure messaging options. | +| `smsglocalkeys` | `[whitelist\|all\|wallet\|recv +/- \|anon +/- ]` | Manage which local keys participate in secure messaging. | +| `smsgaddkey` | `
` | Adds someone's public key so you can send them encrypted messages. | +| `smsggetpubkey` | `
` | Retrieves the public key for an address (needed to send messages to it). | +| `smsgsend` | ` ` | Sends an encrypted message from one of your addresses to a recipient. | +| `smsgsendanon` | ` ` | Sends an anonymous encrypted message (no sender address attached). | +| `smsginbox` | `[all\|unread\|clear]` | View received secure messages. Default shows unread. | +| `smsgoutbox` | `[all\|clear]` | View sent secure messages. | +| `smsgscanchain` | | Scans the blockchain for secure message public keys. | +| `smsgscanbuckets` | | Scans stored message buckets for messages addressed to your keys. | +| `smsgbuckets` | `[stats\|dump]` | View secure message bucket statistics or dump contents. | +| `smsgbroadcast` | ` ` | Broadcasts a message to all SMSG participants (not encrypted to a single recipient). | + +--- + +## Quick Reference — Common Tasks + +**Check node status:** +``` +getinfo +getblockcount +getconnectioncount +getstakinginfo +``` + +**Check balance and transactions:** +``` +getbalance +listtransactions +``` + +**Send coins:** +``` +walletpassphrase "yourpassphrase" 60 +sendtoaddress "TRIaddress" 100 +walletlock +``` + +**Unlock for staking only:** +``` +walletpassphrase "yourpassphrase" 999999999 true +``` + +**Add a peer manually (Tor .onion):** +``` +addnode "abcdef1234567890.onion" "add" +``` + +**Export/import a private key:** +``` +dumpprivkey "TRIaddress" +importprivkey "5KPrivKeyHere" "mylabel" +``` + +**Fix incorrect money supply display:** +``` +recalculatesupply +``` + +**Full reindex (rebuild block index from raw data):** +``` +trianglesd -reindex +``` + +--- + +## Connection Info + +| Setting | Value | +|---------|-------| +| Default RPC port | 19112 | +| Default P2P port | 24112 | +| Config file (Windows) | `%APPDATA%\triangles\triangles.conf` | +| Config file (Linux) | `~/.triangles/triangles.conf` | +| Protocol version | 70205 | +| Network | Tor-only | diff --git a/src/clientversion.h b/src/clientversion.h index 95d5509..833ff3c 100644 --- a/src/clientversion.h +++ b/src/clientversion.h @@ -8,7 +8,7 @@ // These need to be macros, as version.cpp's and triangles-qt.rc's voodoo requires it #define CLIENT_VERSION_MAJOR 5 #define CLIENT_VERSION_MINOR 9 -#define CLIENT_VERSION_REVISION 2 +#define CLIENT_VERSION_REVISION 3 #define CLIENT_VERSION_BUILD 0 // Converts the parameter X to a string after macro replacement on X has been performed. diff --git a/src/net.h b/src/net.h index 3e95882..86065c7 100644 --- a/src/net.h +++ b/src/net.h @@ -277,6 +277,7 @@ public: uint256 hashLastGetHeadersEnd; int nStartingHeight; int64_t nLastTipCheck; // last time we asked this peer for chain tip + int64_t nLastIbdHeaderRequest; // last time we sent IBD-mode getheaders to this peer (heartbeat throttle) int64_t nAvgBlockLatencyUs; // rolling average block delivery latency (microseconds) int nBlocksDelivered; // count of blocks delivered by this peer int nBestKnownHeight; // highest block height known to this peer (updated from inv/block msgs) @@ -336,6 +337,7 @@ public: hashLastGetHeadersEnd = 0; nStartingHeight = -1; nLastTipCheck = 0; + nLastIbdHeaderRequest = 0; nAvgBlockLatencyUs = 0; nBlocksDelivered = 0; nBestKnownHeight = -1;