// Copyright (C) 2023 Braiins Systems s.r.o. // // This file is part of Braiins Open-Source Initiative (BOSI). // // BOSI is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program. If not, see . // // Please, keep in mind that we may also license BOSI or any part thereof // under a proprietary license. For more information on the terms and conditions // of such proprietary license or if you have any other questions, please // contact us at opensource@braiins.com. syntax = "proto3"; package braiins.bos.v1; import "bos/v1/common.proto"; import "bos/v1/cooling.proto"; import "bos/v1/pool.proto"; import "bos/v1/units.proto"; import "bos/v1/work.proto"; import "google/protobuf/timestamp.proto"; import "google/protobuf/wrappers.proto"; option go_package = "github.com/braiins/bos-plus-api/braiins/bos/v1;bos_proto_v1"; // Supported platforms enum Platform { PLATFORM_UNSPECIFIED = 0; PLATFORM_AM1_S9 = 1; PLATFORM_AM2_S17 = 2; PLATFORM_AM3_BBB = 3; PLATFORM_AM3_AML = 4; PLATFORM_STM32MP157C_II1_AM2 = 5; PLATFORM_CVITEK_BM1_AM2 = 6; PLATFORM_ZYNQ_BM3_AM2 = 7; PLATFORM_STM32MP157C_II2_BMM1 = 8; } // Control board soc family “CVITEK”, “BBB”, “AML”, “ZYNQ”, "BRAIINS" enum ControlBoardSocFamily { CONTROL_BOARD_SOC_FAMILY_UNSPECIFIED = 0; CONTROL_BOARD_SOC_FAMILY_CVITEK = 1; CONTROL_BOARD_SOC_FAMILY_BBB = 2; CONTROL_BOARD_SOC_FAMILY_AML = 3; CONTROL_BOARD_SOC_FAMILY_ZYNQ = 4; CONTROL_BOARD_SOC_FAMILY_BRAIINS = 5; } // BOS modes enumeration enum BosMode { BOS_MODE_UNSPECIFIED = 0; BOS_MODE_UPGRADE = 1; BOS_MODE_RECOVERY = 2; BOS_MODE_SD = 3; BOS_MODE_NAND = 4; BOS_MODE_EMMC = 5; } enum MinerBrand { MINER_BRAND_UNSPECIFIED = 0; MINER_BRAND_ANTMINER = 1; MINER_BRAND_WHATSMINER = 2; } // Deprecated: This enumeration is not longer maintained enum MinerModel { option deprecated = true; MINER_MODEL_UNSPECIFIED = 0; MINER_MODEL_ANTMINER_S9 = 1; MINER_MODEL_ANTMINER_X17 = 2; MINER_MODEL_ANTMINER_S17 = 3; MINER_MODEL_ANTMINER_S17_PLUS = 4; MINER_MODEL_ANTMINER_S17_PRO = 5; MINER_MODEL_ANTMINER_S17E = 6; MINER_MODEL_ANTMINER_T17 = 7; MINER_MODEL_ANTMINER_T17E = 8; MINER_MODEL_ANTMINER_T17_PLUS = 9; MINER_MODEL_ANTMINER_X19 = 10; MINER_MODEL_ANTMINER_S19 = 11; MINER_MODEL_ANTMINER_S19_PRO = 12; MINER_MODEL_ANTMINER_S19_PLUS = 13; MINER_MODEL_ANTMINER_S19J = 14; MINER_MODEL_ANTMINER_S19J_PRO = 15; MINER_MODEL_ANTMINER_S19A = 16; MINER_MODEL_ANTMINER_S19A_PRO = 17; MINER_MODEL_ANTMINER_S19XP = 18; MINER_MODEL_ANTMINER_T19 = 19; MINER_MODEL_ANTMINER_S19J_PRO_PLUS = 20; } message MinerIdentity { MinerBrand brand = 1; // Deprecated: Use miner_model instead. // This field is no longer supported. MinerModel model = 2 [deprecated = true]; string name = 3; string miner_model = 4; } // Structure to handle BOS version message BosVersion { string current = 1; string major = 2; bool bos_plus = 3; } enum MinerStatus { MINER_STATUS_UNSPECIFIED = 0; MINER_STATUS_NOT_STARTED = 1; MINER_STATUS_NORMAL = 2; MINER_STATUS_PAUSED = 3; MINER_STATUS_SUSPENDED = 4; MINER_STATUS_RESTRICTED = 5; } message ErrorCode { string code = 1; string reason = 2; string hint = 3; } message Component { string name = 1; uint32 index = 2; } message MinerError { string timestamp = 1; string message = 2; repeated ErrorCode error_codes = 3; repeated Component components = 4; } message GetMinerStatusRequest {} message GetMinerStatusResponse { MinerStatus status = 1; } message GetMinerDetailedStatusRequest {} // Detailed miner status: the lifecycle phase the miner is in, the reason or // sub-state behind it, and when it entered and is expected to leave that phase message MinerDetailedStatus { oneof status { // Miner is stopped and not mining StopReason stopped = 1; // Miner is starting up and not yet mining StartReason starting = 2; // Miner is running and mining RunReason running = 3; // Miner is shutting down StopReason stopping = 4; } // When the miner entered the current status google.protobuf.Timestamp status_since = 5; // When the miner is expected to leave the current status (transition to another one), left unset // when that time is unknown ExpectedTime status_until = 6; } message GetMinerDetailedStatusResponse { // Detailed miner status MinerDetailedStatus status = 1; } // A point in time known with a given precision: either an exact timestamp or // an upper bound (the event happens no later than the timestamp) message ExpectedTime { oneof precision { // Upper bound: not known exactly, but no later than this timestamp google.protobuf.Timestamp max = 1; // Exact: known precisely, equal to this timestamp google.protobuf.Timestamp exact = 2; } } // Bosminer application is unavailable message ApplicationUnavailable {} // Hardware detection failed message UnsupportedHardware { // Detected hardware error messages repeated string errors = 1; } // All mining pools are unresponsive (or there is no pool configuration) message DeadPools {} // No valid BOS license message MissingLicense {} // User-initiated pause message UserPause {} // Reason why the miner is thermally paused enum ThermalPauseReason { THERMAL_PAUSE_REASON_UNSPECIFIED = 0; // Temperature reached a dangerous level THERMAL_PAUSE_REASON_DANGEROUS_TEMPERATURE = 1; // Fans are broken THERMAL_PAUSE_REASON_BROKEN_FANS = 2; } // Paused due to thermal conditions message ThermalPause { // Thermal reason that triggered the pause ThermalPauseReason reason = 1; } // Dynamic Performance Scaling cooldown in progress message DpsCooldown {} // Autotuner encountered an error message TunerError { // Autotuner error message string message = 1; } // Hardware error during operation message HardwareError { // Hardware error message string message = 1; } // Detailed state of a stopped or stopping miner. // // The same message is reused for both the `stopped` and `stopping` arms of // `MinerDetailedStatus.status` (a miner stops, and is shutting down, // for the same underlying reasons). The message type alone does not tell the // two phases apart: clients must look at which `status` arm is set to know // whether the miner is already stopped or still stopping. message StopReason { oneof reason { // Stopped with no additional context Unspecified unspecified = 1; // Application unavailable ApplicationUnavailable application_unavailable = 2; // Hardware detection failed UnsupportedHardware unsupported_hardware = 3; // All mining pools are unresponsive (or there is no pool configuration) DeadPools dead_pools = 4; // No valid BOS license MissingLicense missing_license = 5; // User-initiated pause UserPause user_pause = 6; // Paused due to thermal conditions ThermalPause thermal_pause = 7; // Dynamic Performance Scaling cooldown in progress DpsCooldown dps_cooldown = 8; // Autotuner encountered an error TunerError tuner_error = 9; // Hardware error during operation HardwareError hardware_error = 10; } } // Empty state used when a state has no additional context message Unspecified {} // Waiting for a startup delay message DelayedStart {} // Cooling down before start message CoolingDown {} // Ambient temperature too low, waiting before start message WaitingWhileCold {} // Hashboard defrosting in progress message Defrosting {} // State of a starting miner message StartReason { oneof reason { // Starting with no additional context Unspecified none = 1; // Waiting for a startup delay DelayedStart delayed_start = 2; // Cooling down before start CoolingDown cooling_down = 3; // Ambient temperature too low, waiting before start WaitingWhileCold waiting_while_cold = 4; // Hashboard defrosting in progress Defrosting defrosting = 5; } } // Mining normally at full performance message Normal {} // Mining at reduced performance while hashboards preheat to a stable temperature message Preheating {} // State of a running miner message RunReason { oneof reason { // Running normally Normal normal = 1; // Mining at reduced performance while hashboards preheat to a stable temperature Preheating preheating = 2; } } message GetMinerDetailsRequest {} message PsuInfo { // PSU hardware version identifier optional google.protobuf.UInt32Value version = 1; // PSU firmware version identifier optional google.protobuf.UInt32Value fw_version = 2; // PSU serial number (e.g. "DGAH335BDJDJG0782") optional string serial_number = 3; // PSU model/version name in human-readable form (e.g. "APW121215b") optional string model_name = 4; // Minimal voltage that can be set in volts optional braiins.bos.v1.Voltage min_voltage = 5; // Maximal voltage that can be set in volts optional braiins.bos.v1.Voltage max_voltage = 6; } // Structure to handle system details message GetMinerDetailsResponse { // Miner ID string uid = 1; // Miner identity MinerIdentity miner_identity = 2; // Miner platform Platform platform = 3; // BOS Mode BosMode bos_mode = 4; // OS Version BosVersion bos_version = 5; // Hostname string hostname = 6; // MAC address string mac_address = 7; // Deprecated: Use system_uptime_s uint64 system_uptime = 8 [deprecated = true]; // Miner hashrate declared by manufacturer braiins.bos.v1.GigaHashrate sticker_hashrate = 9; // Bosminer uptime. `0` means bosminer is not running uint64 bosminer_uptime_s = 10; // System uptime uint64 system_uptime_s = 11; // Miner status // Deprecated: Use detailed_status instead. MinerStatus status = 12 [deprecated = true]; // Kernel version string kernel_version = 13; // PSU details optional PsuInfo psu_info = 14; // Control board soc family ControlBoardSocFamily control_board_soc_family = 15; // Miner serial number optional string serial_number = 16; // Whether the miner has a PIC (Programmable Interrupt Controller) board optional bool is_pic_model = 17; // Detailed miner status MinerDetailedStatus detailed_status = 18; } message MinerPowerStats { // Miner approximated power consumption. braiins.bos.v1.Power approximated_consumption = 1; // Miner power efficiency braiins.bos.v1.PowerEfficiency efficiency = 2; } message GetMinerStatsRequest {} message GetMinerStatsResponse { // Aggregate pool statistic braiins.bos.v1.PoolStats pool_stats = 1; // Miner hashrate statistics braiins.bos.v1.WorkSolverStats miner_stats = 2; // Miner power stats MinerPowerStats power_stats = 3; } message GetErrorsRequest {} message GetErrorsResponse { // Array of errors repeated MinerError errors = 1; } // Structure to handle HB details message Hashboard { // Hashboard ID string id = 1; // Flag if HB is enabled bool enabled = 2; // Number of chips google.protobuf.UInt32Value chips_count = 3; // Current HB voltage in volts braiins.bos.v1.Voltage current_voltage = 4; // Current HB frequency in Hz braiins.bos.v1.Frequency current_frequency = 5; // Highest chip temperature braiins.bos.v1.TemperatureSensor highest_chip_temp = 6; // Board temperature braiins.bos.v1.Temperature board_temp = 7; // Hashboard stats braiins.bos.v1.WorkSolverStats stats = 8; // Hashboard model optional string model = 9; // Lowest inlet temperature braiins.bos.v1.Temperature lowest_inlet_temp = 10; // Highest outlet temperature braiins.bos.v1.Temperature highest_outlet_temp = 11; // Hashboard serial number optional string serial_number = 12; // Hashboard board name optional string board_name = 13; // Hashboard chip type optional string chip_type = 14; // Lowest water inlet temperature (hydro cooling only) optional braiins.bos.v1.Temperature lowest_water_inlet_temp = 15; // Highest water outlet temperature (hydro cooling only) optional braiins.bos.v1.Temperature highest_water_outlet_temp = 16; } // Enumeration for support archive format enum SupportArchiveFormat { SUPPORT_ARCHIVE_FORMAT_UNSPECIFIED = 0; // Compressed zip format SUPPORT_ARCHIVE_FORMAT_ZIP = 1; // BOS custom format SUPPORT_ARCHIVE_FORMAT_BOS = 2; // Compressed encrypted zip format SUPPORT_ARCHIVE_FORMAT_ZIP_ENCRYPTED = 3; } // Supported log types for download enum LogType { LOG_TYPE_UNSPECIFIED = 0; // Bosminer error logs LOG_TYPE_ERRORS = 1; // Bosminer logs LOG_TYPE_BOSMINER = 2; // Boser logs LOG_TYPE_BOSER = 3; // Monitor logs LOG_TYPE_MONITOR = 4; // System logs LOG_TYPE_SYSLOG = 5; // Kernel ring buffer (dmesg) LOG_TYPE_DMESG = 6; } message GetSupportArchiveRequest { // Support archive format. SupportArchiveFormat format = 1; } message GetSupportArchiveResponse { // Support archive data bytes chunk_data = 1; } message GetLogRequest { // Type of log to download LogType log_type = 1; } message GetLogResponse { // Log data chunk bytes chunk_data = 1; } message GetHashboardsRequest {} message GetHashboardsResponse { // All HB details repeated Hashboard hashboards = 1; } message EnableHashboardsRequest { // Save action braiins.bos.v1.SaveAction save_action = 1; // IDs of HB that should be enabled repeated string hashboard_ids = 2; } message EnableHashboardsResponse { // Hashboards enable state repeated HashboardEnableState hashboards = 1; } message DisableHashboardsRequest { // Save action braiins.bos.v1.SaveAction save_action = 1; // IDs of HB that should be disabled repeated string hashboard_ids = 2; } message DisableHashboardsResponse { // Hashboards disable state repeated HashboardEnableState hashboards = 1; } message HashboardEnableState { // Hashboard ID string id = 1; // Flag if hashboard is enabled or not bool is_enabled = 2; } service MinerService { // Method to fetch miner status // Deprecated: Use GetMinerDetailedStatus instead. rpc GetMinerStatus(GetMinerStatusRequest) returns (stream GetMinerStatusResponse) { option deprecated = true; } // Method to fetch detailed miner status. // Sends a message on every status change. rpc GetMinerDetailedStatus(GetMinerDetailedStatusRequest) returns (stream GetMinerDetailedStatusResponse); // Method to get miner details. rpc GetMinerDetails(GetMinerDetailsRequest) returns (GetMinerDetailsResponse); // Method to get aggregated miner stats. rpc GetMinerStats(GetMinerStatsRequest) returns (GetMinerStatsResponse); // Method to get miner errors rpc GetErrors(GetErrorsRequest) returns (GetErrorsResponse); // Method to get miner hashboards state and statistics. rpc GetHashboards(GetHashboardsRequest) returns (GetHashboardsResponse); // Method to download BOS support archive // Method returns stream of messages with binary chunks that needs to be concatenated on the caller side rpc GetSupportArchive(GetSupportArchiveRequest) returns (stream GetSupportArchiveResponse); // Method to download miner log file // Method returns stream of messages with binary chunks that needs to be concatenated on the caller side rpc GetLog(GetLogRequest) returns (stream GetLogResponse); // Method to enable hashboards rpc EnableHashboards(EnableHashboardsRequest) returns (EnableHashboardsResponse); // Method to disable hashboards rpc DisableHashboards(DisableHashboardsRequest) returns (DisableHashboardsResponse); }