# HempCoin THC: Quantum Upgrade (Dec 2026)

What changed in the chain, how to use it, and how it was tested.

## Consensus rules

**Komodo keys only.** The wallet imports old private keys only in the Komodo era format (WIF byte 188, keys start with U). The 2014, PIVX, Bitcoin, Litecoin and Dogecoin formats are refused.

**Vault staking.** Coins in a thc1z vault (NIST FIPS 204) can stake. The coinstake input is signed with the vault key, the reward goes back into the same vault, and the block header carries a post quantum block signature: a marker byte, the vault public key (1312 bytes) and the signature (2420 bytes), with its own context string so a transaction signature can never be replayed as a block signature. Every node checks it at the header stage and again on the full block. No elliptic curve key is involved anywhere in a vault staked block. The coinstake witness is now committed in the witness merkle root, so a copy of a block with its witness stripped is caught as a mutation and cannot get the honest block banned.

**Claim rule.** Coins created in the snapshot blocks (heights 1 to 229, the balances carried over from the Komodo chain) can only be spent into vault outputs (a zero value note is allowed). Every carried over coin becomes post quantum protected on its first move. Carried over coins cannot stake until claimed. Claim in block 230 and they are mature at block 730, the first reward block.

**Legacy sunset, in three parts.**

Phase A. From block 1,480,000 (about 18 months in) ordinary transactions can no longer create new single key old style outputs (P2PK, P2PKH, P2WPKH). Old coins still move, into vaults or anywhere else. Coinstakes, contract payouts and OP_RETURN are exempt, so staking and contracts carry on.

The canary. Block 729, the last proof of work block, holds one fixed coinbase: no reward, one zero value output paying a public key nobody holds the private key for. The key is the first valid curve point from SHA256("THC quantum canary v1" plus a counter), so anyone can check that no one chose it. Anyone can add a bounty by paying that key. A valid signature for it can only come from breaking elliptic curve keys, so if it is ever spent, every old style coin freezes from the next block on. Vault coins keep moving. The bounty can only be taken in the same transaction that spends the canary, so nobody can collect it quietly. Pending old style spends are dropped from every mempool at that moment, so staking never stalls.

The backstop. If the canary is never touched, old style coins freeze at block 9,860,000, about ten years in.

Nobody can move these dates. They are consensus rules with no switch, key or vote behind them.

**Script vaults (thc1y, witness v4).** Coins locked by a small script that can only check post quantum signatures: OP_CHECKQSIG and OP_CHECKQSIGADD verify ML DSA 44 against a key hash. Elliptic curve signature opcodes are disabled inside these scripts. Ready made templates: m of n multisig (up to 15 keys), inheritance (owner any time, heir after the coins sit unmoved for a set number of blocks) and HTLC (SHA256 hash lock plus timeout, the same lock Bitcoin and Ethereum atomic swaps use). Script limit 3,600 bytes, 201 operations.

**Cold staking vaults (thc19, witness v5).** Two keys: a stake key on the staking node and a spend key kept offline. The stake key can only sign a coinstake that returns at least the full amount to the same vault; it can never send the coins anywhere else. The spend key can do anything. Block headers from cold vaults carry marker 0x72, the stake public key, the spend key hash and the signature (3,765 bytes). Headers per P2P message are capped at 1,000 so a full batch stays well under the message limit.

**The wallet owns vaults.** Every wallet has thc1z vaults derived from its own HD key, so any wallet backup recovers them, and they can also be written down as 24 BIP39 words with a checksum. Vault coins count in the balance and are spent by normal sends. Change goes into a vault by default (`-vaultchange=0` turns that off). A locked wallet hands out addresses made in advance. Coins carried over from the old chain are only used for payments where every output is a vault, so the wallet never makes a transaction the network will refuse. Exchanges run a watch only wallet that imports vault addresses and builds PSBTs, signed by an offline wallet with `walletprocesspsbt`. Phase A also stops new taproot (P2TR) outputs, which carry the public key itself.

**Hash vault.** A second vault type, thc1r, uses SLH DSA SHA2 128s (NIST FIPS 205). Its security rests on SHA256 alone. Signatures are 7,856 bytes, so spends cost more. Hash vaults cannot stake.

**Memory.** Quantum block signatures are kept on disk once saved, so memory use does not grow with them.

**Ethereum quantum verifier.** The smart contract engine has a precompile at address 0x87 that verifies FIPS 204 signatures, in the style of Ethereum's EIP 8355 drafts. Input: public key, signature, message. Output: a 32 byte word, 1 if valid. Gas: 6,500 plus 6 per 32 byte message word. Pure FIPS 204 with an empty context, so it can never accept a vault or block signature.

**Bitcoin anchored checkpoints.** A node can load checkpoints written into Bitcoin (`-anchorfile`, `addanchor`). It then rejects any other block at an anchored height, so history before an anchor cannot be rewritten without rewriting Bitcoin. On top of that, Qtum's existing sync checkpoint already refuses forks deeper than 500 blocks.

## New commands

| Command | What it does |
|---|---|
| `startvaultstaking ["seed",...]` | Stake from one or more vaults. Seeds stay in memory only. |
| `stopvaultstaking` | Stop and wipe the keys. |
| `getvaultstakinginfo` | Vaults, coins, weight, blocks staked. |
| `-vaultstakingseedfile=<file>` | Start vault staking at launch (one hex seed per line, chmod 600). |
| `createhashvault [seed]` | New thc1r hash vault. |
| `sweephashvault seed address` | Move everything out of a hash vault. |
| `signquantumtransaction` | Now takes `"type":"hash"` for hash vault inputs. |
| `addanchor height hash`, `getanchors` | Bitcoin anchored checkpoints. |
| `createscriptvault template options` | thc1y vault: multisig, inheritance, htlc or custom. |
| `signscriptvault`, `finalizescriptvault` | Each signer signs on their own machine, then the signatures are combined. |
| `createcoldstakingvault stake_hash spend_hash` | thc19 cold staking vault. Stake with `startvaultstaking ["stakeseed:spendhash"]`. Spend with `signquantumtransaction` type cold. |
| `getnewvaultaddress [label]` | New thc1z vault address of this wallet. |
| `getvaultinfo` | Vault setup, address pools, whether change goes to vaults. |
| `getvaultphrase`, `restorevaultphrase` | The vault seed as 24 words, and restoring from them. |
| `exportvaultaddresses`, `importvaultaddresses` | Addresses for a watch only wallet (exchanges). |
| `getquantumstatus` | Phase A, canary state (waiting, alive, spent) and whether old style coins are frozen. |
| `-anchorfile=<file>` | Load anchors at launch. |

Wallet: THC Tools, Quantum Vault now has Create (thc1z or thc1r), Check, Sweep Out, Stake From Vault and Claim Old Coins.

Explorer: `/api/quantum` shows vault totals by type, vault staked share, the canary state, the Phase A and backstop countdowns and coins still to move. `/api/anchors` lists anchors.

Anchoring: `anchor/anchor.py` writes `THCA + height + block hash` into a Bitcoin OP_RETURN from a block 600 deep. `anchor/verify_anchors.py` checks each anchor against Bitcoin (your own node or a public API) and your THC node before you load it.

## Tests

| Suite | Result |
|---|---|
| test_vault_staking.py: claim rule, vault staking, 7 block attacks, witness stripping on a fresh node, sunset | 31 of 31 |
| test_hash_vault_precompile.py: hash vault, 0x87 precompile, anchors | 28 of 28 |
| test_anchor_tools.py: posting and verifying anchors | 4 of 4 |
| test_quantum_vault.py (earlier suite, rerun) | 21 of 21 |
| test_badges.py (earlier suite, rerun) | 16 of 16 |
| Qtum's own PoS tests: qtum_pos, qtum_pos_segwit, qtum_header_spam, qtum_duplicate_stake | all pass |
| test_script_cold_canary.py: multisig, inheritance, HTLC, ECDSA refused in scripts, cold staking with header attacks, Phase A, canary bounty and freeze, mempool cleanup, restart and reorg of the freeze | 64 of 64 |
| test_vault_wallet.py: vaults from the HD key, sends and change, phrase checked with the reference BIP39 library, restore from HD key and from words, encrypted wallets, watch only wallet plus offline PSBT signer, carried over coins, Phase A taproot, restart | 33 of 33 |
| test_fuzz_script_cold.py: 2,000 random corruptions of script and cold vault spends | 5 of 5 |
| test_stress.py: two nodes vault staking with traffic, 1,500 transaction and 300 block corruptions, restart, fresh node P2P sync | 13 of 13 |
| Mainnet settings: genesis hash unchanged, Komodo key imports, other formats refused | checked |

Every post quantum signature the node produced was also verified by independent code: `dilithium-py` for FIPS 204 and the `slh-dsa` package for FIPS 205.

## Memory

Each vault staked block header holds 3.7 KB of signature. The node keeps those signatures on disk, not in memory, once a block is saved, and reads them back when it serves headers to peers. Tested: after a restart every header rebuilt from disk carries a valid signature, and a brand new node synced the full chain over P2P from it.

## Known limits

1. Smart contracts cannot yet be called from vault coins (the contract sender must be an old style address). Contracts work normally until the freeze, so this must be finished well before the backstop, or sooner if the canary falls.
2. Offline staking delegation still uses old style keys and stops at the freeze. Cold staking vaults replace it.
3. New crypto code (vault staking, hash vault, script vaults, cold staking, precompile) should get an outside review before mainnet.
