1. Defining your Schema

The first step in the process of creating a Chainwalker is to define the block schema and transaction schema for the fully decoded/parsed data. All schema files should be placed into the schema directory. Each schema file should contain the names of fields, whether the field is optional, a description, and the data type of each field.

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 are encoded this must be fully decoded into a human-readable format.

block_schema.json
header_schema.json
transaction_schema.json
{
"Hash": {
"type": "string",
"description": "Block hash",
"required": true
},
"Header": {
"type": "struct",
"description": "Block header",
"required": true
},
"Transactions": {
"type": "struct",
"description": "transactions in the block",
"required": false
}
}
{
"Version": {
"type": "integer",
"description": "Block height",
"required": true
},
"PrevBlockHash": {
"type": "string",
"description": "previous block hash",
"required": true
},
"TransactionsRoot": {
"type": "string",
"description": "transactions root",
"required": true
},
"BlockRoot": {
"type": "string",
"description": "block root",
"required": true
},
"Timestamp": {
"type": "integer",
"description": "Block timestamp",
"required": true
},
"Height": {
"type": "integer",
"description": "Block height",
"required": true
},
"ConsensusData": {
"type": "integer",
"description": "consensus data",
"required": true
},
"ConsensusPayload": {
"type": "string",
"description": "consensus payload",
"required": true
},
"NextBookkeeper": {
"type": "string",
"description": "bookkeeper address",
"required": true
},
"Bookkeepers": {
"type": "array",
"description": "bookkeeper publickey",
"required": true
},
"SigData": {
"type": "array",
"description": "signature data",
"required": true
},
"Hash": {
"type": "string",
"description": "block hash",
"required": true
}
}
‚Äč
{
"Version": {
"type": "integer",
"description": "transaction version",
"required": true
},
"Nonce": {
"type": "integer",
"description": "random number",
"required": true
},
"GasPrice": {
"type": "integer",
"description": "gas price",
"required": true
},
"GasLimit": {
"type": "integer",
"description": "gas limit",
"required": true
},
"Payer": {
"type": "string",
"description": "payer address for transaction fee",
"required": true
},
"TxType": {
"type": "integer",
"description": "transaction type",
"required": true
},
"Payload": {
"type": "string",
"description": "transaction payload",
"required": true
},
"Attributes": {
"type": "array",
"description": "transaction attributes",
"required": false
},
"Sigs": {
"type": "array",
"description": "transaction signature",
"required": true
},
"Hash": {
"type": "string",
"description": "transaction hash",
"required": true
},
"Height": {
"type": "integer",
"description": "transaction height",
"required": false
},
"States": {
"type": "array",
"description": "transaction events",
"required": false
}
}

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