From 91f8af8fd8a85200ab09a5a610c7b657796c23d9 Mon Sep 17 00:00:00 2001 From: Ethan Buchman Date: Wed, 5 Sep 2018 19:14:18 -0400 Subject: [PATCH] docs/spec/blockchain: update vote, signature, time --- docs/spec/blockchain/blockchain.md | 68 ++++++++++-------------------- 1 file changed, 23 insertions(+), 45 deletions(-) diff --git a/docs/spec/blockchain/blockchain.md b/docs/spec/blockchain/blockchain.md index 35fb9d67..dc3ba64b 100644 --- a/docs/spec/blockchain/blockchain.md +++ b/docs/spec/blockchain/blockchain.md @@ -8,9 +8,9 @@ The Tendermint blockchains consists of a short list of basic data types: - `Block` - `Header` -- `Vote` - `BlockID` -- `Signature` +- `Time` +- `Vote` - `Evidence` ## Block @@ -90,6 +90,16 @@ type PartsHeader struct { } ``` +## Time + +Tendermint uses the +[Google.Protobuf.WellKnownTypes.Timestamp](https://developers.google.com/protocol-buffers/docs/reference/csharp/class/google/protobuf/well-known-types/timestamp) +format, which uses two integers, one for Seconds and for Nanoseconds. + +TODO: clarify exact format and reconcile [this +comment](https://github.com/tendermint/tendermint/blob/892b170818cd3be4cd3f919d72dde1ad60c28bbb/types/proto3/block.proto#L43). + + ## Vote A vote is a signed message from a validator for a particular block. @@ -97,14 +107,14 @@ The vote includes information about the validator signing it. ```go type Vote struct { - Timestamp int64 - Address []byte - Index int - Height int64 - Round int - Type int8 - BlockID BlockID - Signature Signature + ValidatorAddress []byte + ValidatorIndex int + Height int64 + Round int + Timestamp Time + Type int8 + BlockID BlockID + Signature []byte } ``` @@ -114,41 +124,9 @@ a _precommit_ has `vote.Type == 2`. ## Signature -Tendermint allows for multiple signature schemes to be used by prepending a single type-byte -to the signature bytes. Different signatures may also come with fixed or variable lengths. -Currently, Tendermint supports Ed25519 and Secp256k1. - -### ED25519 - -An ED25519 signature has `Type == 0x1`. It looks like: - -```go -// Implements Signature -type Ed25519Signature struct { - Type int8 = 0x1 - Signature [64]byte -} -``` - -where `Signature` is the 64 byte signature. - -### Secp256k1 - -A `Secp256k1` signature has `Type == 0x2`. It looks like: - -```go -// Implements Signature -type Secp256k1Signature struct { - Type int8 = 0x2 - Signature []byte -} -``` - -where `Signature` is the DER encoded signature, ie: - -```hex -0x30 <0x02> 0x2 . -``` +Signatures in Tendermint are raw bytes representing the underlying signature. +The only signature scheme currently supported for Tendermint validators is +ED25519. The signature is the raw 64-byte ED25519 signature. ## Evidence