GitHub – Kristian5013/flow-protocol


Flow Protocol

Decentralized cryptocurrency built from scratch in C++20.
81,418 lines of original code • 333 files • 11 modules • 184+ tests • 0 dependencies on Bitcoin Core

flowcoin.org
flowprotocol.net
Telegram
GitHub


Flow Protocol is a Layer-1 blockchain with its own native coin FTC. The network uses Equihash (200,9) proof-of-work, 10-minute block times, and a fixed supply of 21,000,000 FTC. All consensus rules (SegWit, BIP34/65/66) are active from genesis.

The entire codebase — core libraries, cryptography, networking, consensus, wallet, miner, and RPC server — is written from the ground up in modern C++20 with zero external dependencies beyond OpenSSL.

Key Differences from Bitcoin

  • Keccak-256d (SHA-3) instead of SHA-256d — fundamentally stronger hash construction
  • Equihash PoW (200,9) — ASIC-resistant, memory-hard, CPU/GPU fair mining
  • Actor model P2P — lock-free message passing, no deadlocks
  • 81,418 lines of original C++20 code — not a fork, fully verifiable on GitHub
  • Zero Bitcoin Core dependencies — independent implementation of every subsystem

Parameter Value
Algorithm Equihash (N=200, K=9)
Block Time 600 seconds (10 minutes)
Block Reward 50 FTC (halves every 210,000 blocks)
Max Supply 21,000,000 FTC
Difficulty Adjustment Every 2,016 blocks (~2 weeks)
Max Block Weight 4,000,000 WU
Coinbase Maturity 100 confirmations
P2P Port 9333
RPC Port 9332
SegWit Active from genesis
Address Format Base58Check (P2PKH, P2SH)

Domain Location IP
seed.flowcoin.org Virginia, USA 44.221.81.40
seed.flowprotocol.net Seoul, South Korea 3.35.208.160

  • C++20 compiler (GCC 13+, Clang 16+, MSVC 2022)
  • CMake 3.20+
  • OpenSSL 3.0+
sudo apt update
sudo apt install -y build-essential cmake libssl-dev

git clone https://github.com/Kristian5013/flow-protocol.git
cd flow-protocol
mkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
cmake --build . -j$(nproc)
pacman -S mingw-w64-ucrt-x86_64-gcc mingw-w64-ucrt-x86_64-cmake mingw-w64-ucrt-x86_64-openssl

git clone https://github.com/Kristian5013/flow-protocol.git
cd flow-protocol
mkdir build && cd build
cmake .. -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release
cmake --build . -j8

Binary Description
ftcd Full node daemon
ftc-miner External Equihash miner
ftc-wallet Wallet CLI utility
ftc_tests Test suite (184 tests, 791 checks)

./ftcd -datadir=/var/lib/ftc -rpcuser=myuser -rpcpassword=mypass

Create ftc.conf in your data directory:

# Network
listen=1
port=9333
maxoutbound=8
maxinbound=117
dnsseed=1

# RPC
rpcuser=myuser
rpcpassword=mypass
rpcbind=127.0.0.1
rpcport=9332

# Logging
loglevel=info
-datadir=       Data directory for blockchain, wallet, logs
-listen=         Accept incoming P2P connections (default: 1)
-port=             P2P listen port (default: 9333)
-rpcport=          RPC listen port (default: 9332)
-rpcuser=       RPC authentication username
-rpcpassword=   RPC authentication password
-rpcbind=       RPC bind address (default: 127.0.0.1)
-norpc                Disable RPC server
-nowallet             Disable wallet functionality
-connect=       Connect only to specified node
-addnode=       Add a node to connect to
-maxoutbound=      Max outbound connections (default: 8)
-maxinbound=       Max inbound connections (default: 117)
-dnsseed=        Use DNS seeds for peer discovery (default: 1)
-mine                 Enable built-in miner
-minethreads=      Mining threads (default: all CPUs)
-mineaddress=   Mining reward address
-testnet              Use testnet
-regtest              Use regression test mode
-loglevel=     Log level: debug, info, warn, error
[Unit]
Description=FTC Node
After=network.target

[Service]
ExecStart=/opt/ftc/ftcd -datadir=/var/lib/ftc -conf=/etc/ftc/ftc.conf
Restart=on-failure
User=ftc

[Install]
WantedBy=multi-user.target

FTC uses Equihash (200,9) — an ASIC-resistant, memory-hard proof-of-work algorithm. The external miner communicates with the node via getwork/submitwork RPC calls.

./ftc-miner \
  --rpcuser=myuser \
  --rpcpassword=mypass \
  --rpchost=127.0.0.1 \
  --rpcport=9332 \
  --address=your_FTC_address> \
  --threads=4
# Generate 1 block (built-in solver)
curl --user myuser:mypass --data-binary \
  '{"jsonrpc":"1.0","id":1,"method":"generate","params":[1,"
"]}'
\ http://127.0.0.1:9332/ # External mining flow # Step 1: Get work curl --user myuser:mypass --data-binary \ '{"jsonrpc":"1.0","id":1,"method":"getwork","params":["
"]}'
\ http://127.0.0.1:9332/ # Step 2: Submit solved nonce curl --user myuser:mypass --data-binary \ '{"jsonrpc":"1.0","id":1,"method":"submitwork","params":[]}' \ http://127.0.0.1:9332/

All RPC calls use standard JSON-RPC 1.0 over HTTP with Basic authentication.

curl --user rpcuser>:rpcpassword> \
  --data-binary '{"jsonrpc":"1.0","id":1,"method":"","params":[...]}' \
  -H 'content-type: text/plain;' \
  http://127.0.0.1:9332/

Returns an object containing various state info regarding blockchain processing.

{
  "chain": "main",
  "blocks": 6,
  "headers": 6,
  "bestblockhash": "00064a5c...",
  "difficulty": 0.0000019073,
  "mediantime": 1770459231,
  "chainwork": "000...0e000",
  "pruned": false,
  "initialblockdownload": false,
  "verificationprogress": 1.0
}

getblock "blockhash" ( verbosity )

Returns block data for the given block hash.

Parameters:
  1. blockhash  (string, required) The block hash
  2. verbosity  (int, optional, default=1) 0=hex, 1=json, 2=json with full tx details

Returns hash of block at the given height.

Parameters:
  1. height  (int, required) The height index

getblockheader "blockhash" ( verbose )

Returns information about a block header.

Parameters:
  1. blockhash  (string, required) The block hash
  2. verbose    (bool, optional, default=true) true=json object, false=hex

Returns the height of the most-work fully-validated chain (tip height).

Returns the hash of the best (tip) block in the most-work fully-validated chain.

Returns the proof-of-work difficulty as a multiple of the minimum difficulty.

Returns information about all known tips in the block tree, including the main chain and any orphan/fork branches.

Returns details about an unspent transaction output (UTXO).

Parameters:
  1. txid  (string, required) The transaction id
  2. n     (int, required) The output index (vout)

scantxoutset "action" [scanobjects,...]

Scans the UTXO set for outputs matching the given addresses.

Parameters:
  1. action       (string, required) "start"
  2. scanobjects  (array, required)  [{"address":"addr"}, ...] or ["addr", ...]

Returns details on the active state of the transaction memory pool.

{
  "loaded": true,
  "size": 5,
  "bytes": 1250,
  "usage": 4096,
  "maxmempool": 300000000,
  "mempoolminfee": 0.00001000
}

getrawmempool ( verbose )

Returns all transaction IDs in the memory pool.

Parameters:
  1. verbose  (bool, optional, default=false) true=detailed JSON, false=array of txids

Returns mempool data for the given transaction.

Parameters:
  1. txid  (string, required) The transaction id

testmempoolaccept ["rawtx",...]

Tests whether raw transactions would be accepted by the mempool (dry run, does not submit).

Parameters:
  1. rawtxs  (array, required) Array of hex-encoded raw transactions

Returns a JSON object containing mining-related information.

{
  "blocks": 6,
  "difficulty": 0.0000019073,
  "networkhashps": 42.5,
  "pooledtx": 0,
  "chain": "main"
}

getnetworkhashps ( nblocks height )

Returns the estimated network hashes per second.

Parameters:
  1. nblocks  (int, optional, default=120) Number of blocks to use for estimate
  2. height   (int, optional, default=-1) Height to estimate at (-1 for tip)

getblocktemplate ( "template_request" )

Returns data needed to construct a block to work on. Used by advanced mining software.

Parameters:
  1. template_request  (object, optional) Template request parameters

Submits a new block to the network. The block hex must include all transactions.

Parameters:
  1. hexdata  (string, required) The hex-encoded block data

generate nblocks "address"

Mines blocks using the built-in Equihash solver. Returns array of mined block hashes.

Parameters:
  1. nblocks  (int, required) Number of blocks to mine (1-1000)
  2. address  (string, required) FTC address for coinbase reward

Returns mining work (header + target) for external miners. The miner solves Equihash locally and submits the nonce via submitwork.

Parameters:
  1. address  (string, required) FTC address for coinbase reward
{
  "header": "0100000042a3...",
  "target": "0007ffff000000...",
  "height": 7
}

Submits a solved nonce from an external miner. Call getwork first to obtain the work.

Parameters:
  1. nonce  (int, required) The solved nonce value

Returns an object containing various state info regarding P2P networking.

{
  "version": 70015,
  "subversion": "/FTC:1.0.0/",
  "protocolversion": 70015,
  "connections": 2,
  "connections_in": 1,
  "connections_out": 1,
  "localaddresses": []
}

Returns data about each connected network peer.

[
  {
    "id": 1,
    "addr": "3.35.208.160:9333",
    "version": 70015,
    "subver": "/FTC:1.0.0/",
    "inbound": true,
    "startingheight": 0,
    "banscore": 0,
    "synced_headers": 6,
    "synced_blocks": 6,
    "pingtime": 0.178
  }
]

Returns the number of connections to other nodes.

Returns information about network traffic (bytes sent/received).

Attempts to add or remove a node from the connection list.

Parameters:
  1. node     (string, required) The address (ip:port)
  2. command  (string, required) "add", "remove", or "onetry"

disconnectnode ( "address" nodeid )

Immediately disconnects from the specified peer.

Parameters:
  1. address  (string, optional) The IP address/port of the node
  2. nodeid   (int, optional) The peer node id

getrawtransaction "txid" ( verbose )

Returns the raw transaction data.

Parameters:
  1. txid     (string, required) The transaction id
  2. verbose  (bool, optional, default=false) true=JSON object, false=hex string

decoderawtransaction "hexstring"

Returns a JSON object representing the serialized hex-encoded transaction.

Parameters:
  1. hexstring  (string, required) The hex-encoded transaction

createrawtransaction [{"txid":"id","vout":n},...] {"address":amount,...} ( locktime )

Creates an unsigned raw transaction spending the given inputs.

Parameters:
  1. inputs    (array, required)  [{"txid":"hex","vout":n}, ...]
  2. outputs   (object, required) {"address": amount, ...}
  3. locktime  (int, optional, default=0) Transaction locktime

signrawtransactionwithkey "hexstring" ["privatekey",...]

Signs inputs for a raw transaction with the provided private keys.

Parameters:
  1. hexstring    (string, required) The hex-encoded raw transaction
  2. privatekeys  (array, required)  Private keys in WIF or hex format
{
  "hex": "0100000001...",
  "complete": true
}

sendrawtransaction "hexstring"

Submits a signed raw transaction to the network.

Parameters:
  1. hexstring  (string, required) The hex-encoded signed transaction

Returns the transaction hash (txid).


Returns the total available balance in FTC.

getnewaddress ( "label" )

Generates a new FTC address with a fresh private key.

Parameters:
  1. label  (string, optional) A label for the address
{
  "address": "1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa",
  "wif": "KwDiBf89QgGbjEhKnhXJuH7LrciVrZi3qYjgd9M7rFU73sVHnoWn",
  "hex": "0c28fca386c7a227600b2fe50b7cae11ec86d3bf1fbe471be89827e19d72aa1d"
}

sendtoaddress "address" amount ( "comment" )

Sends FTC to the given address. Returns the transaction ID.

Parameters:
  1. address  (string, required) The FTC address to send to
  2. amount   (numeric, required) The amount in FTC
  3. comment  (string, optional) A comment for the transaction

listtransactions ( count skip )

Returns the most recent wallet transactions.

Parameters:
  1. count  (int, optional, default=10) Number of transactions to return
  2. skip   (int, optional, default=0) Number of transactions to skip

listunspent ( minconf maxconf )

Returns array of unspent transaction outputs (UTXOs).

Parameters:
  1. minconf  (int, optional, default=1) Minimum confirmations
  2. maxconf  (int, optional, default=9999999) Maximum confirmations

Reveals the private key for the given address.

Parameters:
  1. address  (string, required) The FTC address

importprivkey "privkey" ( "label" rescan )

Imports a private key into the wallet.

Parameters:
  1. privkey  (string, required) The private key in WIF format
  2. label    (string, optional) A label for the address
  3. rescan   (bool, optional, default=true) Rescan the blockchain for transactions

estimatesmartfee conf_target ( "estimate_mode" )

Estimates the approximate fee per kilobyte for a transaction to confirm within conf_target blocks.

Parameters:
  1. conf_target    (int, required) Confirmation target in blocks
  2. estimate_mode  (string, optional, default="conservative") "unset", "economical", or "conservative"
{
  "feerate": 0.00010000,
  "blocks": 6
}

estimaterawfee conf_target ( threshold )

Returns raw fee estimation data for each tracking horizon.

Parameters:
  1. conf_target  (int, required) Confirmation target in blocks
  2. threshold    (numeric, optional) Confidence threshold (0.0 - 1.0)

validateaddress "address"

Returns information about the given FTC address.

Parameters:
  1. address  (string, required) The FTC address to validate
{
  "isvalid": true,
  "address": "1EVegNcW9sgaRqgQFyPYVcPEjYq9hikMKo",
  "scriptPubKey": "76a914...",
  "isscript": false,
  "iswitness": false
}

createmultisig nrequired ["key",...]

Creates a multi-signature address with n-of-m keys required.

Parameters:
  1. nrequired  (int, required) Number of required signatures
  2. keys       (array, required) Array of public keys or addresses

signmessagewithprivkey "privkey" "message"

Signs a message with a private key.

Parameters:
  1. privkey  (string, required) The private key in WIF format
  2. message  (string, required) The message to sign

verifymessage "address" "signature" "message"

Verifies a signed message.

Parameters:
  1. address    (string, required) The FTC address that signed the message
  2. signature  (string, required) The base64-encoded signature
  3. message    (string, required) The message that was signed

Request a graceful shutdown of the FTC node.

Returns the total uptime of the server in seconds.

Lists all commands, or gets help for a specific command.

Parameters:
  1. command  (string, optional) The command to get help for

Returns information about memory usage.

Parameters:
  1. mode  (string, optional) "stats" or "mallocinfo"

logging ( ["include",...] ["exclude",...] )

Gets and sets the logging configuration.

Parameters:
  1. include  (array, optional) Categories to enable
  2. exclude  (array, optional) Categories to disable

Available categories: net, mempool, validation, mining, rpc, wallet, chain, script, lock, p2p, bench, all, none.


src/
  core/         Core types, serialization, streams, logging, threading
  crypto/       Keccak-256, secp256k1, Schnorr, BIP32/39, AES, ChaCha20, Equihash
  primitives/   Transactions, blocks, scripts, addresses, fees
  consensus/    Consensus rules, PoW validation, block/tx verification
  chain/        Block index, chain state, UTXO set, block storage
  mempool/      Transaction memory pool, fee estimation, RBF
  net/          P2P networking, peer management, block/tx relay
  rpc/          JSON-RPC server with 51 commands
  wallet/       Key management, HD wallet, coin selection, signing
  miner/        Block template construction, Equihash solver
  node/         Node lifecycle, initialization, shutdown
  test/         Test suite (184 tests across 12 test files)
Hash:    0000451ca7b54fd5e3d96f6b07b9ee74d9dd9abebd8b8ae4e9b78f2c740c2bb7
Time:    2026-02-03 00:00:00 UTC
Message: "Pilatovich Kristian 20091227"
Nonce:   4737

SHA-256 Cryptanalysis Research

Author’s independent cryptanalysis of the SHA-256 compression function. Novel attack vectors discovered through 100+ billion message samples.

Rounds Result Method
17 7-bit near-collision (249/256 bits match) w15.b0 differential
18 21-bit near-collision w15.b0 differential
19 44-bit near-collision w15.b31 differential
20 60-bit near-collision w15.b0 differential
21 Distinguisher (massive h7 bias) Asymmetric diffusion
22 Distinguisher (2.8% h7 bias, ~1,300 samples) h7.b31 bias
23 Distinguisher (0.046% h7 bias, ~29M samples) h7.b19 residual
24 RANDOM — full diffusion achieved Wall confirmed

Key Vulnerabilities Discovered

1. Low-bit Deltas Superior to High-bit (Counter-intuitive)

Delta w15.b0  (0x00000001): 7-bit collision at 17R
Delta w15.b31 (0x80000000): 11-bit collision at 17R

Reason: +1 additive difference propagates slower
        through mod 2^32 arithmetic than sign flip

2. Asymmetric Diffusion (a-chain vs e-chain)

a-chain update: a_new = T1 + T2  (strong mixing, includes Sigma0 + Maj)
e-chain update: e_new = d + T1   (weak mixing, no T2 term)

Result: h7 (e-chain output) lags ~2 rounds behind h3 (a-chain)
        h7 is the "last holdout" showing bias

3. Structural Collisions in Early Rounds

17R: 128-bit structural collision (h2,h3,h6,h7 = 0)
18R: 64-bit structural (h3,h7 = 0)
19R: ~31-bit partial structural
20R: Structure collapses, h7 bias remains

4. Phase Transition at Round 23 -> 24

Round 22: h7 chi-squared = 364,975 (massive bias)
Round 23: h7 chi-squared = 208      (weak but detectable)
Round 24: h7 chi-squared = 41       (random)

56x reduction in single round (22 -> 23)
Complete randomness at 24 rounds

5. Sigma1 Rotation Correlation

h7 pairwise bit correlations follow Sigma1 rotation offsets (6,11,25)
Diagonal sums at 23R: 109 vs expected 32
Residual structure from rotation-based diffusion
  • Custom CUDA implementation for parallel testing
  • 100+ billion message pairs analyzed
  • AI-assisted pattern discovery (neural network on state transitions)
  • Differential, linear, and differential-linear cryptanalysis attempted
SHA-256 full diffusion boundary: 24 rounds
Security margin: 64 - 24 = 40 rounds (sufficient)
Attack complexity for 23R distinguisher: ~29M samples

FTC uses Keccak-256 (SHA-3), not SHA-256:

  • 1600-bit state (vs 256-bit)
  • Sponge construction (vs Merkle-Damgard)
  • Best known attacks: 5-6 rounds (vs 23 for SHA-256)
  • Fundamentally different — SHA-256 weaknesses don’t apply

Kristian Pilatovich, 16 years old

  • SHA-256 cryptanalysis (17-24 rounds, novel distinguisher at 23R)
  • Pressure Ontology
  • Built Flow Protocol from scratch — 81,418 lines of C++20

Distributed under the MIT software license. See COPYING for more information.



Source link

Leave a Reply

Your email address will not be published. Required fields are marked *