github.com/prysmaticlabs/prysm@v1.4.4/proto/eth/v1alpha1/node.proto (about) 1 // Copyright 2020 Prysmatic Labs. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 syntax = "proto3"; 15 16 package ethereum.eth.v1alpha1; 17 18 import "google/api/annotations.proto"; 19 import "google/protobuf/empty.proto"; 20 import "google/protobuf/timestamp.proto"; 21 22 import "proto/eth/ext/options.proto"; 23 24 option csharp_namespace = "Ethereum.Eth.v1alpha1"; 25 option go_package = "github.com/prysmaticlabs/prysm/proto/eth/v1alpha1;eth"; 26 option java_multiple_files = true; 27 option java_outer_classname = "NodeProto"; 28 option java_package = "org.ethereum.eth.v1alpha1"; 29 option php_namespace = "Ethereum\\Eth\\v1alpha1"; 30 31 // Node service API 32 // 33 // Node service provides general information about the node itself, the services 34 // it supports, chain information and node version. 35 service Node { 36 // Retrieve the current network sync status of the node. 37 rpc GetSyncStatus(google.protobuf.Empty) returns (SyncStatus) { 38 option (google.api.http) = { 39 get: "/eth/v1alpha1/node/syncing" 40 }; 41 } 42 43 // Retrieve information about the genesis of Ethereum proof of stake. 44 rpc GetGenesis(google.protobuf.Empty) returns (Genesis) { 45 option (google.api.http) = { 46 get: "/eth/v1alpha1/node/genesis" 47 }; 48 } 49 50 // Retrieve information about the running Ethereum Beacon Node. 51 rpc GetVersion(google.protobuf.Empty) returns (Version) { 52 option (google.api.http) = { 53 get: "/eth/v1alpha1/node/version" 54 }; 55 } 56 57 // Retrieve the list of services implemented and enabled by this node. 58 // 59 // Any service not present in this list may return UNIMPLEMENTED or 60 // PERMISSION_DENIED. The server may also support fetching services by grpc 61 // reflection. 62 rpc ListImplementedServices(google.protobuf.Empty) returns (ImplementedServices) { 63 option (google.api.http) = { 64 get: "/eth/v1alpha1/node/services" 65 }; 66 } 67 68 // Retrieves the peer data of the local peer. 69 rpc GetHost(google.protobuf.Empty) returns (HostData) { 70 option (google.api.http) = { 71 get: "/eth/v1alpha1/node/p2p" 72 }; 73 } 74 75 // Retrieve the peer corresponding to the provided peer id. 76 rpc GetPeer(PeerRequest) returns (Peer) { 77 option (google.api.http) = { 78 get: "/eth/v1alpha1/node/peer" 79 }; 80 } 81 82 // Retrieve the list of peers currently connected to this node. 83 rpc ListPeers(google.protobuf.Empty) returns (Peers) { 84 option (google.api.http) = { 85 get: "/eth/v1alpha1/node/peers" 86 }; 87 } 88 } 89 90 // Information about the current network sync status of the node. 91 message SyncStatus { 92 // Whether or not the node is currently syncing. 93 bool syncing = 1; 94 } 95 96 // Information about the genesis of Ethereum proof of stake. 97 message Genesis { 98 // UTC time specified in the chain start event in the deposit contract. 99 google.protobuf.Timestamp genesis_time = 1; 100 101 // Address of the deposit contract in the Ethereum 1 chain. 102 bytes deposit_contract_address = 2; 103 104 // Root of the genesis validators deposits; used for domain separation 105 // when signing data structures for this chain. 106 bytes genesis_validators_root = 3 [(ethereum.eth.ext.ssz_size) = "32"]; 107 } 108 109 // Information about the node version. 110 message Version { 111 // A string that uniquely identifies the node and its version. 112 string version = 1; 113 114 // Additional metadata that the node would like to provide. This field may 115 // be used to list any meaningful data to the client. 116 string metadata = 2; 117 } 118 119 message ImplementedServices { 120 repeated string services = 1; 121 } 122 123 message PeerRequest { 124 // Peer id of the peer requested. 125 string peer_id = 1; 126 } 127 128 // Peers is a list of peer messages. 129 message Peers { 130 repeated Peer peers = 1; 131 } 132 133 // Peer provides details of a peer on the network. 134 message Peer { 135 // The address of the peer, as a full multiaddr, for example: 136 // /ip4/37.221.192.134/tcp/13000/p2p/16Uiu2HAm8maLMjag1TAUM52zPfmLbVMGFdwUAWgoHu1HDQLR6e17 137 string address = 1; 138 // The direction of the connection (inbound/outbound). 139 PeerDirection direction = 2; 140 // The connection state of the peer at the moment of the request. (e.g. Connecting) 141 ConnectionState connection_state = 3; 142 // The peer id of the peer. 143 string peer_id = 4; 144 // The latest ENR of the peer that's in the record. 145 string enr = 5; 146 } 147 148 // P2P Data on the local host. 149 message HostData{ 150 // All the multiaddress of the peer, specified as a full multiaddr, for example: 151 // /ip4/37.221.192.134/tcp/13000/p2p/16Uiu2HAm8maLMjag1TAUM52zPfmLbVMGFdwUAWgoHu1HDQLR6e17 152 repeated string addresses = 1; 153 // The peer id of the peer. 154 string peer_id = 2; 155 // The latest ENR of the local peer. 156 string enr = 3; 157 } 158 159 // PeerDirection states the direction of the connection to a peer. 160 enum PeerDirection { 161 UNKNOWN = 0; 162 INBOUND = 1; 163 OUTBOUND = 2; 164 } 165 166 // ConnectionState states the current status of the peer. 167 enum ConnectionState { 168 DISCONNECTED = 0; 169 DISCONNECTING = 1; 170 CONNECTED = 2; 171 CONNECTING = 3; 172 }