1. Defining your Schema

The schema development phase gets both of our teams on the same page on what data we are expecting to ingest.

We've started working on a schema in the JSON schema standard during the kick-off call, now you'll need to fill out the information specific to your chain. Our data engineering/science team will conduct an initial review of the schema to make sure it contains the information we need to analyze your chain.

The following checklist, along with our discussion on the call, will help guide you to include the information we need

  • Block ID

  • Block Timestamp

  • Transaction ID

  • Transaction Fee Amount

  • Amount Transferred

  • To Address

  • From address

  • Currency Transferred (if there are multiple)

  • Smart Contract Events (if applicable)

  • Smart Contract Actors (if applicable)

  • Internal Transactions (if applicable)

Example Schema Files

The following is for example purposes only. It is up to your team to define your unique schema file(s). The only requirement is that block/transaction/contract data must be parsed and decoded into a human-readable format. For example if data associated with smart contract calls or logs (any internal transactions) are encoded this must be fully decoded into a human-readable format.

block_schema.json
transaction_schema.json
input.json
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "array",
"title": "Root Block Schema",
"items": {
"required": [
"bits",
"chain_work",
"confirmations",
"difficulty",
"hash",
"height",
"prev_block_hash",
"prev_block_hash_as_number",
"transactions",
],
"properties": {
"bits": {
"type": "boolean",
"description": "The value of the nBits field in the block header, indicating the target threshold this block’s header had to pass"
},
"chain_work": {
"type": "string",
"description": "The estimated number of block header hashes miners had to check from the genesis block to this block, encoded as big-endian hex."
},
"confirmations": {
"type": "integer",
"description": "The number of confirmations the transactions in this block have, starting at 1 when this block is at the tip of the best block chain. This score will be -1 if the the block is not part of the best block chain."
},
"transactions": {
"$ref": "transactions.json"
},
"height": {
"type": "integer",
"description": "The height of this block on its block chain."
},...
{
"definitions": {},
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "array",
"items": {
"required": [
"coinbase",
"hash",
"id",
"index",
"inputs",
"outputs",
],
"properties": {
"coinbase": {
"type": "boolean",
"description": "The coinbase (similar to the hex field of a scriptSig) encoded as hex. Only present if this is a coinbase transaction."
},
"hash": {
"type": "string",
"description": "The transaction hash."
},
"id": {
"type": "string",
"description": "The transaction's TXID encoded as hex in RPC byte order"
},
"index": {
"type": "integer",
"description": "Index of the transaction in the block."
},
"inputs": {
"$ref": "inputs.json"
},
"outputs": {
"$ref": "outputs.json",
"description": "The output index number (vout) of the outpoint being spent. The first output in a transaction has an index of 0. Not present if this is a coinbase transaction."
}
...
}
}
}
{
"$schema": "http://json-schema.org/draft-07/schema#",
"definitions": {
"inputs": {
"type": "object",
"properties": {
"output_index": {
"type": "integer",
"description": "The output index number (vout) of the outpoint being spent. The first output in a transaction has an index of 0. Not present if this is a coinbase transaction"
},
"prev_output": {
"$ref": "file://outputs.json"
},
"script_sig": {
"type": "string",
"description": "An object describing the signature script of this input. Not present if this is a coinbase transaction"
},
"txid": {
"type": "string",
"description": "The TXID of the outpoint being spent, encoded as hex in RPC byte order. Not present if this is a coinbase transaction."
},
"txid_as_number": {
"type": "integer",
"description": "Integer representation of the transaction id."
},
"txinwitness": {
"type": "array",
"description": "Hex-encoded witness data. Only for segregated witness transactions"
}
}
}
},
"type": "array",
"items": {"$ref": "#/definitions/inputs"}
}

Before continuing to write your parser, please share your schema with the our data team for review.