ProtoKit API Documentation

Explore all queries, mutations and types provided by Protokit.

API Endpoints
http://localhost:8080/graphql

Queries

batches

Description

Returns previously computed batches of blocks used for settlement

Response

Returns a BatchModel

Arguments
Name Description
height - Float Filters the batches for a specific height

Example

Query
query batches($height: Float) {
  batches(height: $height) {
    blocks {
      ...BlockModelFragment
    }
    proof
  }
}
Variables
{"height": 987.65}
Response
{
  "data": {
    "batches": {
      "blocks": [BlockModel],
      "proof": "abc123"
    }
  }
}

block

Description

Queries for blocks that have been sequenced and included into the chain

Response

Returns a BlockModel

Arguments
Name Description
hash - String Filters the blocks for a specific hash
height - Float Filters the blocks for a specific height

Example

Query
query block(
  $hash: String,
  $height: Float
) {
  block(
    hash: $hash,
    height: $height
  ) {
    hash
    previousBlockHash
    height
    txs {
      ...BatchTransactionModelFragment
    }
    transactionsHash
  }
}
Variables
{"hash": "xyz789", "height": 987.65}
Response
{
  "data": {
    "block": {
      "hash": "abc123",
      "previousBlockHash": "xyz789",
      "height": 987.65,
      "txs": [BatchTransactionModel],
      "transactionsHash": "xyz789"
    }
  }
}

network

Response

Returns a network

Example

Query
query network {
  network {
    unproven {
      ...NetworkFragment
    }
    staged {
      ...NetworkFragment
    }
    proven {
      ...NetworkFragment
    }
  }
}
Response
{
  "data": {
    "network": {
      "unproven": Network,
      "staged": Network,
      "proven": Network
    }
  }
}

node

Description

Retrieves general information about the appchain

Response

Returns a NodeInformationObject!

Example

Query
query node {
  node {
    blockHeight
    batchHeight
  }
}
Response
{"data": {"node": {"blockHeight": 123.45, "batchHeight": 987.65}}}

protocol

Response

Returns a Protocol

Example

Query
query protocol {
  protocol {
    AccountState {
      ...AccountStateFragment
    }
  }
}
Response
{"data": {"protocol": {"AccountState": AccountState}}}

runtime

Response

Returns a Runtime

Example

Query
query runtime {
  runtime {
    Balances {
      ...BalancesFragment
    }
  }
}
Response
{"data": {"runtime": {"Balances": Balances}}}

state

Description

Allows the raw querying of values inside a specific state slot. Returns a string[] that represents the field-encoding of the given value

Response

Returns [String!]

Arguments
Name Description
path - String! The path to the state slot to be queried

Example

Query
query state($path: String!) {
  state(path: $path)
}
Variables
{"path": "abc123"}
Response
{"data": {"state": ["abc123"]}}

transactionState

Description

Returns the state of a given transaction

Response

Returns an InclusionStatus!

Arguments
Name Description
hash - String! The hash of the transaction to be queried for

Example

Query
query transactionState($hash: String!) {
  transactionState(hash: $hash)
}
Variables
{"hash": "xyz789"}
Response
{"data": {"transactionState": "UNKNOWN"}}

transactions

Description

Returns the hashes of all transactions that are currently inside the mempool

Response

Returns [String!]!

Example

Query
query transactions {
  transactions
}
Response
{"data": {"transactions": ["xyz789"]}}

witness

Description

Allows retrieval of merkle witnesses corresponding to a specific path in the appchain's state tree. These proves are generally retrieved from the current 'proven' state

Response

Returns a LinkedMerkleWitnessDTO!

Arguments
Name Description
path - String!

Example

Query
query witness($path: String!) {
  witness(path: $path) {
    leaf {
      ...LeafDTOFragment
    }
    merkleWitness {
      ...MerkleWitnessDTOFragment
    }
  }
}
Variables
{"path": "xyz789"}
Response
{
  "data": {
    "witness": {
      "leaf": LeafDTO,
      "merkleWitness": MerkleWitnessDTO
    }
  }
}

Mutations

submitTx

Description

Adds a transaction to the mempool and validates it

Response

Returns a String!

Arguments
Name Description
tx - TransactionObjectInput!

Example

Query
mutation submitTx($tx: TransactionObjectInput!) {
  submitTx(tx: $tx)
}
Variables
{"tx": TransactionObjectInput}
Response
{"data": {"submitTx": "xyz789"}}

Types

AccountState

Fields
Field Name Description
accountState - ProtocolAccountStateaccountStateValue
Example
{"accountState": ProtocolAccountStateaccountStateValue}

Balances

Fields
Field Name Description
balances - RuntimeBalancesbalancesValue
Arguments
Example
{"balances": RuntimeBalancesbalancesValue}

BatchModel

Fields
Field Name Description
blocks - [BlockModel!]!
proof - String!
Example
{
  "blocks": [BlockModel],
  "proof": "xyz789"
}

BatchTransactionModel

Fields
Field Name Description
tx - TransactionObject!
status - Boolean!
statusMessage - String
Example
{
  "tx": TransactionObject,
  "status": false,
  "statusMessage": "abc123"
}

BlockModel

Fields
Field Name Description
hash - String!
previousBlockHash - String
height - Float!
txs - [BatchTransactionModel!]!
transactionsHash - String!
Example
{
  "hash": "abc123",
  "previousBlockHash": "xyz789",
  "height": 123.45,
  "txs": [BatchTransactionModel],
  "transactionsHash": "abc123"
}

Boolean

Description

The Boolean scalar type represents true or false.

Example
true

Float

Description

The Float scalar type represents signed double-precision fractional values as specified by IEEE 754.

Example
123.45

InclusionStatus

Values
Enum Value Description

UNKNOWN

PENDING

INCLUDED

SETTLED

Example
"UNKNOWN"

LeafDTO

Fields
Field Name Description
value - String!
path - String!
nextPath - String!
Example
{
  "value": "xyz789",
  "path": "xyz789",
  "nextPath": "xyz789"
}

LinkedMerkleWitnessDTO

Fields
Field Name Description
leaf - LeafDTO!
merkleWitness - MerkleWitnessDTO!
Example
{
  "leaf": LeafDTO,
  "merkleWitness": MerkleWitnessDTO
}

MerkleWitnessDTO

Fields
Field Name Description
siblings - [String!]!
isLefts - [Boolean!]!
Example
{"siblings": ["abc123"], "isLefts": [true]}

Network

Fields
Field Name Description
block - Networkblock
previous - Networkprevious
Example
{
  "block": Networkblock,
  "previous": Networkprevious
}

Networkblock

Fields
Field Name Description
height - String
Example
{"height": "abc123"}

Networkprevious

Fields
Field Name Description
rootHash - String
Example
{"rootHash": "xyz789"}

NodeInformationObject

Fields
Field Name Description
blockHeight - Float!
batchHeight - Float!
Example
{"blockHeight": 123.45, "batchHeight": 987.65}

Protocol

Fields
Field Name Description
AccountState - AccountState
Example
{"AccountState": AccountState}

ProtocolAccountStateaccountStateKey

Fields
Input Field Description
x - String
isOdd - Boolean
Example
{"x": "xyz789", "isOdd": true}

ProtocolAccountStateaccountStateValue

Fields
Field Name Description
nonce - String
Example
{"nonce": "abc123"}

Runtime

Fields
Field Name Description
Balances - Balances
Example
{"Balances": Balances}

RuntimeBalancesbalancesKey

Fields
Input Field Description
tokenId - String
address - RuntimeBalancesbalancesKeyaddress
Example
{
  "tokenId": "xyz789",
  "address": RuntimeBalancesbalancesKeyaddress
}

RuntimeBalancesbalancesKeyaddress

Fields
Input Field Description
x - String
isOdd - Boolean
Example
{"x": "abc123", "isOdd": false}

RuntimeBalancesbalancesValue

Fields
Field Name Description
value - String
Example
{"value": "xyz789"}

Signature

Fields
Field Name Description
r - String!
s - String!
Example
{
  "r": "abc123",
  "s": "abc123"
}

SignatureInput

Fields
Input Field Description
r - String!
s - String!
Example
{
  "r": "abc123",
  "s": "abc123"
}

String

Description

The String scalar type represents textual data, represented as UTF-8 character sequences. The String type is most often used by GraphQL to represent free-form human-readable text.

Example
"abc123"

TransactionObject

Fields
Field Name Description
hash - String!
methodId - String!
sender - String!
nonce - String!
signature - Signature!
argsFields - [String!]!
auxiliaryData - [String!]!
isMessage - Boolean!
Example
{
  "hash": "abc123",
  "methodId": "abc123",
  "sender": "xyz789",
  "nonce": "abc123",
  "signature": Signature,
  "argsFields": ["xyz789"],
  "auxiliaryData": ["xyz789"],
  "isMessage": true
}

TransactionObjectInput

Fields
Input Field Description
hash - String!
methodId - String!
sender - String!
nonce - String!
signature - SignatureInput!
argsFields - [String!]!
auxiliaryData - [String!]!
isMessage - Boolean!
Example
{
  "hash": "abc123",
  "methodId": "abc123",
  "sender": "xyz789",
  "nonce": "abc123",
  "signature": SignatureInput,
  "argsFields": ["xyz789"],
  "auxiliaryData": ["abc123"],
  "isMessage": false
}

network

Fields
Field Name Description
unproven - Network
staged - Network
proven - Network
Example
{
  "unproven": Network,
  "staged": Network,
  "proven": Network
}