Schema format

When writing data to Beneath, it is required that you provide a file to detail the data’s schema. By explicitly defining the schema, our underlying data infrastructure can interpret your data the same way that you do. The schema file should follow the format of the “GraphQL schema language.” The following are a few examples for different data streams.


" Blocks loaded from Ethereum "
type Block @stream(name: "blocks", key: "number") {
  " Block number "
  number: Int!

  " Block timestamp "
  timestamp: Timestamp!

  " Block hash "
  hash: Bytes32!

  " Hash of parent block "
  parentHash: Bytes32!

  " Address of block miner "
  miner: Bytes20!

  " Size of block in bytes "
  size: Int!

  " Number of transactions in block "
  transactions: Int!

  " Block difficulty "
  difficulty: Numeric!

  " Extra data embedded in block by miner "
  extraData: Bytes!

  " Gas limit "
  gasLimit: Int!

  " Gas used "
  gasUsed: Int!


" Dai transfers including mints and burns "
type DaiTransfers @stream(name: "dai-transfers", key: ["time", "index"]) {
  transactionHash: String!
  time: Timestamp! 
  index: Int!
  name: String!
  from: String
  to: String
  value: String!


" Metrics on daily activity in Dai "
type DaiDailyActivity @stream(name: "dai-daily-activity", key: "day") {
  day: Timestamp!
  users: Int!
  senders: Int!
  receivers: Int!
  transfers: Int!
  minted: Float!
  burned: Float!
  turnover: Float!

Note: An exclamation point after the type (e.g. “Float!”) indicates that the field is required. Fields without exclamation points indicate that the field is not required.