Kusama trace API
The trace API from Kusama — 4 operation(s) for trace.
The trace API from Kusama — 4 operation(s) for trace.
openapi: 3.0.0
info:
title: Substrate API Sidecar accounts trace API
description: '> ⚠️ **Deprecation Notice** — `substrate-api-sidecar` is deprecated in favor of
> [`polkadot-rest-api`](https://github.com/paritytech/polkadot-rest-api), a ground-up Rust rewrite
> built on [`subxt`](https://github.com/paritytech/subxt) with 1:1 API compatibility (endpoints
> served under `/v1/`, e.g. `/v1/blocks/head`), stable memory under sustained load, significantly
> lower latency and higher throughput, and native SCALE decoding via `parity-scale-codec`.
>
> **Migrate today:** Docker `paritytech/polkadot-rest-api:v0.1.0` ·
> [crate](https://crates.io/crates/polkadot-rest-api) ·
> [migration guide](https://github.com/paritytech/polkadot-rest-api/blob/main/docs/guides/MIGRATION.md) ·
> [docs](https://paritytech.github.io/polkadot-rest-api/) ·
> [issues](https://github.com/paritytech/polkadot-rest-api/issues)
Substrate API Sidecar is a REST service that makes it easy to interact with blockchain nodes
built using Substrate''s FRAME framework.
'
contact:
url: https://github.com/paritytech/substrate-api-sidecar
license:
name: GPL-3.0-or-later
url: https://github.com/paritytech/substrate-api-sidecar/blob/master/LICENSE
version: 20.14.1
servers:
- url: https://polkadot-public-sidecar.parity-chains.parity.io/
description: Polkadot Parity public sidecar
- url: https://kusama-public-sidecar.parity-chains.parity.io/
description: Kusama Parity public sidecar
- url: https://polkadot-asset-hub-public-sidecar.parity-chains.parity.io/
description: Polkadot Asset Hub Parity public sidecar
- url: https://kusama-asset-hub-public-sidecar.parity-chains.parity.io/
description: Kusama Asset Hub Parity public sidecar
- url: http://localhost:8080
description: Localhost
tags:
- name: trace
paths:
/experimental/blocks/head/traces:
get:
tags:
- trace
summary: '[Experimental - subject to breaking change.] Get traces for the most
recently finalized block.
'
description: 'Returns traces (spans and events) of the most recently finalized block from
RPC `state_straceBlock`. Consult the [RPC docs](https://github.com/paritytech/substrate/blob/aba876001651506f85c14baf26e006b36092e1a0/client/rpc-api/src/state/mod.rs#L140)
for conceptual info.
'
responses:
'200':
description: successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/BlocksTrace'
/experimental/blocks/{blockId}/traces:
get:
tags:
- trace
summary: '[Experimental - subject to breaking change.] Get traces for the given `blockId`.
'
description: 'Returns traces (spans and events) of the specified block from
RPC `state_straceBlock`. Consult the [RPC docs](https://github.com/paritytech/substrate/blob/aba876001651506f85c14baf26e006b36092e1a0/client/rpc-api/src/state/mod.rs#L140) for conceptual info.
'
parameters:
- name: blockId
in: path
description: Block identifier, as the block height or block hash.
required: true
schema:
pattern: ^0[xX][0-9a-fA-F]{1,64}$|[0-9]{1,12}
type: string
responses:
'200':
description: successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/BlocksTrace'
/experimental/blocks/head/traces/operations:
get:
tags:
- trace
summary: '[Experimental - subject to breaking change.] Get the operations from the
most recently finalized block.
'
description: 'Returns the operations from the most recently finalized block. Operations
represent one side of a balance change. For example if Alice transfers
100unit to Bob there will be two operations; 1) Alice - 100 2) Bob + 100.
Given account A and A''s balance at block k0 (Ak0), if we sum all the
operations for A from block k1 through kn against Ak0, we will end up
with A''s balance at block kn (Akn). Thus, operations can be used to audit
that balances change as expected.
This is useful for Substrate based chains because the advanced business
logic can make it difficult to ensure auditable balance reconciliation
based purely on events. Instead of using events one can use the
operations given from this endpoint.
Note - each operation corresponds to a delta of a single field of the
`system::AccountData` storage item (i.e `free`, `reserved`, `misc_frozen`
and `fee_frozen`).
Note - operations are assigned a block execution phase (and extrinsic index
for those in the apply extrinsic phase) based on an "action group". For
example all the operations for 1 extrinsic will be in the same action group.
The action groups can optionally be fetched with the `action` query param
for closer auditing.
Note - There are no 0 value operations (e.g. a transfer of 0, or a
transfer to itself)
To learn more about operation and action group creation please consult
[this diagram](https://docs.google.com/drawings/d/1vZoJo9jaXlz0LmrdTOgHck9_1LsfuQPRmTr-5g1tOis/edit?usp=sharing)
'
parameters:
- name: actions
in: query
description: Whether or not to include action groups.
required: false
schema:
type: boolean
default: false
responses:
'200':
description: successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/BlocksTraceOperations'
/experimental/blocks/{blockId}/traces/operations:
get:
tags:
- trace
summary: '[Experimental - subject to breaking change.] Get the operations from the
specified block.
'
description: 'Returns the operations from the most recently finalized block. Operations
represent one side of a balance change. For example if Alice transfers
100unit to Bob there will be two operations; 1) Alice - 100 2) Bob + 100.
Given account A and A''s balance at block k0 (Ak0), if we sum all the
operations for A from block k1 through kn against Ak0, we will end up
with A''s balance at block kn (Akn). Thus, operations can be used to audit
that balances change as expected.
This is useful for Substrate based chains because the advanced business
logic can make it difficult to ensure auditable balance reconciliation
based purely on events. Instead of using events one can use the
operations given from this endpoint.
Note - each operation corresponds to a delta of a single field of the
`system::AccountData` storage item (i.e `free`, `reserved`, `misc_frozen`
and `fee_frozen`).
Note - operations are assigned a block execution phase (and extrinsic index
for those in the apply extrinsic phase) based on an "action group". For
example all the operations for 1 extrinsic will be in the same action group.
The action groups can optionally be fetched with the `action` query param
for closer auditing.
Note - There are no 0 value operations (e.g. a transfer of 0, or a
transfer to itself)
To learn more about operation and action group creation please consult
[this diagram](https://docs.google.com/drawings/d/1vZoJo9jaXlz0LmrdTOgHck9_1LsfuQPRmTr-5g1tOis/edit?usp=sharing)
'
parameters:
- name: blockId
in: path
description: Block identifier, as the block height or block hash.
required: true
schema:
pattern: ^0[xX][0-9a-fA-F]{1,64}$|[0-9]{1,12}
type: string
- name: actions
in: query
description: Whether or not to include action groups.
required: false
schema:
type: boolean
default: false
responses:
'200':
description: successful operation
content:
application/json:
schema:
$ref: '#/components/schemas/BlocksTraceOperations'
components:
schemas:
TraceSpan:
type: object
properties:
id:
type: string
format: unsignedInteger
name:
type: string
parentId:
type: string
format: unsignedInteger
target:
type: string
wasm:
type: boolean
OperationAmountCurrency:
type: object
properties:
symbol:
type: string
example: KSM
TraceEvent:
type: object
properties:
data:
type: object
properties:
stringValues:
$ref: '#/components/schemas/TraceEventDataStringValues'
parentId:
type: string
format: unsignedInteger
target:
type: string
BlockIdentifiers:
type: object
properties:
hash:
type: string
description: The block's hash.
format: hex
height:
type: string
description: The block's height.
format: unsignedInteger
BlocksTraceOperations:
type: object
properties:
at:
$ref: '#/components/schemas/BlockIdentifiers'
operations:
type: array
items:
$ref: '#/components/schemas/Operation'
SpanId:
type: object
properties:
name:
type: string
target:
type: string
id:
type: string
format: unsignedInteger
TraceEventDataStringValues:
type: object
properties:
key:
type: string
format: hex
description: The complete storage key for the entry.
method:
type: string
description: Normally one of Put or Get.
result:
type: string
format: hex
description: Hex scale encoded storage value.
description: Note these exact values will only be present for storage events.
OperationPhase:
type: object
properties:
variant:
type: string
enum:
- onInitialize
- initialChecks
- applyExtrinsic
- onFinalize
- finalChecks
description: Phase of block execution pipeline.
extrinsicIndex:
type: string
format: unsignedInteger
description: 'If phase variant is `applyExtrinsic` this will be the index of
the extrinsic. Otherwise this field will not be present.
'
BlocksTrace:
type: object
properties:
at:
$ref: '#/components/schemas/BlockIdentifiers'
blockHash:
type: string
events:
type: array
items:
$ref: '#/components/schemas/TraceEvent'
parentHash:
type: string
spans:
type: array
items:
$ref: '#/components/schemas/TraceSpan'
storageKeys:
type: string
description: Hex encoded storage keys used to filter events.
tracingTargets:
type: string
description: Targets used to filter spans and events.
OperationAmount:
type: object
properties:
values:
type: string
format: unsignedInteger
currency:
$ref: '#/components/schemas/OperationAmountCurrency'
Operation:
type: object
properties:
phase:
$ref: '#/components/schemas/OperationPhase'
parentSpanId:
$ref: '#/components/schemas/SpanId'
primarySpanId:
$ref: '#/components/schemas/SpanId'
eventIndex:
type: string
format: unsignedInteger
description: Index of the underlying trace event.
address:
type: string
description: 'Account this operation affects. Note - this will be an object like
`{ id: address }` if the network uses `MultiAddress`
'
storage:
type: object
properties:
pallet:
type: string
item:
type: string
field1:
type: string
description: 'A field of the storage item. (i.e `system::Account::get(address).data`)
'
field2:
type: string
description: 'A field of the struct described by field1 (i.e
`system::Account::get(address).data.free`)
'
amount:
$ref: '#/components/schemas/OperationAmount'