NetChain is an experimental Layer-1 blockchain prototype in Rust built around a hybrid Proof of Internet consensus model. Validator selection blends measured network performance with stake, identity confidence, reputation, slashing history, and multi-party attestations.
- Rust blockchain prototype with blocks, chain validation, state, wallet, RPC, and libp2p networking
- Hybrid validator scoring that combines Proof of Internet, stake, identity, reputation, slashing, and attestation quorum
- Peer metric announcements, challenge-response attestations, and anti-gaming validation
- Native staking, governance, and slashing state transitions with on-chain proposal voting
- Explorer-style RPC reads for blocks, accounts, staking positions, proposals, and health telemetry
- Persistent local storage with sled
- Runtime config file support, structured logging, health checks, and a Prometheus-style metrics endpoint
NetChain now treats validator selection as a composite signal:
- Proof of Internet measures download speed, upload speed, latency, uptime, and stability.
- Stake acts as an economic weight instead of the only security signal.
- Identity and reputation scores reward nodes that remain stable and well-attested over time.
- Multi-party attestations raise a node's confidence level and reduce the chance of score spoofing.
- Slashing history applies a persistent trust penalty after invalid blocks, fraudulent metrics, or missed blocks.
This keeps the protocol experimental, but makes the selection model much harder to game than PoI alone.
netchain/
├── config/default.toml # Runtime configuration
├── docker-compose.yml # Local container orchestration
├── Dockerfile # Container image build
├── src/
│ ├── main.rs # Node entry point (bin)
│ ├── lib.rs # Shared library crate
│ ├── bin/wallet.rs # Wallet CLI (bin)
│ ├── app/config.rs # Runtime configuration loader
│ ├── chain/ # Blocks, state, transactions
│ ├── net/ # P2P, RPC, WebSocket, monitoring
│ ├── node/ # Mempool, producer, storage
│ ├── poi/ # Hybrid consensus + anti-gaming
│ └── wallet/ # Wallet types + crypto helpers
└── .github/workflows/ci.yml # CI pipeline
Prerequisites:
- Rust toolchain
Build:
cargo buildRun the node:
cargo run --bin netchainRun tests:
cargo testNetChain loads config from config/default.toml by default.
Override the config path:
NETCHAIN_CONFIG=./config/default.toml cargo run --bin netchainUseful env overrides:
DATA_DIRPORTRPC_PORTNETCHAIN_RPC_BIND_ADDRNETCHAIN_MONITORING_PORTNETCHAIN_MONITORING_BIND_ADDRNETCHAIN_WS_PORTNETCHAIN_WS_BIND_ADDRNETCHAIN_BLOCK_INTERVAL_SECSNETCHAIN_BLOCK_REWARDNETCHAIN_MAX_TXS_PER_BLOCKNETCHAIN_STAKE_WEIGHTNETCHAIN_LOG_LEVEL
- P2P:
0.0.0.0:30333by default for node gossip and discovery - RPC:
127.0.0.1:8545by default - Monitoring:
127.0.0.1:9090by default - WebSocket:
127.0.0.1:8546by default
Native transaction types:
TransferStakeUnstakeCreateProposalVoteProposal
Governance notes:
- Proposal creation requires an existing stake position
- Vote weight equals the voter's currently staked balance
- Proposal status is
Active,Passed, orRejectedbased on deadline, quorum, and yes-vote approval share - Passed proposals can update runtime chain parameters without restarting the node
- Supported proposal actions:
ChangeBlockReward,ChangeBlockInterval,ChangeMaxTxsPerBlock,ChangeStakeWeight - Proposal actions are validated before entering the mempool
Runtime governance defaults:
- Minimum proposal stake:
100 - Quorum:
20%of total staked balance - Approval threshold:
50.01%yes votes among participating stake
WebSocket protocol:
- Connect to
ws://127.0.0.1:8546 - Subscribe with
{"action":"subscribe","topics":["new_blocks","new_transactions","proposals","slashing"]} - Unsubscribe with
{"action":"unsubscribe","topics":["proposals"]} - Ping with
{"action":"ping"}
Example using wscat:
npx wscat -c ws://127.0.0.1:8546
> {"action":"subscribe","topics":["new_blocks","proposals"]}Example WebSocket event:
{"event":"validator_slashed","data":{"validator":"node1","reason":"MetricFraud","amount_burned":250,"remaining_stake":4750}}Monitoring endpoints:
GET /healthreturns JSON health statusGET /metricsreturns Prometheus-style plaintext metrics- Health and metrics expose consensus mode, verified/unverified validator counts, slashed validator counts, and average reputation / identity scores.
Example:
curl http://127.0.0.1:9090/health
curl http://127.0.0.1:9090/metricsRPC methods:
get_balanceget_noncesend_transactionget_chain_infoget_mempool_sizeget_blockget_blocksget_accountget_staking_infoget_proposalsget_proposal
Build and run with Docker Compose:
docker compose up --buildThe compose file exposes:
30333for P2P8545for RPC9090for monitoring
GitHub Actions runs:
cargo fmt --all -- --checkcargo check --all-targetscargo test --all-targets
- Logs are emitted with
tracing; useNETCHAIN_LOG_LEVEL=debugfor more detail. - Runtime metrics and health are intentionally lightweight for local development and early testnet-style deployments.
- The wallet binary is available as
netchain-wallet. - The website under
website/is route-based and includes the explorer/dashboard UI for live hybrid consensus telemetry.
See LICENSE.