[go: up one dir, main page]

Skip to content

Implement Mining Account Type

Summary

Create a specialized account type for managing mining contexts and configurations.

Background

Third-party applications need a dedicated account type to manage their mining parameters, epoch state, and reward configuration.

Requirements

  • Define MiningAccount as a data account extension
  • Store mining configuration and state
  • Support epoch management
  • Track registered miners and rewards

Implementation Details

type MiningAccount struct {
    DataAccount
    
    Config MiningConfig
    State  MiningState
}

type MiningConfig struct {
    Active          bool
    EpochDuration   uint64
    TopN            uint16
    RewardToken     *url.URL
    RewardAmount    uint64
    RewardAccount   *url.URL
    MinSubmissions  uint16
}

type MiningState struct {
    CurrentEpoch     uint64
    LastDNAnchor     [32]byte
    ActiveMiners     uint32
    TotalDistributed uint64
    CurrentQueue     []MiningEntry  // Top N for current epoch
}

Acceptance Criteria

  • MiningAccount type defined in schema
  • Configuration storage and retrieval
  • State management methods
  • Epoch transition logic
  • Priority queue management
  • Unit tests for account operations
  • Integration with data account infrastructure

Dependencies

  • Depends on: #3668 (Mining Transaction Type)

Related

  • Epic: &37
  • Specification: 32-lxr-mining.md