The Vote Schema File

BigchainDB checks all votes (JSON documents) against a formal schema defined in a JSON Schema file named vote.yaml. The contents of that file are copied below. To understand those contents (i.e. JSON Schema), check out “Understanding JSON Schema” by Michael Droettboom or json-schema.org.

vote.yaml

---
"$schema": "http://json-schema.org/draft-04/schema#"
id: "http://www.bigchaindb.com/schema/vote.json"
type: object
additionalProperties: false
title: Vote Schema
required:
- node_pubkey
- signature
- vote
properties:
  node_pubkey:
    type: "string"
    pattern: "[1-9a-zA-Z^OIl]{43,44}"
  signature:
    type: "string"
    pattern: "[1-9a-zA-Z^OIl]{86,88}"
  vote:
    type: "object"
    additionalProperties: false
    required:
    - invalid_reason
    - is_block_valid
    - previous_block
    - voting_for_block
    - timestamp
    properties:
      previous_block:
        "$ref": "#/definitions/sha3_hexdigest"
      voting_for_block:
        "$ref": "#/definitions/sha3_hexdigest"
      is_block_valid:
        type: "boolean"
      invalid_reason:
        anyOf:
        - type: "string"
        - type: "null"
      timestamp:
        type: "string"
        pattern: "[0-9]{10}"
definitions:
  sha3_hexdigest:
    pattern: "[0-9a-f]{64}"
    type: string