Commit 32ddad93 authored by jim's avatar jim

add verify signature, checktx, eth proto

parent 43d405c6
...@@ -7,43 +7,6 @@ import "google/protobuf/field_mask.proto"; ...@@ -7,43 +7,6 @@ import "google/protobuf/field_mask.proto";
import "google/protobuf/timestamp.proto"; import "google/protobuf/timestamp.proto";
import "meta/crypter/v1/resource.proto"; import "meta/crypter/v1/resource.proto";
message SignRequest {
string id = 1;
bytes privk = 2;
bytes data = 3;
CryptType crypt_type = 4;
}
message SignResponse {
string id = 1;
bytes signature = 2;
}
message VerifyRequest {
string id = 1;
bytes pubkey = 2;
bytes signature = 3;
CryptType crypt_type = 4;
}
message VerifyResponse {
string id = 1;
bool verified = 2;
}
message RecoverRequest {
string id = 1;
bytes data = 2;
bytes signature = 3;
CryptType crypt_type = 4;
}
message RecoverResponse {
string id = 1;
bytes pubkey = 2;
}
message BatchSignRequest { message BatchSignRequest {
...@@ -67,7 +30,7 @@ message BatchVerifyRequest { ...@@ -67,7 +30,7 @@ message BatchVerifyRequest {
message BatchVerifyResponse { message BatchVerifyResponse {
string id = 1; string id = 1;
repeated bool verified = 2; repeated bytes from = 2;
} }
......
...@@ -6,9 +6,9 @@ option go_package = "crypterv1"; ...@@ -6,9 +6,9 @@ option go_package = "crypterv1";
import "meta/crypter/v1/request_response.proto"; import "meta/crypter/v1/request_response.proto";
service CrypterService { service CrypterService {
rpc Sign(SignRequest) returns (SignResponse) {} // rpc Sign(SignRequest) returns (SignResponse) {}
rpc Verify(VerifyRequest) returns (VerifyResponse) {} // rpc Verify(VerifyRequest) returns (VerifyResponse) {}
rpc Recover(RecoverRequest) returns (RecoverResponse) {} // rpc Recover(RecoverRequest) returns (RecoverResponse) {}
rpc BatchSign(BatchSignRequest) returns (BatchSignResponse) {} rpc BatchSign(BatchSignRequest) returns (BatchSignResponse) {}
rpc BatchVerify(BatchVerifyRequest) returns (BatchVerifyResponse) {} rpc BatchVerify(BatchVerifyRequest) returns (BatchVerifyResponse) {}
rpc BatchRecover(BatchRecoverRequest) returns (BatchRecoverResponse) {} rpc BatchRecover(BatchRecoverRequest) returns (BatchRecoverResponse) {}
......
##############################################################################
# Common
##############################################################################
load("@rules_proto//proto:defs.bzl", "proto_library")
load("@rules_java//java:defs.bzl", "java_proto_library")
proto_library(
name = "proto",
srcs = [
"options.proto",
],
visibility = ["//visibility:public"],
deps = [
"@com_google_protobuf//:descriptor_proto",
"@com_google_protobuf//:empty_proto",
],
)
##############################################################################
# Go
##############################################################################
load("@io_bazel_rules_go//go:def.bzl", "go_library")
load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
load("//tools:ssz.bzl", "SSZ_DEPS", "ssz_gen_marshal")
go_proto_library(
name = "go_proto",
compilers = [
"@com_github_prysmaticlabs_protoc_gen_go_cast//:go_cast",
],
importpath = "github.com/prysmaticlabs/ethereumapis/eth/ext",
proto = ":proto",
visibility = ["//visibility:public"],
deps = [
"@io_bazel_rules_go//proto/wkt:descriptor_go_proto",
"@com_github_golang_protobuf//proto:go_default_library",
"@org_golang_google_protobuf//types/descriptorpb:go_default_library",
"@go_googleapis//google/api:annotations_go_proto",
"@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
"@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
],
)
go_library(
name = "go_default_library",
embed = [":go_proto"],
importpath = "github.com/prysmaticlabs/ethereumapis/eth/ext",
visibility = ["//visibility:public"],
deps = SSZ_DEPS + [
"@io_bazel_rules_go//proto/wkt:empty_go_proto",
"@io_bazel_rules_go//proto/wkt:descriptor_go_proto",
"@com_github_golang_protobuf//proto:go_default_library",
"@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
"@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
], # keep
)
##############################################################################
# Java
##############################################################################
java_proto_library(
name = "java_proto",
deps = [":proto"],
)
// Copyright 2020 Prysmatic Labs.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package ethereum.eth.ext;
import "google/protobuf/descriptor.proto";
option csharp_namespace = "Ethereum.Eth.ext";
option go_package = "github.com/prysmaticlabs/prysm/v3/proto/eth/ext";
option java_multiple_files = true;
option java_outer_classname = "OptionsProto";
option java_package = "org.ethereum.eth.ext";
option php_namespace = "Ethereum\\Eth\\ext";
extend google.protobuf.FieldOptions {
string cast_type = 50000;
string ssz_size = 50001;
string ssz_max = 50002;
string spec_name = 50003;
}
\ No newline at end of file
This diff is collapsed.
// Copyright 2020 Prysmatic Labs.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package ethereum.eth.service;
import "google/api/annotations.proto";
import "google/protobuf/descriptor.proto";
import "google/protobuf/empty.proto";
import "eth/v1/beacon_chain.proto";
import "eth/v1/beacon_state.proto";
import "eth/v2/beacon_state.proto";
import "eth/v2/ssz.proto";
option csharp_namespace = "Ethereum.Eth.Service";
option go_package = "github.com/prysmaticlabs/prysm/v3/proto/eth/service";
option java_multiple_files = true;
option java_outer_classname = "BeaconDebugServiceProto";
option java_package = "org.ethereum.eth.service";
option php_namespace = "Ethereum\\Eth\\Service";
// Beacon chain debug API
//
// The beacon chain debug API is a set of endpoints to debug chain and shouldn't be exposed publicly.
//
// This service is defined in the upstream Ethereum consensus APIs repository (beacon-apis/apis/debug).
service BeaconDebug {
// GetBeaconStateSSZ returns the SSZ-serialized version of the full BeaconState object for given stateId.
//
// Spec: https://ethereum.github.io/beacon-APIs/?urls.primaryName=v2.3.0#/Debug/getState
rpc GetBeaconStateSSZ(v1.StateRequest) returns (v2.SSZContainer) {
option (google.api.http) = {
get: "/internal/eth/v1/debug/beacon/states/{state_id}/ssz"
};
}
// GetBeaconStateV2 returns full BeaconState object for given stateId.
//
// Spec: https://ethereum.github.io/beacon-APIs/?urls.primaryName=v2.3.0#/Debug/getStateV2
rpc GetBeaconStateV2(v2.BeaconStateRequestV2) returns (v2.BeaconStateResponseV2) {
option (google.api.http) = {
get: "/internal/eth/v2/debug/beacon/states/{state_id}"
};
}
// GetBeaconStateSSZV2 returns the SSZ-serialized version of the full BeaconState object for given stateId.
//
// Spec: https://ethereum.github.io/beacon-APIs/?urls.primaryName=v2.3.0#/Debug/getStateV2
rpc GetBeaconStateSSZV2(v2.BeaconStateRequestV2) returns (v2.SSZContainer) {
option (google.api.http) = {
get: "/internal/eth/v2/debug/beacon/states/{state_id}/ssz"
};
}
// ListForkChoiceHeadsV2 retrieves all possible chain heads (leaves of fork choice tree).
//
// Spec: https://ethereum.github.io/beacon-APIs/?urls.primaryName=v2.3.0#/Debug/getDebugChainHeadsV2
rpc ListForkChoiceHeadsV2(google.protobuf.Empty) returns (v2.ForkChoiceHeadsResponse) {
option (google.api.http) = {
get: "/internal/eth/v2/debug/beacon/heads"
};
}
// GetForkChoice returns a dump fork choice store.
//
// This function is not a part of the official Beacon APIs.
rpc GetForkChoice(google.protobuf.Empty) returns (v1.ForkChoiceResponse) {
option (google.api.http) = {
get: "/internal/eth/v1/debug/beacon/forkchoice"
};
}
}
\ No newline at end of file
// Copyright 2020 Prysmatic Labs.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package ethereum.eth.service;
import "google/api/annotations.proto";
import "google/protobuf/descriptor.proto";
import "eth/v1/events.proto";
import "proto/gateway/event_source.proto";
option csharp_namespace = "Ethereum.Eth.Service";
option go_package = "github.com/prysmaticlabs/prysm/v3/proto/eth/service";
option java_multiple_files = true;
option java_outer_classname = "EventsServiceProto";
option java_package = "org.ethereum.eth.service";
option php_namespace = "Ethereum\\Eth\\Service";
// Events API
//
// This service is defined in the upstream Ethereum consensus APIs repository (beacon-apis/apis/debug).
service Events {
// Provides endpoint to subscribe to beacon node Server-Sent-Events stream. Consumers should use eventsource implementation to listen on those events.
// Servers may send SSE comments beginning with : for any purpose, including to keep the event stream connection alive in the presence of proxy servers.
//
// Spec: https://ethereum.github.io/beacon-APIs/?urls.primaryName=v2.3.0#/Events/eventstream
rpc StreamEvents(v1.StreamEventsRequest) returns (stream gateway.EventSource) {
option (google.api.http) = {
get: "/internal/eth/v1/events"
};
}
}
This diff is collapsed.
// Copyright 2020 Prysmatic Labs.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package ethereum.eth.service;
import "google/api/annotations.proto";
import "google/protobuf/descriptor.proto";
import "google/protobuf/empty.proto";
import "eth/v1/node.proto";
option csharp_namespace = "Ethereum.Eth.Service";
option go_package = "github.com/prysmaticlabs/prysm/v3/proto/eth/service";
option java_multiple_files = true;
option java_outer_classname = "NodeServiceProto";
option java_package = "org.ethereum.eth.service";
option php_namespace = "Ethereum\\Eth\\Service";
// Beacon chain node API
//
// The beacon chain node API is a set of endpoints to query node information.
service BeaconNode {
// GetIdentity retrieves data about the node's network presence.
//
// Spec: https://ethereum.github.io/beacon-APIs/?urls.primaryName=v2.3.0#/Node/getNetworkIdentity
rpc GetIdentity(google.protobuf.Empty) returns (v1.IdentityResponse) {
option (google.api.http) = {get: "/internal/eth/v1/node/identity"};
}
// ListPeers retrieves data about the node's network peers.
//
// Spec: https://ethereum.github.io/beacon-APIs/?urls.primaryName=v2.3.0#/Node/getPeers
rpc ListPeers(v1.PeersRequest) returns (v1.PeersResponse) {
option (google.api.http) = {get: "/internal/eth/v1/node/peers"};
}
// GetPeer retrieves data about the given peer.
//
// Spec: https://ethereum.github.io/beacon-APIs/?urls.primaryName=v2.3.0#/Node/getPeer
rpc GetPeer(v1.PeerRequest) returns (v1.PeerResponse) {
option (google.api.http) = {get: "/internal/eth/v1/node/peers/{peer_id}"};
}
// PeerCount retrieves number of known peers.
//
// Spec: https://ethereum.github.io/beacon-APIs/?urls.primaryName=v2.3.0#/Node/getPeerCount
rpc PeerCount(google.protobuf.Empty) returns (v1.PeerCountResponse) {
option (google.api.http) = {get: "/internal/eth/v1/node/peer_count"};
}
// GetSyncStatus requests the beacon node to describe if it's currently syncing or not, and
// if it is, what block it is up to.
//
// Spec: https://ethereum.github.io/beacon-APIs/?urls.primaryName=v2.3.0#/Node/getSyncingStatus
rpc GetSyncStatus(google.protobuf.Empty) returns (v1.SyncingResponse) {
option (google.api.http) = {get: "/internal/eth/v1/node/syncing"};
}
// GetVersion requests that the beacon node identify information about its implementation in a
// format similar to a HTTP User-Agent field.
//
// Spec: https://ethereum.github.io/beacon-APIs/?urls.primaryName=v2.3.0#/Node/getNodeVersion
rpc GetVersion(google.protobuf.Empty) returns (v1.VersionResponse) {
option (google.api.http) = {get: "/internal/eth/v1/node/version"};
}
// GetHealth returns node health status in http status codes. Useful for load balancers.
// Response Usage:
// "200":
// description: Node is ready
// "206":
// description: Node is syncing but can serve incomplete data
// "503":
// description: Node not initialized or having issues
//
// Spec: https://ethereum.github.io/beacon-APIs/?urls.primaryName=v2.3.0#/Node/getHealth
rpc GetHealth(google.protobuf.Empty) returns (google.protobuf.Empty) {
option (google.api.http) = {get: "/internal/eth/v1/node/health"};
}
}
This diff is collapsed.
##############################################################################
# Common
##############################################################################
load("@rules_proto//proto:defs.bzl", "proto_library")
load("@rules_java//java:defs.bzl", "java_proto_library")
proto_library(
name = "proto",
srcs = [
"attestation.proto",
"beacon_block.proto",
"beacon_chain_service.proto",
"beacon_debug_service.proto",
"beacon_state.proto",
"node.proto",
"events.proto",
"validator.proto",
"validator_service.proto",
],
visibility = ["//visibility:public"],
deps = [
"//eth/ext:proto",
"@com_google_protobuf//:descriptor_proto",
"@com_google_protobuf//:empty_proto",
"@com_google_protobuf//:timestamp_proto",
"@go_googleapis//google/api:annotations_proto",
"@com_github_grpc_ecosystem_grpc_gateway_v2//proto/gateway:event_source_proto",
],
)
##############################################################################
# Go
##############################################################################
load("@io_bazel_rules_go//go:def.bzl", "go_library")
load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
load("//tools:ssz.bzl", "SSZ_DEPS", "ssz_gen_marshal")
ssz_gen_marshal(
name = "ssz_generated_files",
go_proto = ":go_proto",
includes = [
"@com_github_prysmaticlabs_eth2_types//:go_default_library",
],
objs = [
"AggregateAttestationAndProof",
"Attestation",
"AttestationData",
"AttesterSlashing",
"BeaconBlock",
"BeaconBlockV1",
"BeaconBlockHeader",
"BeaconBlockBodyV1",
"Checkpoint",
"Deposit",
"DepositData",
"Eth1Data",
"IndexedAttestation",
"ProposerSlashing",
"SignedAggregateAttestationAndProof",
"SignedBeaconBlock",
"SignedBeaconBlockV1",
"SignedBeaconBlockHeader",
"SignedVoluntaryExit",
"Validator",
"VoluntaryExit",
],
)
go_proto_library(
name = "go_proto",
compilers = [
"@com_github_prysmaticlabs_protoc_gen_go_cast//:go_cast_grpc",
],
importpath = "github.com/prysmaticlabs/ethereumapis/eth/v1",
proto = ":proto",
visibility = ["//visibility:public"],
deps = [
"//eth/ext:go_default_library",
"@io_bazel_rules_go//proto/wkt:descriptor_go_proto",
"@com_github_golang_protobuf//proto:go_default_library",
"@io_bazel_rules_go//proto/wkt:empty_go_proto",
"@io_bazel_rules_go//proto/wkt:timestamp_go_proto",
"@com_github_prysmaticlabs_go_bitfield//:go_default_library", # keep
"@com_github_prysmaticlabs_eth2_types//:go_default_library",
"@go_googleapis//google/api:annotations_go_proto",
"@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
"@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
"@org_golang_google_protobuf//types/descriptorpb:go_default_library",
"@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
"@com_github_grpc_ecosystem_grpc_gateway_v2//proto/gateway:event_source_go_proto",
],
)
go_proto_library(
name = "go_grpc_gateway_library",
compilers = [
"@com_github_grpc_ecosystem_grpc_gateway_v2//protoc-gen-grpc-gateway:go_gen_grpc_gateway",
],
embed = [":go_proto"],
importpath = "github.com/prysmaticlabs/ethereumapis/eth/v1",
protos = [":proto"],
visibility = ["//visibility:private"],
deps = [
"//eth/ext:go_default_library",
"@io_bazel_rules_go//proto/wkt:empty_go_proto",
"@com_github_grpc_ecosystem_grpc_gateway_v2//protoc-gen-openapiv2/options:options_go_proto",
"@com_github_grpc_ecosystem_grpc_gateway_v2//proto/gateway:event_source_go_proto",
"@com_github_prysmaticlabs_go_bitfield//:go_default_library",
"@go_googleapis//google/api:annotations_go_proto",
"@io_bazel_rules_go//proto/wkt:timestamp_go_proto",
"@io_bazel_rules_go//proto/wkt:descriptor_go_proto",
],
)
go_library(
name = "go_default_library",
srcs = [
":ssz_generated_files", # keep
],
embed = [
":go_grpc_gateway_library",
],
importpath = "github.com/prysmaticlabs/ethereumapis/eth/v1",
visibility = ["//visibility:public"],
deps = SSZ_DEPS + [
"//eth/ext:go_default_library",
"@com_github_grpc_ecosystem_grpc_gateway_v2//runtime:go_default_library",
"@com_github_grpc_ecosystem_grpc_gateway_v2//utilities:go_default_library",
"@io_bazel_rules_go//proto/wkt:empty_go_proto",
"@org_golang_google_grpc//:go_default_library",
"@org_golang_google_grpc//codes:go_default_library",
"@org_golang_google_grpc//grpclog:go_default_library",
"@org_golang_google_grpc//metadata:go_default_library",
"@org_golang_google_grpc//status:go_default_library",
"@io_bazel_rules_go//proto/wkt:descriptor_go_proto",
"@com_github_golang_protobuf//proto:go_default_library",
"@io_bazel_rules_go//proto/wkt:struct_go_proto",
"@io_bazel_rules_go//proto/wkt:timestamp_go_proto",
"@com_github_prysmaticlabs_go_bitfield//:go_default_library", # keep
"@go_googleapis//google/api:annotations_go_proto",
"@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
"@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
], # keep
)
##############################################################################
# Java
##############################################################################
java_proto_library(
name = "java_proto",
deps = [":proto"],
)
# gRPC Gateway
This package is contains generated files for applications that wish to use eth/v1alpha as a
[gRPC gateway](https://github.com/grpc-ecosystem/grpc-gateway).
\ No newline at end of file
// Copyright 2020 Prysmatic Labs.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package ethereum.eth.v1;
import "google/protobuf/descriptor.proto";
import "eth/ext/options.proto";
option csharp_namespace = "Ethereum.Eth.V1";
option go_package = "github.com/prysmaticlabs/prysm/v3/proto/eth/v1";
option java_multiple_files = true;
option java_outer_classname = "AttestationProto";
option java_package = "org.ethereum.eth.v1";
option php_namespace = "Ethereum\\Eth\\v1";
message Attestation {
// A bitfield representation of validator indices that have voted exactly
// the same vote and have been aggregated into this attestation.
bytes aggregation_bits = 1 [(ethereum.eth.ext.ssz_max) = "2048", (ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/go-bitfield.Bitlist"];
AttestationData data = 2;
// 96 byte BLS aggregate signature.
bytes signature = 3 [(ethereum.eth.ext.ssz_size) = "96"];
}
message AggregateAttestationAndProof {
// The aggregator index that submitted this aggregated attestation and proof.
uint64 aggregator_index = 1 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v3/consensus-types/primitives.ValidatorIndex"];
// The aggregated attestation that was submitted.
Attestation aggregate = 3;
// 96 byte selection proof signed by the aggregator, which is the signature of the slot to aggregate.
bytes selection_proof = 2 [(ethereum.eth.ext.ssz_size) = "96"];
}
message SignedAggregateAttestationAndProof {
// The aggregated attestation and selection proof itself.
AggregateAttestationAndProof message = 1;
// 96 byte BLS aggregate signature signed by the aggregator over the message.
bytes signature = 2 [(ethereum.eth.ext.ssz_size) = "96"];
}
message AttestationData {
// Attestation data includes information on Casper the Friendly Finality Gadget's votes
// See: https://arxiv.org/pdf/1710.09437.pdf
// Slot of the attestation attesting for.
uint64 slot = 1 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v3/consensus-types/primitives.Slot"];
// The committee index that submitted this attestation.
uint64 index = 2 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v3/consensus-types/primitives.CommitteeIndex"];
// 32 byte root of the LMD GHOST block vote.
bytes beacon_block_root = 3 [(ethereum.eth.ext.ssz_size) = "32"];
// The most recent justified checkpoint in the beacon state
Checkpoint source = 4;
// The checkpoint attempting to be justified for the current epoch and its epoch boundary block
Checkpoint target = 5;
}
message Checkpoint {
// A checkpoint is every epoch's first slot. The goal of Casper FFG
// is to link the check points together for justification and finalization.
// Epoch the checkpoint references.
uint64 epoch = 1 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v3/consensus-types/primitives.Epoch"];
// Block root of the checkpoint references.
bytes root = 2 [(ethereum.eth.ext.ssz_size) = "32"];
}
// Copyright 2021 Prysmatic Labs.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package ethereum.eth.v1;
import "google/protobuf/descriptor.proto";
import "eth/ext/options.proto";
import "eth/v1/attestation.proto";
option csharp_namespace = "Ethereum.Eth.V1";
option go_package = "github.com/prysmaticlabs/prysm/v3/proto/eth/v1";
option java_multiple_files = true;
option java_outer_classname = "BeaconBlockProto";
option java_package = "org.ethereum.eth.v1";
option php_namespace = "Ethereum\\Eth\\v1";
// The Ethereum consensus beacon block. The message does not contain a validator signature.
message BeaconBlock {
// Beacon chain slot that this block represents.
uint64 slot = 1 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v3/consensus-types/primitives.Slot"];
// Validator index of the validator that proposed the block header.
uint64 proposer_index = 2 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v3/consensus-types/primitives.ValidatorIndex"];
// 32 byte root of the parent block.
bytes parent_root = 3 [(ethereum.eth.ext.ssz_size) = "32"];
// 32 byte root of the resulting state after processing this block.
bytes state_root = 4 [(ethereum.eth.ext.ssz_size) = "32"];
// The block body itself.
BeaconBlockBody body = 5;
}
// The signed version of beacon block.
message SignedBeaconBlock {
// The unsigned beacon block itself.
BeaconBlock block = 1;
// 96 byte BLS signature from the validator that produced this block.
bytes signature = 2 [(ethereum.eth.ext.ssz_size) = "96"];
}
// The block body of an Ethereum consensus beacon block.
message BeaconBlockBody {
// The validators RANDAO reveal 96 byte value.
bytes randao_reveal = 1 [(ethereum.eth.ext.ssz_size) = "96"];
// A reference to the Ethereum 1.x chain.
Eth1Data eth1_data = 2;
// 32 byte field of arbitrary data. This field may contain any data and
// is not used for anything other than a fun message.
bytes graffiti = 3 [(ethereum.eth.ext.ssz_size) = "32"];
// Block operations
// Refer to spec constants at https://github.com/ethereum/consensus-specs/blob/dev/specs/core/0_beacon-chain.md#max-operations-per-block
// At most MAX_PROPOSER_SLASHINGS.
repeated ProposerSlashing proposer_slashings = 4 [(ethereum.eth.ext.ssz_max) = "16"];
// At most MAX_ATTESTER_SLASHINGS.
repeated AttesterSlashing attester_slashings = 5 [(ethereum.eth.ext.ssz_max) = "2"];
// At most MAX_ATTESTATIONS.
repeated Attestation attestations = 6 [(ethereum.eth.ext.ssz_max) = "128"];
// At most MAX_DEPOSITS.
repeated Deposit deposits = 7 [(ethereum.eth.ext.ssz_max) = "16"];
// At most MAX_VOLUNTARY_EXITS.
repeated SignedVoluntaryExit voluntary_exits = 8 [(ethereum.eth.ext.ssz_max) = "16"];
}
// Proposer slashings are proofs that a slashable offense has been committed by
// proposing two conflicting blocks from the same validator.
message ProposerSlashing {
// First conflicting signed block header.
SignedBeaconBlockHeader signed_header_1 = 2;
// Second conflicting signed block header.
SignedBeaconBlockHeader signed_header_2 = 3;
}
// Attestor slashings are proofs that a slashable offense has been committed by
// attesting to two conflicting pieces of information by the same validator.
message AttesterSlashing {
// First conflicting attestation.
IndexedAttestation attestation_1 = 1;
// Second conflicting attestation.
IndexedAttestation attestation_2 = 2;
}
// Deposit into the Ethereum consensus from the Ethereum 1.x deposit contract.
message Deposit {
message Data {
// 48 byte BLS public key of the validator.
bytes pubkey = 1 [(ethereum.eth.ext.ssz_size) = "48", (ethereum.eth.ext.spec_name) = "pubkey"];
// A 32 byte hash of the withdrawal address public key.
bytes withdrawal_credentials = 2 [(ethereum.eth.ext.ssz_size) = "32"];
// Deposit amount in gwei.
uint64 amount = 3;
// 96 byte signature from the validators public key.
bytes signature = 4 [(ethereum.eth.ext.ssz_size) = "96"];
}
// 32 byte roots in the deposit tree branch.
repeated bytes proof = 1 [(ethereum.eth.ext.ssz_size) = "33,32"];
Data data = 2;
}
// A message that represents a validator signaling that they want to voluntarily
// withdraw from the active validator set. The message does not contain a
// validator signature.
message VoluntaryExit {
// The epoch on when exit request becomes valid.
uint64 epoch = 1 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v3/consensus-types/primitives.Epoch"];
// Index of the exiting validator.
uint64 validator_index = 2 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v3/consensus-types/primitives.ValidatorIndex"];
}
// The signed version of voluntary exit.
message SignedVoluntaryExit {
// The unsigned voluntary exit itself.
VoluntaryExit message = 1;
// Validator's 96 byte signature
bytes signature = 2 [(ethereum.eth.ext.ssz_size) = "96"];
}
// Eth1Data represents references to the Ethereum 1.x deposit contract.
message Eth1Data {
// The 32 byte deposit tree root for the last deposit included in this
// block.
bytes deposit_root = 1 [(ethereum.eth.ext.ssz_size) = "32"];
// The total number of deposits included in the beacon chain since genesis
// including the deposits in this block.
uint64 deposit_count = 2;
// The 32 byte block hash of the Ethereum 1.x block considered for deposit
// inclusion.
bytes block_hash = 3 [(ethereum.eth.ext.ssz_size) = "32"];
}
// A beacon block header is essentially a beacon block with only a reference to
// the beacon body as a 32 byte merkle tree root. This type of message is more
// lightweight than a full beacon block. The message does not contain
// a validator signature.
message BeaconBlockHeader {
// Beacon chain slot that this block represents.
uint64 slot = 1 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v3/consensus-types/primitives.Slot"];
// Validator index of the validator that proposed the block header.
uint64 proposer_index = 2 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v3/consensus-types/primitives.ValidatorIndex"];
// 32 byte merkle tree root of the parent ssz encoded block.
bytes parent_root = 3 [(ethereum.eth.ext.ssz_size) = "32"];
// 32 byte merkle tree root of the resulting ssz encoded state after processing this block.
bytes state_root = 4 [(ethereum.eth.ext.ssz_size) = "32"];
// 32 byte merkle tree root of the ssz encoded block body.
bytes body_root = 5 [(ethereum.eth.ext.ssz_size) = "32"];
}
message SignedBeaconBlockHeader {
// The unsigned beacon block header itself.
BeaconBlockHeader message = 1;
// 96 byte BLS signature from the validator that produced this block header.
bytes signature = 2 [(ethereum.eth.ext.ssz_size) = "96"];
}
message IndexedAttestation {
repeated uint64 attesting_indices = 1 [(ethereum.eth.ext.ssz_max) = "2048"];
AttestationData data = 2;
// 96 bytes aggregate signature.
bytes signature = 3 [(ethereum.eth.ext.ssz_size) = "96"];
}
// The sync aggregate object for the beacon chain to track sync committee votes and to
// support light client infra.
message SyncAggregate {
// Sync committee bits as Bitvector to track votes.
bytes sync_committee_bits = 1 [(ethereum.eth.ext.ssz_size) = "sync_committee_bytes.size", (ethereum.eth.ext.cast_type) = "sync_committee_bits.type"];
// BLS aggregated signature of the sync committee for the ones that voted.
bytes sync_committee_signature = 2 [(ethereum.eth.ext.ssz_size) = "96"];
}
This diff is collapsed.
// Copyright 2020 Prysmatic Labs.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package ethereum.eth.v1;
import "google/api/annotations.proto";
import "google/protobuf/descriptor.proto";
import "google/protobuf/empty.proto";
import "eth/v1/beacon_block.proto";
import "eth/v1/beacon_chain.proto";
option csharp_namespace = "Ethereum.Eth.V1";
option go_package = "github.com/prysmaticlabs/ethereumapis/eth/v1";
option java_multiple_files = true;
option java_outer_classname = "BeaconChainServiceProto";
option java_package = "org.ethereum.eth.v1";
option php_namespace = "Ethereum\\Eth\\v1";
// Beacon Chain API
//
// The config API endpoints can be used to query the beacon chain state and information. Such as spec, current fork,
// blocks, and the validator spec.
//
// This service is defined in the upstream Ethereum consensus APIs repository (eth2.0-APIs/apis/).
service BeaconChain {
// Beacon state API related endpoints.
// GetGenesis retrieves details of the chain's genesis which can be used to identify chain.
rpc GetGenesis(google.protobuf.Empty) returns (GenesisResponse) {
option (google.api.http) = { get: "/eth/v1/beacon/genesis" };
}
// GetStateRoot calculates HashTreeRoot for state with given 'stateId'. If stateId is root, same value will be returned.
rpc GetStateRoot(StateRequest) returns (StateRootResponse) {
option (google.api.http) = {
get: "/eth/v1/beacon/states/{state_id}/root"
};
}
// GetStateFork returns Fork object for state with given 'stateId'.
rpc GetStateFork(StateRequest) returns (StateForkResponse) {
option (google.api.http) = {
get: "/eth/v1/beacon/states/{state_id}/fork"
};
}
// GetFinalityCheckpoints returns finality checkpoints for state with given 'stateId'. In case finality is
// not yet achieved, checkpoint should return epoch 0 and ZERO_HASH as root.
rpc GetFinalityCheckpoints(StateRequest) returns (StateFinalityCheckpointResponse) {
option (google.api.http) = {
get: "/eth/v1/beacon/states/{state_id}/finality_checkpoints"
};
}
// ListValidators returns a filterable list of validators with their balance, status and index.
rpc ListValidators(StateValidatorsRequest) returns (StateValidatorsResponse) {
option (google.api.http) = {
get: "/eth/v1/beacon/states/{state_id}/validators"
};
}
// GetValidator returns a validator specified by state and id or public key along with status and balance.
rpc GetValidator(StateValidatorRequest) returns (StateValidatorResponse) {
option (google.api.http) = {
get: "/eth/v1/beacon/states/{state_id}/validators/{validator_id}"
};
}
// ListValidators returns a filterable list of validator balances.
rpc ListValidatorBalances(ValidatorBalancesRequest) returns (ValidatorBalancesResponse) {
option (google.api.http) = {
get: "/eth/v1/beacon/states/{state_id}/validator_balances"
};
}
// ListCommittees retrieves the committees for the given state at the given epoch.
rpc ListCommittees(StateCommitteesRequest) returns (StateCommitteesResponse) {
option (google.api.http) = {
get: "/eth/v1/beacon/states/{state_id}/committees"
};
}
// Beacon blocks API related endpoints.
// ListBlockHeaders retrieves block headers matching given query. By default it will fetch current head slot blocks.
rpc ListBlockHeaders(BlockHeadersRequest) returns (BlockHeadersResponse) {
option (google.api.http) = {
get: "/eth/v1/beacon/headers"
};
}
// GetBlockHeader retrieves block header for given block id.
rpc GetBlockHeader(BlockRequest) returns (BlockHeaderResponse) {
option (google.api.http) = {
get: "/eth/v1/beacon/headers/{block_id}"
};
}
// SubmitBlock instructs the beacon node to broadcast a newly signed beacon block to the beacon network, to be
// included in the beacon chain. The beacon node is not required to validate the signed BeaconBlock, and a successful
// response (20X) only indicates that the broadcast has been successful. The beacon node is expected to integrate the
// new block into its state, and therefore validate the block internally, however blocks which fail the validation are
// still broadcast but a different status code is returned (202).
rpc SubmitBlock(BeaconBlockContainer) returns (google.protobuf.Empty) {
option (google.api.http) = {
post: "/eth/v1/beacon/blocks"
body: "*"
};
}
// GetBlockRoot retrieves hashTreeRoot of BeaconBlock/BeaconBlockHeader.
rpc GetBlockRoot(BlockRequest) returns (BlockRootResponse) {
option (google.api.http) = {
get: "/eth/v1/beacon/blocks/{block_id}/root"
};
}
// GetBlock retrieves block details for given block id.
rpc GetBlock(BlockRequest) returns (BlockResponse) {
option (google.api.http) = {
get: "/eth/v1/beacon/blocks/{block_id}"
};
}
// GetBlockSSZ returns the SSZ-serialized version of block details for given block id.
rpc GetBlockSSZ(BlockRequest) returns (BlockSSZResponse) {
option (google.api.http) = {
get: "/eth/v1/beacon/blocks/{block_id}/ssz"
};
}
// ListBlockAttestations retrieves attestation included in requested block.
rpc ListBlockAttestations(BlockRequest) returns (BlockAttestationsResponse) {
option (google.api.http) = {
get: "/eth/v1/beacon/blocks/{block_id}/attestations"
};
}
// Beacon pools API related endpoints.
// ListPoolAttestations retrieves attestations known by the node but
// not necessarily incorporated into any block.
rpc ListPoolAttestations(AttestationsPoolRequest) returns (AttestationsPoolResponse) {
option (google.api.http) = {
get: "/eth/v1/beacon/pool/attestations"
};
}
// SubmitAttestations submits Attestation objects to node. If attestation passes all validation
// constraints, node MUST publish attestation on appropriate subnet.
rpc SubmitAttestations(SubmitAttestationsRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {
post: "/eth/v1/beacon/pool/attestations"
body: "*"
};
}
// ListPoolAttesterSlashings retrieves attester slashings known by the node but
// not necessarily incorporated into any block.
rpc ListPoolAttesterSlashings(google.protobuf.Empty) returns (AttesterSlashingsPoolResponse) {
option (google.api.http) = {
get: "/eth/v1/beacon/pool/attester_slashings"
};
}
// SubmitAttesterSlashing submits AttesterSlashing object to node's pool and
// if passes validation node MUST broadcast it to network.
rpc SubmitAttesterSlashing(AttesterSlashing) returns (google.protobuf.Empty) {
option (google.api.http) = {
post: "/eth/v1/beacon/pool/attester_slashings"
body: "*"
};
}
// ListPoolProposerSlashings retrieves proposer slashings known by the node
// but not necessarily incorporated into any block.
rpc ListPoolProposerSlashings(google.protobuf.Empty) returns (ProposerSlashingPoolResponse) {
option (google.api.http) = {
get: "/eth/v1/beacon/pool/proposer_slashings"
};
}
// SubmitProposerSlashing submits AttesterSlashing object to node's pool and if
// passes validation node MUST broadcast it to network.
rpc SubmitProposerSlashing(ProposerSlashing) returns (google.protobuf.Empty) {
option (google.api.http) = {
post: "/eth/v1/beacon/pool/proposer_slashings"
body: "*"
};
}
// ListPoolVoluntaryExits retrieves voluntary exits known by the node but
// not necessarily incorporated into any block.
rpc ListPoolVoluntaryExits(google.protobuf.Empty) returns (VoluntaryExitsPoolResponse) {
option (google.api.http) = {
get: "/eth/v1/beacon/pool/voluntary_exits"
};
}
// SubmitVoluntaryExit submits SignedVoluntaryExit object to node's pool
// and if passes validation node MUST broadcast it to network.
rpc SubmitVoluntaryExit(SignedVoluntaryExit) returns (google.protobuf.Empty) {
option (google.api.http) = {
post: "/eth/v1/beacon/pool/voluntary_exits"
body: "*"
};
}
// Beacon config API related endpoints.
// GetForkSchedule retrieve all scheduled upcoming forks this node is aware of.
rpc GetForkSchedule(google.protobuf.Empty) returns (ForkScheduleResponse) {
option (google.api.http) = {get: "/eth/v1/config/fork_schedule"};
}
// Spec retrieves specification configuration (without Phase 1 params) used on this node. Specification params list
// Values are returned with following format:
// - any value starting with 0x in the spec is returned as a hex string
// - all other values are returned as number
rpc GetSpec(google.protobuf.Empty) returns (SpecResponse) {
option (google.api.http) = {get: "/eth/v1/config/spec"};
}
// GetDepositContract retrieves deposit contract address and genesis fork version.
rpc GetDepositContract(google.protobuf.Empty) returns (DepositContractResponse) {
option (google.api.http) = {get: "/eth/v1/config/deposit_contract"};
}
}
// Copyright 2020 Prysmatic Labs.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package ethereum.eth.v1;
import "google/api/annotations.proto";
import "google/protobuf/descriptor.proto";
import "google/protobuf/empty.proto";
import "eth/v1/beacon_chain.proto";
import "eth/v1/beacon_state.proto";
option csharp_namespace = "Ethereum.Eth.V1";
option go_package = "github.com/prysmaticlabs/ethereumapis/eth/v1";
option java_multiple_files = true;
option java_outer_classname = "BeaconDebugServiceProto";
option java_package = "org.ethereum.eth.v1";
option php_namespace = "Ethereum\\Eth\\v1";
// Beacon chain debug API
//
// The beacon chain debug API is a set of endpoints to debug chain and shouldn't be exposed publicly.
//
// This service is defined in the upstream Ethereum consensus APIs repository (eth2.0-APIs/apis/debug).
service BeaconDebug {
// GetBeaconState returns full BeaconState object for given stateId.
rpc GetBeaconState(StateRequest) returns (BeaconStateResponse) {
option (google.api.http) = {
get: "/eth/v1/debug/beacon/states/{state_id}"
};
}
// GetBeaconStateSSZ returns the SSZ-serialized version of the full BeaconState object for given stateId.
rpc GetBeaconStateSSZ(StateRequest) returns (BeaconStateSSZResponse) {
option (google.api.http) = {
get: "/eth/v1/debug/beacon/states/{state_id}/ssz"
};
}
// ListForkChoiceHeads retrieves all possible chain heads (leaves of fork choice tree).
rpc ListForkChoiceHeads(google.protobuf.Empty) returns (ForkChoiceHeadsResponse) {
option (google.api.http) = {
get: "/eth/v1/debug/beacon/heads"
};
}
}
\ No newline at end of file
// Copyright 2020 Prysmatic Labs.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package ethereum.eth.v1;
import "google/protobuf/descriptor.proto";
import "eth/ext/options.proto";
import "eth/v1/attestation.proto";
import "eth/v1/beacon_block.proto";
import "eth/v1/validator.proto";
option csharp_namespace = "Ethereum.Eth.V1";
option go_package = "github.com/prysmaticlabs/prysm/v3/proto/eth/v1";
option java_multiple_files = true;
option java_outer_classname = "BeaconStateProto";
option java_package = "org.ethereum.eth.v1";
option php_namespace = "Ethereum\\Eth\\v1";
message BeaconState {
// Versioning [1001-2000]
uint64 genesis_time = 1001;
bytes genesis_validators_root = 1002 [(ethereum.eth.ext.ssz_size) = "32"];
uint64 slot = 1003 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v3/consensus-types/primitives.Slot"];
Fork fork = 1004;
// History [2001-3000]
BeaconBlockHeader latest_block_header = 2001;
repeated bytes block_roots = 2002 [(ethereum.eth.ext.ssz_size) = "block_roots.size"];
repeated bytes state_roots = 2003 [(ethereum.eth.ext.ssz_size) = "state_roots.size"];
repeated bytes historical_roots = 2004 [(ethereum.eth.ext.ssz_size) = "?,32", (ethereum.eth.ext.ssz_max) = "16777216"];
// Eth1 [3001-4000]
Eth1Data eth1_data = 3001;
repeated Eth1Data eth1_data_votes = 3002 [(ethereum.eth.ext.ssz_max) = "eth1_data_votes.size"];
uint64 eth1_deposit_index = 3003;
// Registry [4001-5000]
repeated Validator validators = 4001 [(ethereum.eth.ext.ssz_max) = "1099511627776"];
repeated uint64 balances = 4002 [(ethereum.eth.ext.ssz_max) = "1099511627776"];
// Randomness [5001-6000]
repeated bytes randao_mixes = 5001 [(ethereum.eth.ext.ssz_size) = "randao_mixes.size"];
// Slashings [6001-7000]
repeated uint64 slashings = 6001 [(ethereum.eth.ext.ssz_size) = "slashings.size"];
// Attestations [7001-8000]
repeated PendingAttestation previous_epoch_attestations = 7001 [(ethereum.eth.ext.ssz_max) = "previous_epoch_attestations.max"];
repeated PendingAttestation current_epoch_attestations = 7002 [(ethereum.eth.ext.ssz_max) = "current_epoch_attestations.max"];
// Finality [8001-9000]
// Spec type [4]Bitvector which means this would be a fixed size of 4 bits.
bytes justification_bits = 8001 [(ethereum.eth.ext.ssz_size) = "1", (ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/go-bitfield.Bitvector4"];
Checkpoint previous_justified_checkpoint = 8002;
Checkpoint current_justified_checkpoint = 8003;
Checkpoint finalized_checkpoint = 8004;
}
message PendingAttestation {
// Bitfield representation of validator indices that have voted exactly
// the same vote and have been aggregated into this attestation.
bytes aggregation_bits = 1 [(ethereum.eth.ext.ssz_max) = "2048", (ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/go-bitfield.Bitlist"];
AttestationData data = 2;
// The difference of when attestation gets created and get included on chain.
uint64 inclusion_delay = 3 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v3/consensus-types/primitives.Slot"];
// The proposer who included the attestation in the block.
uint64 proposer_index = 4 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v3/consensus-types/primitives.ValidatorIndex"];
}
message Committee {
uint64 index = 1 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v3/consensus-types/primitives.CommitteeIndex"];
uint64 slot = 2 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v3/consensus-types/primitives.Slot"];
repeated uint64 validators = 3 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v3/consensus-types/primitives.ValidatorIndex"];
}
// Fork structure used for indicating beacon chain versioning and forks.
message Fork {
bytes previous_version = 1 [(ethereum.eth.ext.ssz_size) = "4"];
bytes current_version = 2 [(ethereum.eth.ext.ssz_size) = "4"];
uint64 epoch = 3 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v3/consensus-types/primitives.Epoch"];
}
message ForkChoiceHeadsResponse {
repeated ForkChoiceHead data = 1;
}
message ForkChoiceHead {
bytes root = 1 [(ethereum.eth.ext.ssz_size) = "32"];
uint64 slot = 2 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v3/consensus-types/primitives.Slot"];
}
message BeaconStateResponse {
BeaconState data = 1;
}
// Copyright 2021 Prysmatic Labs.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package ethereum.eth.v1;
import "google/protobuf/descriptor.proto";
import "eth/ext/options.proto";
option csharp_namespace = "Ethereum.Eth.V1";
option go_package = "github.com/prysmaticlabs/prysm/v3/proto/eth/v1";
option java_multiple_files = true;
option java_outer_classname = "BeaconEventsProto";
option java_package = "org.ethereum.eth.v1";
option php_namespace = "Ethereum\\Eth\\v1";
message StreamEventsRequest {
// List of topics to request for event streaming items. Allowed request topics are
// head, attestation, block, voluntary_exit, finalized_checkpoint, chain_reorg.
repeated string topics = 1;
}
message EventHead {
// Slot of the new chain head.
uint64 slot = 1 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v3/consensus-types/primitives.Slot"];
// Block root of the new chain head.
bytes block = 2 [(ethereum.eth.ext.ssz_size) = "32"];
// State root of the new chain head.
bytes state = 3 [(ethereum.eth.ext.ssz_size) = "32"];
// Whether or not the new chain head is at an epoch transition.
bool epoch_transition = 4;
// The previous dependent root.
bytes previous_duty_dependent_root = 5 [(ethereum.eth.ext.ssz_size) = "32"];
// The current dependent root.
bytes current_duty_dependent_root = 6 [(ethereum.eth.ext.ssz_size) = "32"];
// Information about optimistic sync.
bool execution_optimistic = 7;
}
message EventBlock {
// The slot of the observed block.
uint64 slot = 1 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v3/consensus-types/primitives.Slot"];
// The root of the observed block.
bytes block = 2 [(ethereum.eth.ext.ssz_size) = "32"];
// Information about optimistic sync.
bool execution_optimistic = 3;
}
message EventChainReorg {
// The slot of the observed reorg.
uint64 slot = 1 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v3/consensus-types/primitives.Slot"];
// Depth of the reorg in slots.
uint64 depth = 2;
// Block root of the old head.
bytes old_head_block = 3 [(ethereum.eth.ext.ssz_size) = "32"];
// Block root of the new head.
bytes new_head_block = 4 [(ethereum.eth.ext.ssz_size) = "32"];
// State root of the old state.
bytes old_head_state = 5 [(ethereum.eth.ext.ssz_size) = "32"];
// State root of the new state.
bytes new_head_state = 6 [(ethereum.eth.ext.ssz_size) = "32"];
// Epoch of the observed reorg.
uint64 epoch = 7 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v3/consensus-types/primitives.Epoch"];
// Information about optimistic sync.
bool execution_optimistic = 8;
}
message EventFinalizedCheckpoint {
// Block root of the finalized checkpoint.
bytes block = 1 [(ethereum.eth.ext.ssz_size) = "32"];
// State root of the finalized checkpoint.
bytes state = 2 [(ethereum.eth.ext.ssz_size) = "32"];
// Epoch the checkpoint references.
uint64 epoch = 3 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v3/consensus-types/primitives.Epoch"];
// Information about optimistic sync.
bool execution_optimistic = 4;
}
// Copyright 2020 Prysmatic Labs.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package ethereum.eth.v1;
import "google/api/annotations.proto";
import "google/protobuf/descriptor.proto";
import "eth/v1/events.proto";
import "proto/gateway/event_source.proto";
option csharp_namespace = "Ethereum.Eth.V1";
option go_package = "github.com/prysmaticlabs/ethereumapis/eth/v1";
option java_multiple_files = true;
option java_outer_classname = "EventsServiceProto";
option java_package = "org.ethereum.eth.v1";
option php_namespace = "Ethereum\\Eth\\v1";
// Events API
//
// This service is defined in the upstream Ethereum consensus APIs repository (eth2.0-APIs/apis/debug).
service Events {
rpc StreamEvents(StreamEventsRequest) returns (stream gateway.EventSource) {
option (google.api.http) = {
get: "/eth/v1/events"
};
}
}
// Copyright 2021 Prysmatic Labs.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package ethereum.eth.v1;
import "google/protobuf/descriptor.proto";
import "eth/ext/options.proto";
option csharp_namespace = "Ethereum.Eth.V1";
option go_package = "github.com/prysmaticlabs/prysm/v3/proto/eth/v1";
option java_multiple_files = true;
option java_outer_classname = "BeaconNodeProto";
option java_package = "org.ethereum.eth.v1";
option php_namespace = "Ethereum\\Eth\\v1";
message IdentityResponse {
Identity data = 1;
}
message Identity {
// The peer id of the node.
string peer_id = 1;
// The latest ENR of the node.
string enr = 2;
// All the p2p multiaddresses of the peer, specified as a full multiaddr.
repeated string p2p_addresses = 3;
// All the discv5 multiaddresses of the peer, specified as a full multiaddr.
repeated string discovery_addresses = 4;
// Additional metadata that the node would like to provide. Includes extra networking information.
Metadata metadata = 5;
}
message Metadata {
// Sequence number starts at 0 used to version the node's metadata. If any other field in the local MetaData changes,
// the node MUST increment seq_number by 1.
uint64 seq_number = 1;
// Attnets is a bitvector representing the node's persistent attestation subnet subscriptions.
bytes attnets = 2 [(ethereum.eth.ext.ssz_size) = "8", (ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/go-bitfield.Bitvector64"];
}
message PeerRequest {
// Peer id of the peer requested.
string peer_id = 1;
}
message PeersRequest {
// Requested peer states (available values: disconnected, connecting, connected, disconnecting).
repeated ConnectionState state = 1;
// Requested peer directions (available values: inbound, outbound).
repeated PeerDirection direction = 2;
}
message PeerResponse {
Peer data = 1;
Meta meta = 2;
message Meta {
uint64 count = 1;
}
}
message PeersResponse {
repeated Peer data = 1;
}
message PeerCountResponse {
PeerCount data = 1;
message PeerCount {
// The number of disconnected peers.
uint64 disconnected = 1;
// The number of connecting peers.
uint64 connecting = 2;
// The number of connected peers.
uint64 connected = 3;
// The number of disconnecting peers.
uint64 disconnecting = 4;
}
}
// Peer provides details of a peer on the network.
message Peer {
// The peer id of the peer.
string peer_id = 1;
// The latest ENR of the peer that's in the record.
string enr = 2;
// The address of the peer, as a full multiaddr, for example:
// /ip4/37.221.192.134/tcp/13000/p2p/16Uiu2HAm8maLMjag1TAUM52zPfmLbVMGFdwUAWgoHu1HDQLR6e17
string last_seen_p2p_address = 3;
// The connection state of the peer at the moment of the request. (e.g. Connecting)
ConnectionState state = 4;
// The direction of the connection (inbound/outbound).
PeerDirection direction = 5;
}
// PeerDirection states the direction of the connection to a peer.
enum PeerDirection {
INBOUND = 0;
OUTBOUND = 1;
}
// ConnectionState states the current status of the peer.
enum ConnectionState {
DISCONNECTED = 0;
CONNECTING = 1;
CONNECTED = 2;
DISCONNECTING = 3;
}
message VersionResponse {
Version data = 1;
}
// Information about the node version.
message Version {
// A string that uniquely identifies the node and its version.
string version = 1;
}
message SyncingResponse {
SyncInfo data = 1;
}
message SyncInfo {
// A uint64 states the latest head slot of the current node.
uint64 head_slot = 1 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v3/consensus-types/primitives.Slot"];
// A uint64 indicating how many slots are left for the beacon node sync to complete.
uint64 sync_distance = 2 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/prysm/v3/consensus-types/primitives.Slot"];
// A bool indicating whether the node is currently syncing or not.
bool is_syncing = 3;
// A bool indicating whether the node is currently in optimistic mode.
bool is_optimistic = 4;
}
// Copyright 2020 Prysmatic Labs.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package ethereum.eth.v1;
import "google/api/annotations.proto";
import "google/protobuf/descriptor.proto";
import "google/protobuf/empty.proto";
import "eth/v1/node.proto";
option csharp_namespace = "Ethereum.Eth.V1";
option go_package = "github.com/prysmaticlabs/ethereumapis/eth/v1";
option java_multiple_files = true;
option java_outer_classname = "NodeServiceProto";
option java_package = "org.ethereum.eth.v1";
option php_namespace = "Ethereum\\Eth\\v1";
// Beacon chain node API
//
// The beacon chain node API is a set of endpoints to query node information.
service BeaconNode {
// GetIdentity retrieves data about the node's network presence.
rpc GetIdentity(google.protobuf.Empty) returns (IdentityResponse) {
option (google.api.http) = {get: "/eth/v1/node/identity"};
}
// ListPeers retrieves data about the node's network peers.
rpc ListPeers(PeersRequest) returns (PeersResponse) {
option (google.api.http) = {get: "/eth/v1/node/peers"};
}
// GetPeer retrieves data about the given peer.
rpc GetPeer(PeerRequest) returns (PeerResponse) {
option (google.api.http) = {get: "/eth/v1/node/peers/{peer_id}"};
}
// PeerCount retrieves number of known peers.
rpc PeerCount(google.protobuf.Empty) returns (PeerCountResponse) {
option (google.api.http) = {get: "/eth/v1/node/peer_count"};
}
// GetSyncStatus requests the beacon node to describe if it's currently syncing or not, and
// if it is, what block it is up to.
rpc GetSyncStatus(google.protobuf.Empty) returns (SyncingResponse) {
option (google.api.http) = {get: "/eth/v1/node/syncing"};
}
// GetVersion requests that the beacon node identify information about its implementation in a
// format similar to a HTTP User-Agent field.
rpc GetVersion(google.protobuf.Empty) returns (VersionResponse) {
option (google.api.http) = {get: "/eth/v1/node/version"};
}
// GetHealth returns node health status in http status codes. Useful for load balancers.
// Response Usage:
// "200":
// description: Node is ready
// "206":
// description: Node is syncing but can serve incomplete data
// "503":
// description: Node not initialized or having issues
rpc GetHealth(google.protobuf.Empty) returns (google.protobuf.Empty) {
option (google.api.http) = {get: "/eth/v1/node/health"};
}
}
This diff is collapsed.
// Copyright 2020 Prysmatic Labs.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package ethereum.eth.v1;
import "google/api/annotations.proto";
import "google/protobuf/descriptor.proto";
import "google/protobuf/empty.proto";
import "eth/v1/validator.proto";
option csharp_namespace = "Ethereum.Eth.V1";
option go_package = "github.com/prysmaticlabs/ethereumapis/eth/v1";
option java_multiple_files = true;
option java_outer_classname = "ValidatorServiceProto";
option java_package = "org.ethereum.eth.v1";
option php_namespace = "Ethereum\\Eth\\v1";
// Beacon chain validator API
//
// The beacon chain validator API is a set of endpoints to be used by validators for performing their roles.
//
// This service is defined in the upstream Ethereum consensus APIs repository (eth2.0-APIs/apis/validator).
service BeaconValidator {
// GetAttesterDuties requests the beacon node to provide a set of attestation duties, which should be performed
// by validators, for a particular epoch.
//
// HTTP response usage:
// - 200: Successful response
// - 400: Invalid epoch or index
// - 500: Beacon node internal error
// - 503: Beacon node is currently syncing, try again later
rpc GetAttesterDuties(AttesterDutiesRequest) returns (AttesterDutiesResponse) {
option (google.api.http) = {
post: "/eth/v1/validator/duties/attester/{epoch}"
body: "*"
};
}
// GetProposerDuties requests beacon node to provide all validators that are scheduled to
// propose a block in the given epoch.
//
// HTTP response usage:
// - 200: Successful response
// - 400: Invalid epoch
// - 500: Beacon node internal error
// - 503: Beacon node is currently syncing, try again later
rpc GetProposerDuties(ProposerDutiesRequest) returns (ProposerDutiesResponse) {
option (google.api.http) = { get: "/eth/v1/validator/duties/proposer/{epoch}" };
}
// ProduceBlock requests the beacon node to produce a valid unsigned beacon block,
// which can then be signed by a proposer and submitted.
//
// HTTP response usage:
// - 200: Successful response
// - 400: Invalid block production request
// - 500: Beacon node internal error
// - 503: Beacon node is currently syncing, try again later
rpc ProduceBlock(ProduceBlockRequest) returns (ProduceBlockResponse) {
option (google.api.http) = { get: "/eth/v1/validator/blocks/{slot}" };
}
// ProduceAttestationData requests that the beacon node produces attestation data for
// the requested committee index and slot based on the nodes current head.
//
// HTTP response usage:
// - 200: Successful response
// - 400: Invalid request syntax
// - 500: Beacon node internal error
// - 503: Beacon node is currently syncing, try again later
rpc ProduceAttestationData(ProduceAttestationDataRequest) returns (ProduceAttestationDataResponse) {
option (google.api.http) = { get: "/eth/v1/validator/attestation_data" };
}
// GetAggregateAttestation aggregates all attestations matching the given attestation data root and slot,
// returning the aggregated result.
//
// HTTP response usage:
// - 200: Successful response
// - 400: Invalid request syntax
// - 500: Beacon node internal error
rpc GetAggregateAttestation(AggregateAttestationRequest) returns (AggregateAttestationResponse) {
option (google.api.http) = { get: "/eth/v1/validator/aggregate_attestation" };
}
// SubmitAggregateAndProofs verifies given aggregate and proofs and publishes them on appropriate gossipsub topic.
//
// Response usage:
// - 200: Successful response
// - 400: Invalid request syntax
// - 500: Beacon node internal error
rpc SubmitAggregateAndProofs(SubmitAggregateAndProofsRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {
post: "/eth/v1/validator/aggregate_and_proofs"
body: "*"
};
}
// SubmitBeaconCommitteeSubscription searches using discv5 for peers related to
// the provided subnet information and replaces current peers with those ones if necessary.
//
// If validator is_aggregator, beacon node must:
// - announce subnet topic subscription on gossipsub.
// - aggregate attestations received on that subnet.
//
// Response usage:
// - 200: Slot signature is valid and beacon node has prepared the attestation subnet
// Note that we cannot be certain Beacon node will find peers for that subnet for various reasons
// - 400: Invalid request syntax
// - 500: Beacon node internal error
// - 503: Beacon node is currently syncing, try again later
rpc SubmitBeaconCommitteeSubscription(SubmitBeaconCommitteeSubscriptionsRequest) returns (google.protobuf.Empty) {
option (google.api.http) = {
post: "/eth/v1/validator/beacon_committee_subscriptions"
body: "*"
};
}
}
##############################################################################
# Common
##############################################################################
load("@rules_proto//proto:defs.bzl", "proto_library")
load("@rules_java//java:defs.bzl", "java_proto_library")
##############################################################################
# Go
##############################################################################
# gazelle:ignore
load("@io_bazel_rules_go//go:def.bzl", "go_library")
load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
load("//tools:ssz.bzl", "SSZ_DEPS", "ssz_gen_marshal")
##############################################################################
# OpenAPI (Swagger) V2
##############################################################################
load("@com_github_grpc_ecosystem_grpc_gateway_v2//protoc-gen-openapiv2:defs.bzl", "protoc_gen_openapiv2")
proto_library(
name = "proto",
srcs = [
"attestation.proto",
"beacon_block.proto",
"beacon_block_altair.proto",
"beacon_chain.proto",
"sync_committee.proto",
"node.proto",
"validator.proto",
":generated_swagger_proto",
],
visibility = ["//visibility:public"],
deps = [
"//eth/ext:proto",
"@com_github_grpc_ecosystem_grpc_gateway_v2//protoc-gen-openapiv2/options:options_proto",
"@com_google_protobuf//:any_proto",
"@com_google_protobuf//:descriptor_proto",
"@com_google_protobuf//:empty_proto",
"@com_google_protobuf//:timestamp_proto",
"@go_googleapis//google/api:annotations_proto",
],
)
##############################################################################
# Java
##############################################################################
java_proto_library(
name = "java_proto",
deps = [":proto"],
)
##############################################################################
# Go
##############################################################################
ssz_gen_marshal(
name = "ssz_generated_files",
go_proto = ":go_proto",
includes = [
"@com_github_prysmaticlabs_eth2_types//:go_default_library",
],
objs = [
"AggregateAttestationAndProof",
"Attestation",
"AttestationData",
"AttesterSlashing",
"BeaconBlock",
"BeaconBlockAltair",
"BeaconBlockBodyAltair",
"BeaconBlockHeader",
"Checkpoint",
"Deposit",
"Eth1Data",
"IndexedAttestation",
"ProposerSlashing",
"SignedAggregateAttestationAndProof",
"SignedBeaconBlock",
"SignedBeaconBlockAltair",
"SignedBeaconBlockHeader",
"SignedVoluntaryExit",
"Validator",
"VoluntaryExit",
"SyncCommitteeSignature",
"SyncCommitteeContribution",
"ContributionAndProof",
"SignedContributionAndProof",
],
)
go_proto_library(
name = "go_proto",
compilers = [
"@com_github_prysmaticlabs_protoc_gen_go_cast//:go_cast_grpc",
],
importpath = "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1",
proto = ":proto",
visibility = ["//visibility:public"],
deps = [
"//eth/ext:go_default_library",
"@io_bazel_rules_go//proto/wkt:descriptor_go_proto",
"@com_github_golang_protobuf//proto:go_default_library",
"@io_bazel_rules_go//proto/wkt:empty_go_proto",
"@io_bazel_rules_go//proto/wkt:timestamp_go_proto",
"@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
"@com_github_grpc_ecosystem_grpc_gateway_v2//protoc-gen-openapiv2/options:options_go_proto",
"@com_github_prysmaticlabs_go_bitfield//:go_default_library",
"@com_github_prysmaticlabs_eth2_types//:go_default_library",
"@go_googleapis//google/api:annotations_go_proto",
"@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
"@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
],
)
go_proto_library(
name = "go_grpc_gateway_library",
compilers = [
"@com_github_grpc_ecosystem_grpc_gateway_v2//protoc-gen-grpc-gateway:go_gen_grpc_gateway",
],
embed = [":go_proto"],
importpath = "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1",
protos = [":proto"],
visibility = ["//visibility:private"],
deps = [
"//eth/ext:go_default_library",
"@io_bazel_rules_go//proto/wkt:empty_go_proto",
"@com_github_grpc_ecosystem_grpc_gateway_v2//protoc-gen-openapiv2/options:options_go_proto",
"@com_github_prysmaticlabs_go_bitfield//:go_default_library",
"@go_googleapis//google/api:annotations_go_proto",
"@io_bazel_rules_go//proto/wkt:timestamp_go_proto",
"@io_bazel_rules_go//proto/wkt:descriptor_go_proto",
],
)
go_library(
name = "go_default_library",
srcs = [
":ssz_generated_files", # keep
],
embed = [
":go_grpc_gateway_library",
],
importpath = "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1",
visibility = ["//visibility:public"],
deps = SSZ_DEPS + [
"//eth/ext:go_default_library",
"@com_github_grpc_ecosystem_grpc_gateway_v2//runtime:go_default_library",
"@com_github_grpc_ecosystem_grpc_gateway_v2//utilities:go_default_library",
"@io_bazel_rules_go//proto/wkt:empty_go_proto",
"@org_golang_google_grpc//:go_default_library",
"@org_golang_google_grpc//codes:go_default_library",
"@org_golang_google_grpc//grpclog:go_default_library",
"@org_golang_google_grpc//metadata:go_default_library",
"@org_golang_google_grpc//status:go_default_library",
"@io_bazel_rules_go//proto/wkt:descriptor_go_proto",
"@com_github_golang_protobuf//proto:go_default_library",
"@io_bazel_rules_go//proto/wkt:timestamp_go_proto",
"@com_github_prysmaticlabs_go_bitfield//:go_default_library", # keep
"@go_googleapis//google/api:annotations_go_proto",
"@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
"@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
"@com_github_grpc_ecosystem_grpc_gateway_v2//protoc-gen-openapiv2/options:options_go_proto",
], # keep
)
protoc_gen_openapiv2(
name = "swagger",
json_names_for_fields = True,
proto = ":proto",
single_output = True,
visibility = ["//visibility:public"],
)
# Genrule for template subsitution.
# See documentation in //tools/replacer.
genrule(
name = "generated_swagger_proto",
srcs = [
"swagger.proto", # A go template compatibile file.
"swagger_description.md", # Replacement for description.
],
outs = ["swagger_generated.proto"],
cmd = "$(location //tools/replacer) $(location swagger.proto) description=$(location swagger_description.md) > $(@)",
tools = ["//tools/replacer"],
)
# gRPC Gateway
This package is contains generated files for applications that wish to use eth/v1alpha as a
[gRPC gateway](https://github.com/grpc-ecosystem/grpc-gateway).
\ No newline at end of file
// Copyright 2020 Prysmatic Labs.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package ethereum.eth.v1alpha1;
import "eth/ext/options.proto";
option csharp_namespace = "Ethereum.Eth.v1alpha1";
option go_package = "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1;eth";
option java_multiple_files = true;
option java_outer_classname = "AttestationProto";
option java_package = "org.ethereum.eth.v1alpha1";
option php_namespace = "Ethereum\\Eth\\v1alpha1";
message Attestation {
// A bitfield representation of validator indices that have voted exactly
// the same vote and have been aggregated into this attestation.
bytes aggregation_bits = 1 [(ethereum.eth.ext.ssz_max) = "2048", (ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/go-bitfield.Bitlist"];
AttestationData data = 2;
// 96 byte BLS aggregate signature.
bytes signature = 3 [(ethereum.eth.ext.ssz_size) = "96"];
}
message AggregateAttestationAndProof {
// The aggregator index that submitted this aggregated attestation and proof.
uint64 aggregator_index = 1 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/eth2-types.ValidatorIndex"];
// The aggregated attestation that was submitted.
Attestation aggregate = 3;
// 96 byte selection proof signed by the aggregator, which is the signature of the slot to aggregate.
bytes selection_proof = 2 [(ethereum.eth.ext.ssz_size) = "96"];
}
message SignedAggregateAttestationAndProof {
// The aggregated attestation and selection proof itself.
AggregateAttestationAndProof message = 1;
// 96 byte BLS aggregate signature signed by the aggregator over the message.
bytes signature = 2 [(ethereum.eth.ext.ssz_size) = "96"];
}
message AttestationData {
// Attestation data includes information on Casper the Friendly Finality Gadget's votes
// See: https://arxiv.org/pdf/1710.09437.pdf
// Slot of the attestation attesting for.
uint64 slot = 1 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/eth2-types.Slot"];
// The committee index that submitted this attestation.
uint64 committee_index = 2 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/eth2-types.CommitteeIndex"];
// 32 byte root of the LMD GHOST block vote.
bytes beacon_block_root = 3 [(ethereum.eth.ext.ssz_size) = "32"];
// The most recent justified checkpoint in the beacon state
Checkpoint source = 4;
// The checkpoint attempting to be justified for the current epoch and its epoch boundary block
Checkpoint target = 5;
}
message Checkpoint {
// A checkpoint is every epoch's first slot. The goal of Casper FFG
// is to link the check points together for justification and finalization.
// Epoch the checkpoint references.
uint64 epoch = 1 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/eth2-types.Epoch"];
// Block root of the checkpoint references.
bytes root = 2 [(ethereum.eth.ext.ssz_size) = "32"];
}
// Copyright 2020 Prysmatic Labs.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package ethereum.eth.v1alpha1;
import "eth/ext/options.proto";
import "eth/v1alpha1/attestation.proto";
option csharp_namespace = "Ethereum.Eth.v1alpha1";
option go_package = "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1;eth";
option java_multiple_files = true;
option java_outer_classname = "BeaconBlockProto";
option java_package = "org.ethereum.eth.v1alpha1";
option php_namespace = "Ethereum\\Eth\\v1alpha1";
// The Ethereum consensus beacon block. The message does not contain a validator signature.
message BeaconBlock {
// Beacon chain slot that this block represents.
uint64 slot = 1 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/eth2-types.Slot"];
// Validator index of the validator that proposed the block header.
uint64 proposer_index = 2 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/eth2-types.ValidatorIndex"];
// 32 byte root of the parent block.
bytes parent_root = 3 [(ethereum.eth.ext.ssz_size) = "32"];
// 32 byte root of the resulting state after processing this block.
bytes state_root = 4 [(ethereum.eth.ext.ssz_size) = "32"];
// The block body itself.
BeaconBlockBody body = 5;
}
// The signed version of beacon block.
message SignedBeaconBlock {
// The unsigned beacon block itself.
BeaconBlock block = 1;
// 96 byte BLS signature from the validator that produced this block.
bytes signature = 2 [(ethereum.eth.ext.ssz_size) = "96"];
}
// The block body of an Ethereum consensus beacon block.
message BeaconBlockBody {
// The validators RANDAO reveal 96 byte value.
bytes randao_reveal = 1 [(ethereum.eth.ext.ssz_size) = "96"];
// A reference to the Ethereum 1.x chain.
Eth1Data eth1_data = 2;
// 32 byte field of arbitrary data. This field may contain any data and
// is not used for anything other than a fun message.
bytes graffiti = 3 [(ethereum.eth.ext.ssz_size) = "32"];
// Block operations
// Refer to spec constants at https://github.com/ethereum/eth2.0-specs/blob/dev/specs/core/0_beacon-chain.md#max-operations-per-block
// At most MAX_PROPOSER_SLASHINGS.
repeated ProposerSlashing proposer_slashings = 4 [(ethereum.eth.ext.ssz_max) = "16"];
// At most MAX_ATTESTER_SLASHINGS.
repeated AttesterSlashing attester_slashings = 5 [(ethereum.eth.ext.ssz_max) = "2"];
// At most MAX_ATTESTATIONS.
repeated Attestation attestations = 6 [(ethereum.eth.ext.ssz_max) = "128"];
// At most MAX_DEPOSITS.
repeated Deposit deposits = 7 [(ethereum.eth.ext.ssz_max) = "16"];
// At most MAX_VOLUNTARY_EXITS.
repeated SignedVoluntaryExit voluntary_exits = 8 [(ethereum.eth.ext.ssz_max) = "16"];
}
// Proposer slashings are proofs that a slashable offense has been committed by
// proposing two conflicting blocks from the same validator.
message ProposerSlashing {
// First conflicting signed block header.
SignedBeaconBlockHeader header_1 = 2;
// Second conflicting signed block header.
SignedBeaconBlockHeader header_2 = 3;
}
// Attestor slashings are proofs that a slashable offense has been committed by
// attestating to two conflicting pieces of information by the same validator.
message AttesterSlashing {
// First conflicting attestation.
IndexedAttestation attestation_1 = 1;
// Second conflicting attestation.
IndexedAttestation attestation_2 = 2;
}
// Deposit into the Ethereum consensus from the Ethereum 1.x deposit contract.
message Deposit {
// DepositData that is encoded into a deposit signature.
message Data {
// 48 byte BLS public key of the validator.
bytes public_key = 1 [(ethereum.eth.ext.ssz_size) = "48", (ethereum.eth.ext.spec_name) = "pubkey"];
// A 32 byte hash of the withdrawal address public key.
bytes withdrawal_credentials = 2 [(ethereum.eth.ext.ssz_size) = "32"];
// Deposit amount in gwei.
uint64 amount = 3;
// 96 byte signature from the validators public key.
bytes signature = 4 [(ethereum.eth.ext.ssz_size) = "96"];
}
// 32 byte roots in the deposit tree branch.
repeated bytes proof = 1 [(ethereum.eth.ext.ssz_size) = "33,32"];
Data data = 2;
}
// A message that represents a validator signaling that they want to voluntarily
// withdraw from the active validator set. The message does not contain a
// validator signature.
message VoluntaryExit {
// The epoch on when exit request becomes valid.
uint64 epoch = 1 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/eth2-types.Epoch"];
// Index of the exiting validator.
uint64 validator_index = 2 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/eth2-types.ValidatorIndex"];
}
// The signed version of voluntary exit.
message SignedVoluntaryExit {
// The unsigned voluntary exit itself.
VoluntaryExit exit = 1;
// Validator's 96 byte signature
bytes signature = 2 [(ethereum.eth.ext.ssz_size) = "96"];
}
// Eth1Data represents references to the Ethereum 1.x deposit contract.
message Eth1Data {
// The 32 byte deposit tree root for the last deposit included in this
// block.
bytes deposit_root = 1 [(ethereum.eth.ext.ssz_size) = "32"];
// The total number of deposits included in the beacon chain since genesis
// including the deposits in this block.
uint64 deposit_count = 2;
// The 32 byte block hash of the Ethereum 1.x block considered for deposit
// inclusion.
bytes block_hash = 3 [(ethereum.eth.ext.ssz_size) = "32"];
}
// A beacon block header is essentially a beacon block with only a reference to
// the beacon body as a 32 byte merkle tree root. This type of message is more
// lightweight than a full beacon block. The message does not contain
// a validator signature.
message BeaconBlockHeader {
// Beacon chain slot that this block represents.
uint64 slot = 1 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/eth2-types.Slot"];
// Validator index of the validator that proposed the block header.
uint64 proposer_index = 2 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/eth2-types.ValidatorIndex"];
// 32 byte merkle tree root of the parent ssz encoded block.
bytes parent_root = 3 [(ethereum.eth.ext.ssz_size) = "32"];
// 32 byte merkle tree root of the resulting ssz encoded state after processing this block.
bytes state_root = 4 [(ethereum.eth.ext.ssz_size) = "32"];
// 32 byte merkle tree root of the ssz encoded block body.
bytes body_root = 5 [(ethereum.eth.ext.ssz_size) = "32"];
}
message SignedBeaconBlockHeader {
// The unsigned beacon block header itself.
BeaconBlockHeader header = 1;
// 96 byte BLS signature from the validator that produced this block header.
bytes signature = 2 [(ethereum.eth.ext.ssz_size) = "96"];
}
message IndexedAttestation {
repeated uint64 attesting_indices = 1 [(ethereum.eth.ext.ssz_max) = "2048"];
AttestationData data = 2;
// 96 bytes aggregate signature.
bytes signature = 3 [(ethereum.eth.ext.ssz_size) = "96"];
}
// Copyright 2021 Prysmatic Labs.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package ethereum.eth.v1alpha1;
import "eth/ext/options.proto";
import "eth/v1alpha1/attestation.proto";
import "eth/v1alpha1/beacon_block.proto";
option csharp_namespace = "Ethereum.Eth.v1alpha1";
option go_package = "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1;eth";
option java_multiple_files = true;
option java_outer_classname = "BeaconBlockAltairProto";
option java_package = "org.ethereum.eth.v1alpha1";
option php_namespace = "Ethereum\\Eth\\v1alpha1";
// The signed version of a Altair(HF1) beacon block.
message SignedBeaconBlockAltair {
// The unsigned beacon block itself.
BeaconBlockAltair block = 1;
// 96 byte BLS signature from the validator that produced this block.
bytes signature = 2 [(ethereum.eth.ext.ssz_size) = "96"];
}
// The unsigned version of a Altair(HF1) beacon block.. The message does not contain a validator signature.
message BeaconBlockAltair {
// Beacon chain slot that this block represents.
uint64 slot = 1 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/eth2-types.Slot"];
// Validator index of the validator that proposed the block header.
uint64 proposer_index = 2 [(ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/eth2-types.ValidatorIndex"];
// 32 byte root of the parent block.
bytes parent_root = 3 [(ethereum.eth.ext.ssz_size) = "32"];
// 32 byte root of the resulting state after processing this block.
bytes state_root = 4 [(ethereum.eth.ext.ssz_size) = "32"];
// The Altair beacon block body.
BeaconBlockBodyAltair body = 5;
}
// The block body of an Altair(HF1) beacon block.
// The new addition for Altair is SyncAggregate for light client support.
message BeaconBlockBodyAltair {
// The validators RANDAO reveal 96 byte value.
bytes randao_reveal = 1 [(ethereum.eth.ext.ssz_size) = "96"];
// A reference to the Ethereum 1.x chain.
Eth1Data eth1_data = 2;
// 32 byte field of arbitrary data. This field may contain any data and
// is not used for anything other than a fun message.
bytes graffiti = 3 [(ethereum.eth.ext.ssz_size) = "32"];
// Block operations
// Refer to spec constants at https://github.com/ethereum/eth2.0-specs/blob/dev/specs/core/0_beacon-chain.md#max-operations-per-block
// At most MAX_PROPOSER_SLASHINGS.
repeated ProposerSlashing proposer_slashings = 4 [(ethereum.eth.ext.ssz_max) = "16"];
// At most MAX_ATTESTER_SLASHINGS.
repeated AttesterSlashing attester_slashings = 5 [(ethereum.eth.ext.ssz_max) = "2"];
// At most MAX_ATTESTATIONS.
repeated Attestation attestations = 6 [(ethereum.eth.ext.ssz_max) = "128"];
// At most MAX_DEPOSITS.
repeated Deposit deposits = 7 [(ethereum.eth.ext.ssz_max) = "16"];
// At most MAX_VOLUNTARY_EXITS.
repeated SignedVoluntaryExit voluntary_exits = 8 [(ethereum.eth.ext.ssz_max) = "16"];
// Sync aggregate object to track sync committee votes for light client support. [New in Altair]
SyncAggregate sync_aggregate = 9;
}
// The sync aggregate object for the beacon chain to track sync committee votes and to
// support light client infra.
message SyncAggregate {
// Sync committee bits as Bitvector to track votes.
bytes sync_committee_bits = 1 [(ethereum.eth.ext.ssz_size) = "64", (ethereum.eth.ext.cast_type) = "github.com/prysmaticlabs/go-bitfield.Bitvector512"];
// BLS aggregated signature of the sync committee for the ones that voted.
bytes sync_committee_signature = 2 [(ethereum.eth.ext.ssz_size) = "96"];
}
This diff is collapsed.
This diff is collapsed.
// Copyright 2020 Prysmatic Labs.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// This is an optional proto that provides some gRPC gateway metadata for
// generating the OpenAPIv2(swagger) header.
syntax = "proto3";
package ethereum.eth.v1alpha1;
import "protoc-gen-openapiv2/options/annotations.proto";
option go_package = "github.com/prysmaticlabs/ethereumapis/eth/v1alpha1;eth";
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = {
info: {
title: "Ethereum Serenity APIs";
version: "v1alpha1";
license: {
name: "Licenced under Apache 2.0";
url: "http://www.apache.org/licenses/LICENSE-2.0";
};
description: "{{ index . "description" }}";
};
external_docs: {
url: "https://github.com/ethereum/eth2.0-specs";
description: "Ethereum Consensus Specification on Github";
};
host: "api.prylabs.net",
schemes: HTTPS;
schemes: WSS;
consumes: "application/json";
consumes: "application/grpc-web-text";
consumes: "application/grpc-web-json";
produces: "application/json";
produces: "application/grpc-web-text";
produces: "application/grpc-web-json";
};
{
"swagger": "2.0",
"info": {
"title": "Ethereum Serenity APIs",
"description": "{{ index . description }}",
"version": "v1alpha1",
"license": {
"name": "Licenced under Apache 2.0",
"url": "http://www.apache.org/licenses/LICENSE-2.0"
}
},
"host": "api.prylabs.net",
"schemes": [
"https",
"wss"
],
"consumes": [
"application/json",
"application/grpc-web-text",
"application/grpc-web-json"
],
"produces": [
"application/json",
"application/grpc-web-text",
"application/grpc-web-json"
],
"paths": {},
"definitions": {
"protobufAny": {
"type": "object",
"properties": {
"typeUrl": {
"type": "string"
},
"value": {
"type": "string",
"format": "byte"
}
}
},
"rpcStatus": {
"type": "object",
"properties": {
"code": {
"type": "integer",
"format": "int32"
},
"message": {
"type": "string"
},
"details": {
"type": "array",
"items": {
"$ref": "#/definitions/protobufAny"
}
}
}
}
},
"externalDocs": {
"description": "Ethereum 2.0 Specification on Github",
"url": "https://github.com/ethereum/eth2.0-specs"
}
}
[![Build status](https://badge.buildkite.com/62be08099e9e228b165c2dba69c637eb9ca7a1ca95efd54b9f.svg?branch=master)](https://buildkite.com/prysmatic-labs/ethereum-apis)[![Discord](https://user-images.githubusercontent.com/7288322/34471967-1df7808a-efbb-11e7-9088-ed0b04151291.png)](https://discord.gg/KSA7rPr)[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/prysmaticlabs/geth-sharding?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)[![ETH2.0_Spec_Version 0.12.1](https://img.shields.io/badge/ETH2.0%20Spec%20Version-v0.12.1-blue.svg)](https://github.com/ethereum/eth2.0-specs/tree/v0.12.1)
This swagger site hosts the service interface definitions for the Ethereum Serenity JSON API.
## Service Overview
At the core of Ethereum Serenity lies the "Beacon Chain", a proof-of-stake based blockchain managing a set of validators and "shards" across a network, which are stateful, smaller blockchains used for transaction and smart contract execution. The Beacon Chain reconciles consensus results across shards to provide the backbone of Ethereum Serenity. The services below allow for retrieval of current and historical information relating to validators, consensus, blocks, and staking participation.
| Package | Service | Version | Description |
|---------|---------|---------|-------------|
| eth | BeaconChain | v1alpha1 | This service is used to retrieve critical data relevant to the Ethereum Beacon Chain, including the most recent head block, current pending deposits, the chain state and more. |
| eth | Node | v1alpha1 | The Node service returns information about the Ethereum node itself, including versioning and general information as well as network sync status and a list of services currently implemented on the node.
| eth | Validator | v1alpha1 | This API provides the information a validator needs to retrieve throughout its lifecycle, including recieved assignments from the network, its current index in the state, as well the rewards and penalties that have been applied to it.
### JSON Mapping
The majority of field primitive types for Ethereum are either `bytes` or `uint64`. The canonical JSON mapping for those fields are a Base64 encoded string for `bytes`, or a string representation of `uint64`. Since JavaScript loses precision for values over [MAX_SAFE_INTEGER](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER), uint64 must be a JSON string in order to accommodate those values. If the field value not changed and is still set to protobuf's default, this field will be omitted from the JSON encoding entirely.
For more details on JSON mapping for other types, view the relevant section in the [proto3 language guide](https://developers.google.com/protocol-buffers/docs/proto3#json).
### Helpful gRPC Tooling and Resources
- [Google's API Style Guide](https://cloud.google.com/apis/design/)
- [Language reference for protoc3](https://developers.google.com/protocol-buffers/docs/proto3)
- [Awesome gRPC](https://github.com/grpc-ecosystem/awesome-grpc)
- [Protocol Buffer Basics: Go](https://developers.google.com/protocol-buffers/docs/gotutorial)
- [Transcoding gRPC to JSON/HTTP using Envoy](https://blog.jdriven.com/2018/11/transcoding-grpc-to-http-json-using-envoy/)
## Contributing
We have put all of our contribution guidelines into [CONTRIBUTING.md](https://github.com/prysmaticlabs/prysm/blob/master/CONTRIBUTING.md)! Check it out to get started.
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment