DocsThe data protocol

layer/v1

packages/core/schema/layer.schema.json
On this page

One set of facts about an address's participants, from one author, at one time, named by the SHA-256 of its canonical JSON and never changed after (specs/005-mapping-brain/data.md). Who made it is kept by whoever stores it, outside the hash.

Fields

Field Type or allowed values Presence in its parent Description
petal "layer/v1" Required
about string Required the investigated address, chain:address (eip155:100:0x…, near:mainnet:alice.near)
kind "measures" Required
measures array Required
measures[] object Required
measures[].name string Required
measures[].unit string Required
measures[].kind "amount" / "count" / "share" / "category" / "flag" Required
measures[].label string Optional
rows array Required a value per participant and piece of data; amounts, counts and shares as decimal text
rows[] object Required
rows[].participant string Required
rows[].measure string Required
rows[].value string Required
how object Required
how.method string Required how it was made, in words anyone could repeat
how.sources array Required
how.sources[] object Required
how.sources[].url string Required
how.sources[].note string Optional
how.recipe string Optional the reading recipe it was read with, by hash
from array Required the layers or readings it was built on, by hash
from[] string Required
when object Required
when.as_of string Required a full date and time, with its zone
when.block_height integer Optional
standing "verified" / "inferred" / "lead" Required verified: read from the chain, and anyone can read it again; inferred: a step beyond a read; lead: a direction, never a fact

Examples

layer.v1.json

Fixture source

{
  "petal": "layer/v1",
  "about": "eip155:100:0x10e31c10fb0b3f56a9e7fd0b0a3d17a1be0ac9c1",
  "kind": "measures",
  "measures": [
    {
      "name": "proposals_written",
      "unit": "proposals",
      "kind": "count",
      "label": "Proposals written"
    }
  ],
  "rows": [
    {
      "participant": "eip155:100:0x1111111111111111111111111111111111111111",
      "measure": "proposals_written",
      "value": "3"
    },
    {
      "participant": "eip155:100:0x2222222222222222222222222222222222222222",
      "measure": "proposals_written",
      "value": "1"
    }
  ],
  "how": {
    "method": "counted the DAO's ProcessProposal events by who sent each submission",
    "sources": [
      {
        "url": "https://rpc.gnosischain.com",
        "note": "eth_getLogs"
      }
    ]
  },
  "from": [],
  "when": {
    "as_of": "2026-11-09T00:00:00Z",
    "block_height": 40000000
  },
  "standing": "verified"
}

Full schema

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "urn:petal:schema:layer:v1",
  "title": "Petal layer v1",
  "description": "One set of facts about an address's participants, from one author, at one time, named by the SHA-256 of its canonical JSON and never changed after (specs/005-mapping-brain/data.md). Who made it is kept by whoever stores it, outside the hash.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "petal",
    "about",
    "kind",
    "measures",
    "rows",
    "how",
    "from",
    "when",
    "standing"
  ],
  "properties": {
    "petal": {
      "const": "layer/v1"
    },
    "about": {
      "description": "the investigated address, chain:address (eip155:100:0x…, near:mainnet:alice.near)",
      "type": "string",
      "pattern": "^[-a-z0-9]{3,8}:[-_a-zA-Z0-9]{1,32}:\\S{2,128}$"
    },
    "kind": {
      "const": "measures"
    },
    "measures": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "name",
          "unit",
          "kind"
        ],
        "properties": {
          "name": {
            "type": "string",
            "pattern": "^[a-z][a-z0-9_]{0,40}$"
          },
          "unit": {
            "type": "string",
            "minLength": 1
          },
          "kind": {
            "enum": [
              "amount",
              "count",
              "share",
              "category",
              "flag"
            ]
          },
          "label": {
            "type": "string"
          }
        }
      }
    },
    "rows": {
      "description": "a value per participant and piece of data; amounts, counts and shares as decimal text",
      "type": "array",
      "minItems": 1,
      "maxItems": 20000,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "participant",
          "measure",
          "value"
        ],
        "properties": {
          "participant": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200
          },
          "measure": {
            "type": "string"
          },
          "value": {
            "type": "string"
          }
        }
      }
    },
    "how": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "method",
        "sources"
      ],
      "properties": {
        "method": {
          "description": "how it was made, in words anyone could repeat",
          "type": "string",
          "pattern": "\\S"
        },
        "sources": {
          "type": "array",
          "items": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "url"
            ],
            "properties": {
              "url": {
                "type": "string",
                "pattern": "^(https?://|petal:|eip155:|near:)\\S+$"
              },
              "note": {
                "type": "string"
              }
            }
          }
        },
        "recipe": {
          "description": "the reading recipe it was read with, by hash",
          "type": "string",
          "pattern": "^[0-9a-f]{64}$"
        }
      }
    },
    "from": {
      "description": "the layers or readings it was built on, by hash",
      "type": "array",
      "items": {
        "type": "string",
        "pattern": "^[0-9a-f]{64}$"
      }
    },
    "when": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "as_of"
      ],
      "properties": {
        "as_of": {
          "description": "a full date and time, with its zone",
          "type": "string",
          "format": "date-time"
        },
        "block_height": {
          "type": "integer",
          "minimum": 0
        }
      }
    },
    "standing": {
      "description": "verified: read from the chain, and anyone can read it again; inferred: a step beyond a read; lead: a direction, never a fact",
      "enum": [
        "verified",
        "inferred",
        "lead"
      ]
    }
  }
}