Skip to content

TycheVRF/contracts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tyche (TYCHE)

Status: This repository is in an early development stage. APIs, parameters, and architecture may change before stable releases.

Tyche is an immutable mining and randomness protocol for high-speed, low-fee EVM environments. It combines VRF-style (signature-derived) share validity with EIP-918 mining interfaces and exposes a decentralized randomness oracle for external contracts.

Initial chain focus is MegaETH, with staged expansion to other EVM networks after stability and telemetry validation.

Key Properties

  • Fully on-chain control flow after initialization (no owner pause, no mutable admin config path).
  • Signature-based VRF-style proof validation with anti-replay constraints per (miner, Challenge).
  • EIP-918 mining interface exposure (mint, getMiningTarget, getMiningChallenge).
  • Oracle randomness read interface (getLatestRandom) from finalized rounds.
  • Dual-purpose staking for target relief and stake-gated oracle fee governance (Vote Tyche, vTYCHE).
  • Stake-share target allocation after staking starts, so splitting stake across many accounts does not increase aggregate target.
  • Zero-stake mining is disabled; startup mining uses one-time bootstrap seed that is directly credited as initial stake at deployment.
  • Damped Oracle fee governance with floor price and per-epoch max step limits.

Repository Layout

  • contracts/core/TycheToken.sol: Standard ERC20-like TYCHE token with no fee-on-transfer; controller burn is used for oracle fee sink.
  • contracts/core/TycheController.sol: Mining/oracle core orchestration and round finalization.
  • contracts/core/OracleFeeManager.sol (spec target): Oracle fee damping with epoch step bounds; updates are stake-gated via controller.
  • contracts/core/ShareDAG.sol: Round-scoped DAG share storage and settlement progression.
  • contracts/core/SettlementAuction.sol: Time-based settlement reward auction with surge mode after delay threshold.
  • contracts/core/TycheSystemFactory.sol: System deployment and one-shot wiring.
  • contracts/core/TycheEconomicsSimulator.sol: Pure simulation utility for policy window behavior.
  • contracts/libraries/FixedPointMath.sol: WAD math and deterministic fixed-point primitives.
  • contracts/libraries/TycheTypes.sol: Shared protocol structs.

End-to-End Flow

  1. Miner obtains current challenge via getMiningChallenge.
  2. Miner performs CPU nonce search and computes proof/output (nonce, π, V) against registered keypair.
  3. Miner submits share via mint/submitShare path; controller verifies proof + target + replay conditions.
  4. Valid shares are ingested into current round and later finalized permissionlessly.
  5. Finalized round randomness is aggregated and exposed through oracle read methods.
  6. Oracle calls pay TYCHE fees, split into burn and staker yield under damped governance.

Mining target policy:

  • Before any stake exists: mining target is 0 (zero-stake mining disabled).
  • Startup is enabled through one-time bootstrap seed (bootstrapMiner, bootstrapMintAmount) at deployment.
  • After stake exists: target is stake-share based (stake_i / totalStaked) with a global multiplier, making stake-splitting Sybil-neutral at aggregate level.

Mining search policy:

  • For each challenge, miners search over nonce space on CPU.
  • Signature verification is over keccak256(challenge || nonce).
  • Output check uses keccak256(proof || nonce) <= target.

Oracle fee voting policy:

  • Stakers cast one weighted vote per epoch via locked stake.
  • Epoch finalization applies stake-weighted average vote only when quorum is met against an epoch stake snapshot.
  • If quorum is not met, fee remains at current value (no forced jump).

Security Hardening Included

  • VRF proof verification and per-challenge replay protection.
  • Registered-key activation delay to reduce precomputation abuse.
  • Deterministic multi-share randomness aggregation per finalized round.
  • Damped governance with absolute fee floor and bounded step changes.
  • Non-reentrant critical paths and deterministic round finalization.

Immutability and Decentralization Model

  • Child contracts are deployed and wired by factory bootstrapper.
  • Each child supports one-time initializeController only.
  • After initialization, runtime control is performed only by immutable protocol logic.
  • No emergency stop circuit is included.

Deployment Notes

Deployment starts on MegaETH. TycheSystemFactory enforces fixed branding:

  • Tyche / TYCHE

Which Contract To Deploy

  • Deploy contract: contracts/core/TycheSystemFactory.sol
  • Call entrypoint: deploySystem(DeployConfig) on the deployed factory
  • Runtime mining contract: the controller address returned by deploySystem (this is the TycheController miners must submit shares to)

Required constructor config includes:

  • stakeLockDuration for anti-flash-stake lock.
  • minOracleFee for absolute oracle fee floor.
  • maxFeeStepPct for epoch fee damping bound.
  • voteEpochDuration for governance cadence.
  • bootstrapMiner for one-time startup seed recipient.
  • bootstrapMintAmount for one-time startup seed amount.

Chain Optimization Parameter Table

Recommended initial MegaETH baseline.

Chain Symbol minDifficulty difficultyCap auctionTargetDelay (s) auctionSlopePerSecond alphaWad decayKWad tailReward stakeLockDuration (s) minOracleFee maxFeeStepPct voteEpochDuration (s)
MegaETH TYCHE 130 6500 2 13 85000000000000000 1850000000000 200000000000000000 720 1000000000000000 500 3600

These are baseline presets, not hard guarantees. Run simulation/fuzz and live gas-latency observation before production rollout.

Known Engineering Constraints

  • stateRoot is used for cycle-context binding only and is excluded from parameter-rotation entropy.
  • Emission and control loops are deterministic approximations, not floating-point exact replicas of symbolic formulas.
  • VRF verification gas must remain under strict budget via optimized curve libraries.
  • Oracle fee governance is bounded but still requires economic monitoring against volume shocks.
  • Tail emission remains inflationary without sufficient sinks, so tailReward must be periodically re-evaluated.

Recommended Next Steps

  • Add invariant/fuzz tests for DAG parent rules and param rotation under adversarial workloads.
  • Add gas snapshots for share submission and finalize paths.
  • Add deployment scripts with canonical mainnet parameter presets.

Contributing

Contributions are welcome while the protocol is in early development. Please follow the guidelines in CONTRIBUTING.md before opening issues or pull requests.

License

This project is licensed under the MIT License. See LICENSE for details.

About

Tyche is an immutable protocol that combines VRF-style signature-derived validity with the EIP-918 mining interface. Designed for sub-second block times, initiating on MegaETH, Tyche unifies issuance security, randomness integrity, and oracle utility.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Contributors

No contributors