syntax = "proto3";

package ring.v1;
import "google/protobuf/field_mask.proto";
import "google/protobuf/timestamp.proto";
import "nebula/v1/resource.proto";

message NodeVersionRequest { }

message NodeVersionResponse {
  bytes version = 1;
}

message Sha3Request {
  // data need to caculate sha3.
  bytes data = 1;
}

message Sha3Response {
  // 
  bytes hash = 1;
}

message NetVersionRequest { }

message NetVersionResponse {
  bytes version = 1;
}

message NetPeerCountRequest { }

message NetPeerCountResponse {
  uint32 peer_count = 1;
}

message ProtocolVersionRequest { }

message ProtocolVersionResponse {
  bytes version = 1;
}

message SyncingRequest { }

message SyncingResponse {
  bytes start = 1;
  bytes end = 2;
  bytes current = 3;
}

message CoinbaseRequest { }

message CoinbaseResponse {
  bytes address = 1;
}

message MiningRequest { }

message MiningResponse {
  string status = 1;
}

message HashRateRequest { }

message HashRateResponse {
  string result = 1;
}

message GasPriceRequest { }

message GasPriceResponse {
  // gas price in wei.
  bytes gas_price = 1;
}

message AccountsRequest { }

message AccountsResponse {
  repeated bytes address = 1;
}

message HeightRequest { }

message HeightResponse {
  bytes height = 1;
}

message BalanceRequest {
  // request address
  bytes address = 1;
  // request block number
  bytes block_id = 2;
}

message BalanceResponse {
  // the address
  bytes address = 1;
  // block height
  bytes block_id = 2;
  // balance
  bytes balance = 3;
}

message StorageRequest {
  bytes address = 1;
  bytes block_id = 2;
  bytes position = 3;
}

message StorageResponse {
  bytes address = 1;
  bytes block_id = 2;
  bytes position = 3;
  bytes data = 4;
}

message NonceRequest {
  // request address
 bytes address = 1;
  // request block number
  bytes block_id = 2;
}

message NonceResponse {
  // the address
  bytes address = 1;
  // block height
  bytes block_id = 2;
  // nonce
  bytes nonce = 3;
}


message RepeatedNonceRequest {
  // request address
  repeated bytes address = 1;
  // request block number
  repeated bytes block_id = 2;
}

message RepeatedNonceResponse {
  // the address
  repeated bytes address = 1;
  // block height
  repeated bytes block_id = 2;
  // nonce
  repeated bytes nonce = 3;
}



message TransactionCountRequest {
  // request address
  bytes address = 1;
  // request block number
  bytes block_id = 2;
}

message TransactionCountResponse {
  // the address
  bytes address = 1;
  // block height
  bytes block_id = 2;
  // count
  bytes count = 3;
}

message BlockTransactionCountByHashRequest {
  bytes block_hash = 1;
}

message BlockTransactionCountByHashResponse {
  bytes block_hash = 1;
  uint32 count = 2;
}

message BlockTransactionCountByNumberRequest {
  bytes block_id = 1;
}

message BlockTransactionCountByNumberResponse {
  bytes block_id = 1;
  uint32 count = 2;
}

message UncleCountByHashRequest {
  bytes block_hash = 1;
}

message UncleCountByHashResponse {
  bytes  block_hash = 1;
  uint32 count = 2;
}

message UncleCountByNumberRequest {
  bytes block_id = 1;
}

message UncleCountByNumberResponse {
  bytes  block_id = 1;
  uint32 count = 2;
}

message GetCodeRequest {
  bytes address = 1;
  bytes block_id = 2;
}

message GetCodeResponse {
  bytes address = 1;
  bytes block_id = 2;
  bytes code = 3;
}

message SignRequest {
  bytes address = 1;
  bytes data = 2;
}

message SignResponse {
  bytes signature = 1;
}

message SignTransactionRequest {
  bytes address = 1;
  bytes tx_data = 2;
  bytes method  = 3;

}
message SignTransactionResponse {
  bytes signed_tx = 1;
}

message SendTransactionRequest {
  bytes address = 1;
  bytes tx_data = 2;
}
message SendTransactionResponse {
  bytes tx_hash = 1;
}

message SendRawTransactionRequest {
  bytes signed_tx = 1;
}

message SendRawTransactionResponse {
  bytes tx_hash = 1;
}

message CallRequest {
  bytes signed_tx = 1;
}

message CallResponse {
  bytes result = 1;
}

message EstimateGasRequest {
  bytes signed_tx = 1;
}

message EstimateGasResponse {
  bytes result = 1;
  uint32 gas = 2;

}

message BlockByHashRequest {
  bytes block_hash = 1;
}

message BlockByHashResponse {
  bytes block = 1;
}

message BlockByNumberRequest {
  bytes block_id = 1;

}

message BlockByNumberResponse {
  bytes block = 1;
}

message TransactionByHashRequest {
  bytes tx_hash = 1;
}

message TransactionByHashResponse {
  bytes tx_data = 1;
}

message TransactionByBlockHashAndIndexRequest {
  bytes block_hash = 1;
  uint32 index = 2;
}

message TransactionByBlockHashAndIndexResponse {
  bytes tx_data = 1;
}

message TransactionByBlockNumberAndIndexRequest {
  bytes block_id = 1;
  uint32 index = 2;
}

message TransactionByBlockNumberAndIndexResponse {
  bytes tx_data = 1;
}

message TransactionReceiptRequest {
  bytes tx_hash = 1;
}

message TransactionReceiptResponse {
  bytes tx_receipt = 1;
}

message UncleByBlockHashAndIndexRequest {
  bytes block_hash = 1;
  uint32 index = 2;
}

message UncleByBlockHashAndIndexResponse {
  bytes uncle_block = 1;
}

message UncleByBlockNumberAndIndexRequest {
  bytes block_id = 1;
  uint32 index = 2;
}

message UncleByBlockNumberAndIndexResponse {
  bytes uncle_block = 1;
}

message CompilersRequest {
}

message CompilersResponse {
  bytes compilers = 1;
}

message CompileSolidityRequest {
  bytes source = 1;
}

message CompileSolidityResponse {
  bytes code = 1;
}

message CompileLLLRequest {
  bytes source = 1;
}

message CompileLLLResponse {
  bytes code = 1;
}

message CompileSerpentRequest {
  bytes source = 1;
}

message CompileSerpentResponse {
  bytes code = 1;
}

message NewFilterRequest {
  bytes param = 1;
}

message NewFilterResponse {
  bytes filter_id = 1;
}

message NewBlockFilterRequest { }

message NewBlockFilterResponse {
  bytes filter_id = 1;
}

message PendingTransactionFilterRequest { }

message PendingTransactionFilterResponse {
  bytes filter_id = 1;
}

message UninstallFilterRequest {
  bytes filter_id = 1;
}

message UninstallFilterResponse {
  bool result = 1;
}

message FilterChangesRequest {
  bytes filter_id = 1;
}

message FilterChangesResponse {
  bytes info = 1;
}

message FilterLogsRequest {
  bytes filter_id = 1;
}

message FilterLogsResponse {
  bytes logs = 1;
}

message LogsRequest {
  bytes param = 1;
}

message LogsResponse {
  bytes logs = 1;
}