OpenAPI Specification
openapi: 3.0.1
info:
title: Meterest Accounts Subscriptions API
description: 'RESTful API to access Meter.io
[Project Home](https://github.com/meterio)
'
license:
name: LGPL 3.0
url: https://www.gnu.org/licenses/lgpl-3.0.en.html
version: 1.2.2
servers:
- url: /
description: local meter node
tags:
- name: Subscriptions
description: Subscribe interested subjects
paths:
/subscriptions/block:
get:
tags:
- Subscriptions
summary: (Websocket) Subscribe new blocks
parameters:
- $ref: '#/components/parameters/PositionInQuery'
responses:
'200':
description: OK
content:
application/json:
schema:
allOf:
- $ref: '#/components/schemas/Block'
- $ref: '#/components/schemas/Obsolete'
/subscriptions/event:
get:
tags:
- Subscriptions
summary: (Websocket) Subscribe new events
description: 'which satisfy criteria in query.
'
parameters:
- $ref: '#/components/parameters/PositionInQuery'
- name: addr
in: query
schema:
type: string
description: address of event emitter
- name: t0
in: query
schema:
type: string
description: topic0 of event
- name: t1
in: query
schema:
type: string
description: topic1 of event
- name: t2
in: query
schema:
type: string
description: topic2 of event
- name: t3
in: query
schema:
type: string
description: topic3 of event
- name: t4
in: query
schema:
type: string
description: topic4 of event
responses:
'200':
description: OK
content:
application/json:
schema:
allOf:
- $ref: '#/components/schemas/Event'
- $ref: '#/components/schemas/Obsolete'
- type: object
properties:
meta:
$ref: '#/components/schemas/LogMeta'
/subscriptions/transfer:
get:
tags:
- Subscriptions
summary: (Websocket) Subscribe new transfers
description: 'which satisfy criteria in query.
'
parameters:
- $ref: '#/components/parameters/PositionInQuery'
- name: txOrigin
in: query
schema:
type: string
description: signer address of tx which contains the transfer
- name: sender
in: query
schema:
type: string
description: address of token sender
- name: recipient
in: query
schema:
type: string
description: address of token recipient
responses:
'200':
description: OK
content:
application/json:
schema:
allOf:
- $ref: '#/components/schemas/Transfer'
- $ref: '#/components/schemas/Obsolete'
- type: object
properties:
meta:
$ref: '#/components/schemas/LogMeta'
/subscriptions/beat:
get:
tags:
- Subscriptions
summary: (Websocket) Subscribe block chain's beats
description: 'which contain summary of new blocks, and bloom filters that composited with affected addresses.
'
parameters:
- $ref: '#/components/parameters/PositionInQuery'
responses:
'200':
description: OK
content:
application/json:
schema:
allOf:
- $ref: '#/components/schemas/Beat'
- $ref: '#/components/schemas/Obsolete'
components:
parameters:
PositionInQuery:
name: pos
in: query
description: 'a saved block ID for resuming the subscription. best block ID is assumed if omitted.
'
schema:
type: string
schemas:
Block:
properties:
number:
type: integer
format: uint32
description: block number (height)
example: 325324
id:
type: string
format: bytes32
description: block identifier
example: '0x0004f6cc88bb4626a92907718e82f255b8fa511453a78e8797eb8cea3393b215'
size:
type: integer
format: uint32
description: RLP encoded block size in bytes
example: 373
parentID:
type: string
format: bytes32
description: parent block ID
example: '0x0004f6cb730dbd90fed09d165bfdf33cc0eed47ec068938f6ee7b7c12a4ea98d'
timestamp:
type: integer
format: uint64
description: block unix timestamp
example: 1533267900
gasLimit:
type: integer
format: uint64
description: block gas limit (max allowed accumulative gas usage of transactions)
example: 11253579
beneficiary:
type: string
format: bytes32
description: address of account to receive block reward
example: '0xb4094c25f86d628fdd571afc4077f0d0196afb48'
gasUsed:
type: integer
format: uint64
description: accumulative gas usage of transactions
example: 21000
totalScore:
type: integer
format: uint64
description: sum of all ancestral blocks' score
example: 1029988
txsRoot:
type: string
format: bytes32
description: root hash of transactions in the block
example: '0x89dfd9fcd10c9e53d68592cf8b540b280b72d381b868523223992f3e09a806bb'
stateRoot:
type: string
format: bytes32
description: root hash of accounts state
example: '0x86bcc6d214bc9d8d0dedba1012a63c8317d19ce97f60c8a2ef5c59bbd40d4261'
receiptsRoot:
type: string
format: bytes32
description: root hash of transaction receipts
example: '0x15787e2533c470e8a688e6cd17a1ee12d8457778d5f82d2c109e2d6226d8e54e'
signer:
type: string
format: bytes20
description: the one who signed this block
example: '0xab7b27fc9e7d29f9f2e5bd361747a5515d0cc2d1'
transactions:
type: array
description: transactions IDs
items:
type: string
format: bytes32
description: transaction ID
example: '0x284bba50ef777889ff1a367ed0b38d5e5626714477c40de38d71cedd6f9fa477'
Obsolete:
properties:
obsolete:
type: boolean
description: 'indicates whether the block containing this data become branch block
'
Transfer:
properties:
sender:
type: string
description: address that sends tokens
example: '0xdb4027477b2a8fe4c83c6dafe7f86678bb1b8a8d'
recipient:
type: string
description: address that receives tokens
example: '0x5034aa590125b64023a0262112b98d72e3c8e40e'
amount:
type: string
description: amount of tokens
example: '0x47fdb3c3f456c0000'
LogMeta:
description: event or transfer log meta info
properties:
blockID:
type: string
description: block identifier (bytes32)
example: '0x0004f6cc88bb4626a92907718e82f255b8fa511453a78e8797eb8cea3393b215'
blockNumber:
type: integer
format: uint32
description: block number (height)
example: 325324
blockTimestamp:
type: integer
format: uint64
description: block unix timestamp
example: 1533267900
txID:
type: string
description: transaction identifier
example: '0x284bba50ef777889ff1a367ed0b38d5e5626714477c40de38d71cedd6f9fa477'
txOrigin:
type: string
description: transaction origin (signer)
example: '0xdb4027477b2a8fe4c83c6dafe7f86678bb1b8a8d'
Event:
properties:
address:
type: string
description: the address of contract which produces the event (bytes20)
example: '0x7567d83b7b8d80addcb281a71d54fc7b3364ffed'
topics:
type: array
items:
type: string
example: '0x4de71f2d588aa8a1ea00fe8312d92966da424d9939a511fc0be81e65fad52af8'
data:
type: string
example: '0x4de71f2d588aa8a1ea00fe8312d92966da424d9939a511fc0be81e65fad52af8'
Beat:
properties:
number:
type: integer
format: uint32
description: block number (height)
example: 325324
id:
type: string
format: bytes32
description: block identifier
example: '0x0004f6cc88bb4626a92907718e82f255b8fa511453a78e8797eb8cea3393b215'
parentID:
type: string
format: bytes32
description: parent block ID
example: '0x0004f6cb730dbd90fed09d165bfdf33cc0eed47ec068938f6ee7b7c12a4ea98d'
timestamp:
type: integer
format: uint64
description: block unix timestamp
example: 1533267900
bloom:
type: string
format: hex
description: 'the bloom filter composited with affected addresses
'
example: '0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'
k:
type: integer
format: uint32
description: 'the number of hash functions for bloom filter
'
example: 3