Created
December 15, 2017 12:49
-
-
Save neewy/4e347bc8493951733998e01af633dbbb to your computer and use it in GitHub Desktop.
A JSON schema for block in Iroha
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"definitions": {}, | |
"$schema": "http://json-schema.org/draft-06/schema#", | |
"$id": "http://example.com/example.json", | |
"type": "object", | |
"properties": { | |
"signatures": { | |
"$id": "/properties/signatures", | |
"type": "array", | |
"minItems": 1, | |
"items": { | |
"$id": "eurasianbear", | |
"title": "Array of signatures", | |
"description": "It accepts ed25519 signatures of peers, who validates the block and voted for it during consensus" | |
} | |
}, | |
"created_ts": { | |
"$id": "/properties/created_ts", | |
"type": "integer", | |
"title": "Timestamp of creation time", | |
"description": "unix time in milliseconds", | |
"default": 0, | |
"examples": [ | |
0 | |
] | |
}, | |
"hash": { | |
"$id": "/properties/hash", | |
"type": "string", | |
"title": "Block hash", | |
"description": "SHA3 hash", | |
"default": "", | |
"examples": [ | |
"107e0ee9963b93e19b98d41fe2d13da4acc72eb5fef3f341f71f6bae7a595a87" | |
] | |
}, | |
"prev_hash": { | |
"$id": "/properties/prev_hash", | |
"type": "string", | |
"title": "Hash of previous block", | |
"description": "Hash of previous block", | |
"default": "", | |
"examples": [ | |
"0000000000000000000000000000000000000000000000000000000000000000" | |
] | |
}, | |
"height": { | |
"$id": "/properties/height", | |
"type": "integer", | |
"title": "Height", | |
"description": "The length of the chain", | |
"default": 0, | |
"examples": [ | |
1 | |
] | |
}, | |
"txs_number": { | |
"$id": "/properties/txs_number", | |
"type": "integer", | |
"title": "Quantity of transactions in the block", | |
"description": "An explanation about the purpose of this instance.", | |
"default": 0, | |
"examples": [ | |
1 | |
] | |
}, | |
"transactions": { | |
"$id": "/properties/transactions", | |
"type": "array", | |
"minItems": 1, | |
"items": { | |
"$id": "/properties/transactions/items", | |
"type": "object", | |
"properties": { | |
"signatures": { | |
"$id": "/properties/transactions/items/properties/signatures", | |
"type": "array", | |
"minItems": 1, | |
"items": { | |
"$id": "europeanbear", | |
"title": "Empty Object", | |
"description": "This accepts anything, as long as it's valid JSON." | |
} | |
}, | |
"created_ts": { | |
"$id": "/properties/transactions/items/properties/created_ts", | |
"type": "integer", | |
"title": "The Created_ts Schema.", | |
"description": "An explanation about the purpose of this instance.", | |
"default": 0, | |
"examples": [ | |
0 | |
] | |
}, | |
"creator_account_id": { | |
"$id": "/properties/transactions/items/properties/creator_account_id", | |
"type": "string", | |
"title": "The Creator_account_id Schema.", | |
"description": "An explanation about the purpose of this instance.", | |
"default": "", | |
"examples": [ | |
"" | |
] | |
}, | |
"tx_counter": { | |
"$id": "/properties/transactions/items/properties/tx_counter", | |
"type": "integer", | |
"title": "The Tx_counter Schema.", | |
"description": "An explanation about the purpose of this instance.", | |
"default": 0, | |
"examples": [ | |
0 | |
] | |
}, | |
"commands": { | |
"$id": "/properties/transactions/items/properties/commands", | |
"type": "array", | |
"minItems": 1, | |
"items": { | |
"$id": "/properties/transactions/items/properties/commands/items", | |
"type": "object", | |
"properties": { | |
"command_type": { | |
"$id": "/properties/transactions/items/properties/commands/items/properties/command_type", | |
"type": "string", | |
"title": "The Command_type Schema.", | |
"description": "An explanation about the purpose of this instance.", | |
"default": "", | |
"examples": [ | |
"AddPeer" | |
] | |
}, | |
"address": { | |
"$id": "/properties/transactions/items/properties/commands/items/properties/address", | |
"type": "string", | |
"title": "The Address Schema.", | |
"description": "An explanation about the purpose of this instance.", | |
"default": "", | |
"examples": [ | |
"localhost:10001" | |
] | |
}, | |
"peer_key": { | |
"$id": "/properties/transactions/items/properties/commands/items/properties/peer_key", | |
"type": "string", | |
"title": "The Peer_key Schema.", | |
"description": "An explanation about the purpose of this instance.", | |
"default": "", | |
"examples": [ | |
"19f5bf5dec59a7ee40e3e609b9d54a0f048633a6db42f27b1609d2d06aa9234e" | |
] | |
} | |
} | |
} | |
} | |
} | |
} | |
} | |
}, | |
"required": [ | |
"signatures", | |
"created_ts", | |
"hash", | |
"prev_hash", | |
"height", | |
"txs_number", | |
"transactions" | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment