Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

123 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

疾風 Hayate

Swift Cardano Indexer with UTxORPC API

A lightweight, efficient Cardano blockchain indexer that implements the UTxORPC standard for wallet integration.

Name

Hayate (疾風) - Japanese for "swift wind" or "gale". Represents speed and efficiency.

Features

  • 🚀 UTxORPC API - Standard gRPC protocol for wallet integration
  • 💾 Lightweight - Only indexes tracked wallets (not entire chain)
  • 🔄 Multi-network - Mainnet, preprod, preview, sanchonet, custom networks
  • 👛 Smart tracking - BIP44 gap limit address discovery
  • 📊 Staking rewards - Following cardano-wallet pattern
  • 🏛️ Full governance - All proposals, votes from tracked wallets
  • 📜 Plutus transactions - Native support for script transactions and contract deployment
  • 🎯 Efficient - LSM tree storage, ~1MB per 1000 wallets per year
  • 🦀 Pure Rust - Safe, fast, cross-platform

What We Index

For Tracked Wallets

  • ✅ UTxOs (payment addresses)
  • ✅ Balances (monoidal aggregation)
  • ✅ Stake delegations (pool changes)
  • ✅ DRep delegations (governance)
  • ✅ Reward withdrawals (on-chain)
  • ✅ Reward snapshots (queried from node)

For Everyone

  • ✅ All governance proposals
  • ✅ All pool registrations/retirements
  • ✅ Epoch nonces

Architecture

┌─────────────────────────────────────────┐
│         Hayate Service                  │
│         (UTxORPC Server)                │
├─────────────────────────────────────────┤
│  Multi-Network Indexer                  │
│  ┌────────┬────────┬────────┐          │
│  │Mainnet │Preprod │SanchoNet│         │
│  └───┬────┴───┬────┴───┬────┘          │
│      │        │        │                │
│      ↓        ↓        ↓                │
│  ┌─────────────────────────┐            │
│  │    LSM Storage          │            │
│  │  • UTxOs                │            │
│  │  • Balances             │            │
│  │  • Rewards              │            │
│  │  • Governance           │            │
│  │  • Nonces               │            │
│  └─────────────────────────┘            │
│              ↓                           │
│  ┌─────────────────────────┐            │
│  │  UTxORPC gRPC (:50051)  │            │
│  │  • Query                │            │
│  │  • Watch (streaming)    │            │
│  │  • Submit               │            │
│  └─────────────────────────┘            │
└─────────────────────────────────────────┘
         ↓
    ┌────┴────┬────────┬──────┐
    │  Lace   │  CLI   │  TUI │
    └─────────┴────────┴──────┘

Quick Start

# Enter development shell
nix develop

# Run on preprod testnet
just run-preprod

# Or manually
cargo run -- --network preprod --from-genesis

# Run tests
just test

Usage

# Index mainnet
hayate --network mainnet --db-path ./mainnet-db

# Track specific addresses
hayate --network preprod --addresses addr1_alice addr1_bob

# Start from genesis
hayate --from-genesis

Plutus Transaction Support

Hayate includes native support for building and submitting Plutus script transactions (Conway era):

use hayate::wallet::plutus::*;
use hayate::wallet::tx_builder::*;

// Deploy a PlutusV2 script with inline datum
let script = PlutusScript::v2_from_cbor(script_bytes)?;
let mut builder = PlutusTransactionBuilder::new(Network::Testnet, change_addr);

// Add inputs, outputs, collateral
builder.add_input(&PlutusInput::regular(utxo))?;
builder.add_output(&PlutusOutput::new(script.address(Network::Testnet)?, 50_000_000)
    .with_datum(DatumOption::inline(datum_bytes)))?;
builder.add_collateral(&collateral_utxo)?;

// Build transaction
builder
    .set_fee(200_000)
    .set_ttl(slot + 1000)
    .set_network_id()
    .set_default_language_view(PlutusVersion::V2);

let (tx_bytes, tx_hash) = builder.build()?;

Features:

  • Full PlutusV1/V2/V3 support via pallas-txbuilder
  • Script address calculation (BLAKE2b-224)
  • Inline datums and datum hashes
  • Redeemers with execution units
  • Standard cost models for all Plutus versions
  • Conway-era transaction format

See docs/plutus-transactions.md and examples/deploy_plutus_contract.rs for more details.

Development

# Watch and test
just watch

# Lint and test
just check

# Format code
just fmt

# Build release
just build-release

Testing

Hayate includes comprehensive test coverage:

# Run standard unit and integration tests
cargo test

# Run live integration tests (requires running node at localhost:50051)
./run-live-tests.sh

# Or run directly:
cargo test --test live_integration_tests -- --ignored --nocapture

# Run specific live test
cargo test --test live_integration_tests test_live_get_chain_tip -- --ignored --nocapture

# Run with custom endpoint
HAYATE_API=http://127.0.0.1:50053 cargo test --test live_integration_tests -- --ignored --nocapture

Test Categories:

  • Unit tests - Component-level testing with mocked dependencies
  • Integration tests - Multi-component testing with temporary storage
  • Live integration tests - End-to-end testing against a running Hayate node (marked #[ignore])

The live integration tests verify the full stack against real blockchain data but are excluded from default test runs and CI/nix builds. See tests/README.md for detailed documentation.

Storage

Uses cardano-lsm for efficient blockchain storage:

  • UTxO tree - Transaction outputs
  • Balance tree - Monoidal aggregation for fast queries
  • Governance tree - Merkle-verified governance actions
  • Transaction tree - Complete transaction history

Performance Targets

  • Genesis sync: < 8 hours (mainnet)
  • Live block processing: < 50ms per block
  • Balance query: < 1ms for any address
  • Chain reorg: < 1s for 100 block rollback

Documentation

  • Setting Up a New Midnight Network - Complete guide for deploying Cardano governance contracts and configuring Hayate as the UTxORPC indexer for a new Midnight federated network

License

Apache-2.0

Status

🚧 Under Development 🚧

Current: Setting up project structure Next: Implement chain sync and block processing

About

Cardano Indexer and Lightweight node in rust

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages