RillCoin
RillCoin DocsTestnet Live
Protocol

Mining

SHA-256 proof-of-work, difficulty adjustment, halving schedule, block templates, and decay pool supplemental rewards.

Overview

RillCoin uses SHA-256 proof-of-work — the same algorithm as Bitcoin. Miners compute a valid block header hash below the current target and submit it via the submitblock RPC. Difficulty adjusts every DIFFICULTY_WINDOW = 60 blocks to maintain the 60-second target block time.

AlgorithmSHA-256
Block Time60 seconds
Initial Reward50 RILL
Difficulty Window60 blocks

Block Reward

The block reward consists of three components:

formula
total_reward = block_subsidy + transaction_fees + decay_pool_release

block_subsidy  = INITIAL_REWARD >> (height / HALVING_INTERVAL)
               = 50 RILL >> (height / 210_000)

decay_pool_release = decay_pool_balance × DECAY_POOL_RELEASE_BPS / 10_000
                   = decay_pool_balance × 1%

The decay pool release provides an additional incentive that grows as concentration decay accumulates. As more tokens decay into the pool, miners receive larger supplemental rewards each block.

Halving Schedule

Block subsidies halve every 210,000 blocks (~4 years at 60-second block times). Total mineable supply asymptotically approaches 21,000,000 RILL.

EraStart HeightBlock RewardApprox. DateCumulative Mined
1050 RILL2025 (genesis)10,500,000 RILL
2210,00025 RILL~202915,750,000 RILL
3420,00012.5 RILL~203318,375,000 RILL
4630,0006.25 RILL~203719,687,500 RILL
5840,0003.125 RILL~204120,343,750 RILL
61,050,0001.5625 RILL~204520,671,875 RILL

Coinbase Maturity

Coinbase outputs (block rewards) cannot be spent until COINBASE_MATURITY = 100 additional blocks have been mined on top of the block containing the coinbase transaction. This prevents reorganization-based reward theft.

For example, if you mine a block at height 1,000, your coinbase UTXO is spendable starting at height 1,100.

Difficulty Adjustment

Difficulty adjusts every 60 blocks. The new target is computed from the ratio of actual elapsed time to expected time:

Difficulty adjustment algorithm
// Every DIFFICULTY_WINDOW (60) blocks:
//
// expected_time = DIFFICULTY_WINDOW × BLOCK_TIME_SECS
//              = 60 × 60 = 3,600 seconds
//
// actual_time = timestamp[tip] - timestamp[tip - DIFFICULTY_WINDOW]
//
// new_target = old_target × actual_time / expected_time
//
// Clamped to [old_target / 4, old_target × 4] to prevent extreme swings.

fn adjust_difficulty(old_target: u32, actual_secs: u64) -> u32 {
    let expected = DIFFICULTY_WINDOW as u64 * BLOCK_TIME_SECS;
    let ratio = actual_secs.clamp(expected / 4, expected * 4);

    // Scale compact nBits target
    compact_to_u256(old_target)
        .saturating_mul(ratio)
        .saturating_div(expected)
        .to_compact()
}

Block Template

Miners request a block template from a synced node via the getblocktemplate RPC. The template includes all pending transactions sorted by fee rate.

getblocktemplate response
{
  "version":           1,
  "prev_hash":         "a3f8...64b2",
  "merkle_root":       "d1e2...89ab",  // pre-computed with coinbase
  "timestamp":         1740000000,
  "difficulty_target": 486604799,
  "nonce":             0,              // start here, increment to find solution
  "height":            42381,
  "transactions": [
    {
      "txid":  "7f3a...12cd",
      "data":  "01000000...",          // hex-encoded bincode transaction
      "fee":   1000                   // in rills
    }
  ]
}

Submitting a Block

Once a valid nonce is found, serialize the complete block using bincode and hex-encode it, then submit via submitblock:

Submit block via RPC
curl -X POST http://127.0.0.1:28332 \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "method":  "submitblock",
    "params":  ["01000000a3f8..."],
    "id": 1
  }'

# Success response:
# {"jsonrpc":"2.0","result":"ok","id":1}

# Error response (invalid block):
# {"jsonrpc":"2.0","error":{"code":-1,"message":"invalid proof of work"},"id":1}

Quick Start: rill-miner

The rill-miner binary provides a CPU miner for testnet use. Install and run:

Install rill-miner
# From GitHub releases
wget https://github.com/rillcoin/rill/releases/latest/download/rill-miner-linux-x86_64.tar.gz
tar xzf rill-miner-linux-x86_64.tar.gz
sudo mv rill-miner /usr/local/bin/

# Or build from source (requires Rust 1.85+)
git clone https://github.com/rillcoin/rill
cd rill
cargo build --release -p rill-miner
sudo cp target/release/rill-miner /usr/local/bin/
Run the miner
# First create a wallet to receive rewards
rill-cli wallet create --network testnet
rill-cli address  # note your trill1... address

# Start mining (testnet)
rill-miner \
  --rpc     http://127.0.0.1:28332 \
  --address trill1qw5r3k8d9...    \
  --threads 4

# Mainnet
rill-miner \
  --rpc     http://127.0.0.1:18332 \
  --address rill1qw5r3k8d9...     \
  --threads $(nproc)

Miner Output

text
[2026-02-19 12:00:00] RillCoin Miner v0.1.0
[2026-02-19 12:00:00] Connected to node at 127.0.0.1:28332
[2026-02-19 12:00:00] Mining address: trill1qw5r3k8d9...
[2026-02-19 12:00:00] Threads: 4
[2026-02-19 12:00:01] New template: height=42381 target=0x1d00ffff
[2026-02-19 12:01:03] BLOCK FOUND! height=42381 nonce=0x1a3f8b2c hash=0000001f...
[2026-02-19 12:01:03] Reward: 25.00000000 RILL + 0.12500000 RILL (decay pool)
[2026-02-19 12:01:03] Hashrate: 8.4 MH/s

Notes for Miners

  • Always mine to a wallet you control — never to an exchange address. Coinbase outputs have a 100-block maturity delay.
  • The decay pool release adds a variable component to each block reward. A node with more circulating decay yields higher pool rewards.
  • CPU mining is only practical on testnet. Mainnet will require SHA-256 ASICs for competitive mining.
  • Ensure your node is fully synced before mining. Stale templates result in rejected blocks.