54 lines
1.1 KiB
Kotlin
54 lines
1.1 KiB
Kotlin
package org.ccoin.models
|
|
|
|
import kotlinx.serialization.Serializable
|
|
|
|
@Serializable
|
|
data class StartMiningRequest(
|
|
val minerAddress: String, // Format: random_word:random_6_digits
|
|
val difficulty: Int? = null
|
|
)
|
|
|
|
@Serializable
|
|
data class SubmitMiningRequest(
|
|
val minerAddress: String,
|
|
val nonce: Long,
|
|
val hash: String,
|
|
val previousHash: String,
|
|
val timestamp: Long
|
|
)
|
|
|
|
@Serializable
|
|
data class BlockResponse(
|
|
val hash: String,
|
|
val previousHash: String?,
|
|
val merkleRoot: String,
|
|
val timestamp: Long,
|
|
val difficulty: Int,
|
|
val nonce: Long,
|
|
val minerAddress: String
|
|
val reward: Double,
|
|
val height: Int,
|
|
val transactionCount: Int,
|
|
val confirmations: Int = 0
|
|
)
|
|
|
|
@Serializable
|
|
data class MiningJobResponse(
|
|
val jobId: String,
|
|
val target: String,
|
|
val difficulty: Int,
|
|
val previousHash: String,
|
|
val height: Int,
|
|
val timestamp: Long,
|
|
val expiresAt: Long
|
|
)
|
|
|
|
@Serializable
|
|
data class MiningStatsResponse(
|
|
val minerAddress: String,
|
|
val totalBlocksMined: Int,
|
|
val totalRewardEarned: Double,
|
|
val lastBlockMined: Long?,
|
|
val currentDifficulty: Int
|
|
)
|