Last active
March 5, 2019 03:30
-
-
Save CodeSandwich/1349fef0d1fd277b018be04e996c6df2 to your computer and use it in GitHub Desktop.
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
openapi: "3.0.2" | |
info: | |
title: Generic blockchain node REST API | |
version: 0.0.1 | |
paths: | |
/v0/tip: | |
description: Get block ID of the chain tip | |
get: | |
responses: | |
200: | |
description: Block ID of the chain tip | |
content: | |
text/plain: | |
schema: | |
$ref: '#/components/schemas/block_id' | |
/v0/block/{block_id}: | |
description: Fetch binary blob of a block with given ID | |
get: | |
parameters: | |
- $ref: '#/components/parameters/block_id_path' | |
responses: | |
200: | |
description: Binary blob with a block | |
content: | |
application/octet-stream: | |
schema: | |
type: string | |
format: binary | |
404: | |
description: Block with given ID was not found | |
/v0/block/{block_id}/next_id: | |
description: Get IDs of block's descendants | |
get: | |
parameters: | |
- $ref: '#/components/parameters/block_id_path' | |
- name: count | |
in: query | |
description: Number of descendant block IDs to fetch | |
schema: | |
type: integer | |
minimum: 1 | |
default: 1 | |
responses: | |
200: | |
description: > | |
List of block descendants' IDs sorted from closest to farthest. | |
The returned data is concatenation of IDs binary blobs. | |
If requested block has less descendants than `size`, the list contains | |
all its descendants. | |
content: | |
application/octet-stream: | |
schema: | |
type: string | |
format: binary | |
404: | |
description: Block with given ID was not found | |
/v0/transaction: | |
description: Publish a signed transaction | |
post: | |
requestBody: | |
description: Signed transaction | |
required: true | |
content: | |
application/octet-stream: | |
schema: | |
type: string | |
format: binary | |
responses: | |
200: | |
description: Transaction was accepted | |
/v0/node/stats: | |
description: Fetch node stats | |
get: | |
responses: | |
200: | |
description: Node stats | |
content: | |
application/json: | |
schema: | |
type: object | |
properties: | |
uptime: | |
description: Node uptime in seconds | |
type: integer | |
minimum: 0 | |
components: | |
parameters: | |
block_id_path: | |
name: block_id | |
in: path | |
required: true | |
schema: | |
$ref: '#/components/schemas/block_id' | |
schemas: | |
block_id: | |
description: Block ID encoded as hex | |
type: string | |
pattern: '[0-9a-fA-F]+' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment