syntax = "proto3"; package inx; option go_package = "github.com/iotaledger/inx/go;inx"; service INX { // Node rpc ReadNodeStatus(NoParams) returns (NodeStatus); rpc ListenToNodeStatus(NodeStatusRequest) returns (stream NodeStatus); rpc ReadNodeConfiguration(NoParams) returns (NodeConfiguration); rpc ReadProtocolParameters(MilestoneRequest) returns (RawProtocolParameters); // Milestones rpc ReadMilestone(MilestoneRequest) returns (Milestone); rpc ListenToLatestMilestones(NoParams) returns (stream Milestone); rpc ListenToConfirmedMilestones(MilestoneRangeRequest) returns (stream MilestoneAndProtocolParameters); rpc ComputeWhiteFlag(WhiteFlagRequest) returns (WhiteFlagResponse); rpc ReadMilestoneCone(MilestoneRequest) returns (stream BlockWithMetadata); rpc ReadMilestoneConeMetadata(MilestoneRequest) returns (stream BlockMetadata); // Blocks rpc ListenToBlocks(NoParams) returns (stream Block); rpc ListenToSolidBlocks(NoParams) returns (stream BlockMetadata); rpc ListenToReferencedBlocks(NoParams) returns (stream BlockMetadata); rpc SubmitBlock(RawBlock) returns (BlockId); rpc ReadBlock(BlockId) returns (RawBlock); rpc ReadBlockMetadata(BlockId) returns (BlockMetadata); // Tips rpc RequestTips(TipsRequest) returns (TipsResponse); rpc ListenToTipsMetrics(TipsMetricRequest) returns (stream TipsMetric); rpc ListenToTipScoreUpdates(NoParams) returns (stream BlockMetadata); // UTXO rpc ReadUnspentOutputs(NoParams) returns (stream UnspentOutput); // A stream that yields updates to the ledger. A `LedgerUpdate` represents a batch to be applied to the ledger. // It first sends a `BEGIN`, then all the consumed outputs, then all the created outputs and finally an `END`. // `BEGIN` and `END` will also be sent for milestones that did not mutate the ledger. // The counts in the batch markers can be used to sanity check that everything arrived and to pre-allocate space if needed. rpc ListenToLedgerUpdates(MilestoneRangeRequest) returns (stream LedgerUpdate); rpc ListenToTreasuryUpdates(MilestoneRangeRequest) returns (stream TreasuryUpdate); rpc ReadOutput(OutputId) returns (OutputResponse); rpc ListenToMigrationReceipts(NoParams) returns (stream RawReceipt); // REST API rpc RegisterAPIRoute(APIRouteRequest) returns (NoParams); rpc UnregisterAPIRoute(APIRouteRequest) returns (NoParams); rpc PerformAPIRequest(APIRequest) returns (APIResponse); } message NoParams {} // Node message NodeConfiguration { uint32 milestone_public_key_count = 1; repeated MilestoneKeyRange milestone_key_ranges = 2; BaseToken base_token = 3; repeated uint32 supported_protocol_versions = 4; } message BaseToken { string name = 1; string ticker_symbol = 2; string unit = 3; string subunit = 4; uint32 decimals = 5; bool use_metric_prefix = 6; } message MilestoneKeyRange { bytes public_key = 1; uint32 start_index = 2; uint32 end_index = 3; } message NodeStatus { bool is_healthy = 1; bool is_synced = 2; bool is_almost_synced = 3; Milestone latest_milestone = 4; Milestone confirmed_milestone = 5; RawProtocolParameters current_protocol_parameters = 6; uint32 tangle_pruning_index = 7; uint32 milestones_pruning_index = 8; uint32 ledger_pruning_index = 9; uint32 ledger_index = 10; } message NodeStatusRequest { uint32 cooldown_in_milliseconds = 1; } message RawProtocolParameters { uint32 protocol_version = 1; bytes params = 2; } // Milestones message RawMilestone { bytes data = 1; } message MilestoneId { bytes id = 1; } message MilestoneRequest { uint32 milestone_index = 1; MilestoneId milestone_id = 2; } message MilestoneRangeRequest { // start_milestone_index is the initial milestone to get. Use 0 to start from the current node status. uint32 start_milestone_index = 1; // end_milestone_index is the last milestone to get (inclusive). Use 0 to keep getting new confirmed milestones. uint32 end_milestone_index = 2; } message MilestoneInfo { // Optional. This field can be missing for example if there are no milestones yet in a network. MilestoneId milestone_id = 1; uint32 milestone_index = 2; // Optional. This field can be missing for example if there are no milestones yet in a network. uint32 milestone_timestamp = 3; } message Milestone { MilestoneInfo milestone_info = 1; // Optional. This field can be missing for example if there are no milestones yet in a network. RawMilestone milestone = 2; } message MilestoneAndProtocolParameters { Milestone milestone = 1; RawProtocolParameters current_protocol_parameters = 2; } message WhiteFlagRequest { uint32 milestone_index = 1; uint32 milestone_timestamp = 2; repeated BlockId parents = 3; MilestoneId previous_milestone_id = 4; } message WhiteFlagResponse { bytes milestone_inclusion_merkle_root = 1; bytes milestone_applied_merkle_root = 2; } // Blocks message RawBlock { bytes data = 1; } message BlockId { bytes id = 1; } message Block { BlockId block_id = 1; RawBlock block = 2; } message BlockWithMetadata { BlockMetadata metadata = 1; RawBlock block = 2; } message BlockMetadata { BlockId block_id = 1; repeated BlockId parents = 2; bool solid = 3; bool should_promote = 4; bool should_reattach = 5; uint32 referenced_by_milestone_index = 6; uint32 milestone_index = 7; enum LedgerInclusionState { LEDGER_INCLUSION_STATE_NO_TRANSACTION = 0; LEDGER_INCLUSION_STATE_INCLUDED = 1; LEDGER_INCLUSION_STATE_CONFLICTING = 2; } LedgerInclusionState ledger_inclusion_state = 8; enum ConflictReason { CONFLICT_REASON_NONE = 0; CONFLICT_REASON_INPUT_ALREADY_SPENT = 1; CONFLICT_REASON_INPUT_ALREADY_SPENT_IN_THIS_MILESTONE = 2; CONFLICT_REASON_INPUT_NOT_FOUND = 3; CONFLICT_REASON_INPUT_OUTPUT_SUM_MISMATCH = 4; CONFLICT_REASON_INVALID_SIGNATURE = 5; CONFLICT_REASON_TIMELOCK_NOT_EXPIRED = 6; CONFLICT_REASON_INVALID_NATIVE_TOKENS = 7; CONFLICT_REASON_RETURN_AMOUNT_NOT_FULFILLED = 8; CONFLICT_REASON_INVALID_INPUT_UNLOCK = 9; CONFLICT_REASON_INVALID_INPUTS_COMMITMENT = 10; CONFLICT_REASON_INVALID_SENDER = 11; CONFLICT_REASON_INVALID_CHAIN_STATE_TRANSITION = 12; CONFLICT_REASON_SEMANTIC_VALIDATION_FAILED = 255; } ConflictReason conflict_reason = 9; uint32 white_flag_index = 10; } // Tips message TipsRequest { uint32 count = 1; bool allow_semiLazy = 2; } message TipsResponse { repeated BlockId tips = 1; } message TipsMetricRequest { uint32 interval_in_milliseconds = 1; } message TipsMetric { uint32 non_lazy_pool_size = 1; uint32 semi_lazy_pool_size = 2; } // UTXO message TransactionId { bytes id = 1; } message OutputId { bytes id = 1; } message OutputResponse { uint32 ledger_index = 1; oneof payload { LedgerOutput output = 2; LedgerSpent spent = 3; } } message UnspentOutput { uint32 ledgerIndex = 1; LedgerOutput output = 2; } message RawOutput { bytes data = 1; } message LedgerOutput { OutputId output_id = 1; BlockId blockId = 2; uint32 milestone_index_booked = 3; uint32 milestone_timestamp_booked = 4; RawOutput output = 5; } message LedgerSpent { LedgerOutput output = 1; TransactionId transaction_id_spent = 2; uint32 milestone_index_spent = 3; uint32 milestone_timestamp_spent = 4; } message TreasuryOutput { MilestoneId milestone_id = 1; uint64 amount = 2; } message LedgerUpdate { message Marker { uint32 milestone_index = 1; enum MarkerType { BEGIN = 0; END = 1; } MarkerType marker_type = 2; uint32 consumed_count = 3; uint32 created_count = 4; } oneof op { Marker batch_marker = 1; LedgerSpent consumed = 2; LedgerOutput created = 3; } } message TreasuryUpdate { uint32 milestone_index = 1; TreasuryOutput created = 2; TreasuryOutput consumed = 3; } message RawReceipt { bytes data = 1; } // REST API message APIRouteRequest { string route = 1; string host = 2; uint32 port = 3; } message APIRequest { string method = 1; string path = 2; map headers = 3; bytes body = 4; } message APIResponse { uint32 code = 1; map headers = 2; bytes body = 3; }