All Downloads are FREE. Search and download functionalities are using the official Maven repository.

node.services.node_rpc.proto Maven / Gradle / Ivy

There is a newer version: 0.1.5
Show newest version
syntax = "proto3";
import "scalapb/scalapb.proto";
import "scalapb/validate.proto";



package org.plasmalabs.node.services;

import 'consensus/models/block_id.proto';
import 'consensus/models/block_header.proto';
import 'node/models/block.proto';
import 'node/models/node_config.proto';
import 'node/models/node_epochData.proto';
import 'sdk/models/identifier.proto';
import 'sdk/models/transaction/io_transaction.proto';

import "validate/validate.proto";
import 'google/protobuf/wrappers.proto';

service NodeRpc {
  // Submit a proven Transaction to the node
  rpc BroadcastTransaction (BroadcastTransactionReq) returns (BroadcastTransactionRes);
  // Read the contents of the node's mempool
  rpc CurrentMempool (CurrentMempoolReq) returns (CurrentMempoolRes);

  // Check the content of the node's mempool and return if a Transaction Id exists
  rpc CurrentMempoolContains (CurrentMempoolContainsReq) returns (CurrentMempoolContainsRes);

  // retrieve a Block Header by its ID
  rpc FetchBlockHeader (FetchBlockHeaderReq) returns (FetchBlockHeaderRes);

  // retrieve a Block Body by its ID
  rpc FetchBlockBody (FetchBlockBodyReq) returns (FetchBlockBodyRes);

  // retrieve a Transaction by its ID
  rpc FetchTransaction (FetchTransactionReq) returns (FetchTransactionRes);

  // retrieve the Block ID associated with a height, according to the node's canonical chain
  rpc FetchBlockIdAtHeight (FetchBlockIdAtHeightReq) returns (FetchBlockIdAtHeightRes);

  // retrieve the Block ID associated with a depth, according to the node's canonical chain
  rpc FetchBlockIdAtDepth (FetchBlockIdAtDepthReq) returns (FetchBlockIdAtDepthRes);

  // retrieve a stream of changes to the canonical head of the chain.
  rpc SynchronizationTraversal (SynchronizationTraversalReq) returns (stream SynchronizationTraversalRes);

  // retrieve a stream of node's protocol configuration
  rpc FetchNodeConfig (FetchNodeConfigReq) returns (stream FetchNodeConfigRes);

  // retrieve epoch data content
  rpc FetchEpochData (FetchEpochDataReq) returns (FetchEpochDataRes);
}

// Request type for BroadcastTransaction
message BroadcastTransactionReq {
  // A "proven" Transaction that is meant to be included in the blockchain
  org.plasmalabs.sdk.models.transaction.IoTransaction transaction = 1 [(validate.rules).message.required = true];
}

// Response type for BroadcastTransaction
message BroadcastTransactionRes {}

// Request type for CurrentMempool
message CurrentMempoolReq {}

// Response type for CurrentMempool
message CurrentMempoolRes {
  // A list of Transaction IDs that are currently in the node's mempool
  repeated org.plasmalabs.sdk.models.TransactionId transactionIds = 1;
}

// Request type for CurrentMempoolContainsReq
message CurrentMempoolContainsReq {
  org.plasmalabs.sdk.models.TransactionId transactionId = 1[(validate.rules).message.required = true];
}

// Response type for CurrentMempoolContainsRes
message CurrentMempoolContainsRes {
  // Predicate indicating if the Transaction ID is currently in the node's mempool
  bool inMempool = 1;
}

// Request type for FetchBlockHeader
message FetchBlockHeaderReq {
  // The ID of the block to retrieve
  org.plasmalabs.consensus.models.BlockId blockId = 1 [(validate.rules).message.required = true];
}

// Response type for FetchBlockHeader
message FetchBlockHeaderRes {
  // The Block Header associated with the requested ID.  None/null if not found.
  // optional
  org.plasmalabs.consensus.models.BlockHeader header = 1;
}

// Request type for FetchBlockBody
message FetchBlockBodyReq {
  // The ID of the block to retrieve
  org.plasmalabs.consensus.models.BlockId blockId = 1 [(validate.rules).message.required = true];
}

// Response type for FetchBlockBody
message FetchBlockBodyRes {
  // The Block Body associated with the requested ID.  None/null if not found.
  // optional
  org.plasmalabs.node.models.BlockBody body = 1;
}

// Request type for FetchTransaction
message FetchTransactionReq {
  org.plasmalabs.sdk.models.TransactionId transactionId = 1 [(validate.rules).message.required = true];
}

// Response type for FetchTransaction
message FetchTransactionRes {
  // The Transaction associated with the requested ID.  None/null if not found.
  // optional
  org.plasmalabs.sdk.models.transaction.IoTransaction transaction = 1;
}

// Request type for FetchBlockIdAtHeight
message FetchBlockIdAtHeightReq {
  // The height of interest
  uint64 height = 1;
}

// Response type for FetchBlockIdAtHeight
message FetchBlockIdAtHeightRes {
  // The Block ID associated with the requested height.  None/null if not found.
  // optional
  org.plasmalabs.consensus.models.BlockId blockId = 1;
}

// Request type for FetchBlockIdAtDepth
message FetchBlockIdAtDepthReq {
  // The depth of interest.  When depth=0, the canonical head is retrieved.
  uint64 depth = 1;
}

// Response type for FetchBlockIdAtDepth
message FetchBlockIdAtDepthRes {
  // The Block ID associated with the requested depth.  None/null if not found.
  // optional
  org.plasmalabs.consensus.models.BlockId blockId = 1;
}

// Request type for SynchronizationTraversal
message SynchronizationTraversalReq {}

// Response type for SynchronizationTraversal
message SynchronizationTraversalRes {
  oneof status {
    // Block ID applied
    org.plasmalabs.consensus.models.BlockId applied = 1;
    // Block ID unapplied
    org.plasmalabs.consensus.models.BlockId unapplied = 2;
  }
}

// Request type for FetchNodeConfigReq
message FetchNodeConfigReq {}

// Response type for FetchNodeConfigRes
message FetchNodeConfigRes {
  org.plasmalabs.proto.node.NodeConfig config = 1 [(validate.rules).message.required = true];
}

// Request type for FetchEpochDataReq
message FetchEpochDataReq {
  google.protobuf.UInt64Value epoch = 1;
}

// Response type for FetchEpochDataRes
message FetchEpochDataRes {
  org.plasmalabs.proto.node.EpochData epochData = 1;
}

option (scalapb.options) = {
  [scalapb.validate.file] {
    validate_at_construction: true
  }
  field_transformations: [
    {
      when: {options: {[validate.rules] {message: {required: true}}}}
      set: {
        [scalapb.field] {
          required: true
        }
      }
    }
  ]
};




© 2015 - 2025 Weber Informatics LLC | Privacy Policy